diff options
author | Arthur de Jong <arthur@arthurdejong.org> | 2006-10-12 11:01:56 +0000 |
---|---|---|
committer | Arthur de Jong <arthur@arthurdejong.org> | 2006-10-12 11:01:56 +0000 |
commit | dba09bb1389491f82beb862323a5ccab428a7f2d (patch) | |
tree | e617b84715ab650b6cd162876f7ff6d0b897a05a /ldap-proto.c | |
parent | 54845e6fb6d0fa0f7f77b4a7d8520897e0e98496 (diff) |
first round of cleanups, all non-glibc NSS stuff has been removed, because we are going to do some major restructuring it will not likely remain valid anyway and we can always re-add it later
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/libnss_ldapd@10 ef36b2f9-881f-0410-afb5-c4e39611909c
Diffstat (limited to 'ldap-proto.c')
-rw-r--r-- | ldap-proto.c | 106 |
1 files changed, 10 insertions, 96 deletions
diff --git a/ldap-proto.c b/ldap-proto.c index 824a6df..95328c0 100644 --- a/ldap-proto.c +++ b/ldap-proto.c @@ -1,4 +1,5 @@ -/* Copyright (C) 1997-2005 Luke Howard. +/* + Copyright (C) 1997-2005 Luke Howard This file is part of the nss_ldap library. Contributed by Luke Howard, <lukeh@padl.com>, 1997. @@ -18,7 +19,7 @@ Boston, MA 02111-1307, USA. $Id$ - */ +*/ /* Determine the canonical name of the RPC with _nss_ldap_getrdnvalue(), @@ -26,10 +27,6 @@ as aliases. */ - -static char rcsId[] = - "$Id$"; - #include "config.h" #ifdef HAVE_PORT_BEFORE_H @@ -62,11 +59,9 @@ static char rcsId[] = #include <port_after.h> #endif -#ifdef HAVE_NSS_H static ent_context_t *proto_context = NULL; -#endif -static NSS_STATUS +static enum nss_status _nss_ldap_parse_proto (LDAPMessage * e, ldap_state_t * pvt, void *result, char *buffer, size_t buflen) @@ -74,7 +69,7 @@ _nss_ldap_parse_proto (LDAPMessage * e, struct protoent *proto = (struct protoent *) result; char *number; - NSS_STATUS stat; + enum nss_status stat; stat = _nss_ldap_getrdnvalue (e, ATM (LM_PROTOCOLS, cn), &proto->p_name, @@ -99,15 +94,7 @@ _nss_ldap_parse_proto (LDAPMessage * e, return NSS_SUCCESS; } -#ifdef HAVE_NSSWITCH_H -static NSS_STATUS -_nss_ldap_getprotobyname_r (nss_backend_t * be, void *args) -{ - LOOKUP_NAME (args, _nss_ldap_filt_getprotobyname, LM_PROTOCOLS, - _nss_ldap_parse_proto, LDAP_NSS_BUFLEN_DEFAULT); -} -#elif defined(HAVE_NSS_H) -NSS_STATUS +enum nss_status _nss_ldap_getprotobyname_r (const char *name, struct protoent *result, char *buffer, size_t buflen, int *errnop) { @@ -115,17 +102,8 @@ _nss_ldap_getprotobyname_r (const char *name, struct protoent *result, _nss_ldap_filt_getprotobyname, LM_PROTOCOLS, _nss_ldap_parse_proto, LDAP_NSS_BUFLEN_DEFAULT); } -#endif -#ifdef HAVE_NSSWITCH_H -static NSS_STATUS -_nss_ldap_getprotobynumber_r (nss_backend_t * be, void *args) -{ - LOOKUP_NUMBER (args, key.number, _nss_ldap_filt_getprotobynumber, - LM_PROTOCOLS, _nss_ldap_parse_proto, LDAP_NSS_BUFLEN_DEFAULT); -} -#elif defined(HAVE_NSS_H) -NSS_STATUS +enum nss_status _nss_ldap_getprotobynumber_r (int number, struct protoent *result, char *buffer, size_t buflen, int *errnop) { @@ -133,41 +111,18 @@ _nss_ldap_getprotobynumber_r (int number, struct protoent *result, _nss_ldap_filt_getprotobynumber, LM_PROTOCOLS, _nss_ldap_parse_proto, LDAP_NSS_BUFLEN_DEFAULT); } -#endif -#ifdef HAVE_NSSWITCH_H -static NSS_STATUS -_nss_ldap_setprotoent_r (nss_backend_t * proto_context, void *fakeargs) -#elif defined(HAVE_NSS_H) - NSS_STATUS _nss_ldap_setprotoent (void) -#endif -#if defined(HAVE_NSS_H) || defined(HAVE_NSSWITCH_H) + enum nss_status _nss_ldap_setprotoent (void) { LOOKUP_SETENT (proto_context); } -#endif -#ifdef HAVE_NSSWITCH_H -static NSS_STATUS -_nss_ldap_endprotoent_r (nss_backend_t * proto_context, void *fakeargs) -#elif defined(HAVE_NSS_H) - NSS_STATUS _nss_ldap_endprotoent (void) -#endif -#if defined(HAVE_NSS_H) || defined(HAVE_NSSWITCH_H) + enum nss_status _nss_ldap_endprotoent (void) { LOOKUP_ENDENT (proto_context); } -#endif -#ifdef HAVE_NSSWITCH_H -static NSS_STATUS -_nss_ldap_getprotoent_r (nss_backend_t * proto_context, void *args) -{ - LOOKUP_GETENT (args, proto_context, _nss_ldap_filt_getprotoent, - LM_PROTOCOLS, _nss_ldap_parse_proto, LDAP_NSS_BUFLEN_DEFAULT); -} -#elif defined(HAVE_NSS_H) -NSS_STATUS +enum nss_status _nss_ldap_getprotoent_r (struct protoent *result, char *buffer, size_t buflen, int *errnop) { @@ -175,44 +130,3 @@ _nss_ldap_getprotoent_r (struct protoent *result, char *buffer, size_t buflen, _nss_ldap_filt_getprotoent, LM_PROTOCOLS, _nss_ldap_parse_proto, LDAP_NSS_BUFLEN_DEFAULT); } -#endif - -#ifdef HAVE_NSSWITCH_H -static NSS_STATUS -_nss_ldap_protocols_destr (nss_backend_t * proto_context, void *args) -{ - return _nss_ldap_default_destr (proto_context, args); -} - -static nss_backend_op_t proto_ops[] = { - _nss_ldap_protocols_destr, - _nss_ldap_endprotoent_r, - _nss_ldap_setprotoent_r, - _nss_ldap_getprotoent_r, - _nss_ldap_getprotobyname_r, - _nss_ldap_getprotobynumber_r -}; - -nss_backend_t * -_nss_ldap_protocols_constr (const char *db_name, - const char *src_name, const char *cfg_args) -{ - nss_ldap_backend_t *be; - - if (!(be = (nss_ldap_backend_t *) malloc (sizeof (*be)))) - return NULL; - - be->ops = proto_ops; - be->n_ops = sizeof (proto_ops) / sizeof (nss_backend_op_t); - - if (_nss_ldap_default_constr (be) != NSS_SUCCESS) - return NULL; - - return (nss_backend_t *) be; -} - -#endif /* !HAVE_NSS_H */ - -#ifdef HAVE_IRS_H -#include "irs-proto.c" -#endif |