diff options
author | Arthur de Jong <arthur@arthurdejong.org> | 2006-11-22 13:16:29 +0000 |
---|---|---|
committer | Arthur de Jong <arthur@arthurdejong.org> | 2006-11-22 13:16:29 +0000 |
commit | ac8e4bfe6e6cc127856019b4f95b77f0a16a98cc (patch) | |
tree | 807b8cb5b084d1345c2201543009e7196f3123d0 | |
parent | e45dcde096907034807924384565f2c1ce2f5af8 (diff) |
only flush the stream after writing all records (not every time) and more logging consistency
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/libnss_ldapd@112 ef36b2f9-881f-0410-afb5-c4e39611909c
-rw-r--r-- | server/alias.c | 5 | ||||
-rw-r--r-- | server/ether.c | 5 | ||||
-rw-r--r-- | server/group.c | 13 | ||||
-rw-r--r-- | server/passwd.c | 8 | ||||
-rw-r--r-- | server/shadow.c | 5 |
5 files changed, 13 insertions, 23 deletions
diff --git a/server/alias.c b/server/alias.c index eefb1c8..7d39fa6 100644 --- a/server/alias.c +++ b/server/alias.c @@ -122,14 +122,13 @@ int nslcd_alias_all(FILE *fp) /* loop over all results */ while ((retv=nss2nslcd(_nss_ldap_getent(&alias_context,&result,buffer,1024,&errnop,_nss_ldap_filt_getaliasent,LM_ALIASES,_nss_ldap_parse_alias)))==NSLCD_RESULT_SUCCESS) { - /* write the result code */ + /* write the result */ WRITE_INT32(fp,retv); - /* write the alias entry */ LDF_ALIAS; - fflush(fp); } /* write the final result code */ WRITE_INT32(fp,retv); + WRITE_FLUSH(fp); /* FIXME: if a previous call returns what happens to the context? */ _nss_ldap_enter(); _nss_ldap_ent_context_release(alias_context); diff --git a/server/ether.c b/server/ether.c index 524923a..8db4f3e 100644 --- a/server/ether.c +++ b/server/ether.c @@ -221,14 +221,13 @@ int nslcd_ether_all(FILE *fp) /* loop over all results */ while ((retv=nss2nslcd(_nss_ldap_getent(ðer_context,&result,buffer,1024,&errnop,_nss_ldap_filt_getetherent,LM_ETHERS,_nss_ldap_parse_ether)))==NSLCD_RESULT_SUCCESS) { - /* write the result code */ + /* write the result */ WRITE_INT32(fp,retv); - /* write the ether entry */ LDF_ETHER; - fflush(fp); } /* write the final result code */ WRITE_INT32(fp,retv); + WRITE_FLUSH(fp); /* FIXME: if a previous call returns what happens to the context? */ _nss_ldap_enter(); _nss_ldap_ent_context_release(ether_context); diff --git a/server/group.c b/server/group.c index 36d225f..ad509f3 100644 --- a/server/group.c +++ b/server/group.c @@ -1074,7 +1074,6 @@ int nslcd_group_byname(FILE *fp) LDF_GROUP; } WRITE_FLUSH(fp); - log_log(LOG_DEBUG,"nslcd_group_byname DONE"); /* we're done */ return 0; } @@ -1114,7 +1113,6 @@ int nslcd_group_bygid(FILE *fp) LDF_GROUP; } WRITE_FLUSH(fp); - log_log(LOG_DEBUG,"nslcd_group_bygid DONE"); /* we're done */ return 0; } @@ -1133,7 +1131,7 @@ int nslcd_group_bymember(FILE *fp) READ_STRING_ALLOC(fp,name); /* FIXME: free() this buffer somewhere */ /* log call */ - log_log(LOG_DEBUG,"nslcd_group_byname(%s)",name); + log_log(LOG_DEBUG,"nslcd_group_bymember(%s)",name); /* do the LDAP request */ retv=NSLCD_RESULT_NOTFOUND; /* @@ -1174,7 +1172,6 @@ int nslcd_group_bymember(FILE *fp) WRITE_FLUSH(fp); /* no more need for this */ free(name); - log_log(LOG_DEBUG,"nslcd_group_byname DONE"); /* we're done */ return 0; } @@ -1189,7 +1186,7 @@ int nslcd_group_all(FILE *fp) int errnop; int retv; /* log call */ - log_log(LOG_DEBUG,"nslcd_group_all"); + log_log(LOG_DEBUG,"nslcd_group_all()"); /* write the response header */ WRITE_INT32(fp,NSLCD_VERSION); WRITE_INT32(fp,NSLCD_ACTION_GROUP_ALL); @@ -1199,19 +1196,17 @@ int nslcd_group_all(FILE *fp) /* loop over all results */ while ((retv=nss2nslcd(_nss_ldap_getent(&gr_context,&result,buffer,1024,&errnop,_nss_ldap_filt_getgrent,LM_GROUP,_nss_ldap_parse_gr)))==NSLCD_RESULT_SUCCESS) { - /* write the result code */ + /* write the result */ WRITE_INT32(fp,retv); - /* write the group entry */ LDF_GROUP; - fflush(fp); } /* write the final result code */ WRITE_INT32(fp,retv); + WRITE_FLUSH(fp); /* FIXME: if a previous call returns what happens to the context? */ _nss_ldap_enter(); _nss_ldap_ent_context_release(gr_context); _nss_ldap_leave(); - log_log(LOG_DEBUG,"nslcd_group_all DONE"); /* we're done */ return 0; } diff --git a/server/passwd.c b/server/passwd.c index de6f72e..4429226 100644 --- a/server/passwd.c +++ b/server/passwd.c @@ -266,7 +266,7 @@ int nslcd_passwd_all(FILE *fp) int errnop; int retv; /* log call */ - log_log(LOG_DEBUG,"nslcd_passwd_all"); + log_log(LOG_DEBUG,"nslcd_passwd_all()"); /* write the response header */ WRITE_INT32(fp,NSLCD_VERSION); WRITE_INT32(fp,NSLCD_ACTION_PASSWD_ALL); @@ -276,19 +276,17 @@ int nslcd_passwd_all(FILE *fp) /* go over results */ while ((retv=nss2nslcd(_nss_ldap_getent(&pw_context,&result,buffer,1024,&errnop,_nss_ldap_filt_getpwent,LM_PASSWD,_nss_ldap_parse_pw)))==NSLCD_RESULT_SUCCESS) { - /* write the result code */ + /* write the result */ WRITE_INT32(fp,retv); - /* write the password entry */ LDF_PASSWD; - fflush(fp); } /* write the final result code */ WRITE_INT32(fp,retv); + WRITE_FLUSH(fp); /* FIXME: if some statement returns what happens to the context? */ _nss_ldap_enter(); \ _nss_ldap_ent_context_release(pw_context); \ _nss_ldap_leave(); \ - log_log(LOG_DEBUG,"nslcd_passwd_all DONE"); /* we're done */ return 0; } diff --git a/server/shadow.c b/server/shadow.c index f90293a..c607efb 100644 --- a/server/shadow.c +++ b/server/shadow.c @@ -174,14 +174,13 @@ int nslcd_shadow_all(FILE *fp) /* loop over all results */ while ((retv=nss2nslcd(_nss_ldap_getent(&shadow_context,&result,buffer,1024,&errnop,_nss_ldap_filt_getspent,LM_SHADOW,_nss_ldap_parse_sp)))==NSLCD_RESULT_SUCCESS) { - /* write the result code */ + /* write the result */ WRITE_INT32(fp,retv); - /* write the shadow entry */ LDF_SHADOW; - fflush(fp); } /* write the final result code */ WRITE_INT32(fp,retv); + WRITE_FLUSH(fp); /* FIXME: if a previous call returns what happens to the context? */ _nss_ldap_enter(); _nss_ldap_ent_context_release(shadow_context); |