summaryrefslogtreecommitdiff
path: root/nss/netgroup.c
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2009-05-29 21:22:58 +0000
committerArthur de Jong <arthur@arthurdejong.org>2009-05-29 21:22:58 +0000
commitf91b33e7b87b0447029e9b7593b796c3b9d0d0b0 (patch)
treecb66705231e6c4480c62c3b690867c426cf2763b /nss/netgroup.c
parent7c32d0121c95bbb05ab064b29bf7ec2ba5defc00 (diff)
refactor protocol reading and writing macros to the common directory, use more logical names and in the PAM module no longer use NSS status codes (import of r887 from nss-pam-ldapd)
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-ldapd@904 ef36b2f9-881f-0410-afb5-c4e39611909c
Diffstat (limited to 'nss/netgroup.c')
-rw-r--r--nss/netgroup.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/nss/netgroup.c b/nss/netgroup.c
index 57299ea..63e0b97 100644
--- a/nss/netgroup.c
+++ b/nss/netgroup.c
@@ -34,7 +34,7 @@
/* we redefine this here because we need to return NSS_STATUS_RETURN
instead of NSS_STATUS_NOTFOUND */
#undef ERROR_OUT_NOSUCCESS
-#define ERROR_OUT_NOSUCCESS(fp,retv) \
+#define ERROR_OUT_NOSUCCESS(fp) \
(void)tio_close(fp); \
fp=NULL; \
return NSS_STATUS_RETURN;
@@ -53,28 +53,28 @@ static enum nss_status read_netgrent(
{
/* the response is a reference to another netgroup */
result->type=group_val;
- READ_STRING_BUF(fp,result->val.group);
+ READ_BUF_STRING(fp,result->val.group);
}
else if (type==NSLCD_NETGROUP_TYPE_TRIPLE)
{
/* the response is a host/user/domain triple */
result->type=triple_val;
/* read host and revert to NULL on empty string */
- READ_STRING_BUF(fp,result->val.triple.host);
+ READ_BUF_STRING(fp,result->val.triple.host);
if (result->val.triple.host[0]=='\0')
{
result->val.triple.host=NULL;
bufptr--; /* free unused space */
}
/* read user and revert to NULL on empty string */
- READ_STRING_BUF(fp,result->val.triple.user);
+ READ_BUF_STRING(fp,result->val.triple.user);
if (result->val.triple.user[0]=='\0')
{
result->val.triple.user=NULL;
bufptr--; /* free unused space */
}
/* read domain and revert to NULL on empty string */
- READ_STRING_BUF(fp,result->val.triple.domain);
+ READ_BUF_STRING(fp,result->val.triple.domain);
if (result->val.triple.domain[0]=='\0')
{
result->val.triple.domain=NULL;
@@ -102,12 +102,7 @@ enum nss_status _nss_ldap_setnetgrent(const char *group,struct __netgrent UNUSED
if ((group==NULL)||(group[0]=='\0'))
return NSS_STATUS_UNAVAIL;
/* open a new stream and write the request */
- OPEN_SOCK(netgrentfp);
- WRITE_REQUEST(netgrentfp,NSLCD_ACTION_NETGROUP_BYNAME);
- WRITE_STRING(netgrentfp,group);
- WRITE_FLUSH(netgrentfp);
- /* read response header */
- READ_RESPONSEHEADER(netgrentfp,NSLCD_ACTION_NETGROUP_BYNAME);
+ NSLCD_REQUEST(netgrentfp,NSLCD_ACTION_NETGROUP_BYNAME,WRITE_STRING(netgrentfp,group));
return NSS_STATUS_SUCCESS;
}