Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
path: root/nslcd/protocol.c
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2007-07-28 18:20:06 +0200
committerArthur de Jong <arthur@arthurdejong.org>2007-07-28 18:20:06 +0200
commit9e68b31911052fd5270c036366d2875f02ec3280 (patch)
treeec6d37e7cb09ab75dc94747d6da7ae94879dc421 /nslcd/protocol.c
parentc8fa7714097214ca7efd94ed69d27ffaacb59a07 (diff)
define the list of attributes to look up in searches in the service modules instead of in ldap-schema
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-ldapd@337 ef36b2f9-881f-0410-afb5-c4e39611909c
Diffstat (limited to 'nslcd/protocol.c')
-rw-r--r--nslcd/protocol.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/nslcd/protocol.c b/nslcd/protocol.c
index 98873c4..035697d 100644
--- a/nslcd/protocol.c
+++ b/nslcd/protocol.c
@@ -55,6 +55,16 @@
#include "attmap.h"
#include "ldap-schema.h"
+/* the attributes to request with searches */
+static const char *attlst[3];
+
+static void attlst_init(void)
+{
+ attlst[0] = attmap_protocol_cn;
+ attlst[1] = attmap_protocol_ipProtocolNumber;
+ attlst[2] = NULL;
+}
+
static enum nss_status _nss_ldap_parse_proto (LDAPMessage *e,
struct ldap_state UNUSED(*pvt),
void *result, char *buffer, size_t buflen)
@@ -116,7 +126,8 @@ int nslcd_protocol_byname(TFILE *fp)
LA_INIT(a);
LA_STRING(a)=name;
LA_TYPE(a)=LA_TYPE_STRING;
- retv=nss2nslcd(_nss_ldap_getbyname(&a,&result,buffer,1024,&errnop,_nss_ldap_filt_getprotobyname,LM_PROTOCOLS,_nss_ldap_parse_proto));
+ attlst_init();
+ retv=nss2nslcd(_nss_ldap_getbyname(&a,&result,buffer,1024,&errnop,_nss_ldap_filt_getprotobyname,LM_PROTOCOLS,attlst,_nss_ldap_parse_proto));
/* write the response */
WRITE_INT32(fp,retv);
if (retv==NSLCD_RESULT_SUCCESS)
@@ -149,7 +160,8 @@ int nslcd_protocol_bynumber(TFILE *fp)
LA_INIT(a);
LA_NUMBER(a)=protocol;
LA_TYPE(a)=LA_TYPE_NUMBER;
- retv=nss2nslcd(_nss_ldap_getbyname(&a,&result,buffer,1024,&errnop,_nss_ldap_filt_getprotobynumber,LM_PROTOCOLS,_nss_ldap_parse_proto));
+ attlst_init();
+ retv=nss2nslcd(_nss_ldap_getbyname(&a,&result,buffer,1024,&errnop,_nss_ldap_filt_getprotobynumber,LM_PROTOCOLS,attlst,_nss_ldap_parse_proto));
/* write the response */
WRITE_INT32(fp,retv);
if (retv==NSLCD_RESULT_SUCCESS)
@@ -179,7 +191,8 @@ int nslcd_protocol_all(TFILE *fp)
if (_nss_ldap_ent_context_init(&protocol_context)==NULL)
return -1;
/* loop over all results */
- while ((retv=nss2nslcd(_nss_ldap_getent(&protocol_context,&result,buffer,1024,&errnop,_nss_ldap_filt_getprotoent,LM_PROTOCOLS,_nss_ldap_parse_proto)))==NSLCD_RESULT_SUCCESS)
+ attlst_init();
+ while ((retv=nss2nslcd(_nss_ldap_getent(&protocol_context,&result,buffer,1024,&errnop,_nss_ldap_filt_getprotoent,LM_PROTOCOLS,attlst,_nss_ldap_parse_proto)))==NSLCD_RESULT_SUCCESS)
{
/* write the result code */
WRITE_INT32(fp,retv);