nss-pam-ldapd commit: r1333 - nss-pam-ldapd-solaris/nss
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
nss-pam-ldapd commit: r1333 - nss-pam-ldapd-solaris/nss
- From: Commits of the nss-pam-ldapd project <nss-pam-ldapd-commits [at] lists.arthurdejong.org>
- To: nss-pam-ldapd-commits [at] lists.arthurdejong.org
- Reply-to: nss-pam-ldapd-users [at] lists.arthurdejong.org
- Subject: nss-pam-ldapd commit: r1333 - nss-pam-ldapd-solaris/nss
- Date: Thu, 16 Dec 2010 22:50:53 +0100 (CET)
Author: arthur
Date: Thu Dec 16 22:50:51 2010
New Revision: 1333
URL: http://arthurdejong.org/viewvc/nss-pam-ldapd?view=rev&revision=1333
Log:
switch to a common back-end with a common constructor and destructor and put
file pointer shared between {set,get,end}ent() calls in there
Modified:
nss-pam-ldapd-solaris/nss/common.c
nss-pam-ldapd-solaris/nss/common.h
nss-pam-ldapd-solaris/nss/group.c
nss-pam-ldapd-solaris/nss/hosts.c
nss-pam-ldapd-solaris/nss/networks.c
nss-pam-ldapd-solaris/nss/passwd.c
nss-pam-ldapd-solaris/nss/protocols.c
nss-pam-ldapd-solaris/nss/rpc.c
nss-pam-ldapd-solaris/nss/services.c
nss-pam-ldapd-solaris/nss/shadow.c
Modified: nss-pam-ldapd-solaris/nss/common.c
==============================================================================
--- nss-pam-ldapd-solaris/nss/common.c Thu Dec 16 21:25:41 2010 (r1332)
+++ nss-pam-ldapd-solaris/nss/common.c Thu Dec 16 22:50:51 2010 (r1333)
@@ -19,4 +19,38 @@
02110-1301 USA
*/
+#include "config.h"
+
+#include <errno.h>
+
+#include "prototypes.h"
+#include "common.h"
+#include "compat/attrs.h"
+
+/* global symbol to prevent NSS name lookups using this module */
int _nss_ldap_enablelookups=1;
+
+#ifdef NSS_FLAVOUR_SOLARIS
+
+nss_backend_t *nss_ldap_constructor(nss_backend_op_t *ops,size_t sizeofops)
+{
+ struct nss_ldap_backend *ldapbe;
+ ldapbe=(struct nss_ldap_backend *)malloc(sizeof(struct nss_ldap_backend));
+ if (ldapbe==NULL)
+ return NULL;
+ ldapbe->ops=ops;
+ ldapbe->n_ops=sizeofops/sizeof(nss_backend_op_t);
+ ldapbe->fp=NULL;
+ return (nss_backend_t *)ldapbe;
+}
+
+nss_status_t nss_ldap_destructor(nss_backend_t *be,void UNUSED(*args))
+{
+ struct nss_ldap_backend *ldapbe=(struct nss_ldap_backend *)be;
+ if (ldapbe->fp!=NULL)
+ (void)tio_close(ldapbe->fp);
+ free(ldapbe);
+ return NSS_STATUS_SUCCESS;
+}
+
+#endif /* NSS_FLAVOUR_SOLARIS */
Modified: nss-pam-ldapd-solaris/nss/common.h
==============================================================================
--- nss-pam-ldapd-solaris/nss/common.h Thu Dec 16 21:25:41 2010 (r1332)
+++ nss-pam-ldapd-solaris/nss/common.h Thu Dec 16 22:50:51 2010 (r1333)
@@ -104,6 +104,26 @@
return NSS_STATUS_TRYAGAIN; \
}
+/* this is the backend structure for Solaris */
+struct nss_ldap_backend
+{
+ nss_backend_op_t *ops; /* function-pointer table */
+ int n_ops; /* number of function pointers */
+ TFILE *fp; /* the file pointer for {set,get,end}ent() functions */
+};
+
+/* constructor for LDAP backends */
+nss_backend_t *nss_ldap_constructor(nss_backend_op_t *ops,size_t sizeofops);
+
+/* destructor for LDAP backends */
+nss_status_t nss_ldap_destructor(nss_backend_t *be,void UNUSED(*args));
+
+extern TFILE *xxfp;
+
+/* easy way to get fp from back-end */
+/* #define LDAP_GET_FP(be) (((struct nss_ldap_backend*)(be))->fp) */
+#define LDAP_BE(be) ((struct nss_ldap_backend*)(be))
+
#endif /* NSS_FLAVOUR_SOLARIS */
/* The following macros to automatically generate get..byname(),
Modified: nss-pam-ldapd-solaris/nss/group.c
==============================================================================
--- nss-pam-ldapd-solaris/nss/group.c Thu Dec 16 21:25:41 2010 (r1332)
+++ nss-pam-ldapd-solaris/nss/group.c Thu Dec 16 22:50:51 2010 (r1333)
@@ -247,23 +247,20 @@
READ_RESULT(fp));
}
-/* thread-local file pointer to an ongoing request */
-static __thread TFILE *grentfp;
-
-static nss_status_t group_setgrent(nss_backend_t UNUSED(*be),void
UNUSED(*args))
+static nss_status_t group_setgrent(nss_backend_t *be,void UNUSED(*args))
{
- NSS_SETENT(grentfp);
+ NSS_SETENT(LDAP_BE(be)->fp);
}
-static nss_status_t group_getgrent(nss_backend_t UNUSED(*be),void *args)
+static nss_status_t group_getgrent(nss_backend_t *be,void *args)
{
- NSS_GETENT(grentfp,NSLCD_ACTION_GROUP_ALL,
- READ_RESULT(grentfp));
+ NSS_GETENT(LDAP_BE(be)->fp,NSLCD_ACTION_GROUP_ALL,
+ READ_RESULT((LDAP_BE(be)->fp)));
}
-static nss_status_t group_endgrent(nss_backend_t UNUSED(*be),void
UNUSED(*args))
+static nss_status_t group_endgrent(nss_backend_t *be,void UNUSED(*args))
{
- NSS_ENDENT(grentfp);
+ NSS_ENDENT(LDAP_BE(be)->fp);
}
/*
@@ -282,14 +279,8 @@
argp->numgids=(int)start;);
}
-static nss_status_t group_destructor(nss_backend_t *be,void UNUSED(*args))
-{
- free(be);
- return NSS_STATUS_SUCCESS;
-}
-
static nss_backend_op_t group_ops[]={
- group_destructor,
+ nss_ldap_destructor,
group_endgrent,
group_setgrent,
group_getgrent,
@@ -301,12 +292,7 @@
nss_backend_t *_nss_ldap_group_constr(const char UNUSED(*db_name),
const char UNUSED(*src_name),const char UNUSED(*cfg_args))
{
- nss_backend_t *be;
- if (!(be=(nss_backend_t *)malloc(sizeof(*be))))
- return NULL;
- be->ops=group_ops;
- be->n_ops=sizeof(group_ops)/sizeof(nss_backend_op_t);
- return (nss_backend_t *)be;
+ return nss_ldap_constructor(group_ops,sizeof(group_ops));
}
#endif /* NSS_FLAVOUR_SOLARIS */
Modified: nss-pam-ldapd-solaris/nss/hosts.c
==============================================================================
--- nss-pam-ldapd-solaris/nss/hosts.c Thu Dec 16 21:25:41 2010 (r1332)
+++ nss-pam-ldapd-solaris/nss/hosts.c Thu Dec 16 22:50:51 2010 (r1333)
@@ -242,6 +242,13 @@
#ifdef NSS_FLAVOUR_SOLARIS
+struct nss_ldap_hosts_backend
+{
+ nss_backend_op_t *ops;
+ int n_ops;
+ TFILE *fp;
+};
+
#ifdef HAVE_STRUCT_NSS_XBYY_ARGS_RETURNLEN
static nss_status_t read_hoststring(TFILE *fp,nss_XbyY_args_t *args,int
erronempty)
@@ -341,33 +348,24 @@
READ_RESULT_ERRONEMPTY(fp));
}
-/* thread-local file pointer to an ongoing request */
-static __thread TFILE *hostentfp;
-
-static nss_status_t hosts_sethostent(nss_backend_t UNUSED(*be),void
UNUSED(*args))
-{
- NSS_SETENT(hostentfp);
-}
-
-static nss_status_t hosts_gethostent(nss_backend_t UNUSED(*be),void *args)
+static nss_status_t hosts_sethostent(nss_backend_t *be,void UNUSED(*args))
{
- NSS_GETENT(hostentfp,NSLCD_ACTION_HOST_ALL,
- READ_RESULT_NEXTONEMPTY(hostentfp));
+ NSS_SETENT(LDAP_BE(be)->fp);
}
-static nss_status_t hosts_endhostent(nss_backend_t UNUSED(*be),void
UNUSED(*args))
+static nss_status_t hosts_gethostent(nss_backend_t *be,void *args)
{
- NSS_ENDENT(hostentfp);
+ NSS_GETENT(LDAP_BE(be)->fp,NSLCD_ACTION_HOST_ALL,
+ READ_RESULT_NEXTONEMPTY(LDAP_BE(be)->fp));
}
-static nss_status_t hosts_destructor(nss_backend_t *be,void UNUSED(*args))
+static nss_status_t hosts_endhostent(nss_backend_t *be,void UNUSED(*args))
{
- free(be);
- return NSS_STATUS_SUCCESS;
+ NSS_ENDENT(LDAP_BE(be)->fp);
}
-static nss_backend_op_t host_ops[]={
- hosts_destructor,
+static nss_backend_op_t hosts_ops[]={
+ nss_ldap_destructor,
hosts_endhostent,
hosts_sethostent,
hosts_gethostent,
@@ -378,12 +376,7 @@
nss_backend_t *_nss_ldap_hosts_constr(const char UNUSED(*db_name),
const char UNUSED(*src_name),const char UNUSED(*cfg_args))
{
- nss_backend_t *be;
- if (!(be=(nss_backend_t *)malloc(sizeof(*be))))
- return NULL;
- be->ops=host_ops;
- be->n_ops=sizeof(host_ops)/sizeof(nss_backend_op_t);
- return (nss_backend_t *)be;
+ return nss_ldap_constructor(hosts_ops,sizeof(hosts_ops));
}
#endif /* NSS_FLAVOUR_SOLARIS */
Modified: nss-pam-ldapd-solaris/nss/networks.c
==============================================================================
--- nss-pam-ldapd-solaris/nss/networks.c Thu Dec 16 21:25:41 2010
(r1332)
+++ nss-pam-ldapd-solaris/nss/networks.c Thu Dec 16 22:50:51 2010
(r1333)
@@ -230,33 +230,24 @@
READ_RESULT(fp));
}
-/* thread-local file pointer to an ongoing request */
-static __thread TFILE *netentfp;
-
-static nss_status_t networks_setnetent(nss_backend_t UNUSED(*be),void
UNUSED(*args))
-{
- NSS_SETENT(netentfp);
-}
-
-static nss_status_t networks_getnetent(nss_backend_t UNUSED(*be),void *args)
+static nss_status_t networks_setnetent(nss_backend_t *be,void UNUSED(*args))
{
- NSS_GETENT(netentfp,NSLCD_ACTION_NETWORK_ALL,
- READ_RESULT(netentfp));
+ NSS_SETENT(LDAP_BE(be)->fp);
}
-static nss_status_t networks_endnetent(nss_backend_t UNUSED(*be),void
UNUSED(*args))
+static nss_status_t networks_getnetent(nss_backend_t *be,void *args)
{
- NSS_ENDENT(netentfp);
+ NSS_GETENT(LDAP_BE(be)->fp,NSLCD_ACTION_NETWORK_ALL,
+ READ_RESULT(LDAP_BE(be)->fp));
}
-static nss_status_t networks_destructor(nss_backend_t *be,void UNUSED(*args))
+static nss_status_t networks_endnetent(nss_backend_t *be,void UNUSED(*args))
{
- free(be);
- return NSS_STATUS_SUCCESS;
+ NSS_ENDENT(LDAP_BE(be)->fp);
}
-static nss_backend_op_t net_ops[]={
- networks_destructor,
+static nss_backend_op_t networks_ops[]={
+ nss_ldap_destructor,
networks_endnetent,
networks_setnetent,
networks_getnetent,
@@ -267,12 +258,7 @@
nss_backend_t *_nss_ldap_networks_constr(const char UNUSED(*db_name),
const char UNUSED(*src_name),const char UNUSED(*cfg_args))
{
- nss_backend_t *be;
- if (!(be=(nss_backend_t *)malloc(sizeof(*be))))
- return NULL;
- be->ops=net_ops;
- be->n_ops=sizeof(net_ops)/sizeof(nss_backend_op_t);
- return (nss_backend_t *)be;
+ return nss_ldap_constructor(networks_ops,sizeof(networks_ops));
}
#endif /* NSS_FLAVOUR_SOLARIS */
Modified: nss-pam-ldapd-solaris/nss/passwd.c
==============================================================================
--- nss-pam-ldapd-solaris/nss/passwd.c Thu Dec 16 21:25:41 2010 (r1332)
+++ nss-pam-ldapd-solaris/nss/passwd.c Thu Dec 16 22:50:51 2010 (r1333)
@@ -155,36 +155,27 @@
READ_RESULT(fp));
}
-/* 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 passwd_setpwent(nss_backend_t UNUSED(*be),void
UNUSED(*args))
+static nss_status_t passwd_setpwent(nss_backend_t *be,void UNUSED(*args))
{
- NSS_SETENT(pwentfp);
+ NSS_SETENT(LDAP_BE(be)->fp);
}
/* read password data from an opened stream */
-static nss_status_t passwd_getpwent(nss_backend_t UNUSED(*be),void *args)
+static nss_status_t passwd_getpwent(nss_backend_t *be,void *args)
{
- NSS_GETENT(pwentfp,NSLCD_ACTION_PASSWD_ALL,
- READ_RESULT(pwentfp));
+ NSS_GETENT(LDAP_BE(be)->fp,NSLCD_ACTION_PASSWD_ALL,
+ READ_RESULT(LDAP_BE(be)->fp));
}
/* close the stream opened with setpwent() above */
-static nss_status_t passwd_endpwent(nss_backend_t UNUSED(*be),void
UNUSED(*args))
-{
- NSS_ENDENT(pwentfp);
-}
-
-static nss_status_t passwd_destructor(nss_backend_t *be,void UNUSED(*args))
+static nss_status_t passwd_endpwent(nss_backend_t *be,void UNUSED(*args))
{
- free(be);
- return NSS_STATUS_SUCCESS;
+ NSS_ENDENT(LDAP_BE(be)->fp);
}
static nss_backend_op_t passwd_ops[]={
- passwd_destructor,
+ nss_ldap_destructor,
passwd_endpwent,
passwd_setpwent,
passwd_getpwent,
@@ -195,12 +186,7 @@
nss_backend_t *_nss_ldap_passwd_constr(const char UNUSED(*db_name),
const char UNUSED(*src_name),const char UNUSED(*cfg_args))
{
- nss_backend_t *be;
- if (!(be=(nss_backend_t *)malloc(sizeof(*be))))
- return NULL;
- be->ops=passwd_ops;
- be->n_ops=sizeof(passwd_ops)/sizeof(nss_backend_op_t);
- return (nss_backend_t *)be;
+ return nss_ldap_constructor(passwd_ops,sizeof(passwd_ops));
}
#endif /* NSS_FLAVOUR_SOLARIS */
Modified: nss-pam-ldapd-solaris/nss/protocols.c
==============================================================================
--- nss-pam-ldapd-solaris/nss/protocols.c Thu Dec 16 21:25:41 2010
(r1332)
+++ nss-pam-ldapd-solaris/nss/protocols.c Thu Dec 16 22:50:51 2010
(r1333)
@@ -156,33 +156,24 @@
READ_RESULT(fp));
}
-/* thread-local file pointer to an ongoing request */
-static __thread TFILE *protoentfp;
-
-static nss_status_t protocols_setprotoent(nss_backend_t UNUSED(*be),void
UNUSED(*args))
-{
- NSS_SETENT(protoentfp);
-}
-
-static nss_status_t protocols_getprotoent(nss_backend_t UNUSED(*be),void *args)
+static nss_status_t protocols_setprotoent(nss_backend_t *be,void UNUSED(*args))
{
- NSS_GETENT(protoentfp,NSLCD_ACTION_PROTOCOL_ALL,
- READ_RESULT(protoentfp));
+ NSS_SETENT(LDAP_BE(be)->fp);
}
-static nss_status_t protocols_endprotoent(nss_backend_t UNUSED(*be),void
UNUSED(*args))
+static nss_status_t protocols_getprotoent(nss_backend_t *be,void *args)
{
- NSS_ENDENT(protoentfp);
+ NSS_GETENT(LDAP_BE(be)->fp,NSLCD_ACTION_PROTOCOL_ALL,
+ READ_RESULT(LDAP_BE(be)->fp));
}
-static nss_status_t protocols_destructor(nss_backend_t *be,void UNUSED(*args))
+static nss_status_t protocols_endprotoent(nss_backend_t *be,void UNUSED(*args))
{
- free(be);
- return NSS_STATUS_SUCCESS;
+ NSS_ENDENT(LDAP_BE(be)->fp);
}
-static nss_backend_op_t proto_ops[]={
- protocols_destructor,
+static nss_backend_op_t protocols_ops[]={
+ nss_ldap_destructor,
protocols_endprotoent,
protocols_setprotoent,
protocols_getprotoent,
@@ -193,13 +184,7 @@
nss_backend_t *_nss_ldap_protocols_constr(const char UNUSED(*db_name),
const char UNUSED(*src_name),const char UNUSED(*cfg_args))
{
- nss_backend_t *be;
- be=(nss_backend_t *)malloc(sizeof(*be));
- if (be==NULL)
- return NULL;
- be->ops=proto_ops;
- be->n_ops=sizeof(proto_ops)/sizeof(nss_backend_op_t);
- return (nss_backend_t *)be;
+ return nss_ldap_constructor(protocols_ops,sizeof(protocols_ops));
}
#endif /* NSS_FLAVOUR_SOLARIS */
Modified: nss-pam-ldapd-solaris/nss/rpc.c
==============================================================================
--- nss-pam-ldapd-solaris/nss/rpc.c Thu Dec 16 21:25:41 2010 (r1332)
+++ nss-pam-ldapd-solaris/nss/rpc.c Thu Dec 16 22:50:51 2010 (r1333)
@@ -156,33 +156,24 @@
READ_RESULT(fp));
}
-/* thread-local file pointer to an ongoing request */
-static __thread TFILE *rpcentfp;
-
-static nss_status_t rpc_setrpcent(nss_backend_t UNUSED(*be),void UNUSED(*args))
-{
- NSS_SETENT(rpcentfp);
-}
-
-static nss_status_t rpc_getrpcent(nss_backend_t UNUSED(*be),void *args)
+static nss_status_t rpc_setrpcent(nss_backend_t *be,void UNUSED(*args))
{
- NSS_GETENT(rpcentfp,NSLCD_ACTION_RPC_ALL,
- READ_RESULT(rpcentfp));
+ NSS_SETENT(LDAP_BE(be)->fp);
}
-static nss_status_t rpc_endrpcent(nss_backend_t UNUSED(*be),void UNUSED(*args))
+static nss_status_t rpc_getrpcent(nss_backend_t *be,void *args)
{
- NSS_ENDENT(rpcentfp);
+ NSS_GETENT(LDAP_BE(be)->fp,NSLCD_ACTION_RPC_ALL,
+ READ_RESULT(LDAP_BE(be)->fp));
}
-static nss_status_t rpc_destructor(nss_backend_t *be,void UNUSED(*args))
+static nss_status_t rpc_endrpcent(nss_backend_t *be,void UNUSED(*args))
{
- free(be);
- return NSS_STATUS_SUCCESS;
+ NSS_ENDENT(LDAP_BE(be)->fp);
}
static nss_backend_op_t rpc_ops[]={
- rpc_destructor,
+ nss_ldap_destructor,
rpc_endrpcent,
rpc_setrpcent,
rpc_getrpcent,
@@ -193,12 +184,7 @@
nss_backend_t *_nss_ldap_rpc_constr(const char UNUSED(*db_name),
const char UNUSED(*src_name),const char UNUSED(*cfg_args))
{
- nss_backend_t *be;
- if (!(be=(nss_backend_t *)malloc(sizeof(*be))))
- return NULL;
- be->ops=rpc_ops;
- be->n_ops=sizeof(rpc_ops)/sizeof(nss_backend_op_t);
- return (nss_backend_t *)be;
+ return nss_ldap_constructor(rpc_ops,sizeof(rpc_ops));
}
#endif /* NSS_FLAVOUR_SOLARIS */
Modified: nss-pam-ldapd-solaris/nss/services.c
==============================================================================
--- nss-pam-ldapd-solaris/nss/services.c Thu Dec 16 21:25:41 2010
(r1332)
+++ nss-pam-ldapd-solaris/nss/services.c Thu Dec 16 22:50:51 2010
(r1333)
@@ -162,33 +162,24 @@
READ_RESULT(fp));
}
-/* thread-local file pointer to an ongoing request */
-static __thread TFILE *serventfp;
-
-static nss_status_t services_setservent(nss_backend_t UNUSED(*be),void
UNUSED(*args))
-{
- NSS_SETENT(serventfp);
-}
-
-static nss_status_t services_getservent(nss_backend_t UNUSED(*be),void *args)
+static nss_status_t services_setservent(nss_backend_t *be,void UNUSED(*args))
{
- NSS_GETENT(serventfp,NSLCD_ACTION_SERVICE_ALL,
- READ_RESULT(serventfp));
+ NSS_SETENT(LDAP_BE(be)->fp);
}
-static nss_status_t services_endservent(nss_backend_t UNUSED(*be),void
UNUSED(*args))
+static nss_status_t services_getservent(nss_backend_t *be,void *args)
{
- NSS_ENDENT(serventfp);
+ NSS_GETENT(LDAP_BE(be)->fp,NSLCD_ACTION_SERVICE_ALL,
+ READ_RESULT(LDAP_BE(be)->fp));
}
-static nss_status_t services_destructor(nss_backend_t *be,void UNUSED(*args))
+static nss_status_t services_endservent(nss_backend_t *be,void UNUSED(*args))
{
- free(be);
- return NSS_STATUS_SUCCESS;
+ NSS_ENDENT(LDAP_BE(be)->fp);
}
static nss_backend_op_t services_ops[]={
- services_destructor,
+ nss_ldap_destructor,
services_endservent,
services_setservent,
services_getservent,
@@ -199,12 +190,7 @@
nss_backend_t *_nss_ldap_services_constr(const char UNUSED(*db_name),
const char UNUSED(*src_name),const char UNUSED(*cfg_args))
{
- nss_backend_t *be;
- if (!(be=(nss_backend_t *)malloc(sizeof(*be))))
- return NULL;
- be->ops=services_ops;
- be->n_ops=sizeof(services_ops)/sizeof(nss_backend_op_t);
- return (nss_backend_t *)be;
+ return nss_ldap_constructor(services_ops,sizeof(services_ops));
}
#endif /* NSS_FLAVOUR_SOLARIS */
Modified: nss-pam-ldapd-solaris/nss/shadow.c
==============================================================================
--- nss-pam-ldapd-solaris/nss/shadow.c Thu Dec 16 21:25:41 2010 (r1332)
+++ nss-pam-ldapd-solaris/nss/shadow.c Thu Dec 16 22:50:51 2010 (r1333)
@@ -174,33 +174,24 @@
READ_RESULT(fp));
}
-/* thread-local file pointer to an ongoing request */
-static __thread TFILE *spentfp;
-
-static nss_status_t shadow_setspent(nss_backend_t UNUSED(*be),void
UNUSED(*args))
-{
- NSS_SETENT(spentfp);
-}
-
-static nss_status_t shadow_getspent(nss_backend_t UNUSED(*be),void *args)
+static nss_status_t shadow_setspent(nss_backend_t *be,void UNUSED(*args))
{
- NSS_GETENT(spentfp,NSLCD_ACTION_SHADOW_ALL,
- READ_RESULT(spentfp));
+ NSS_SETENT(LDAP_BE(be)->fp);
}
-static nss_status_t shadow_endspent(nss_backend_t UNUSED(*be),void
UNUSED(*args))
+static nss_status_t shadow_getspent(nss_backend_t *be,void *args)
{
- NSS_ENDENT(spentfp);
+ NSS_GETENT(LDAP_BE(be)->fp,NSLCD_ACTION_SHADOW_ALL,
+ READ_RESULT(LDAP_BE(be)->fp));
}
-static nss_status_t shadow_destructor(nss_backend_t *be,void UNUSED(*args))
+static nss_status_t shadow_endspent(nss_backend_t *be,void UNUSED(*args))
{
- free(be);
- return NSS_STATUS_SUCCESS;
+ NSS_ENDENT(LDAP_BE(be)->fp);
}
static nss_backend_op_t shadow_ops[]={
- shadow_destructor,
+ nss_ldap_destructor,
shadow_endspent,
shadow_setspent,
shadow_getspent,
@@ -210,12 +201,7 @@
nss_backend_t *_nss_ldap_shadow_constr(const char UNUSED(*db_name),
const char UNUSED(*src_name),const char UNUSED(*cfg_args))
{
- nss_backend_t *be;
- if (!(be=(nss_backend_t *)malloc(sizeof(*be))))
- return NULL;
- be->ops=shadow_ops;
- be->n_ops=sizeof(shadow_ops)/sizeof(nss_backend_op_t);
- return (nss_backend_t *)be;
+ return nss_ldap_constructor(shadow_ops,sizeof(shadow_ops));
}
#endif /* NSS_FLAVOUR_SOLARIS */
--
To unsubscribe send an email to
nss-pam-ldapd-commits-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/nss-pam-ldapd-commits
- nss-pam-ldapd commit: r1333 - nss-pam-ldapd-solaris/nss,
Commits of the nss-pam-ldapd project