diff options
author | Arthur de Jong <arthur@arthurdejong.org> | 2007-09-14 22:50:25 +0200 |
---|---|---|
committer | Arthur de Jong <arthur@arthurdejong.org> | 2007-09-14 22:50:25 +0200 |
commit | 4a6c9a3248ca675cf8b9d5610a64fd2c73eedc34 (patch) | |
tree | 85f82bb182d9a814cd718d99305a4ebe6dc891bd /nslcd/service.c | |
parent | f645df69737893f7846e70f27d0b9ab41165078e (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
Diffstat (limited to 'nslcd/service.c')
-rw-r--r-- | nslcd/service.c | 28 |
1 files changed, 15 insertions, 13 deletions
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); |