diff options
author | Arthur de Jong <arthur@arthurdejong.org> | 2012-03-16 08:28:02 +0000 |
---|---|---|
committer | Arthur de Jong <arthur@arthurdejong.org> | 2012-03-16 08:28:02 +0000 |
commit | c83cb667d3be886ca6c4e2288586c9874b762baa (patch) | |
tree | 92091eff611e78d6f9de87de124f9b7d92367044 | |
parent | 15498aca67bc96b1ac5dbd35be40d8c69a0e2d73 (diff) |
put both tio_skip() and tio_close() within if (fixes r1637) and clarify documentation of one part of the code
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd@1638 ef36b2f9-881f-0410-afb5-c4e39611909c
-rw-r--r-- | nss/common.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/nss/common.h b/nss/common.h index 57587d0..781e159 100644 --- a/nss/common.h +++ b/nss/common.h @@ -147,8 +147,10 @@ nss_status_t nss_ldap_destructor(nss_backend_t *be,void UNUSED(*args)); retv=readfn; \ /* close socket and we're done */ \ if ((retv==NSS_STATUS_SUCCESS)||(retv==NSS_STATUS_TRYAGAIN)) \ + { \ (void)tio_skip(fp,0); /* read any buffered data */ \ (void)tio_close(fp); \ + } \ return retv; /* This macro can be used to generate a get..byname() function @@ -203,9 +205,11 @@ nss_status_t nss_ldap_destructor(nss_backend_t *be,void UNUSED(*args)); /* if we have a full buffer try to reset the stream */ \ if (tio_reset(fp)) \ { \ + /* reset failed, we close and give up with a permanent error \ + because we cannot retry just the getent() call because it \ + may not be only the first entry that failed */ \ tio_close(fp); \ fp=NULL; \ - /* fail with permanent error to prevent retries */ \ *errnop=EINVAL; \ return NSS_STATUS_UNAVAIL; \ } \ |