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>2009-06-06 22:46:33 +0200
committerArthur de Jong <arthur@arthurdejong.org>2009-06-06 22:46:33 +0200
commit285930cbcc3e2074ed7fe78a47aec55e49749953 (patch)
tree923db25377f59fcd0369eb1251fbd391140898a2 /nslcd/protocol.c
parent6a0fbfe59622f76a2546e089d896a4c5ff3eea9b (diff)
implement case-sensitive filtering for group, netgroup, passwd, protocols, rpc, services and shadow lookups
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-ldapd@934 ef36b2f9-881f-0410-afb5-c4e39611909c
Diffstat (limited to 'nslcd/protocol.c')
-rw-r--r--nslcd/protocol.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/nslcd/protocol.c b/nslcd/protocol.c
index 595427b..fadb66f 100644
--- a/nslcd/protocol.c
+++ b/nslcd/protocol.c
@@ -100,7 +100,7 @@ void protocol_init(void)
protocol_attrs[2]=NULL;
}
-static int write_protocol(TFILE *fp,MYLDAP_ENTRY *entry)
+static int write_protocol(TFILE *fp,MYLDAP_ENTRY *entry,const char *reqname)
{
int32_t tmpint32,tmp2int32,tmp3int32;
const char *name;
@@ -108,6 +108,7 @@ static int write_protocol(TFILE *fp,MYLDAP_ENTRY *entry)
const char **protos;
char *tmp;
int proto;
+ int i;
/* get the most canonical name */
name=myldap_get_rdn_value(entry,attmap_protocol_cn);
/* get the other names for the protocol */
@@ -121,6 +122,14 @@ static int write_protocol(TFILE *fp,MYLDAP_ENTRY *entry)
/* if the protocol name is not yet found, get the first entry */
if (name==NULL)
name=aliases[0];
+ /* check case of returned protocol entry */
+ if ((reqname!=NULL)&&(strcmp(reqname,name)!=0))
+ {
+ for (i=0;(aliases[i]!=NULL)&&(strcmp(reqname,aliases[i])!=0);i++)
+ /* nothing here */ ;
+ if (aliases[i]==NULL)
+ return 0; /* neither the name nor any of the aliases matched */
+ }
/* get the protocol number */
protos=myldap_get_values(entry,attmap_protocol_ipProtocolNumber);
if ((protos==NULL)||(protos[0]==NULL))
@@ -157,7 +166,7 @@ NSLCD_HANDLE(
log_log(LOG_DEBUG,"nslcd_protocol_byname(%s)",name);,
NSLCD_ACTION_PROTOCOL_BYNAME,
mkfilter_protocol_byname(name,filter,sizeof(filter)),
- write_protocol(fp,entry)
+ write_protocol(fp,entry,name)
)
NSLCD_HANDLE(
@@ -168,7 +177,7 @@ NSLCD_HANDLE(
log_log(LOG_DEBUG,"nslcd_protocol_bynumber(%d)",protocol);,
NSLCD_ACTION_PROTOCOL_BYNUMBER,
mkfilter_protocol_bynumber(protocol,filter,sizeof(filter)),
- write_protocol(fp,entry)
+ write_protocol(fp,entry,NULL)
)
NSLCD_HANDLE(
@@ -178,5 +187,5 @@ NSLCD_HANDLE(
log_log(LOG_DEBUG,"nslcd_protocol_all()");,
NSLCD_ACTION_PROTOCOL_ALL,
(filter=protocol_filter,0),
- write_protocol(fp,entry)
+ write_protocol(fp,entry,NULL)
)