diff options
author | Arthur de Jong <arthur@arthurdejong.org> | 2009-12-28 10:45:21 +0000 |
---|---|---|
committer | Arthur de Jong <arthur@arthurdejong.org> | 2009-12-28 10:45:21 +0000 |
commit | 0306a19110a9cf925924ad645b51ae0c2cd8e37d (patch) | |
tree | e41ebf89332c897ab9cf915d277197e2fcc5eacf | |
parent | 9aba86c2bbc5fd34488fe0af7af1518136a4e2c8 (diff) |
Glibc changed the addr parameter of getnetbyaddr_r() from network-byte-order to host-byte-order
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd@1039 ef36b2f9-881f-0410-afb5-c4e39611909c
-rw-r--r-- | nss/networks.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/nss/networks.c b/nss/networks.c index 7e1cf11..9f0e253 100644 --- a/nss/networks.c +++ b/nss/networks.c @@ -108,17 +108,19 @@ enum nss_status _nss_ldap_getnetbyname_r(const char *name,struct netent *result, } /* write an address value */ -#define WRITE_ADDRESS(fp,af,len,addr) \ - WRITE_INT32(fp,af); \ - WRITE_INT32(fp,len); \ - WRITE(fp,addr,len); +/* version 2.10 of glibc changed the address from network to host order + (changelog entry 2009-07-01) */ +#define WRITE_ADDRESS(fp,addr) \ + WRITE_INT32(fp,AF_INET); \ + WRITE_INT32(fp,4); \ + WRITE_INT32(htonl(addr)); /* Note: the af parameter is ignored and is assumed to be AF_INET */ /* TODO: implement handling of af parameter */ enum nss_status _nss_ldap_getnetbyaddr_r(uint32_t addr,int UNUSED(af),struct netent *result,char *buffer,size_t buflen,int *errnop,int *h_errnop) { NSS_BYGEN(NSLCD_ACTION_NETWORK_BYADDR, - WRITE_ADDRESS(fp,AF_INET,4,&addr), + WRITE_ADDRESS(fp,addr), read_netent(fp,result,buffer,buflen,errnop,h_errnop)) } |