diff options
author | Arthur de Jong <arthur@arthurdejong.org> | 2010-05-07 23:25:05 +0200 |
---|---|---|
committer | Arthur de Jong <arthur@arthurdejong.org> | 2010-05-07 23:25:05 +0200 |
commit | 458b8e289ad6fb5df0a44c5a119ef9bda8861604 (patch) | |
tree | 06ff0fe76fee3126297d0a6e15036d36dd1321a5 /nslcd | |
parent | c35d25bb095330e6c5f2510cffbab9170675af32 (diff) |
tune some buffer sizes and small cleanups
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd@1087 ef36b2f9-881f-0410-afb5-c4e39611909c
Diffstat (limited to 'nslcd')
-rw-r--r-- | nslcd/alias.c | 4 | ||||
-rw-r--r-- | nslcd/ether.c | 4 | ||||
-rw-r--r-- | nslcd/group.c | 13 | ||||
-rw-r--r-- | nslcd/host.c | 12 | ||||
-rw-r--r-- | nslcd/netgroup.c | 6 | ||||
-rw-r--r-- | nslcd/network.c | 6 | ||||
-rw-r--r-- | nslcd/passwd.c | 2 | ||||
-rw-r--r-- | nslcd/protocol.c | 4 | ||||
-rw-r--r-- | nslcd/rpc.c | 4 | ||||
-rw-r--r-- | nslcd/service.c | 6 | ||||
-rw-r--r-- | nslcd/shadow.c | 4 |
11 files changed, 32 insertions, 33 deletions
diff --git a/nslcd/alias.c b/nslcd/alias.c index 9c8a5f2..e4d15d0 100644 --- a/nslcd/alias.c +++ b/nslcd/alias.c @@ -5,7 +5,7 @@ Copyright (C) 1997-2005 Luke Howard Copyright (C) 2006 West Consulting - Copyright (C) 2006, 2007, 2009 Arthur de Jong + Copyright (C) 2006, 2007, 2009, 2010 Arthur de Jong This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -64,7 +64,7 @@ static const char *alias_attrs[3]; static int mkfilter_alias_byname(const char *name, char *buffer,size_t buflen) { - char safename[1024]; + char safename[300]; /* escape attribute */ if (myldap_escape(name,safename,sizeof(safename))) return -1; diff --git a/nslcd/ether.c b/nslcd/ether.c index ba26a44..aef2b59 100644 --- a/nslcd/ether.c +++ b/nslcd/ether.c @@ -5,7 +5,7 @@ Copyright (C) 1997-2005 Luke Howard Copyright (C) 2006 West Consulting - Copyright (C) 2006, 2007, 2009 Arthur de Jong + Copyright (C) 2006, 2007, 2009, 2010 Arthur de Jong This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -66,7 +66,7 @@ static const char *ether_attrs[3]; static int mkfilter_ether_byname(const char *name, char *buffer,size_t buflen) { - char safename[1024]; + char safename[300]; /* escape attribute */ if(myldap_escape(name,safename,sizeof(safename))) return -1; diff --git a/nslcd/group.c b/nslcd/group.c index 35522f6..14f7251 100644 --- a/nslcd/group.c +++ b/nslcd/group.c @@ -5,7 +5,7 @@ Copyright (C) 1997-2006 Luke Howard Copyright (C) 2006 West Consulting - Copyright (C) 2006, 2007, 2008, 2009 Arthur de Jong + Copyright (C) 2006, 2007, 2008, 2009, 2010 Arthur de Jong This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -80,7 +80,7 @@ static const char *group_attrs[6]; static int mkfilter_group_byname(const char *name, char *buffer,size_t buflen) { - char safename[1024]; + char safename[300]; /* escape attribute */ if(myldap_escape(name,safename,sizeof(safename))) return -1; @@ -108,15 +108,14 @@ static int mkfilter_group_bymember(MYLDAP_SESSION *session, const char *uid, char *buffer,size_t buflen) { - char buf[80],*dn; - char safeuid[80]; - char safedn[1024]; + char dn[256]; + char safeuid[300]; + char safedn[300]; /* escape attribute */ if(myldap_escape(uid,safeuid,sizeof(safeuid))) return -1; /* try to translate uid to DN */ - dn=uid2dn(session,uid,buf,sizeof(buf)); - if (dn==NULL) + if (uid2dn(session,uid,dn,sizeof(dn))==NULL) return mysnprintf(buffer,buflen, "(&%s(%s=%s))", group_filter, diff --git a/nslcd/host.c b/nslcd/host.c index 6a9ddcd..e166889 100644 --- a/nslcd/host.c +++ b/nslcd/host.c @@ -5,7 +5,7 @@ Copyright (C) 1997-2005 Luke Howard Copyright (C) 2006 West Consulting - Copyright (C) 2006, 2007, 2009 Arthur de Jong + Copyright (C) 2006, 2007, 2009, 2010 Arthur de Jong This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -67,21 +67,21 @@ static const char *host_attrs[3]; static int mkfilter_host_byname(const char *name, char *buffer,size_t buflen) { - char buf2[1024]; + char safename[300]; /* escape attribute */ - if (myldap_escape(name,buf2,sizeof(buf2))) + if (myldap_escape(name,safename,sizeof(safename))) return -1; /* build filter */ return mysnprintf(buffer,buflen, "(&%s(%s=%s))", host_filter, - attmap_host_cn,buf2); + attmap_host_cn,safename); } static int mkfilter_host_byaddr(const char *name, char *buffer,size_t buflen) { - char safename[1024]; + char safename[64]; /* escape attribute */ if (myldap_escape(name,safename,sizeof(safename))) return -1; @@ -167,7 +167,7 @@ NSLCD_HANDLE( int af; char addr[64]; int len=sizeof(addr); - char name[1024]; + char name[64]; char filter[1024]; READ_ADDRESS(fp,addr,len,af); /* translate the address to a string */ diff --git a/nslcd/netgroup.c b/nslcd/netgroup.c index feaeadb..298b1ab 100644 --- a/nslcd/netgroup.c +++ b/nslcd/netgroup.c @@ -5,7 +5,7 @@ Copyright (C) 1997-2005 Luke Howard Copyright (C) 2006 West Consulting - Copyright (C) 2006, 2007, 2009 Arthur de Jong + Copyright (C) 2006, 2007, 2009, 2010 Arthur de Jong This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -55,7 +55,7 @@ int netgroup_scope = LDAP_SCOPE_DEFAULT; const char *netgroup_filter = "(objectClass=nisNetgroup)"; /* the attributes to request with searches */ -const char *attmap_netgroup_cn = "cn"; +const char *attmap_netgroup_cn = "cn"; const char *attmap_netgroup_nisNetgroupTriple = "nisNetgroupTriple"; const char *attmap_netgroup_memberNisNetgroup = "memberNisNetgroup"; @@ -65,7 +65,7 @@ static const char *netgroup_attrs[4]; static int mkfilter_netgroup_byname(const char *name, char *buffer,size_t buflen) { - char safename[1024]; + char safename[300]; /* escape attribute */ if (myldap_escape(name,safename,sizeof(safename))) return -1; diff --git a/nslcd/network.c b/nslcd/network.c index ac35b03..26fc78d 100644 --- a/nslcd/network.c +++ b/nslcd/network.c @@ -5,7 +5,7 @@ Copyright (C) 1997-2005 Luke Howard Copyright (C) 2006 West Consulting - Copyright (C) 2006, 2007, 2009 Arthur de Jong + Copyright (C) 2006, 2007, 2009, 2010 Arthur de Jong This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -80,7 +80,7 @@ static int mkfilter_network_byname(const char *name, static int mkfilter_network_byaddr(const char *name, char *buffer,size_t buflen) { - char safename[1024]; + char safename[64]; /* escape attribute */ if (myldap_escape(name,safename,sizeof(safename))) return -1; @@ -166,7 +166,7 @@ NSLCD_HANDLE( int af; char addr[64]; int len=sizeof(addr); - char name[1024]; + char name[64]; char filter[1024]; READ_ADDRESS(fp,addr,len,af); /* translate the address to a string */ diff --git a/nslcd/passwd.c b/nslcd/passwd.c index f1b9031..da26d88 100644 --- a/nslcd/passwd.c +++ b/nslcd/passwd.c @@ -81,7 +81,7 @@ static const char **passwd_attrs=NULL; static int mkfilter_passwd_byname(const char *name, char *buffer,size_t buflen) { - char safename[1024]; + char safename[300]; /* escape attribute */ if(myldap_escape(name,safename,sizeof(safename))) return -1; diff --git a/nslcd/protocol.c b/nslcd/protocol.c index 3223f2c..3760aa9 100644 --- a/nslcd/protocol.c +++ b/nslcd/protocol.c @@ -5,7 +5,7 @@ Copyright (C) 1997-2005 Luke Howard Copyright (C) 2006 West Consulting - Copyright (C) 2006, 2007, 2009 Arthur de Jong + Copyright (C) 2006, 2007, 2009, 2010 Arthur de Jong This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -62,7 +62,7 @@ static const char *protocol_attrs[3]; static int mkfilter_protocol_byname(const char *name, char *buffer,size_t buflen) { - char safename[1024]; + char safename[300]; /* escape attribute */ if (myldap_escape(name,safename,sizeof(safename))) return -1; diff --git a/nslcd/rpc.c b/nslcd/rpc.c index 8e39729..4ceb9c0 100644 --- a/nslcd/rpc.c +++ b/nslcd/rpc.c @@ -5,7 +5,7 @@ Copyright (C) 1997-2005 Luke Howard Copyright (C) 2006 West Consulting - Copyright (C) 2006, 2007, 2009 Arthur de Jong + Copyright (C) 2006, 2007, 2009, 2010 Arthur de Jong This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -64,7 +64,7 @@ static const char *rpc_attrs[3]; static int mkfilter_rpc_byname(const char *name, char *buffer,size_t buflen) { - char safename[1024]; + char safename[300]; /* escape attribute */ if (myldap_escape(name,safename,sizeof(safename))) return -1; diff --git a/nslcd/service.c b/nslcd/service.c index 8bc4a0a..d55647b 100644 --- a/nslcd/service.c +++ b/nslcd/service.c @@ -5,7 +5,7 @@ Copyright (C) 1997-2005 Luke Howard Copyright (C) 2006 West Consulting - Copyright (C) 2006, 2007, 2009 Arthur de Jong + Copyright (C) 2006, 2007, 2009, 2010 Arthur de Jong This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -66,7 +66,7 @@ static int mkfilter_service_byname(const char *name, const char *protocol, char *buffer,size_t buflen) { - char safename[1024],safeprotocol[1024]; + char safename[300],safeprotocol[300]; /* escape attributes */ if (myldap_escape(name,safename,sizeof(safename))) return -1; @@ -92,7 +92,7 @@ static int mkfilter_service_bynumber(int number, const char *protocol, char *buffer,size_t buflen) { - char safeprotocol[1024]; + char safeprotocol[300]; if (*protocol!='\0') { if (myldap_escape(protocol,safeprotocol,sizeof(safeprotocol))) diff --git a/nslcd/shadow.c b/nslcd/shadow.c index 4cb7067..3ce09cc 100644 --- a/nslcd/shadow.c +++ b/nslcd/shadow.c @@ -5,7 +5,7 @@ Copyright (C) 1997-2005 Luke Howard Copyright (C) 2006 West Consulting - Copyright (C) 2006, 2007, 2008, 2009 Arthur de Jong + Copyright (C) 2006, 2007, 2008, 2009, 2010 Arthur de Jong This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -72,7 +72,7 @@ static const char **shadow_attrs=NULL; static int mkfilter_shadow_byname(const char *name, char *buffer,size_t buflen) { - char safename[1024]; + char safename[300]; /* escape attribute */ if(myldap_escape(name,safename,sizeof(safename))) return -1; |