summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2006-10-17 14:13:17 +0000
committerArthur de Jong <arthur@arthurdejong.org>2006-10-17 14:13:17 +0000
commit198b9cdb023374fb47f91f5503655ca14b805a5f (patch)
tree58895dcecdffcb555e723bd036cabd118390382e
parent42688c3b7d616c8dc221a76b1cf2155d336db954 (diff)
get rid of ltf files (which contain NPL licenced code btw) clean up includes and general small code cleanups
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/libnss_ldapd@19 ef36b2f9-881f-0410-afb5-c4e39611909c
-rw-r--r--Makefile.am2
-rw-r--r--dnsconfig.c1
-rw-r--r--dnsconfig.h5
-rw-r--r--ldap-alias.c21
-rw-r--r--ldap-automount.c47
-rw-r--r--ldap-ethers.c35
-rw-r--r--ldap-grp.c20
-rw-r--r--ldap-hosts.c25
-rw-r--r--ldap-netgrp.c25
-rw-r--r--ldap-network.c20
-rw-r--r--ldap-nss.c27
-rw-r--r--ldap-nss.h16
-rw-r--r--ldap-parse.h3
-rw-r--r--ldap-proto.c20
-rw-r--r--ldap-pwd.c20
-rw-r--r--ldap-rpc.c21
-rw-r--r--ldap-schema.c21
-rw-r--r--ldap-schema.h1
-rw-r--r--ldap-service.c21
-rw-r--r--ldap-spwd.c25
-rw-r--r--ltf.c345
-rw-r--r--ltf.h30
-rw-r--r--pagectrl.c19
-rw-r--r--pagectrl.h2
-rw-r--r--resolve.c19
-rw-r--r--resolve.h1
-rw-r--r--util.c48
27 files changed, 133 insertions, 707 deletions
diff --git a/Makefile.am b/Makefile.am
index f49cb49..459510a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -34,7 +34,7 @@ man_MANS = nss_ldap.5
nss_ldap_so_SOURCES = ldap-nss.c ldap-pwd.c ldap-grp.c ldap-netgrp.c ldap-rpc.c \
ldap-hosts.c ldap-network.c ldap-proto.c ldap-spwd.c \
ldap-alias.c ldap-service.c ldap-schema.c ldap-ethers.c \
- ldap-automount.c util.c ltf.c resolve.c \
+ ldap-automount.c util.c resolve.c \
dnsconfig.c pagectrl.c
nss_ldap_so_LDFLAGS = @nss_ldap_so_LDFLAGS@
diff --git a/dnsconfig.c b/dnsconfig.c
index 8f3a9ee..80efbb1 100644
--- a/dnsconfig.c
+++ b/dnsconfig.c
@@ -40,7 +40,6 @@
#include <arpa/nameser.h>
#include <resolv.h>
#include <string.h>
-
#ifdef HAVE_LBER_H
#include <lber.h>
#endif
diff --git a/dnsconfig.h b/dnsconfig.h
index 95e8dd7..8d8b963 100644
--- a/dnsconfig.h
+++ b/dnsconfig.h
@@ -27,8 +27,9 @@
/* utility routines. */
enum nss_status _nss_ldap_getdnsdn (char *domain,
- char **rval, char **buffer, size_t * buflen);
+ char **rval, char **buffer, size_t * buflen);
-enum nss_status _nss_ldap_mergeconfigfromdns (struct ldap_config * result, char **buffer, size_t *buflen);
+enum nss_status _nss_ldap_mergeconfigfromdns (struct ldap_config * result,
+ char **buffer, size_t *buflen);
#endif /* _LDAP_NSS_LDAP_DNSCONFIG_H */
diff --git a/ldap-alias.c b/ldap-alias.c
index e097d77..0d9ec33 100644
--- a/ldap-alias.c
+++ b/ldap-alias.c
@@ -23,15 +23,7 @@
#include "config.h"
-#ifdef HAVE_PORT_BEFORE_H
-#include <port_before.h>
-#endif
-
-#if defined(HAVE_THREAD_H)
-#include <thread.h>
-#elif defined(HAVE_PTHREAD_H)
-#include <pthread.h>
-#endif
+#ifdef HAVE_ALIASES_H
#include <stdio.h>
#include <stdlib.h>
@@ -39,17 +31,16 @@
#include <lber.h>
#include <ldap.h>
#include <errno.h>
-
-#ifdef HAVE_ALIASES_H
#include <aliases.h>
+#if defined(HAVE_THREAD_H)
+#include <thread.h>
+#elif defined(HAVE_PTHREAD_H)
+#include <pthread.h>
+#endif
#include "ldap-nss.h"
#include "util.h"
-#ifdef HAVE_PORT_AFTER_H
-#include <port_after.h>
-#endif
-
static struct ent_context *alias_context = NULL;
static enum nss_status
diff --git a/ldap-automount.c b/ldap-automount.c
index fb84ac4..5f31ef6 100644
--- a/ldap-automount.c
+++ b/ldap-automount.c
@@ -23,16 +23,6 @@
#include "config.h"
-#ifdef HAVE_PORT_BEFORE_H
-#include <port_before.h>
-#endif
-
-#if defined(HAVE_THREAD_H)
-#include <thread.h>
-#elif defined(HAVE_PTHREAD_H)
-#include <pthread.h>
-#endif
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -41,21 +31,21 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
-
#ifdef HAVE_LBER_H
#include <lber.h>
#endif
#ifdef HAVE_LDAP_H
#include <ldap.h>
#endif
+#if defined(HAVE_THREAD_H)
+#include <thread.h>
+#elif defined(HAVE_PTHREAD_H)
+#include <pthread.h>
+#endif
#include "ldap-nss.h"
#include "util.h"
-#ifdef HAVE_PORT_AFTER_H
-#include <port_after.h>
-#endif
-
/* Linux only for now */
struct ldap_automount_context {
/* Enumeration state */
@@ -68,9 +58,6 @@ struct ldap_automount_context {
size_t lac_dn_index;
};
-typedef struct ldap_automount_context ldap_automount_context_t;
-
-
static enum nss_status
_nss_ldap_parse_automount (LDAPMessage * e,
struct ldap_state * pvt,
@@ -95,11 +82,11 @@ _nss_ldap_parse_automount (LDAPMessage * e,
}
enum nss_status
-_nss_ldap_am_context_alloc(ldap_automount_context_t **pContext)
+_nss_ldap_am_context_alloc(struct ldap_automount_context **pContext)
{
- ldap_automount_context_t *context;
+ struct ldap_automount_context *context;
- context = (ldap_automount_context_t *)malloc (sizeof(*context));
+ context = (struct ldap_automount_context *)malloc (sizeof(*context));
if (context == NULL)
{
return NSS_STATUS_TRYAGAIN;
@@ -133,9 +120,9 @@ _nss_ldap_am_context_alloc(ldap_automount_context_t **pContext)
}
void
-_nss_ldap_am_context_free(ldap_automount_context_t **pContext)
+_nss_ldap_am_context_free(struct ldap_automount_context **pContext)
{
- ldap_automount_context_t *context;
+ struct ldap_automount_context *context;
size_t i;
context = *pContext;
@@ -175,7 +162,7 @@ am_context_add_dn (LDAPMessage * e,
struct ldap_state * pvt,
void *result, char *buffer, size_t buflen)
{
- ldap_automount_context_t *context = (ldap_automount_context_t *) result;
+ struct ldap_automount_context *context = (struct ldap_automount_context *) result;
char *dn;
dn = _nss_ldap_get_dn (e);
@@ -210,10 +197,10 @@ am_context_add_dn (LDAPMessage * e,
}
enum nss_status
-_nss_ldap_am_context_init(const char *mapname, ldap_automount_context_t **pContext)
+_nss_ldap_am_context_init(const char *mapname, struct ldap_automount_context **pContext)
{
enum nss_status stat;
- ldap_automount_context_t *context = NULL;
+ struct ldap_automount_context *context = NULL;
const char *no_attrs[] = { NULL };
struct ldap_args a;
struct ent_context *key = NULL;
@@ -265,7 +252,7 @@ _nss_ldap_am_context_init(const char *mapname, ldap_automount_context_t **pConte
enum nss_status _nss_ldap_setautomntent(const char *mapname, void **private)
{
- ldap_automount_context_t *context = NULL;
+ struct ldap_automount_context *context = NULL;
enum nss_status stat;
debug ("==> _nss_ldap_setautomntent");
@@ -300,7 +287,7 @@ enum nss_status _nss_ldap_getautomntent_r(void *private, const char **key, const
char *buffer, size_t buflen, int *errnop)
{
enum nss_status stat;
- ldap_automount_context_t *context = (ldap_automount_context_t *)private;
+ struct ldap_automount_context *context = (struct ldap_automount_context *)private;
struct ldap_args a;
char **keyval[2];
@@ -348,7 +335,7 @@ enum nss_status _nss_ldap_getautomntent_r(void *private, const char **key, const
enum nss_status _nss_ldap_endautomntent(void **private)
{
- ldap_automount_context_t **pContext = (ldap_automount_context_t **)private;
+ struct ldap_automount_context **pContext = (struct ldap_automount_context **)private;
debug ("==> _nss_ldap_endautomntent");
@@ -368,7 +355,7 @@ enum nss_status _nss_ldap_getautomntbyname_r(void *private, const char *key,
char *buffer, size_t buflen, int *errnop)
{
enum nss_status stat = NSS_STATUS_NOTFOUND;
- ldap_automount_context_t *context = (ldap_automount_context_t *)private;
+ struct ldap_automount_context *context = (struct ldap_automount_context *)private;
struct ldap_args a;
char **keyval[2];
size_t i;
diff --git a/ldap-ethers.c b/ldap-ethers.c
index 81ac650..3c2740a 100644
--- a/ldap-ethers.c
+++ b/ldap-ethers.c
@@ -23,41 +23,32 @@
#include "config.h"
-#ifdef HAVE_PORT_BEFORE_H
-#include <port_before.h>
-#endif
-
-#if defined(HAVE_THREAD_H)
-#include <thread.h>
-#elif defined(HAVE_PTHREAD_H)
-#include <pthread.h>
-#endif
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <netdb.h>
#include <errno.h>
-
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <net/if.h>
+#include <netinet/in.h>
#ifdef HAVE_LBER_H
#include <lber.h>
#endif
#ifdef HAVE_LDAP_H
#include <ldap.h>
#endif
-
-#include <sys/types.h>
-#include <sys/socket.h>
+#if defined(HAVE_THREAD_H)
+#include <thread.h>
+#elif defined(HAVE_PTHREAD_H)
+#include <pthread.h>
+#endif
#ifdef HAVE_NET_ROUTE_H
#include <net/route.h>
#endif
-#include <net/if.h>
-#include <netinet/in.h>
-
#ifdef HAVE_NETINET_IF_ETHER_H
#include <netinet/if_ether.h>
#endif
-
#ifdef HAVE_NETINET_ETHER_H
#include <netinet/ether.h>
#endif
@@ -65,12 +56,8 @@
#include "ldap-nss.h"
#include "util.h"
-#ifdef HAVE_PORT_AFTER_H
-#include <port_after.h>
-#endif
-
-#ifndef NSS_BUFLEN_ETHERS
/* for HP-UX */
+#ifndef NSS_BUFLEN_ETHERS
#define NSS_BUFLEN_ETHERS 1024
#endif /* NSS_BUFLEN_ETHERS */
@@ -80,14 +67,12 @@ struct ether_addr {
};
#endif
-
struct ether
{
char *e_name;
struct ether_addr e_addr;
};
-
static struct ent_context *ether_context = NULL;
static enum nss_status
diff --git a/ldap-grp.c b/ldap-grp.c
index 3e2787e..18ecf0f 100644
--- a/ldap-grp.c
+++ b/ldap-grp.c
@@ -23,16 +23,6 @@
#include "config.h"
-#ifdef HAVE_PORT_BEFORE_H
-#include <port_before.h>
-#endif
-
-#if defined(HAVE_THREAD_H)
-#include <thread.h>
-#elif defined(HAVE_PTHREAD_H)
-#include <pthread.h>
-#endif
-
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
@@ -40,21 +30,21 @@
#include <sys/param.h>
#include <grp.h>
#include <errno.h>
-
#ifdef HAVE_LBER_H
#include <lber.h>
#endif
#ifdef HAVE_LDAP_H
#include <ldap.h>
#endif
+#if defined(HAVE_THREAD_H)
+#include <thread.h>
+#elif defined(HAVE_PTHREAD_H)
+#include <pthread.h>
+#endif
#include "ldap-nss.h"
#include "util.h"
-#ifdef HAVE_PORT_AFTER_H
-#include <port_after.h>
-#endif
-
static struct ent_context *gr_context = NULL;
#ifdef HAVE_USERSEC_H
diff --git a/ldap-hosts.c b/ldap-hosts.c
index 507fd30..4fa535e 100644
--- a/ldap-hosts.c
+++ b/ldap-hosts.c
@@ -23,16 +23,6 @@
#include "config.h"
-#ifdef HAVE_PORT_BEFORE_H
-#include <port_before.h>
-#endif
-
-#if defined(HAVE_THREAD_H)
-#include <thread.h>
-#elif defined(HAVE_PTHREAD_H)
-#include <pthread.h>
-#endif
-
#include <sys/socket.h>
#include <stdio.h>
#include <stdlib.h>
@@ -42,27 +32,26 @@
#include <arpa/inet.h>
#include <arpa/nameser.h>
#include <resolv.h>
-
#ifdef HAVE_LBER_H
#include <lber.h>
#endif
#ifdef HAVE_LDAP_H
#include <ldap.h>
#endif
-
+#if defined(HAVE_THREAD_H)
+#include <thread.h>
+#elif defined(HAVE_PTHREAD_H)
+#include <pthread.h>
+#endif
#ifdef INET6
#include <resolv/mapv4v6addr.h>
#endif
-#ifndef MAXALIASES
-#define MAXALIASES 35
-#endif
-
#include "ldap-nss.h"
#include "util.h"
-#ifdef HAVE_PORT_AFTER_H
-#include <port_after.h>
+#ifndef MAXALIASES
+#define MAXALIASES 35
#endif
static struct ent_context *hosts_context = NULL;
diff --git a/ldap-netgrp.c b/ldap-netgrp.c
index ad9cfc2..2f1fd91 100644
--- a/ldap-netgrp.c
+++ b/ldap-netgrp.c
@@ -27,23 +27,16 @@
#include <stdio.h>
#include <stdarg.h>
#include <ctype.h>
-
-#ifdef HAVE_PORT_BEFORE_H
-#include <port_before.h>
-#endif
-
-#if defined(HAVE_THREAD_H)
-#include <thread.h>
-#elif defined(HAVE_PTHREAD_H)
-#include <pthread.h>
-#endif
-
#include <stdlib.h>
#include <sys/types.h>
#include <sys/param.h>
#include <string.h>
#include <assert.h>
-
+#if defined(HAVE_THREAD_H)
+#include <thread.h>
+#elif defined(HAVE_PTHREAD_H)
+#include <pthread.h>
+#endif
#ifdef HAVE_LBER_H
#include <lber.h>
#endif
@@ -54,15 +47,8 @@
#include "ldap-nss.h"
#include "util.h"
-#ifdef HAVE_PORT_AFTER_H
-#include <port_after.h>
-#endif
-
static struct ent_context *_ngbe = NULL;
-
-
-
/*
* I pulled the following macro (EXPAND), functions (strip_whitespace and
* _nss_netgroup_parseline) and structures (name_list and __netgrent) from
@@ -93,7 +79,6 @@ static struct ent_context *_ngbe = NULL;
/* A netgroup can consist of names of other netgroups. We have to
track which netgroups were read and which still have to be read. */
-
/* Dataset for iterating netgroups. */
struct __netgrent
{
diff --git a/ldap-network.c b/ldap-network.c
index 8ad9552..c2da326 100644
--- a/ldap-network.c
+++ b/ldap-network.c
@@ -25,16 +25,6 @@
#include "config.h"
-#ifdef HAVE_PORT_BEFORE_H
-#include <port_before.h>
-#endif
-
-#if defined(HAVE_THREAD_H)
-#include <thread.h>
-#elif defined(HAVE_PTHREAD_H)
-#include <pthread.h>
-#endif
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -44,13 +34,17 @@
#include <arpa/nameser.h>
#include <sys/socket.h>
#include <errno.h>
-
#ifdef HAVE_LBER_H
#include <lber.h>
#endif
#ifdef HAVE_LDAP_H
#include <ldap.h>
#endif
+#if defined(HAVE_THREAD_H)
+#include <thread.h>
+#elif defined(HAVE_PTHREAD_H)
+#include <pthread.h>
+#endif
#include "ldap-nss.h"
#include "util.h"
@@ -60,10 +54,6 @@
#define MAXADDRSIZE 4
#endif /* HAVE_USERSEC_H */
-#ifdef HAVE_PORT_AFTER_H
-#include <port_after.h>
-#endif
-
static struct ent_context *net_context = NULL;
static enum nss_status
diff --git a/ldap-nss.c b/ldap-nss.c
index c3a540d..f5d4539 100644
--- a/ldap-nss.c
+++ b/ldap-nss.c
@@ -25,16 +25,6 @@
#include "config.h"
-#ifdef HAVE_PORT_BEFORE_H
-#include <port_before.h>
-#endif
-
-#if defined(HAVE_THREAD_H)
-#include <thread.h>
-#elif defined(HAVE_PTHREAD_H)
-#include <pthread.h>
-#endif
-
#include <assert.h>
#include <stdlib.h>
#include <unistd.h>
@@ -72,14 +62,17 @@
#ifdef HAVE_MALLOC_H
#include <malloc.h>
#endif
-
+#if defined(HAVE_THREAD_H)
+#include <thread.h>
+#elif defined(HAVE_PTHREAD_H)
+#include <pthread.h>
+#endif
/* Try to handle systems with both SASL libraries installed */
#if defined(HAVE_SASL_SASL_H) && defined(HAVE_SASL_AUXPROP_REQUEST)
#include <sasl/sasl.h>
#elif defined(HAVE_SASL_H)
#include <sasl.h>
#endif
-
#ifdef HAVE_GSSAPI_H
#include <gssapi.h>
#elif defined(HAVE_GSSAPI_GSSAPI_KRB5_H)
@@ -88,7 +81,6 @@
#endif
#include "ldap-nss.h"
-#include "ltf.h"
#include "util.h"
#include "dnsconfig.h"
#include "pagectrl.h"
@@ -1512,15 +1504,6 @@ do_open (void)
cfg = __session.ls_config;
-#ifdef LDAP_OPT_THREAD_FN_PTRS
- if (_nss_ldap_ltf_thread_init (__session.ls_conn) != NSS_STATUS_SUCCESS)
- {
- do_close ();
- debug ("<== do_open (thread initialization failed)");
- return NSS_STATUS_UNAVAIL;
- }
-#endif /* LDAP_OPT_THREAD_FN_PTRS */
-
#if LDAP_SET_REBIND_PROC_ARGS == 3
ldap_set_rebind_proc (__session.ls_conn, do_rebind, NULL);
#elif LDAP_SET_REBIND_PROC_ARGS == 2
diff --git a/ldap-nss.h b/ldap-nss.h
index 8743aa1..2fae7da 100644
--- a/ldap-nss.h
+++ b/ldap-nss.h
@@ -532,22 +532,6 @@ void _nss_ldap_enter (void);
*/
void _nss_ldap_leave (void);
-#ifdef LDAP_OPT_THREAD_FN_PTRS
-/*
- * Netscape's libldap is threadsafe, but we use a
- * lock before it is initialized
- */
-
-struct ldap_error
-{
- int le_errno;
- char *le_matched;
- char *le_errmsg;
-};
-
-#endif /* LDAP_OPT_THREAD_FN_PTRS */
-
-
/*
* _nss_ldap_ent_context_init() is called for each getXXent() call
* This will acquire the global mutex.
diff --git a/ldap-parse.h b/ldap-parse.h
index bce9e43..d465512 100644
--- a/ldap-parse.h
+++ b/ldap-parse.h
@@ -35,6 +35,7 @@
LA_STRING(a) = name; \
LA_TYPE(a) = LA_TYPE_STRING; \
return _nss_ldap_getbyname(&a, result, buffer, buflen, errnop, filter, selector, parser);
+
#define LOOKUP_NUMBER(number, result, buffer, buflen, errnop, filter, selector, parser, req_buflen) \
struct ldap_args a; \
if (buflen < req_buflen) { \
@@ -45,6 +46,7 @@
LA_NUMBER(a) = number; \
LA_TYPE(a) = LA_TYPE_NUMBER; \
return _nss_ldap_getbyname(&a, result, buffer, buflen, errnop, filter, selector, parser)
+
#define LOOKUP_GETENT(key, result, buffer, buflen, errnop, filter, selector, parser, req_buflen) \
if (buflen < req_buflen) { \
*errnop = ERANGE; \
@@ -56,6 +58,7 @@
if (_nss_ldap_ent_context_init(&key) == NULL) \
return NSS_STATUS_UNAVAIL; \
return NSS_STATUS_SUCCESS
+
#define LOOKUP_ENDENT(key) \
_nss_ldap_enter(); \
_nss_ldap_ent_context_release(key); \
diff --git a/ldap-proto.c b/ldap-proto.c
index 9748e4f..a2876e2 100644
--- a/ldap-proto.c
+++ b/ldap-proto.c
@@ -29,36 +29,26 @@
#include "config.h"
-#ifdef HAVE_PORT_BEFORE_H
-#include <port_before.h>
-#endif
-
-#if defined(HAVE_THREAD_H)
-#include <thread.h>
-#elif defined(HAVE_PTHREAD_H)
-#include <pthread.h>
-#endif
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <netdb.h>
#include <errno.h>
-
#ifdef HAVE_LBER_H
#include <lber.h>
#endif
#ifdef HAVE_LDAP_H
#include <ldap.h>
#endif
+#if defined(HAVE_THREAD_H)
+#include <thread.h>
+#elif defined(HAVE_PTHREAD_H)
+#include <pthread.h>
+#endif
#include "ldap-nss.h"
#include "util.h"
-#ifdef HAVE_PORT_AFTER_H
-#include <port_after.h>
-#endif
-
static struct ent_context *proto_context = NULL;
static enum nss_status
diff --git a/ldap-pwd.c b/ldap-pwd.c
index 8338430..d94db20 100644
--- a/ldap-pwd.c
+++ b/ldap-pwd.c
@@ -21,37 +21,27 @@
#include "config.h"
-#ifdef HAVE_PORT_BEFORE_H
-#include <port_before.h>
-#endif
-
-#if defined(HAVE_THREAD_H)
-#include <thread.h>
-#elif defined(HAVE_PTHREAD_H)
-#include <pthread.h>
-#endif
-
#include <stdlib.h>
#include <sys/types.h>
#include <sys/param.h>
#include <string.h>
#include <pwd.h>
#include <errno.h>
-
#ifdef HAVE_LBER_H
#include <lber.h>
#endif
#ifdef HAVE_LDAP_H
#include <ldap.h>
#endif
+#if defined(HAVE_THREAD_H)
+#include <thread.h>
+#elif defined(HAVE_PTHREAD_H)
+#include <pthread.h>
+#endif
#include "ldap-nss.h"
#include "util.h"
-#ifdef HAVE_PORT_AFTER_H
-#include <port_after.h>
-#endif
-
static struct ent_context *pw_context = NULL;
static inline enum nss_status
diff --git a/ldap-rpc.c b/ldap-rpc.c
index 4d84362..614e707 100644
--- a/ldap-rpc.c
+++ b/ldap-rpc.c
@@ -29,41 +29,30 @@
#include "config.h"
-#ifdef HAVE_PORT_BEFORE_H
-#include <port_before.h>
-#endif
-
-#if defined(HAVE_THREAD_H)
-#include <thread.h>
-#elif defined(HAVE_PTHREAD_H)
-#include <pthread.h>
-#endif
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
-
#ifdef HAVE_RPC_RPCENT_H
#include <rpc/rpcent.h>
#else
#include <netdb.h>
#endif
-
#ifdef HAVE_LBER_H
#include <lber.h>
#endif
#ifdef HAVE_LDAP_H
#include <ldap.h>
#endif
+#if defined(HAVE_THREAD_H)
+#include <thread.h>
+#elif defined(HAVE_PTHREAD_H)
+#include <pthread.h>
+#endif
#include "ldap-nss.h"
#include "util.h"
-#ifdef HAVE_PORT_AFTER_H
-#include <port_after.h>
-#endif
-
static struct ent_context *rpc_context = NULL;
static enum nss_status
diff --git a/ldap-schema.c b/ldap-schema.c
index 4fac0c0..a0354eb 100644
--- a/ldap-schema.c
+++ b/ldap-schema.c
@@ -23,39 +23,28 @@
#include "config.h"
-#ifdef HAVE_PORT_BEFORE_H
-#include <port_before.h>
-#endif
-
-#if defined(HAVE_THREAD_H)
-#include <thread.h>
-#elif defined(HAVE_PTHREAD_H)
-#include <pthread.h>
-#endif
-
#include <stdlib.h>
#include <unistd.h>
#include <netdb.h>
#include <stdio.h>
#include <string.h>
#include <syslog.h>
-
#ifdef HAVE_LBER_H
#include <lber.h>
#endif
#ifdef HAVE_LDAP_H
#include <ldap.h>
#endif
+#if defined(HAVE_THREAD_H)
+#include <thread.h>
+#elif defined(HAVE_PTHREAD_H)
+#include <pthread.h>
+#endif
#include "ldap-nss.h"
#include "ldap-schema.h"
#include "util.h"
-#ifdef HAVE_PORT_AFTER_H
-#include <port_after.h>
-#endif
-
-
/**
* declare filters formerly declared in ldap-*.h
*/
diff --git a/ldap-schema.h b/ldap-schema.h
index b0e08e1..b7cfd14 100644
--- a/ldap-schema.h
+++ b/ldap-schema.h
@@ -299,7 +299,6 @@ extern char _nss_ldap_filt_getautomntbyname[];
/*
* Map names
*/
-
#define MP_passwd "passwd"
#define MP_shadow "shadow"
#define MP_group "group"
diff --git a/ldap-service.c b/ldap-service.c
index 9b68923..6a06b71 100644
--- a/ldap-service.c
+++ b/ldap-service.c
@@ -29,41 +29,30 @@
#include "config.h"
-#ifdef HAVE_PORT_BEFORE_H
-#include <port_before.h>
-#endif
-
-#if defined(HAVE_THREAD_H)
-#include <thread.h>
-#elif defined(HAVE_PTHREAD_H)
-#include <pthread.h>
-#endif
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <netdb.h>
#include <netinet/in.h>
#include <errno.h>
-
#ifdef HAVE_SYS_BYTEORDER_H
#include <sys/byteorder.h>
#endif
-
#ifdef HAVE_LBER_H
#include <lber.h>
#endif
#ifdef HAVE_LDAP_H
#include <ldap.h>
#endif
+#if defined(HAVE_THREAD_H)
+#include <thread.h>
+#elif defined(HAVE_PTHREAD_H)
+#include <pthread.h>
+#endif
#include "ldap-nss.h"
#include "util.h"
-#ifdef HAVE_PORT_AFTER_H
-#include <port_after.h>
-#endif
-
static struct ent_context *serv_context = NULL;
static enum nss_status
diff --git a/ldap-spwd.c b/ldap-spwd.c
index a9cf175..483eef2 100644
--- a/ldap-spwd.c
+++ b/ldap-spwd.c
@@ -25,37 +25,26 @@
#ifdef HAVE_SHADOW_H
-#ifdef HAVE_PORT_BEFORE_H
-#include <port_before.h>
-#endif
-
-#if defined(HAVE_THREAD_H)
-#include <thread.h>
-#elif defined(HAVE_PTHREAD_H)
-#include <pthread.h>
-#endif
-
#include <stdlib.h>
#include <string.h>
+#include <shadow.h>
+#include <errno.h>
#ifdef HAVE_PROT_H
#define _PROT_INCLUDED
#endif
-#include <shadow.h>
-#include <errno.h>
-
#ifdef HAVE_LBER_H
#include <lber.h>
#endif
#ifdef HAVE_LDAP_H
#include <ldap.h>
#endif
-
-#include "ldap-nss.h"
-
-#ifdef HAVE_PORT_AFTER_H
-#include <port_after.h>
+#if defined(HAVE_THREAD_H)
+#include <thread.h>
+#elif defined(HAVE_PTHREAD_H)
+#include <pthread.h>
#endif
+#include "ldap-nss.h"
static struct ent_context *sp_context = NULL;
diff --git a/ltf.c b/ltf.c
deleted file mode 100644
index 19a8e2e..0000000
--- a/ltf.c
+++ /dev/null
@@ -1,345 +0,0 @@
-/*
- Copyright (C) 1997-2005 Luke Howard
- This file is part of the nss_ldap library.
- Contributed by Luke Howard, <lukeh@padl.com>, 1997.
-
- The nss_ldap library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The nss_ldap library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the nss_ldap library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-
- $Id$
-*/
-
-#include "config.h"
-
-#ifdef HAVE_PORT_BEFORE_H
-#include <port_before.h>
-#endif
-
-#if defined(HAVE_THREAD_H)
-#include <thread.h>
-#elif defined(HAVE_PTHREAD_H)
-#include <pthread.h>
-#endif
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include <errno.h>
-
-#ifdef HAVE_LBER_H
-#include <lber.h>
-#endif
-#ifdef HAVE_LDAP_H
-#include <ldap.h>
-#endif
-
-#include "ldap-nss.h"
-
-#if defined(LDAP_OPT_THREAD_FN_PTRS) && (defined(HAVE_THREAD_H) || defined(HAVE_PTHREAD_H))
-
-static void *ltf_mutex_alloc (void);
-static void ltf_mutex_free (void *m);
-static enum nss_status ltf_tsd_setup (void);
-static void ltf_set_ld_error (int err, char *matched, char *errmsg,
- void *dummy);
-static int ltf_get_ld_error (char **matched, char **errmsg, void *dummy);
-static void ltf_set_errno (int err);
-static int ltf_get_errno (void);
-
-#ifndef HAVE_THREAD_H /* thus, pthreads */
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
-
- * The contents of this file are subject to the Netscape Public License
- * Version 1.0 (the "NPL"); you may not use this file except in
- * compliance with the NPL. You may obtain a copy of the NPL at
- * http://www.mozilla.org/NPL/
- *
- * Software distributed under the NPL is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
- * for the specific language governing rights and limitations under the
- * NPL.
- *
- * The Initial Developer of this code under the NPL is Netscape
- * Communications Corporation. Portions created by Netscape are
- * Copyright (C) 1998 Netscape Communications Corporation. All Rights
- * Reserved.
- */
-
-static int ltf_mutex_lock (void *);
-static int ltf_mutex_unlock (void *);
-
-static pthread_key_t key;
-
-enum nss_status _nss_ldap_ltf_thread_init (LDAP * ld)
-{
- struct ldap_thread_fns tfns;
-
- /* set mutex pointers */
- memset (&tfns, '\0', sizeof (struct ldap_thread_fns));
- tfns.ltf_mutex_alloc = ltf_mutex_alloc;
- tfns.ltf_mutex_free = ltf_mutex_free;
- tfns.ltf_mutex_lock = ltf_mutex_lock;
- tfns.ltf_mutex_unlock = ltf_mutex_unlock;
- tfns.ltf_get_errno = ltf_get_errno;
- tfns.ltf_set_errno = ltf_set_errno;
- tfns.ltf_get_lderrno = ltf_get_ld_error;
- tfns.ltf_set_lderrno = ltf_set_ld_error;
- tfns.ltf_lderrno_arg = NULL;
- /* set ld_errno pointers */
- if (ldap_set_option (ld, LDAP_OPT_THREAD_FN_PTRS, (void *) &tfns) != 0)
- {
- return NSS_STATUS_UNAVAIL;
- }
-
- return ltf_tsd_setup ();
-}
-
-static void *
-ltf_mutex_alloc (void)
-{
- pthread_mutex_t *mutexp;
-
- if ((mutexp = malloc (sizeof (pthread_mutex_t))) != NULL)
- {
- pthread_mutex_init (mutexp, NULL);
- }
-
- return (mutexp);
-}
-
-static void
-ltf_mutex_free (void *mutexp)
-{
- pthread_mutex_destroy ((pthread_mutex_t *) mutexp);
-}
-
-static int
-ltf_mutex_lock (void *mutexp)
-{
-#if defined(HAVE_LIBC_LOCK_H) || defined(HAVE_BITS_LIBC_LOCK_H)
- return __libc_lock_lock (*(pthread_mutex_t *) mutexp);
-#else
- return pthread_mutex_lock ((pthread_mutex_t *) mutexp);
-#endif /* HAVE_LIBC_LOCK_H || HAVE_BITS_LIBC_LOCK_H */
-}
-
-static int
-ltf_mutex_unlock (void *mutexp)
-{
-#if defined(HAVE_LIBC_LOCK_H) || defined(HAVE_BITS_LIBC_LOCK_H)
- return __libc_lock_unlock (*(pthread_mutex_t *) mutexp);
-#else
- return pthread_mutex_unlock ((pthread_mutex_t *) mutexp);
-#endif /* HAVE_LIBC_LOCK_H || HAVE_BITS_LIBC_LOCK_H */
-}
-
-static enum nss_status
-ltf_tsd_setup (void)
-{
- void *tsd;
-
-#if defined(HAVE_LIBC_LOCK_H) || defined(HAVE_BITS_LIBC_LOCK_H)
- if (__libc_key_create (&key, free) != 0)
- {
- return NSS_STATUS_UNAVAIL;
- }
- tsd = (void *) calloc (1, sizeof (struct ldap_error));
- __libc_setspecific (key, tsd);
-#else
- if (pthread_key_create (&key, free) != 0)
- {
- return NSS_STATUS_UNAVAIL;
- }
- tsd = pthread_getspecific (key);
- if (tsd != NULL)
- {
- pthread_exit (NULL);
- }
- tsd = (void *) calloc (1, sizeof (struct ldap_error));
- pthread_setspecific (key, tsd);
-#endif /* HAVE_LIBC_LOCK_H || HAVE_BITS_LIBC_LOCK_H */
-
- return NSS_STATUS_SUCCESS;
-}
-
-static void
-ltf_set_ld_error (int err, char *matched, char *errmsg, void *dummy)
-{
- struct ldap_error *le;
-
-#if defined(HAVE_LIBC_LOCK_H) || defined(HAVE_BITS_LIBC_LOCK_H)
- le = __libc_getspecific (key);
-#else
- le = pthread_getspecific (key);
-#endif /* HAVE_LIBC_LOCK_H || HAVE_BITS_LIBC_LOCK_H */
-
- le->le_errno = err;
-
- if (le->le_matched != NULL)
- ldap_memfree (le->le_matched);
- le->le_matched = matched;
-
- if (le->le_errmsg != NULL)
- ldap_memfree (le->le_errmsg);
- le->le_errmsg = errmsg;
-}
-
-static int
-ltf_get_ld_error (char **matched, char **errmsg, void *dummy)
-{
- struct ldap_error *le;
-
-#if defined(HAVE_LIBC_LOCK_H) || defined(HAVE_BITS_LIBC_LOCK_H)
- le = __libc_getspecific (key);
-#else
- le = pthread_getspecific (key);
-#endif /* HAVE_LIBC_LOCK_H || HAVE_BITS_LIBC_LOCK_H */
- if (le == NULL)
- return LDAP_LOCAL_ERROR;
-
- if (matched != NULL)
- *matched = le->le_matched;
-
- if (errmsg != NULL)
- *errmsg = le->le_errmsg;
-
- return (le->le_errno);
-}
-
-static void
-ltf_set_errno (int err)
-{
- errno = err;
-}
-
-static int
-ltf_get_errno (void)
-{
- return (errno);
-}
-#else
-static thread_key_t ltf_key = 0;
-
-static void *
-ltf_mutex_alloc (void)
-{
- mutex_t *m;
-
- m = (mutex_t *) malloc (sizeof (*m));
- if (m == NULL)
- return NULL;
-
- if (mutex_init (m, USYNC_THREAD, NULL) < 0)
- return NULL;
-
- return m;
-}
-
-static void
-ltf_mutex_free (void *m)
-{
- mutex_destroy ((mutex_t *) m);
-/* free(m); */
-}
-
-void
-ltf_destr (void *tsd)
-{
- free (tsd);
-}
-
-static enum nss_status
-ltf_tsd_setup (void)
-{
- void *tsd;
-
- (void) thr_keycreate (&ltf_key, ltf_destr);
- tsd = (void *) calloc (1, sizeof (struct ldap_error));
- thr_setspecific (ltf_key, tsd);
- return NSS_STATUS_SUCCESS;
-}
-
-static void
-ltf_set_ld_error (int err, char *matched, char *errmsg, void *dummy)
-{
- struct ldap_error *le;
-
- (void) thr_getspecific (ltf_key, (void **) &le);
- if (le == NULL)
- return;
-
- le->le_errno = err;
-
- if (le->le_matched != NULL)
- ldap_memfree (le->le_matched);
- le->le_matched = matched;
-
- if (le->le_errmsg != NULL)
- ldap_memfree (le->le_errmsg);
- le->le_errmsg = errmsg;
-}
-
-static int
-ltf_get_ld_error (char **matched, char **errmsg, void *dummy)
-{
- struct ldap_error *le = NULL;
-
- (void) thr_getspecific (ltf_key, (void **) &le);
- if (le == NULL)
- return LDAP_LOCAL_ERROR;
-
- if (matched != NULL)
- *matched = le->le_matched;
-
- if (errmsg != NULL)
- *errmsg = le->le_errmsg;
-
- return le->le_errno;
-}
-
-static void
-ltf_set_errno (int err)
-{
- errno = err;
-}
-
-static int
-ltf_get_errno (void)
-{
- return errno;
-}
-
-enum nss_status _nss_ldap_ltf_thread_init (LDAP * ld)
-{
- struct ldap_thread_fns tfns;
-
- memset (&tfns, '\0', sizeof (tfns));
- tfns.ltf_mutex_alloc = ltf_mutex_alloc;
- tfns.ltf_mutex_free = ltf_mutex_free;
- tfns.ltf_mutex_lock = (int (*)(void *)) mutex_lock;
- tfns.ltf_mutex_unlock = (int (*)(void *)) mutex_unlock;
- tfns.ltf_get_errno = ltf_get_errno;
- tfns.ltf_set_errno = ltf_set_errno;
- tfns.ltf_get_lderrno = ltf_get_ld_error;
- tfns.ltf_set_lderrno = ltf_set_ld_error;
- tfns.ltf_lderrno_arg = NULL;
-
- if (ldap_set_option (ld, LDAP_OPT_THREAD_FN_PTRS, (void *) &tfns) != 0)
- return NSS_STATUS_UNAVAIL;
-
- return ltf_tsd_setup ();
-}
-#endif /* !HAVE_THREAD_H */
-#endif /* LDAP_OPT_THREAD_FN_PTRS */
diff --git a/ltf.h b/ltf.h
deleted file mode 100644
index 6f3c5fc..0000000
--- a/ltf.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- Copyright (C) 1997-2005 Luke Howard
- Portions Copyright (C) 1997-2002 Luke Howard
- This file is part of the nss_ldap library.
- Contributed by Luke Howard, <lukeh@padl.com>, 1997.
-
- The nss_ldap library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The nss_ldap library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the nss_ldap library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-*/
-
-#ifndef _LDAP_NSS_LDAP_LTF_H
-#define _LDAP_NSS_LDAP_LTF_H
-
-#ifdef LDAP_OPT_THREAD_FN_PTRS
-enum nss_status _nss_ldap_ltf_thread_init (LDAP * ld);
-#endif
-
-#endif /* _LDAP_NSS_LDAP_LTF_H */
diff --git a/pagectrl.c b/pagectrl.c
index b09c0bb..7020b88 100644
--- a/pagectrl.c
+++ b/pagectrl.c
@@ -1,4 +1,6 @@
/*
+ pagectrl.c - provide a replacement ldap_create_page_control() function.
+
Copyright (C) 2002 Max Caines, All Rights Reserved.
This file is part of the nss_ldap library.
Contributed by Max Caines, <Max.Caines@wlv.ac.uk>, April 2002.
@@ -23,13 +25,15 @@
$Id$
*/
+/* TODO: move this to compat/ and add it only when needed */
+/* Note: this is only used in ldap-nss.c */
+
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
-
#include <lber.h>
#include <ldap.h>
@@ -39,6 +43,10 @@
#define LDAP_CONTROL_PAGE_OID "1.2.840.113556.1.4.319"
#endif
+#ifndef HAVE_LDAP_CREATE_CONTROL
+#error LDAP client library does not support ldap_create_control()
+#endif
+
#ifndef HAVE_LDAP_CREATE_PAGE_CONTROL
/*---
ldap_create_page_control
@@ -79,9 +87,6 @@
---*/
-#ifndef HAVE_LDAP_CREATE_CONTROL
-#error LDAP client library does not support ldap_create_control()
-#else
int
ldap_create_page_control (LDAP * ld,
unsigned long pagesize,
@@ -127,7 +132,6 @@ exit:
ber_free (ber, 1);
return (LDAP_ENCODING_ERROR);
}
-#endif /* HAVE_LDAP_CREATE_CONTROL */
#endif /* HAVE_LDAP_CREATE_PAGE_CONTROL */
#ifndef HAVE_LDAP_PARSE_PAGE_CONTROL
@@ -154,10 +158,6 @@ exit:
when it is no longer needed.
---*/
-
-#ifndef HAVE_LDAP_CREATE_CONTROL
-#error LDAP client library does not support ldap_create_control()
-#else
int
ldap_parse_page_control (LDAP * ld,
LDAPControl ** ctrls,
@@ -223,5 +223,4 @@ foundPageControl:
return (LDAP_SUCCESS);
}
-#endif /* HAVE_LDAP_CREATE_CONTROL */
#endif /* HAVE_LDAP_PARSE_PAGE_CONTROL */
diff --git a/pagectrl.h b/pagectrl.h
index 3dac8fd..b282dfa 100644
--- a/pagectrl.h
+++ b/pagectrl.h
@@ -1,4 +1,6 @@
/*
+ pagectrl.h - provide a replacement ldap_create_page_control() function.
+
Copyright (C) 1997-2005 Luke Howard
This file is part of the nss_ldap library.
Contributed by Luke Howard, <lukeh@padl.com>, 1997.
diff --git a/resolve.c b/resolve.c
index ae3942b..470d33d 100644
--- a/resolve.c
+++ b/resolve.c
@@ -47,7 +47,6 @@
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
-
#include <resolv.h>
#include "resolve.h"
@@ -80,18 +79,6 @@ string_to_type (const char *name)
return -1;
}
-#if 0
-static char *
-type_to_string (int type)
-{
- struct stot *p = stot;
- for (p = stot; p->name; p++)
- if (type == p->type)
- return p->name;
- return NULL;
-}
-#endif
-
void
dns_free_data (struct dns_reply *r)
{
@@ -269,8 +256,6 @@ parse_reply (unsigned char *data, int len)
return r;
}
-
-
struct dns_reply *
dns_lookup (const char *domain, const char *type_name)
{
@@ -312,7 +297,7 @@ dns_free_data (struct dns_reply *r)
{
}
-#endif
+#endif /* not ( defined(HAVE_RES_SEARCH) && defined(HAVE_DN_EXPAND) ) */
#ifdef TEST
@@ -364,4 +349,4 @@ main (int argc, char **argv)
return 0;
}
-#endif
+#endif /* TEST */
diff --git a/resolve.h b/resolve.h
index a10cdb7..62b2574 100644
--- a/resolve.h
+++ b/resolve.h
@@ -97,7 +97,6 @@ struct resource_record
struct resource_record *next;
};
-
#ifndef HAVE_ARPA_NAMESER_H /* XXX */
typedef int HEADER; /* will never be used */
#endif
diff --git a/util.c b/util.c
index 202a749..786d0a8 100644
--- a/util.c
+++ b/util.c
@@ -23,34 +23,30 @@
#include "config.h"
-#if defined(HAVE_THREAD_H)
-#include <thread.h>
-#elif defined(HAVE_PTHREAD_H)
-#include <pthread.h>
-#endif
-
#include <stdio.h>
#include <string.h>
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
#include <stdlib.h>
-
#include <sys/param.h>
#include <sys/stat.h>
-
#include <netdb.h>
#include <syslog.h>
#include <string.h>
#include <fcntl.h>
#include <assert.h>
-
#ifdef HAVE_LBER_H
#include <lber.h>
#endif
#ifdef HAVE_LDAP_H
#include <ldap.h>
#endif
+#if defined(HAVE_THREAD_H)
+#include <thread.h>
+#elif defined(HAVE_PTHREAD_H)
+#include <pthread.h>
+#endif
#include "ldap-nss.h"
#include "util.h"
@@ -60,7 +56,6 @@ static enum nss_status do_getrdnvalue (const char *dn,
char **rval, char **buffer,
size_t * buflen);
-
static enum nss_status do_parse_map_statement (struct ldap_config * cfg,
const char *statement,
enum ldap_map_type type);
@@ -72,7 +67,6 @@ static enum nss_status do_searchdescriptorconfig (const char *key,
** result, char **buffer,
size_t * buflen);
-#include <fcntl.h>
static void *__cache = NULL;
NSS_LDAP_DEFINE_LOCK (__cache_lock);
@@ -216,9 +210,9 @@ _nss_ldap_getrdnvalue (LDAPMessage * entry,
status = do_getrdnvalue (dn, rdntype, rval, buffer, buflen);
#ifdef HAVE_LDAP_MEMFREE
ldap_memfree (dn);
-#else
+#else /* HAVE_LDAP_MEMFREE */
free (dn);
-#endif /* HAVE_LDAP_MEMFREE */
+#endif /* not HAVE_LDAP_MEMFREE */
/*
* If examining the DN failed, then pick the nominal first
@@ -308,7 +302,7 @@ do_getrdnvalue (const char *dn,
}
ldap_value_free (exploded_rdn);
}
-#else
+#else /* HAVE_LDAP_EXPLODE_RDN */
/*
* we don't have Netscape's ldap_explode_rdn() API,
* so we fudge it with strtok(). Note that this will
@@ -317,19 +311,19 @@ do_getrdnvalue (const char *dn,
char *p, *r = *exploded_dn;
#ifdef HAVE_STRTOK_R
char *st = NULL;
-#endif
+#endif /* HAVE_STRTOK_R */
#ifndef HAVE_STRTOK_R
for (p = strtok (r, "+");
-#else
+#else /* HAVE_STRTOK_R */
for (p = strtok_r (r, "+", &st);
-#endif
+#endif /* not HAVE_STRTOK_R */
p != NULL;
#ifndef HAVE_STRTOK_R
p = strtok (NULL, "+"))
-#else
+#else /* HAVE_STRTOK_R */
p = strtok_r (NULL, "+", &st))
-#endif
+#endif /* not HAVE_STRTOK_R */
{
if (strncasecmp (p, rdnava, rdnavalen) == 0)
{
@@ -347,7 +341,7 @@ do_getrdnvalue (const char *dn,
if (r != NULL)
r = NULL;
}
-#endif /* HAVE_LDAP_EXPLODE_RDN */
+#endif /* not HAVE_LDAP_EXPLODE_RDN */
}
if (exploded_dn != NULL)
@@ -405,7 +399,7 @@ do_parse_list (char *values, char ***valptr,
char *s, **p;
#ifdef HAVE_STRTOK_R
char *tok_r;
-#endif
+#endif /* HAVE_STRTOK_R */
int valcount;
int buflen = *pbuflen;
@@ -432,9 +426,9 @@ do_parse_list (char *values, char ***valptr,
#ifdef HAVE_STRTOK_R
for (s = strtok_r(values, ",", &tok_r); s != NULL;
s = strtok_r(NULL, ",", &tok_r))
-#else
+#else /* HAVE_STRTOK_R */
for (s = strtok(values, ","); s != NULL; s = strtok(NULL, ","))
-#endif
+#endif /* not HAVE_STRTOK_R */
{
int vallen;
char *elt = NULL;
@@ -604,9 +598,9 @@ enum nss_status _nss_ldap_init_config (struct ldap_config * result)
result->ldc_rootusesasl = 0;
#ifdef LDAP_VERSION3
result->ldc_version = LDAP_VERSION3;
-#else
+#else /* LDAP_VERSION3 */
result->ldc_version = LDAP_VERSION2;
-#endif /* LDAP_VERSION3 */
+#endif /* not LDAP_VERSION3 */
result->ldc_timelimit = LDAP_NO_LIMIT;
result->ldc_bind_timelimit = 30;
result->ldc_ssl_on = SSL_OFF;
@@ -633,10 +627,10 @@ enum nss_status _nss_ldap_init_config (struct ldap_config * result)
result->ldc_flags = 0;
#ifdef RFC2307BIS
result->ldc_flags |= NSS_LDAP_FLAGS_RFC2307BIS;
-#endif
+#endif /* RFC2307BIS */
#ifdef PAGE_RESULTS
result->ldc_flags |= NSS_LDAP_FLAGS_PAGED_RESULTS;
-#endif
+#endif /* PAGE_RESULTS */
result->ldc_reconnect_tries = LDAP_NSS_TRIES;
result->ldc_reconnect_sleeptime = LDAP_NSS_SLEEPTIME;
result->ldc_reconnect_maxsleeptime = LDAP_NSS_MAXSLEEPTIME;