summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2007-09-14 20:50:25 +0000
committerArthur de Jong <arthur@arthurdejong.org>2007-09-14 20:50:25 +0000
commit4a6c9a3248ca675cf8b9d5610a64fd2c73eedc34 (patch)
tree85f82bb182d9a814cd718d99305a4ebe6dc891bd
parentf645df69737893f7846e70f27d0b9ab41165078e (diff)
make use of write_*ent() functions consistent
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-ldapd@395 ef36b2f9-881f-0410-afb5-c4e39611909c
-rw-r--r--nslcd/alias.c31
-rw-r--r--nslcd/ether.c32
-rw-r--r--nslcd/group.c44
-rw-r--r--nslcd/network.c7
-rw-r--r--nslcd/passwd.c46
-rw-r--r--nslcd/protocol.c42
-rw-r--r--nslcd/rpc.c16
-rw-r--r--nslcd/service.c28
-rw-r--r--nslcd/shadow.c41
9 files changed, 164 insertions, 123 deletions
diff --git a/nslcd/alias.c b/nslcd/alias.c
index 49b0fd3..9d7f74a 100644
--- a/nslcd/alias.c
+++ b/nslcd/alias.c
@@ -98,6 +98,19 @@ static void alias_init(void)
alias_attrs[2]=NULL;
}
+/* macros for expanding the NSLCD_ALIAS macro */
+#define NSLCD_STRING(field) WRITE_STRING(fp,field)
+#define NSLCD_STRINGLIST(field) WRITE_STRINGLIST_NUM(fp,field,result->alias_members_len)
+#define ALIAS_NAME result->alias_name
+#define ALIAS_RCPTS result->alias_members
+
+static int write_aliasent(TFILE *fp,struct aliasent *result)
+{
+ int32_t tmpint32,tmp2int32;
+ NSLCD_ALIAS;
+ return 0;
+}
+
static enum nss_status _nss_ldap_parse_alias(
MYLDAP_SESSION *session,LDAPMessage *e,struct ldap_state UNUSED(*state),void *result,
char *buffer,size_t buflen)
@@ -118,15 +131,9 @@ static enum nss_status _nss_ldap_parse_alias(
return stat;
}
-/* macros for expanding the NSLCD_ALIAS macro */
-#define NSLCD_STRING(field) WRITE_STRING(fp,field)
-#define NSLCD_STRINGLIST(field) WRITE_STRINGLIST_NUM(fp,field,result.alias_members_len)
-#define ALIAS_NAME result.alias_name
-#define ALIAS_RCPTS result.alias_members
-
int nslcd_alias_byname(TFILE *fp,MYLDAP_SESSION *session)
{
- int32_t tmpint32,tmp2int32;
+ int32_t tmpint32;
char name[256];
char filter[1024];
/* these are here for now until we rewrite the LDAP code */
@@ -150,9 +157,8 @@ int nslcd_alias_byname(TFILE *fp,MYLDAP_SESSION *session)
/* write the response */
WRITE_INT32(fp,retv);
if (retv==NSLCD_RESULT_SUCCESS)
- {
- NSLCD_ALIAS;
- }
+ if (write_aliasent(fp,&result))
+ return -1;
WRITE_FLUSH(fp);
/* we're done */
return 0;
@@ -160,7 +166,7 @@ int nslcd_alias_byname(TFILE *fp,MYLDAP_SESSION *session)
int nslcd_alias_all(TFILE *fp,MYLDAP_SESSION *session)
{
- int32_t tmpint32,tmp2int32;
+ int32_t tmpint32;
struct ent_context context;
/* these are here for now until we rewrite the LDAP code */
struct aliasent result;
@@ -182,7 +188,8 @@ int nslcd_alias_all(TFILE *fp,MYLDAP_SESSION *session)
{
/* write the result */
WRITE_INT32(fp,retv);
- NSLCD_ALIAS;
+ if (write_aliasent(fp,&result))
+ return -1;
}
/* write the final result code */
WRITE_INT32(fp,retv);
diff --git a/nslcd/ether.c b/nslcd/ether.c
index 7aee6a7..eb6c144 100644
--- a/nslcd/ether.c
+++ b/nslcd/ether.c
@@ -141,6 +141,19 @@ static void ether_init(void)
ether_attrs[2]=NULL;
}
+/* macros for expanding the NSLCD_ETHER macro */
+#define NSLCD_STRING(field) WRITE_STRING(fp,field)
+#define NSLCD_TYPE(field,type) WRITE_TYPE(fp,field,type)
+#define ETHER_NAME result->e_name
+#define ETHER_ADDR result->e_addr
+
+static int write_ether(TFILE *fp,struct ether *result)
+{
+ int32_t tmpint32;
+ NSLCD_ETHER;
+ return 0;
+}
+
static enum nss_status _nss_ldap_parse_ether(
MYLDAP_SESSION *session,LDAPMessage *e,
struct ldap_state UNUSED(*state),void *result,char *buffer,
@@ -160,12 +173,6 @@ static enum nss_status _nss_ldap_parse_ether(
return NSS_STATUS_SUCCESS;
}
-/* macros for expanding the NSLCD_ETHER macro */
-#define NSLCD_STRING(field) WRITE_STRING(fp,field)
-#define NSLCD_TYPE(field,type) WRITE_TYPE(fp,field,type)
-#define ETHER_NAME result.e_name
-#define ETHER_ADDR result.e_addr
-
int nslcd_ether_byname(TFILE *fp,MYLDAP_SESSION *session)
{
int32_t tmpint32;
@@ -192,9 +199,8 @@ int nslcd_ether_byname(TFILE *fp,MYLDAP_SESSION *session)
/* write the response */
WRITE_INT32(fp,retv);
if (retv==NSLCD_RESULT_SUCCESS)
- {
- NSLCD_ETHER;
- }
+ if (write_ether(fp,&result))
+ return -1;
WRITE_FLUSH(fp);
/* we're done */
return 0;
@@ -226,9 +232,8 @@ int nslcd_ether_byether(TFILE *fp,MYLDAP_SESSION *session)
/* write the response */
WRITE_INT32(fp,retv);
if (retv==NSLCD_RESULT_SUCCESS)
- {
- NSLCD_ETHER;
- }
+ if (write_ether(fp,&result))
+ return -1;
WRITE_FLUSH(fp);
/* we're done */
return 0;
@@ -258,7 +263,8 @@ int nslcd_ether_all(TFILE *fp,MYLDAP_SESSION *session)
{
/* write the result */
WRITE_INT32(fp,retv);
- NSLCD_ETHER;
+ if (write_ether(fp,&result))
+ return -1;
}
/* write the final result code */
WRITE_INT32(fp,retv);
diff --git a/nslcd/group.c b/nslcd/group.c
index f3a17f1..0ba1c4b 100644
--- a/nslcd/group.c
+++ b/nslcd/group.c
@@ -240,6 +240,22 @@ static void group_init(void)
group_attrs[5]=NULL;
}
+/* macros for expanding the NSLCD_GROUP macro */
+#define NSLCD_STRING(field) WRITE_STRING(fp,field)
+#define NSLCD_TYPE(field,type) WRITE_TYPE(fp,field,type)
+#define NSLCD_STRINGLIST(field) WRITE_STRINGLIST_NULLTERM(fp,field)
+#define GROUP_NAME result->gr_name
+#define GROUP_PASSWD result->gr_passwd
+#define GROUP_GID result->gr_gid
+#define GROUP_MEMBERS result->gr_mem
+
+static int write_group(TFILE *fp,struct group *result)
+{
+ int32_t tmpint32,tmp2int32,tmp3int32;
+ NSLCD_GROUP;
+ return 0;
+}
+
/*
* Add a nested netgroup or group to the namelist
*/
@@ -1121,18 +1137,9 @@ static int group_bymember(MYLDAP_SESSION *session,const char *user,
return 0;
}
-/* macros for expanding the NSLCD_GROUP macro */
-#define NSLCD_STRING(field) WRITE_STRING(fp,field)
-#define NSLCD_TYPE(field,type) WRITE_TYPE(fp,field,type)
-#define NSLCD_STRINGLIST(field) WRITE_STRINGLIST_NULLTERM(fp,field)
-#define GROUP_NAME result.gr_name
-#define GROUP_PASSWD result.gr_passwd
-#define GROUP_GID result.gr_gid
-#define GROUP_MEMBERS result.gr_mem
-
int nslcd_group_byname(TFILE *fp,MYLDAP_SESSION *session)
{
- int32_t tmpint32,tmp2int32,tmp3int32;
+ int32_t tmpint32;
char name[256];
char filter[1024];
/* these are here for now until we rewrite the LDAP code */
@@ -1161,9 +1168,8 @@ int nslcd_group_byname(TFILE *fp,MYLDAP_SESSION *session)
WRITE_INT32(fp,NSLCD_ACTION_GROUP_BYNAME);
WRITE_INT32(fp,retv);
if (retv==NSLCD_RESULT_SUCCESS)
- {
- NSLCD_GROUP;
- }
+ if (write_group(fp,&result))
+ return -1;
WRITE_FLUSH(fp);
/* we're done */
return 0;
@@ -1171,7 +1177,7 @@ int nslcd_group_byname(TFILE *fp,MYLDAP_SESSION *session)
int nslcd_group_bygid(TFILE *fp,MYLDAP_SESSION *session)
{
- int32_t tmpint32,tmp2int32,tmp3int32;
+ int32_t tmpint32;
gid_t gid;
char filter[1024];
/* these are here for now until we rewrite the LDAP code */
@@ -1200,9 +1206,8 @@ int nslcd_group_bygid(TFILE *fp,MYLDAP_SESSION *session)
WRITE_INT32(fp,NSLCD_ACTION_GROUP_BYGID);
WRITE_INT32(fp,retv);
if (retv==NSLCD_RESULT_SUCCESS)
- {
- NSLCD_GROUP;
- }
+ if (write_group(fp,&result))
+ return -1;
WRITE_FLUSH(fp);
/* we're done */
return 0;
@@ -1266,7 +1271,7 @@ int nslcd_group_bymember(TFILE *fp,MYLDAP_SESSION *session)
int nslcd_group_all(TFILE *fp,MYLDAP_SESSION *session)
{
- int32_t tmpint32,tmp2int32,tmp3int32;
+ int32_t tmpint32;
struct ent_context context;
/* these are here for now until we rewrite the LDAP code */
struct group result;
@@ -1288,7 +1293,8 @@ int nslcd_group_all(TFILE *fp,MYLDAP_SESSION *session)
{
/* write the result */
WRITE_INT32(fp,retv);
- NSLCD_GROUP;
+ if (write_group(fp,&result))
+ return -1;
}
/* write the final result code */
WRITE_INT32(fp,retv);
diff --git a/nslcd/network.c b/nslcd/network.c
index 6cac598..99ead7f 100644
--- a/nslcd/network.c
+++ b/nslcd/network.c
@@ -261,7 +261,8 @@ int nslcd_network_byaddr(TFILE *fp,MYLDAP_SESSION *session)
/* write the response */
WRITE_INT32(fp,retv);
if (retv==NSLCD_RESULT_SUCCESS)
- write_netent(fp,&result);
+ if (write_netent(fp,&result))
+ return -1;
WRITE_FLUSH(fp);
/* we're done */
return 0;
@@ -291,8 +292,8 @@ int nslcd_network_all(TFILE *fp,MYLDAP_SESSION *session)
{
/* write the result */
WRITE_INT32(fp,retv);
- if (retv==NSLCD_RESULT_SUCCESS)
- write_netent(fp,&result);
+ if (write_netent(fp,&result))
+ return -1;
}
/* write the final result code */
WRITE_INT32(fp,retv);
diff --git a/nslcd/passwd.c b/nslcd/passwd.c
index 99fc596..07b4ad3 100644
--- a/nslcd/passwd.c
+++ b/nslcd/passwd.c
@@ -51,11 +51,11 @@
#include "attmap.h"
#ifndef UID_NOBODY
-#define UID_NOBODY (-2)
+#define UID_NOBODY (uid_t)(-2)
#endif
#ifndef GID_NOBODY
-#define GID_NOBODY UID_NOBODY
+#define GID_NOBODY (gid_t)UID_NOBODY
#endif
/* the search base for searches */
@@ -133,6 +133,24 @@ static void passwd_init(void)
passwd_attrs[9]=NULL;
}
+/* macros for expanding the NSLCD_PASSWD macro */
+#define NSLCD_STRING(field) WRITE_STRING(fp,field)
+#define NSLCD_TYPE(field,type) WRITE_TYPE(fp,field,type)
+#define PASSWD_NAME result->pw_name
+#define PASSWD_PASSWD result->pw_passwd
+#define PASSWD_UID result->pw_uid
+#define PASSWD_GID result->pw_gid
+#define PASSWD_GECOS result->pw_gecos
+#define PASSWD_DIR result->pw_dir
+#define PASSWD_SHELL result->pw_shell
+
+static int write_passwd(TFILE *fp,struct passwd *result)
+{
+ int32_t tmpint32;
+ NSLCD_PASSWD;
+ return 0;
+}
+
static inline enum nss_status _nss_ldap_assign_emptystring(
char **valptr, char **buffer, size_t * buflen)
{
@@ -223,17 +241,6 @@ static enum nss_status _nss_ldap_parse_pw(
return NSS_STATUS_SUCCESS;
}
-/* macros for expanding the NSLCD_PASSWD macro */
-#define NSLCD_STRING(field) WRITE_STRING(fp,field)
-#define NSLCD_TYPE(field,type) WRITE_TYPE(fp,field,type)
-#define PASSWD_NAME result.pw_name
-#define PASSWD_PASSWD result.pw_passwd
-#define PASSWD_UID result.pw_uid
-#define PASSWD_GID result.pw_gid
-#define PASSWD_GECOS result.pw_gecos
-#define PASSWD_DIR result.pw_dir
-#define PASSWD_SHELL result.pw_shell
-
/* the caller should take care of opening and closing the stream */
int nslcd_passwd_byname(TFILE *fp,MYLDAP_SESSION *session)
{
@@ -260,9 +267,8 @@ int nslcd_passwd_byname(TFILE *fp,MYLDAP_SESSION *session)
WRITE_INT32(fp,NSLCD_ACTION_PASSWD_BYNAME);
WRITE_INT32(fp,retv);
if (retv==NSLCD_RESULT_SUCCESS)
- {
- NSLCD_PASSWD;
- }
+ if (write_passwd(fp,&result))
+ return -1;
WRITE_FLUSH(fp);
/* we're done */
return 0;
@@ -293,9 +299,8 @@ int nslcd_passwd_byuid(TFILE *fp,MYLDAP_SESSION *session)
WRITE_INT32(fp,NSLCD_ACTION_PASSWD_BYUID);
WRITE_INT32(fp,retv);
if (retv==NSLCD_RESULT_SUCCESS)
- {
- NSLCD_PASSWD;
- }
+ if (write_passwd(fp,&result))
+ return -1;
WRITE_FLUSH(fp);
/* we're done */
return 0;
@@ -325,7 +330,8 @@ int nslcd_passwd_all(TFILE *fp,MYLDAP_SESSION *session)
{
/* write the result */
WRITE_INT32(fp,retv);
- NSLCD_PASSWD;
+ if (write_passwd(fp,&result))
+ return -1;
}
/* write the final result code */
WRITE_INT32(fp,retv);
diff --git a/nslcd/protocol.c b/nslcd/protocol.c
index f26e738..d4daec2 100644
--- a/nslcd/protocol.c
+++ b/nslcd/protocol.c
@@ -116,6 +116,21 @@ static void protocol_init(void)
protocol_attrs[2]=NULL;
}
+/* macros for expanding the NSLCD_PROTOCOL macro */
+#define NSLCD_STRING(field) WRITE_STRING(fp,field)
+#define NSLCD_STRINGLIST(field) WRITE_STRINGLIST_NULLTERM(fp,field)
+#define NSLCD_INT32(field) WRITE_INT32(fp,field)
+#define PROTOCOL_NAME result->p_name
+#define PROTOCOL_ALIASES result->p_aliases
+#define PROTOCOL_NUMBER result->p_proto
+
+static int write_protoent(TFILE *fp,struct protoent *result)
+{
+ int32_t tmpint32,tmp2int32,tmp3int32;
+ NSLCD_PROTOCOL;
+ return 0;
+}
+
static enum nss_status _nss_ldap_parse_proto(
MYLDAP_SESSION *session,LDAPMessage *e,struct ldap_state UNUSED(*state),
void *result,char *buffer,size_t buflen)
@@ -142,17 +157,9 @@ static enum nss_status _nss_ldap_parse_proto(
return NSS_STATUS_SUCCESS;
}
-/* macros for expanding the NSLCD_PROTOCOL macro */
-#define NSLCD_STRING(field) WRITE_STRING(fp,field)
-#define NSLCD_STRINGLIST(field) WRITE_STRINGLIST_NULLTERM(fp,field)
-#define NSLCD_INT32(field) WRITE_INT32(fp,field)
-#define PROTOCOL_NAME result.p_name
-#define PROTOCOL_ALIASES result.p_aliases
-#define PROTOCOL_NUMBER result.p_proto
-
int nslcd_protocol_byname(TFILE *fp,MYLDAP_SESSION *session)
{
- int32_t tmpint32,tmp2int32,tmp3int32;
+ int32_t tmpint32;
char name[256];
char filter[1024];
/* these are here for now until we rewrite the LDAP code */
@@ -176,9 +183,8 @@ int nslcd_protocol_byname(TFILE *fp,MYLDAP_SESSION *session)
/* write the response */
WRITE_INT32(fp,retv);
if (retv==NSLCD_RESULT_SUCCESS)
- {
- NSLCD_PROTOCOL;
- }
+ if (write_protoent(fp,&result))
+ return -1;
WRITE_FLUSH(fp);
/* we're done */
return 0;
@@ -186,7 +192,7 @@ int nslcd_protocol_byname(TFILE *fp,MYLDAP_SESSION *session)
int nslcd_protocol_bynumber(TFILE *fp,MYLDAP_SESSION *session)
{
- int32_t tmpint32,tmp2int32,tmp3int32;
+ int32_t tmpint32;
int protocol;
char filter[1024];
/* these are here for now until we rewrite the LDAP code */
@@ -210,9 +216,8 @@ int nslcd_protocol_bynumber(TFILE *fp,MYLDAP_SESSION *session)
/* write the response */
WRITE_INT32(fp,retv);
if (retv==NSLCD_RESULT_SUCCESS)
- {
- NSLCD_PROTOCOL;
- }
+ if (write_protoent(fp,&result))
+ return -1;
WRITE_FLUSH(fp);
/* we're done */
return 0;
@@ -220,7 +225,7 @@ int nslcd_protocol_bynumber(TFILE *fp,MYLDAP_SESSION *session)
int nslcd_protocol_all(TFILE *fp,MYLDAP_SESSION *session)
{
- int32_t tmpint32,tmp2int32,tmp3int32;
+ int32_t tmpint32;
struct ent_context context;
/* these are here for now until we rewrite the LDAP code */
struct protoent result;
@@ -243,7 +248,8 @@ int nslcd_protocol_all(TFILE *fp,MYLDAP_SESSION *session)
/* write the result code */
WRITE_INT32(fp,retv);
/* write the entry */
- NSLCD_PROTOCOL;
+ if (write_protoent(fp,&result))
+ return -1;
}
/* write the final result code */
WRITE_INT32(fp,retv);
diff --git a/nslcd/rpc.c b/nslcd/rpc.c
index aec6cdd..e56b032 100644
--- a/nslcd/rpc.c
+++ b/nslcd/rpc.c
@@ -58,14 +58,6 @@
#include "log.h"
#include "attmap.h"
-/* macros for expanding the NSLCD_RPC macro */
-#define NSLCD_STRING(field) WRITE_STRING(fp,field)
-#define NSLCD_STRINGLIST(field) WRITE_STRINGLIST_NULLTERM(fp,field)
-#define NSLCD_INT32(field) WRITE_INT32(fp,field)
-#define RPC_NAME result->r_name
-#define RPC_ALIASES result->r_aliases
-#define RPC_NUMBER result->r_number
-
/* ( nisSchema.2.5 NAME 'oncRpc' SUP top STRUCTURAL
* DESC 'Abstraction of an Open Network Computing (ONC)
* [RFC1057] Remote Procedure Call (RPC) binding.
@@ -130,6 +122,14 @@ static void rpc_init(void)
rpc_attrs[2]=NULL;
}
+/* macros for expanding the NSLCD_RPC macro */
+#define NSLCD_STRING(field) WRITE_STRING(fp,field)
+#define NSLCD_STRINGLIST(field) WRITE_STRINGLIST_NULLTERM(fp,field)
+#define NSLCD_INT32(field) WRITE_INT32(fp,field)
+#define RPC_NAME result->r_name
+#define RPC_ALIASES result->r_aliases
+#define RPC_NUMBER result->r_number
+
/* write a single rpc entry to the stream */
static int write_rpcent(TFILE *fp,struct rpcent *result)
{
diff --git a/nslcd/service.c b/nslcd/service.c
index ddd9583..02f6523 100644
--- a/nslcd/service.c
+++ b/nslcd/service.c
@@ -58,15 +58,6 @@
#include "log.h"
#include "attmap.h"
-/* macros for expanding the NSLCD_SERVICE macro */
-#define NSLCD_STRING(field) WRITE_STRING(fp,field)
-#define NSLCD_STRINGLIST(field) WRITE_STRINGLIST_NULLTERM(fp,field)
-#define NSLCD_INT32(field) WRITE_INT32(fp,field)
-#define SERVICE_NAME result->s_name
-#define SERVICE_ALIASES result->s_aliases
-#define SERVICE_NUMBER htons(result->s_port)
-#define SERVICE_PROTOCOL result->s_proto
-
/* ( nisSchema.2.3 NAME 'ipService' SUP top STRUCTURAL
* DESC 'Abstraction an Internet Protocol service.
* Maps an IP port and protocol (such as tcp or udp)
@@ -157,7 +148,15 @@ static void service_init(void)
service_attrs[3]=NULL;
}
-/* write a single host entry to the stream */
+/* macros for expanding the NSLCD_SERVICE macro */
+#define NSLCD_STRING(field) WRITE_STRING(fp,field)
+#define NSLCD_STRINGLIST(field) WRITE_STRINGLIST_NULLTERM(fp,field)
+#define NSLCD_INT32(field) WRITE_INT32(fp,field)
+#define SERVICE_NAME result->s_name
+#define SERVICE_ALIASES result->s_aliases
+#define SERVICE_NUMBER htons(result->s_port)
+#define SERVICE_PROTOCOL result->s_proto
+
static int write_servent(TFILE *fp,struct servent *result)
{
int32_t tmpint32,tmp2int32,tmp3int32;
@@ -299,7 +298,8 @@ int nslcd_service_byname(TFILE *fp,MYLDAP_SESSION *session)
/* write the response */
WRITE_INT32(fp,retv);
if (retv==NSLCD_RESULT_SUCCESS)
- write_servent(fp,&result);
+ if (write_servent(fp,&result))
+ return -1;
WRITE_FLUSH(fp);
/* we're done */
return 0;
@@ -333,7 +333,8 @@ int nslcd_service_bynumber(TFILE *fp,MYLDAP_SESSION *session)
/* write the response */
WRITE_INT32(fp,retv);
if (retv==NSLCD_RESULT_SUCCESS)
- write_servent(fp,&result);
+ if (write_servent(fp,&result))
+ return -1;
WRITE_FLUSH(fp);
/* we're done */
return 0;
@@ -364,7 +365,8 @@ int nslcd_service_all(TFILE *fp,MYLDAP_SESSION *session)
/* write the result code */
WRITE_INT32(fp,retv);
/* write the entry */
- write_servent(fp,&result);
+ if (write_servent(fp,&result))
+ return -1;
}
/* write the final result code */
WRITE_INT32(fp,retv);
diff --git a/nslcd/shadow.c b/nslcd/shadow.c
index 7d15883..a41af72 100644
--- a/nslcd/shadow.c
+++ b/nslcd/shadow.c
@@ -117,6 +117,26 @@ static void shadow_init(void)
shadow_attrs[9]=NULL;
}
+/* macros for expanding the NSLCD_SHADOW macro */
+#define NSLCD_STRING(field) WRITE_STRING(fp,field)
+#define NSLCD_INT32(field) WRITE_INT32(fp,field)
+#define SHADOW_NAME result->sp_namp
+#define SHADOW_PASSWD result->sp_pwdp
+#define SHADOW_LASTCHANGE result->sp_lstchg
+#define SHADOW_MINDAYS result->sp_min
+#define SHADOW_MAXDAYS result->sp_max
+#define SHADOW_WARN result->sp_warn
+#define SHADOW_INACT result->sp_inact
+#define SHADOW_EXPIRE result->sp_expire
+#define SHADOW_FLAG result->sp_flag
+
+static int write_spwd(TFILE *fp,struct spwd *result)
+{
+ int32_t tmpint32;
+ NSLCD_SHADOW;
+ return 0;
+}
+
static int
_nss_ldap_shadow_date (const char *val)
{
@@ -192,19 +212,6 @@ static enum nss_status _nss_ldap_parse_sp(
return NSS_STATUS_SUCCESS;
}
-/* macros for expanding the NSLCD_SHADOW macro */
-#define NSLCD_STRING(field) WRITE_STRING(fp,field)
-#define NSLCD_INT32(field) WRITE_INT32(fp,field)
-#define SHADOW_NAME result.sp_namp
-#define SHADOW_PASSWD result.sp_pwdp
-#define SHADOW_LASTCHANGE result.sp_lstchg
-#define SHADOW_MINDAYS result.sp_min
-#define SHADOW_MAXDAYS result.sp_max
-#define SHADOW_WARN result.sp_warn
-#define SHADOW_INACT result.sp_inact
-#define SHADOW_EXPIRE result.sp_expire
-#define SHADOW_FLAG result.sp_flag
-
int nslcd_shadow_byname(TFILE *fp,MYLDAP_SESSION *session)
{
int32_t tmpint32;
@@ -230,9 +237,8 @@ int nslcd_shadow_byname(TFILE *fp,MYLDAP_SESSION *session)
/* write the response */
WRITE_INT32(fp,retv);
if (retv==NSLCD_RESULT_SUCCESS)
- {
- NSLCD_SHADOW;
- }
+ if (write_spwd(fp,&result))
+ return -1;
WRITE_FLUSH(fp);
/* we're done */
return 0;
@@ -262,7 +268,8 @@ int nslcd_shadow_all(TFILE *fp,MYLDAP_SESSION *session)
{
/* write the result */
WRITE_INT32(fp,retv);
- NSLCD_SHADOW;
+ if (write_spwd(fp,&result))
+ return -1;
}
/* write the final result code */
WRITE_INT32(fp,retv);