summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Cheng <tedcheng@symas.com>2010-10-09 17:26:31 +0000
committerTed Cheng <tedcheng@symas.com>2010-10-09 17:26:31 +0000
commitbdbeab5693d7c28df3174d5352d5a3ff78b22d92 (patch)
tree68ac871057e64b3a1e494e8ec1bedd0d82a0a843
parent611dc583a05914f81c97c165163bcce021b0dfac (diff)
nss-pam-ldapd fixes for solaris 10 build
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd-solaris@1247 ef36b2f9-881f-0410-afb5-c4e39611909c
-rw-r--r--nss/ethers.c11
-rw-r--r--nss/group.c9
-rw-r--r--nss/netgroup.c9
-rw-r--r--nss/networks.c20
-rw-r--r--nss/passwd.c8
-rw-r--r--nss/protocols.c8
-rw-r--r--nss/rpc.c8
-rw-r--r--nss/services.c24
-rw-r--r--nss/shadow.c10
9 files changed, 54 insertions, 53 deletions
diff --git a/nss/ethers.c b/nss/ethers.c
index bc70e81..5c1b758 100644
--- a/nss/ethers.c
+++ b/nss/ethers.c
@@ -42,6 +42,8 @@ static nss_status_t read_etherent(
return NSS_STATUS_SUCCESS;
}
+static __thread TFILE *etherentfp;
+
#ifdef NSS_FLAVOUR_GLIBC
/* map a hostname to the corresponding ethernet address */
@@ -67,7 +69,7 @@ nss_status_t _nss_ldap_getntohost_r(
}
/* thread-local file pointer to an ongoing request */
-static __thread TFILE *etherentfp;
+/* static __thread TFILE *etherentfp; */
/* open a connection to read all ether entries */
nss_status_t _nss_ldap_setetherent(int UNUSED(stayopen))
@@ -97,7 +99,7 @@ nss_status_t _nss_ldap_endetherent(void)
#ifndef NSS_BUFLEN_ETHERS
#define NSS_BUFLEN_ETHERS 1024
-#endif
+#endif /* NSS_BUFLEN_ETHERS */
#define errnop &errno
@@ -159,9 +161,6 @@ static nss_status_t _xnss_ldap_getntohost_r(nss_backend_t UNUSED(*be),void *args
return retv;
}
-/* thread-local file pointer to an ongoing request */
-static __thread TFILE *etherentfp;
-
static nss_status_t _xnss_ldap_setetherent(nss_backend_t UNUSED(*be),void UNUSED(*args))
{
NSS_SETENT(etherentfp);
@@ -169,7 +168,7 @@ static nss_status_t _xnss_ldap_setetherent(nss_backend_t UNUSED(*be),void UNUSED
static nss_status_t _xnss_ldap_getetherent_r(nss_backend_t UNUSED(*be),void *args)
{
- /* TODO: cns3 uses struct ether,verify */
+ /* TODO: padl uses struct ether,verify */
struct etherent result;
char *buffer=NSS_ARGS(args)->buf.buffer;
size_t buflen=NSS_ARGS(args)->buf.buflen;
diff --git a/nss/group.c b/nss/group.c
index 5a64ca5..38757e9 100644
--- a/nss/group.c
+++ b/nss/group.c
@@ -31,6 +31,8 @@
#include "common.h"
#include "compat/attrs.h"
+static __thread TFILE *grentfp;
+
/* read a single group entry from the stream */
static nss_status_t read_group(
TFILE *fp,struct group *result,
@@ -54,10 +56,8 @@ static nss_status_t read_gids(
int32_t res=(int32_t)NSLCD_RESULT_BEGIN;
int32_t tmpint32,tmp2int32,tmp3int32;
gid_t gid;
-#ifdef NSS_FLAVOUR_GLIBC
gid_t *newgroups;
long int newsize;
-#endif /* NSS_FLAVOUR_GLIBC */
/* loop over results */
while (res==(int32_t)NSLCD_RESULT_BEGIN)
{
@@ -130,7 +130,7 @@ nss_status_t _nss_ldap_getgrgid_r(
}
/* thread-local file pointer to an ongoing request */
-static __thread TFILE *grentfp;
+/* static __thread TFILE *grentfp; */
/* start a request to read all groups */
nss_status_t _nss_ldap_setgrent(int UNUSED(stayopen))
@@ -277,9 +277,6 @@ static nss_status_t _xnss_ldap_getgrgid_r(nss_backend_t UNUSED(*be),void *args)
return status;
}
-/* thread-local file pointer to an ongoing request */
-static __thread TFILE *grentfp;
-
static nss_status_t _xnss_ldap_setgrent(nss_backend_t UNUSED(*be),void UNUSED(*args))
{
NSS_SETENT(grentfp);
diff --git a/nss/netgroup.c b/nss/netgroup.c
index 1992ece..6e31a4b 100644
--- a/nss/netgroup.c
+++ b/nss/netgroup.c
@@ -39,6 +39,8 @@
fp=NULL; \
return NSS_STATUS_RETURN;
+static __thread TFILE *netgrentfp;
+
/* function for reading a single result entry */
static nss_status_t read_netgrent(
TFILE *fp,struct __netgrent *result,
@@ -90,7 +92,7 @@ static nss_status_t read_netgrent(
#ifdef NSS_FLAVOUR_GLIBC
/* thread-local file pointer to an ongoing request */
-static __thread TFILE *netgrentfp;
+/* static __thread TFILE *netgrentfp; */
/* start a request to get a netgroup by name */
nss_status_t _nss_ldap_setnetgrent(
@@ -189,9 +191,6 @@ static char *_nss_ldap_chase_netgroup(nss_ldap_netgr_backend_t *ngbe)
return group;
}
-/* thread-local file pointer to an ongoing request */
-static __thread TFILE *netgrentfp;
-
static nss_status_t _nss_nslcd_getnetgrent_r(struct __netgrent *result,char *buffer,size_t buflen,int *errnop)
{
NSS_GETENT(netgrentfp,NSLCD_ACTION_NETGROUP_BYNAME,buffer,buflen,
@@ -199,7 +198,7 @@ static nss_status_t _nss_nslcd_getnetgrent_r(struct __netgrent *result,char *buf
return retv;
}
-static nss_status_t _nss_nslcd_setnetgrent(const char *group,struct __netgrent UNUSED(*result))
+static nss_status_t _nss_nslcd_setnetgrent(const char *group,struct __netgrent UNUSED(* result))
{
/* we cannot use NSS_SETENT() here because we have a parameter that is only
available in this function */
diff --git a/nss/networks.c b/nss/networks.c
index d25f8ad..5266362 100644
--- a/nss/networks.c
+++ b/nss/networks.c
@@ -61,6 +61,9 @@
#define ERROR_OUT_WRITEERROR(fp) \
ERROR_OUT_READERROR(fp)
+/* thread-local file pointer to an ongoing request */
+static __thread TFILE *netentfp;
+
/* read a single network entry from the stream, ignoring entries
that are not AF_INET (IPv4), result is stored in result */
static nss_status_t read_netent(
@@ -137,7 +140,7 @@ nss_status_t _nss_ldap_getnetbyaddr_r(
}
/* thread-local file pointer to an ongoing request */
-static __thread TFILE *netentfp;
+/* static __thread TFILE *netentfp; */
/* start a request to read all networks */
nss_status_t _nss_ldap_setnetent(int UNUSED(stayopen))
@@ -179,6 +182,7 @@ static nss_status_t _xnss_ldap_getnetbyname_r(nss_backend_t UNUSED(*be),void *ar
{
struct netent priv_network;
struct netent *network=NSS_ARGS(args)->buf.result?(struct netent *)NSS_ARGS(args)->buf.result:&priv_network;
+ char *name=(char *)NSS_ARGS(args)->key.name;
int af=NSS_ARGS(args)->key.netaddr.type;
char *buffer=NSS_ARGS(args)->buf.buffer;
size_t buflen=NSS_ARGS(args)->buf.buflen;
@@ -190,7 +194,7 @@ static nss_status_t _xnss_ldap_getnetbyname_r(nss_backend_t UNUSED(*be),void *ar
NSS_ARGS(args)->erange=1;
return NSS_STATUS_TRYAGAIN;
}
- status=_nss_nslcd_getnetbyname_r(NSS_ARGS(args)->key.name,network,buffer,
+ status=_nss_nslcd_getnetbyname_r(name,network,buffer,
buflen,&errno,&h_errno);
if (status!=NSS_STATUS_SUCCESS)
{
@@ -200,8 +204,10 @@ static nss_status_t _xnss_ldap_getnetbyname_r(nss_backend_t UNUSED(*be),void *ar
if (!NSS_ARGS(args)->buf.result)
{
/* result==NULL, return file format */
+ struct in_addr priv_in_addr;
+ priv_in_addr.s_addr = network->n_net;
data_ptr=(char *)malloc(buflen);
- sprintf(data_ptr,"%s %s",network->n_name,inet_ntoa(network->n_net)); /* ipNetworkNumber */
+ sprintf(data_ptr,"%s %s",name,inet_ntoa(priv_in_addr)); /* ipNetworkNumber */
if (network->n_aliases)
{
int i;
@@ -290,9 +296,6 @@ static nss_status_t _xnss_ldap_getnetbyaddr_r(nss_backend_t UNUSED(*be),void *ar
return status;
}
-/* thread-local file pointer to an ongoing request */
-static __thread TFILE *netentfp;
-
static nss_status_t _xnss_ldap_setnetent(nss_backend_t UNUSED(*be),void UNUSED(*args))
{
NSS_SETENT(netentfp);
@@ -316,6 +319,7 @@ static nss_status_t _xnss_ldap_getnetent_r(nss_backend_t UNUSED(*be),void *args)
int h_errno;
char *data_ptr;
nss_status_t status;
+
if (NSS_ARGS(args)->buf.buflen<0)
{
NSS_ARGS(args)->erange=1;
@@ -327,9 +331,11 @@ static nss_status_t _xnss_ldap_getnetent_r(nss_backend_t UNUSED(*be),void *args)
if (!NSS_ARGS(args)->buf.result)
{
/* result==NULL, return file format */
+ struct in_addr priv_in_addr;
+ priv_in_addr.s_addr = network->n_net;
data_ptr=(char *)malloc(buflen);
sprintf(data_ptr,"%s %s",network->n_name,
- inet_ntoa(network->n_net)); /* ipNetworkNumber */
+ inet_ntoa(priv_in_addr)); /* ipNetworkNumber */
if (network->n_aliases)
{
int i;
diff --git a/nss/passwd.c b/nss/passwd.c
index 26327e5..2b0cddd 100644
--- a/nss/passwd.c
+++ b/nss/passwd.c
@@ -30,6 +30,9 @@
#include "common.h"
#include "compat/attrs.h"
+/* thread-local file pointer to an ongoing request */
+static __thread TFILE *pwentfp;
+
/* read a passwd entry from the stream */
static nss_status_t read_passwd(
TFILE *fp,struct passwd *result,
@@ -72,7 +75,7 @@ nss_status_t _nss_ldap_getpwuid_r(
}
/* thread-local file pointer to an ongoing request */
-static __thread TFILE *pwentfp;
+/* static __thread TFILE *pwentfp; */
/* open a connection to read all passwd entries */
nss_status_t _nss_ldap_setpwent(int UNUSED(stayopen))
@@ -158,9 +161,6 @@ static nss_status_t _nss_nslcd_getpwuid_r(
return retv;
}
-/* thread-local file pointer to an ongoing request */
-static __thread TFILE *pwentfp;
-
/* open a connection to the nslcd and write the request */
static nss_status_t _xnss_ldap_setpwent(nss_backend_t UNUSED(*be),void UNUSED(*args))
{
diff --git a/nss/protocols.c b/nss/protocols.c
index b490fc3..5a89075 100644
--- a/nss/protocols.c
+++ b/nss/protocols.c
@@ -30,6 +30,9 @@
#include "common.h"
#include "compat/attrs.h"
+/* thread-local file pointer to an ongoing request */
+static __thread TFILE *protoentfp;
+
/* read a single protocol entry from the stream */
static nss_status_t read_protoent(
TFILE *fp,struct protoent *result,
@@ -68,7 +71,7 @@ nss_status_t _nss_ldap_getprotobynumber_r(
}
/* thread-local file pointer to an ongoing request */
-static __thread TFILE *protoentfp;
+/* static __thread TFILE *protoentfp; */
/* start a request to read all protocol entries */
nss_status_t _nss_ldap_setprotoent(int UNUSED(stayopen))
@@ -203,9 +206,6 @@ static nss_status_t _xnss_ldap_getprotobynumber_r(nss_backend_t UNUSED(*be),void
return status;
}
-/* thread-local file pointer to an ongoing request */
-static __thread TFILE *protoentfp;
-
static nss_status_t _xnss_ldap_setprotoent(nss_backend_t UNUSED(*be),void UNUSED(*args))
{
NSS_SETENT(protoentfp);
diff --git a/nss/rpc.c b/nss/rpc.c
index f9ceab9..8bc0f7f 100644
--- a/nss/rpc.c
+++ b/nss/rpc.c
@@ -30,6 +30,9 @@
#include "common.h"
#include "compat/attrs.h"
+/* thread-local file pointer to an ongoing request */
+static __thread TFILE *protoentfp;
+
/* read a sinlge rpc entry from the stream */
static nss_status_t read_rpcent(
TFILE *fp,struct rpcent *result,
@@ -68,7 +71,7 @@ nss_status_t _nss_ldap_getrpcbynumber_r(
}
/* thread-local file pointer to an ongoing request */
-static __thread TFILE *protoentfp;
+/* static __thread TFILE *protoentfp; */
/* request a stream to list all rpc entries */
nss_status_t _nss_ldap_setrpcent(int UNUSED(stayopen))
@@ -116,9 +119,6 @@ static nss_status_t _nss_nslcd_getrpcbynumber_r(
return retv;
}
-/* thread-local file pointer to an ongoing request */
-static __thread TFILE *protoentfp;
-
static nss_status_t _xnss_ldap_setrpcent(nss_backend_t UNUSED(*be),void UNUSED(*args))
{
NSS_SETENT(protoentfp);
diff --git a/nss/services.c b/nss/services.c
index fb709a4..ff23243 100644
--- a/nss/services.c
+++ b/nss/services.c
@@ -30,6 +30,9 @@
#include "common.h"
#include "compat/attrs.h"
+/* thread-local file pointer to an ongoing request */
+static __thread TFILE *protoentfp;
+
/* read a single services result entry from the stream */
static nss_status_t read_servent(
TFILE *fp,struct servent *result,
@@ -72,12 +75,12 @@ nss_status_t _nss_ldap_getservbyport_r(
}
/* thread-local file pointer to an ongoing request */
-static __thread TFILE *serventfp;
+/* static __thread TFILE *protoentfp; */
/* open request to get all services */
nss_status_t _nss_ldap_setservent(int UNUSED(stayopen))
{
- NSS_SETENT(serventfp);
+ NSS_SETENT(protoentfp);
}
/* read a single returned service definition */
@@ -85,15 +88,15 @@ nss_status_t _nss_ldap_getservent_r(
struct servent *result,
char *buffer,size_t buflen,int *errnop)
{
- NSS_GETENT(serventfp,NSLCD_ACTION_SERVICE_ALL,buffer,buflen,
- read_servent(serventfp,result,buffer,buflen,errnop));
+ NSS_GETENT(protoentfp,NSLCD_ACTION_SERVICE_ALL,buffer,buflen,
+ read_servent(protoentfp,result,buffer,buflen,errnop));
return retv;
}
/* close the stream opened by setservent() above */
nss_status_t _nss_ldap_endservent(void)
{
- NSS_ENDENT(serventfp);
+ NSS_ENDENT(protoentfp);
}
#endif /* NSS_FLAVOUR_GLIBC */
@@ -120,25 +123,22 @@ static nss_status_t _nss_nslcd_getservbyport_r(
return retv;
}
-/* thread-local file pointer to an ongoing request */
-static __thread TFILE *serventfp;
-
static nss_status_t _xnss_ldap_setservent(nss_backend_t UNUSED(*be),void UNUSED(*args))
{
- NSS_SETENT(serventfp);
+ NSS_SETENT(protoentfp);
}
static nss_status_t _nss_nslcd_getservent_r(
struct servent *result,char *buffer,size_t buflen,int *errnop)
{
- NSS_GETENT(serventfp,NSLCD_ACTION_SERVICE_ALL,buffer,buflen,
- read_servent(serventfp,result,buffer,buflen,errnop));
+ NSS_GETENT(protoentfp,NSLCD_ACTION_SERVICE_ALL,buffer,buflen,
+ read_servent(protoentfp,result,buffer,buflen,errnop));
return retv;
}
static nss_status_t _xnss_ldap_endservent(nss_backend_t UNUSED(*be),void UNUSED(*args))
{
- NSS_ENDENT(serventfp);
+ NSS_ENDENT(protoentfp);
}
static nss_status_t _xnss_ldap_getservbyname_r(nss_backend_t UNUSED(*be),void *args)
diff --git a/nss/shadow.c b/nss/shadow.c
index 4ccb7b6..7e5e7ce 100644
--- a/nss/shadow.c
+++ b/nss/shadow.c
@@ -30,6 +30,9 @@
#include "common.h"
#include "compat/attrs.h"
+/* thread-local file pointer to an ongoing request */
+static __thread TFILE *spentfp;
+
/* read a single shadow entry from the stream */
static nss_status_t read_spwd(
TFILE *fp,struct spwd *result,
@@ -63,7 +66,7 @@ nss_status_t _nss_ldap_getspnam_r(
}
/* thread-local file pointer to an ongoing request */
-static __thread TFILE *spentfp;
+/* static __thread TFILE *spentfp; */
/* start listing all shadow users */
nss_status_t _nss_ldap_setspent(int UNUSED(stayopen))
@@ -108,7 +111,6 @@ static nss_status_t _xnss_ldap_getspnam_r(nss_backend_t UNUSED(*be),void *args)
char *buffer=NSS_ARGS(args)->buf.buffer;
size_t buflen=NSS_ARGS(args)->buf.buflen;
char *data_ptr;
- char field_buf[128];
nss_status_t status;
if (NSS_ARGS(args)->buf.buflen<0)
{
@@ -122,6 +124,7 @@ static nss_status_t _xnss_ldap_getspnam_r(nss_backend_t UNUSED(*be),void *args)
{
/* result==NULL, return file format */
data_ptr=(char *)malloc(buflen);
+ char field_buf[128];
sprintf(data_ptr,"%s:%s:",sp->sp_namp,sp->sp_pwdp);
if (sp->sp_lstchg >= 0)
sprintf(field_buf,"%d:",sp->sp_lstchg);
@@ -170,9 +173,6 @@ static nss_status_t _xnss_ldap_getspnam_r(nss_backend_t UNUSED(*be),void *args)
return status;
}
-/* thread-local file pointer to an ongoing request */
-static __thread TFILE *spentfp;
-
static nss_status_t _xnss_ldap_setspent(nss_backend_t UNUSED(*be),void UNUSED(*args))
{
NSS_SETENT(spentfp);