nss-pam-ldapd branch master updated. 0.9.2-2-g9f02853
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
nss-pam-ldapd branch master updated. 0.9.2-2-g9f02853
- From: Commits of the nss-pam-ldapd project <nss-pam-ldapd-commits [at] lists.arthurdejong.org>
- To: nss-pam-ldapd-commits [at] lists.arthurdejong.org
- Reply-to: nss-pam-ldapd-users [at] lists.arthurdejong.org
- Subject: nss-pam-ldapd branch master updated. 0.9.2-2-g9f02853
- Date: Wed, 18 Dec 2013 23:56:04 +0100 (CET)
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "nss-pam-ldapd".
The branch, master has been updated
via 9f0285333e122c625c6055c3aebebc30f25b8702 (commit)
from 23a41ce888caaea871bf3c20c83136e3f6002f2a (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://arthurdejong.org/git/nss-pam-ldapd/commit/?id=9f0285333e122c625c6055c3aebebc30f25b8702
commit 9f0285333e122c625c6055c3aebebc30f25b8702
Author: Arthur de Jong <arthur@arthurdejong.org>
Date: Wed Dec 18 23:53:21 2013 +0100
Centralise buffer sizes
Common buffer sizes are now stored centrally so it can be easily and
consistently updated if required. Some buffers remain with locally
defined sizes that do not match a global buffer size.
diff --git a/nslcd/alias.c b/nslcd/alias.c
index 7bd9603..3603c35 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, 2010, 2011, 2012 Arthur de Jong
+ Copyright (C) 2006, 2007, 2009, 2010, 2011, 2012, 2013 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[300];
+ char safename[BUFLEN_SAFENAME];
/* escape attribute */
if (myldap_escape(name, safename, sizeof(safename)))
return -1;
@@ -119,8 +119,8 @@ static int write_alias(TFILE *fp, MYLDAP_ENTRY *entry,
const char *reqalias)
NSLCD_HANDLE(
alias, byname, NSLCD_ACTION_ALIAS_BYNAME,
- char name[256];
- char filter[4096];
+ char name[BUFLEN_NAME];
+ char filter[BUFLEN_FILTER];
READ_STRING(fp, name);
log_setrequest("alias=\"%s\"", name);,
mkfilter_alias_byname(name, filter, sizeof(filter)),
diff --git a/nslcd/common.c b/nslcd/common.c
index ade9ca6..979be82 100644
--- a/nslcd/common.c
+++ b/nslcd/common.c
@@ -118,7 +118,7 @@ const char *signame(int signum)
const char *getfqdn(void)
{
static char *fqdn = NULL;
- char hostname[HOST_NAME_MAX + 1];
+ char hostname[BUFLEN_HOSTNAME];
int hostnamelen;
int i;
struct hostent *host = NULL;
diff --git a/nslcd/common.h b/nslcd/common.h
index 393f695..cfc51eb 100644
--- a/nslcd/common.h
+++ b/nslcd/common.h
@@ -159,6 +159,17 @@ void invalidator_do(enum ldap_map_selector map);
#endif /* _POSIX_HOST_NAME_MAX */
#endif /* not HOST_NAME_MAX */
+/* common buffer lengths */
+#define BUFLEN_NAME 256 /* user, group names and such */
+#define BUFLEN_SAFENAME 300 /* escaped name */
+#define BUFLEN_PASSWORD 64 /* passwords */
+#define BUFLEN_PASSWORDHASH 256 /* passwords hashes */
+#define BUFLEN_DN 256 /* distinguished names */
+#define BUFLEN_SAFEDN 300 /* escapedd dn */
+#define BUFLEN_FILTER 4096 /* search filters */
+#define BUFLEN_HOSTNAME (HOST_NAME_MAX + 1) /* host names (+ escaped) */
+#define BUFLEN_MESSAGE 1024 /* message strings */
+
/* provide strtouid() function alias */
#if SIZEOF_UID_T == SIZEOF_UNSIGNED_LONG_INT
#define strtouid (uid_t)strtoul
diff --git a/nslcd/ether.c b/nslcd/ether.c
index bf8b084..b1bd21a 100644
--- a/nslcd/ether.c
+++ b/nslcd/ether.c
@@ -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[300];
+ char safename[BUFLEN_HOSTNAME];
/* escape attribute */
if (myldap_escape(name, safename, sizeof(safename)))
return -1;
@@ -155,8 +155,8 @@ static int write_ether(TFILE *fp, MYLDAP_ENTRY *entry,
NSLCD_HANDLE(
ether, byname, NSLCD_ACTION_ETHER_BYNAME,
- char name[256];
- char filter[4096];
+ char name[BUFLEN_HOSTNAME];
+ char filter[BUFLEN_FILTER];
READ_STRING(fp, name);
log_setrequest("ether=\"%s\"", name);,
mkfilter_ether_byname(name, filter, sizeof(filter)),
@@ -167,7 +167,7 @@ NSLCD_HANDLE(
ether, byether, NSLCD_ACTION_ETHER_BYETHER,
struct ether_addr addr;
char addrstr[20];
- char filter[4096];
+ char filter[BUFLEN_FILTER];
READ(fp, &addr, sizeof(uint8_t[6]));
if (ether_ntoa_r(&addr, addrstr) == NULL)
return -1;
diff --git a/nslcd/group.c b/nslcd/group.c
index 4fd40bf..fabc1e6 100644
--- a/nslcd/group.c
+++ b/nslcd/group.c
@@ -83,7 +83,7 @@ static const char **group_attrs = NULL;
static int mkfilter_group_byname(const char *name,
char *buffer, size_t buflen)
{
- char safename[300];
+ char safename[BUFLEN_SAFENAME];
/* escape attribute */
if (myldap_escape(name, safename, sizeof(safename)))
return -1;
@@ -116,9 +116,9 @@ static int mkfilter_group_bymember(MYLDAP_SESSION *session,
const char *uid,
char *buffer, size_t buflen)
{
- char dn[256];
- char safeuid[300];
- char safedn[300];
+ char dn[BUFLEN_DN];
+ char safeuid[BUFLEN_SAFENAME];
+ char safedn[BUFLEN_SAFEDN];
/* escape attribute */
if (myldap_escape(uid, safeuid, sizeof(safeuid)))
return -1;
@@ -139,7 +139,7 @@ static int mkfilter_group_bymember(MYLDAP_SESSION *session,
static int mkfilter_group_bymemberdn(const char *dn,
char *buffer, size_t buflen)
{
- char safedn[300];
+ char safedn[BUFLEN_SAFEDN];
/* escape DN */
if (myldap_escape(dn, safedn, sizeof(safedn)))
return -1;
@@ -215,7 +215,7 @@ static int do_write_group(TFILE *fp, MYLDAP_ENTRY *entry,
static void getmembers(MYLDAP_ENTRY *entry, MYLDAP_SESSION *session,
SET *members, SET *seen, SET *subgroups)
{
- char buf[256];
+ char buf[BUFLEN_NAME];
int i;
const char **values;
/* add the memberUid values */
@@ -260,7 +260,7 @@ static int write_group(TFILE *fp, MYLDAP_ENTRY *entry,
const char *reqname,
gid_t gids[MAXGIDS_PER_ENTRY];
int numgids;
char *tmp;
- char passbuffer[256];
+ char passbuffer[BUFLEN_PASSWORDHASH];
MYLDAP_SEARCH *search;
MYLDAP_ENTRY *entry2;
int rc;
@@ -359,8 +359,8 @@ static int write_group(TFILE *fp, MYLDAP_ENTRY *entry,
const char *reqname,
NSLCD_HANDLE(
group, byname, NSLCD_ACTION_GROUP_BYNAME,
- char name[256];
- char filter[4096];
+ char name[BUFLEN_NAME];
+ char filter[BUFLEN_FILTER];
READ_STRING(fp, name);
log_setrequest("group=\"%s\"", name);
if (!isvalidname(name))
@@ -375,7 +375,7 @@ NSLCD_HANDLE(
NSLCD_HANDLE(
group, bygid, NSLCD_ACTION_GROUP_BYGID,
gid_t gid;
- char filter[4096];
+ char filter[BUFLEN_FILTER];
READ_INT32(fp, gid);
log_setrequest("group=%lu", (unsigned long int)gid);,
mkfilter_group_bygid(gid, filter, sizeof(filter)),
@@ -391,8 +391,8 @@ int nslcd_group_bymember(TFILE *fp, MYLDAP_SESSION *session)
const char *dn;
const char *base;
int rc, i;
- char name[256];
- char filter[4096];
+ char name[BUFLEN_NAME];
+ char filter[BUFLEN_FILTER];
SET *seen=NULL, *tocheck=NULL;
/* read request parameters */
READ_STRING(fp, name);
diff --git a/nslcd/host.c b/nslcd/host.c
index 0ab7281..a898eee 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, 2010, 2011, 2012 Arthur de Jong
+ Copyright (C) 2006, 2007, 2009, 2010, 2011, 2012, 2013 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 *host_attrs[3];
by name, return -1 on errors */
static int mkfilter_host_byname(const char *name, char *buffer, size_t buflen)
{
- char safename[300];
+ char safename[BUFLEN_HOSTNAME];
/* escape attribute */
if (myldap_escape(name, safename, sizeof(safename)))
return -1;
@@ -148,8 +148,8 @@ static int write_host(TFILE *fp, MYLDAP_ENTRY *entry)
NSLCD_HANDLE(
host, byname, NSLCD_ACTION_HOST_BYNAME,
- char name[256];
- char filter[4096];
+ char name[BUFLEN_HOSTNAME];
+ char filter[BUFLEN_FILTER];
READ_STRING(fp, name);
log_setrequest("host=\"%s\"", name);,
mkfilter_host_byname(name, filter, sizeof(filter)),
@@ -162,7 +162,7 @@ NSLCD_HANDLE(
char addr[64];
int len = sizeof(addr);
char addrstr[64];
- char filter[4096];
+ char filter[BUFLEN_FILTER];
READ_ADDRESS(fp, addr, len, af);
/* translate the address to a string */
if (inet_ntop(af, addr, addrstr, sizeof(addrstr)) == NULL)
diff --git a/nslcd/myldap.c b/nslcd/myldap.c
index 235c3c6..620a3b7 100644
--- a/nslcd/myldap.c
+++ b/nslcd/myldap.c
@@ -91,13 +91,13 @@ struct ldap_session {
/* a list of searches registered with this session */
struct myldap_search *searches[MAX_SEARCHES_IN_SESSION];
/* the username to bind with */
- char binddn[256];
+ char binddn[BUFLEN_DN];
/* the password to bind with if any */
- char bindpw[64];
+ char bindpw[BUFLEN_PASSWORD];
/* the authentication result (NSLCD_PAM_* code) */
int policy_response;
/* the authentication message */
- char policy_message[1024];
+ char policy_message[BUFLEN_MESSAGE];
};
/* A search description set as returned by myldap_search(). */
@@ -155,7 +155,7 @@ int first_search = 1;
static void myldap_err(int pri, LDAP *ld, int rc, const char *format, ...)
{
- char message[200];
+ char message[BUFLEN_MESSAGE];
char *msg_ldap = NULL;
char *msg_diag = NULL;
char *msg_errno = NULL;
diff --git a/nslcd/netgroup.c b/nslcd/netgroup.c
index 455eab1..d9acd42 100644
--- a/nslcd/netgroup.c
+++ b/nslcd/netgroup.c
@@ -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[300];
+ char safename[BUFLEN_SAFENAME];
/* escape attribute */
if (myldap_escape(name, safename, sizeof(safename)))
return -1;
@@ -237,8 +237,8 @@ static int write_netgroup(TFILE *fp, MYLDAP_ENTRY *entry,
const char *reqname)
NSLCD_HANDLE(
netgroup, byname, NSLCD_ACTION_NETGROUP_BYNAME,
- char name[256];
- char filter[4096];
+ char name[BUFLEN_NAME];
+ char filter[BUFLEN_FILTER];
READ_STRING(fp, name);
log_setrequest("netgroup=\"%s\"", name);,
mkfilter_netgroup_byname(name, filter, sizeof(filter)),
diff --git a/nslcd/network.c b/nslcd/network.c
index 32678f3..89a3d27 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, 2010, 2011, 2012 Arthur de Jong
+ Copyright (C) 2006, 2007, 2009, 2010, 2011, 2012, 2013 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
@@ -65,7 +65,7 @@ static const char *network_attrs[3];
static int mkfilter_network_byname(const char *name,
char *buffer, size_t buflen)
{
- char safename[300];
+ char safename[BUFLEN_HOSTNAME];
/* escape attribute */
if (myldap_escape(name, safename, sizeof(safename)))
return -1;
@@ -147,8 +147,8 @@ static int write_network(TFILE *fp, MYLDAP_ENTRY *entry)
NSLCD_HANDLE(
network, byname, NSLCD_ACTION_NETWORK_BYNAME,
- char name[256];
- char filter[4096];
+ char name[BUFLEN_HOSTNAME];
+ char filter[BUFLEN_FILTER];
READ_STRING(fp, name);
log_setrequest("network=\"%s\"", name);,
mkfilter_network_byname(name, filter, sizeof(filter)),
@@ -161,7 +161,7 @@ NSLCD_HANDLE(
char addr[64];
int len = sizeof(addr);
char addrstr[64];
- char filter[4096];
+ char filter[BUFLEN_FILTER];
READ_ADDRESS(fp, addr, len, af);
/* translate the address to a string */
if (inet_ntop(af, addr, addrstr, sizeof(addrstr)) == NULL)
diff --git a/nslcd/pam.c b/nslcd/pam.c
index 2593c7c..c194225 100644
--- a/nslcd/pam.c
+++ b/nslcd/pam.c
@@ -260,12 +260,12 @@ int nslcd_pam_authc(TFILE *fp, MYLDAP_SESSION *session,
uid_t calleruid)
{
int32_t tmpint32;
int rc;
- char username[256], service[64], ruser[256], rhost[HOST_NAME_MAX + 1],
tty[64];
- char password[64];
+ char username[BUFLEN_NAME], service[BUFLEN_NAME], ruser[BUFLEN_NAME],
rhost[BUFLEN_HOSTNAME], tty[64];
+ char password[BUFLEN_PASSWORD];
const char *userdn;
MYLDAP_ENTRY *entry;
int authzrc = NSLCD_PAM_SUCCESS;
- char authzmsg[1024];
+ char authzmsg[BUFLEN_MESSAGE];
authzmsg[0] = '\0';
/* read request parameters */
READ_STRING(fp, username);
@@ -438,10 +438,10 @@ static int try_autzsearch(MYLDAP_SESSION *session, const
char *dn,
const char *ruser, const char *rhost,
const char *tty)
{
- char hostname[HOST_NAME_MAX + 1];
+ char hostname[BUFLEN_HOSTNAME];
const char *fqdn;
DICT *dict = NULL;
- char filter[4096];
+ char filter[BUFLEN_FILTER];
int rc = LDAP_SUCCESS;
const char *res;
int i;
@@ -497,9 +497,9 @@ int nslcd_pam_authz(TFILE *fp, MYLDAP_SESSION *session)
{
int32_t tmpint32;
int rc;
- char username[256], service[64], ruser[256], rhost[HOST_NAME_MAX + 1],
tty[64];
+ char username[BUFLEN_NAME], service[BUFLEN_NAME], ruser[BUFLEN_NAME],
rhost[BUFLEN_HOSTNAME], tty[64];
MYLDAP_ENTRY *entry;
- char authzmsg[1024];
+ char authzmsg[BUFLEN_MESSAGE];
authzmsg[0] = '\0';
/* read request parameters */
READ_STRING(fp, username);
@@ -549,7 +549,7 @@ int nslcd_pam_authz(TFILE *fp, MYLDAP_SESSION *session)
int nslcd_pam_sess_o(TFILE *fp, MYLDAP_SESSION UNUSED(*session))
{
int32_t tmpint32;
- char username[256], service[64], ruser[256], rhost[HOST_NAME_MAX + 1],
tty[64];
+ char username[BUFLEN_NAME], service[BUFLEN_NAME], ruser[BUFLEN_NAME],
rhost[BUFLEN_HOSTNAME], tty[64];
char sessionid[25];
static const char alphabet[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
@@ -582,7 +582,7 @@ int nslcd_pam_sess_o(TFILE *fp, MYLDAP_SESSION
UNUSED(*session))
int nslcd_pam_sess_c(TFILE *fp, MYLDAP_SESSION UNUSED(*session))
{
int32_t tmpint32;
- char username[256], service[64], ruser[256], rhost[HOST_NAME_MAX + 1],
tty[64];
+ char username[BUFLEN_NAME], service[BUFLEN_NAME], ruser[BUFLEN_NAME],
rhost[BUFLEN_HOSTNAME], tty[64];
char sessionid[64];
/* read request parameters */
READ_STRING(fp, username);
@@ -679,7 +679,7 @@ static int try_pwmod(MYLDAP_SESSION *oldsession,
char *authzmsg, size_t authzmsg_len)
{
MYLDAP_SESSION *session;
- char buffer[1024];
+ char buffer[BUFLEN_MESSAGE];
int rc;
/* set up a new connection */
session = myldap_create_session();
@@ -723,13 +723,13 @@ int nslcd_pam_pwmod(TFILE *fp, MYLDAP_SESSION *session,
uid_t calleruid)
{
int32_t tmpint32;
int rc;
- char username[256], service[64], ruser[256], rhost[HOST_NAME_MAX + 1],
tty[64];
+ char username[BUFLEN_NAME], service[BUFLEN_NAME], ruser[BUFLEN_NAME],
rhost[BUFLEN_HOSTNAME], tty[64];
int asroot;
- char oldpassword[64];
- char newpassword[64];
+ char oldpassword[BUFLEN_PASSWORD];
+ char newpassword[BUFLEN_PASSWORD];
const char *binddn = NULL; /* the user performing the modification */
MYLDAP_ENTRY *entry;
- char authzmsg[1024];
+ char authzmsg[BUFLEN_MESSAGE];
authzmsg[0] = '\0';
/* read request parameters */
READ_STRING(fp, username);
diff --git a/nslcd/passwd.c b/nslcd/passwd.c
index fc86b4f..2ad53a3 100644
--- a/nslcd/passwd.c
+++ b/nslcd/passwd.c
@@ -87,7 +87,7 @@ static const char **passwd_attrs = NULL;
static int mkfilter_passwd_byname(const char *name,
char *buffer, size_t buflen)
{
- char safename[300];
+ char safename[BUFLEN_SAFENAME];
/* escape attribute */
if (myldap_escape(name, safename, sizeof(safename)))
return -1;
@@ -340,7 +340,7 @@ MYLDAP_ENTRY *uid2entry(MYLDAP_SESSION *session, const char
*uid, int *rcp)
const char *base;
int i;
static const char *attrs[3];
- char filter[4096];
+ char filter[BUFLEN_FILTER];
/* if it isn't a valid username, just bail out now */
if (!isvalidname(uid))
{
@@ -407,7 +407,7 @@ static int write_passwd(TFILE *fp, MYLDAP_ENTRY *entry,
const char *requser,
char gecos[1024];
char homedir[256];
char shell[64];
- char passbuffer[256];
+ char passbuffer[BUFLEN_PASSWORDHASH];
int i, j;
/* get the usernames for this entry */
usernames = myldap_get_values(entry, attmap_passwd_uid);
@@ -545,8 +545,8 @@ static int write_passwd(TFILE *fp, MYLDAP_ENTRY *entry,
const char *requser,
NSLCD_HANDLE_UID(
passwd, byname, NSLCD_ACTION_PASSWD_BYNAME,
- char name[256];
- char filter[4096];
+ char name[BUFLEN_NAME];
+ char filter[BUFLEN_FILTER];
READ_STRING(fp, name);
log_setrequest("passwd=\"%s\"", name);
if (!isvalidname(name))
@@ -562,7 +562,7 @@ NSLCD_HANDLE_UID(
NSLCD_HANDLE_UID(
passwd, byuid, NSLCD_ACTION_PASSWD_BYUID,
uid_t uid;
- char filter[4096];
+ char filter[BUFLEN_FILTER];
READ_INT32(fp, uid);
log_setrequest("passwd=%lu", (unsigned long int)uid);
if (uid < nslcd_cfg->nss_min_uid)
diff --git a/nslcd/protocol.c b/nslcd/protocol.c
index d37c903..32c8784 100644
--- a/nslcd/protocol.c
+++ b/nslcd/protocol.c
@@ -65,7 +65,7 @@ static const char *protocol_attrs[3];
static int mkfilter_protocol_byname(const char *name,
char *buffer, size_t buflen)
{
- char safename[300];
+ char safename[BUFLEN_SAFENAME];
/* escape attribute */
if (myldap_escape(name, safename, sizeof(safename)))
return -1;
@@ -167,8 +167,8 @@ static int write_protocol(TFILE *fp, MYLDAP_ENTRY *entry,
const char *reqname)
NSLCD_HANDLE(
protocol, byname, NSLCD_ACTION_PROTOCOL_BYNAME,
- char name[256];
- char filter[4096];
+ char name[BUFLEN_NAME];
+ char filter[BUFLEN_FILTER];
READ_STRING(fp, name);
log_setrequest("protocol=\"%s\"", name);,
mkfilter_protocol_byname(name, filter, sizeof(filter)),
@@ -178,7 +178,7 @@ NSLCD_HANDLE(
NSLCD_HANDLE(
protocol, bynumber, NSLCD_ACTION_PROTOCOL_BYNUMBER,
int protocol;
- char filter[4096];
+ char filter[BUFLEN_FILTER];
READ_INT32(fp, protocol);
log_setrequest("protocol=%lu", (unsigned long int)protocol);,
mkfilter_protocol_bynumber(protocol, filter, sizeof(filter)),
diff --git a/nslcd/rpc.c b/nslcd/rpc.c
index ba88f4e..6539323 100644
--- a/nslcd/rpc.c
+++ b/nslcd/rpc.c
@@ -66,7 +66,7 @@ static const char *rpc_attrs[3];
static int mkfilter_rpc_byname(const char *name, char *buffer, size_t buflen)
{
- char safename[300];
+ char safename[BUFLEN_SAFENAME];
/* escape attribute */
if (myldap_escape(name, safename, sizeof(safename)))
return -1;
@@ -165,8 +165,8 @@ static int write_rpc(TFILE *fp, MYLDAP_ENTRY *entry, const
char *reqname)
NSLCD_HANDLE(
rpc, byname, NSLCD_ACTION_RPC_BYNAME,
- char name[256];
- char filter[4096];
+ char name[BUFLEN_NAME];
+ char filter[BUFLEN_FILTER];
READ_STRING(fp, name);
log_setrequest("rpc=\"%s\"", name);,
mkfilter_rpc_byname(name, filter, sizeof(filter)),
@@ -176,7 +176,7 @@ NSLCD_HANDLE(
NSLCD_HANDLE(
rpc, bynumber, NSLCD_ACTION_RPC_BYNUMBER,
int number;
- char filter[4096];
+ char filter[BUFLEN_FILTER];
READ_INT32(fp, number);
log_setrequest("rpc=%lu", (unsigned long int)number);,
mkfilter_rpc_bynumber(number, filter, sizeof(filter)),
diff --git a/nslcd/service.c b/nslcd/service.c
index 673aac4..83218db 100644
--- a/nslcd/service.c
+++ b/nslcd/service.c
@@ -68,7 +68,7 @@ static const char *service_attrs[4];
static int mkfilter_service_byname(const char *name, const char *protocol,
char *buffer, size_t buflen)
{
- char safename[300], safeprotocol[300];
+ char safename[BUFLEN_SAFENAME], safeprotocol[BUFLEN_SAFENAME];
/* escape attributes */
if (myldap_escape(name, safename, sizeof(safename)))
return -1;
@@ -89,7 +89,7 @@ static int mkfilter_service_byname(const char *name, const
char *protocol,
static int mkfilter_service_bynumber(int number, const char *protocol,
char *buffer, size_t buflen)
{
- char safeprotocol[300];
+ char safeprotocol[BUFLEN_SAFENAME];
if (*protocol != '\0')
{
if (myldap_escape(protocol, safeprotocol, sizeof(safeprotocol)))
@@ -204,9 +204,9 @@ static int write_service(TFILE *fp, MYLDAP_ENTRY *entry,
NSLCD_HANDLE(
service, byname, NSLCD_ACTION_SERVICE_BYNAME,
- char name[256];
- char protocol[256];
- char filter[4096];
+ char name[BUFLEN_NAME];
+ char protocol[BUFLEN_NAME];
+ char filter[BUFLEN_FILTER];
READ_STRING(fp, name);
READ_STRING(fp, protocol);
log_setrequest("service=\"%s\"%s%s", name,
@@ -218,8 +218,8 @@ NSLCD_HANDLE(
NSLCD_HANDLE(
service, bynumber, NSLCD_ACTION_SERVICE_BYNUMBER,
int number;
- char protocol[256];
- char filter[4096];
+ char protocol[BUFLEN_NAME];
+ char filter[BUFLEN_FILTER];
READ_INT32(fp, number);
READ_STRING(fp, protocol);
log_setrequest("service=%lu%s%s", (unsigned long int)number,
diff --git a/nslcd/shadow.c b/nslcd/shadow.c
index d1312f8..a70efdc 100644
--- a/nslcd/shadow.c
+++ b/nslcd/shadow.c
@@ -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[300];
+ char safename[BUFLEN_SAFENAME];
/* escape attribute */
if (myldap_escape(name, safename, sizeof(safename)))
return -1;
@@ -230,7 +230,7 @@ static int write_shadow(TFILE *fp, MYLDAP_ENTRY *entry,
const char *requser,
long expiredate;
unsigned long flag;
int i;
- char passbuffer[256];
+ char passbuffer[BUFLEN_PASSWORDHASH];
/* get username */
usernames = myldap_get_values(entry, attmap_shadow_uid);
if ((usernames == NULL) || (usernames[0] == NULL))
@@ -271,7 +271,7 @@ MYLDAP_ENTRY *shadow_uid2entry(MYLDAP_SESSION *session,
const char *username,
MYLDAP_SEARCH *search = NULL;
MYLDAP_ENTRY *entry = NULL;
const char *base;
- char filter[4096];
+ char filter[BUFLEN_FILTER];
int i;
/* if it isn't a valid username, just bail out now */
if (!isvalidname(username))
@@ -302,8 +302,8 @@ MYLDAP_ENTRY *shadow_uid2entry(MYLDAP_SESSION *session,
const char *username,
NSLCD_HANDLE_UID(
shadow, byname, NSLCD_ACTION_SHADOW_BYNAME,
- char name[256];
- char filter[4096];
+ char name[BUFLEN_NAME];
+ char filter[BUFLEN_FILTER];
READ_STRING(fp, name);
log_setrequest("shadow=\"%s\"", name);,
mkfilter_shadow_byname(name, filter, sizeof(filter)),
diff --git a/nslcd/usermod.c b/nslcd/usermod.c
index 968985a..f7b22c5 100644
--- a/nslcd/usermod.c
+++ b/nslcd/usermod.c
@@ -108,7 +108,7 @@ static MYLDAP_SESSION *get_session(const char *binddn,
const char *userdn,
const char *password, int *rcp)
{
MYLDAP_SESSION *session;
- char buffer[256];
+ char buffer[BUFLEN_DN];
/* set up a new connection */
session = myldap_create_session();
if (session == NULL)
@@ -161,9 +161,9 @@ int nslcd_usermod(TFILE *fp, MYLDAP_SESSION *session, uid_t
calleruid)
{
int32_t tmpint32;
int rc = LDAP_SUCCESS;
- char username[256];
+ char username[BUFLEN_NAME];
int asroot, isroot;
- char password[64];
+ char password[BUFLEN_PASSWORD];
int32_t param;
char buffer[4096];
size_t buflen = sizeof(buffer);
@@ -175,7 +175,7 @@ int nslcd_usermod(TFILE *fp, MYLDAP_SESSION *session, uid_t
calleruid)
const char *binddn = NULL; /* the user performing the modification */
MYLDAP_ENTRY *entry;
MYLDAP_SESSION *newsession;
- char errmsg[1024];
+ char errmsg[BUFLEN_MESSAGE];
/* read request parameters */
READ_STRING(fp, username);
READ_INT32(fp, asroot);
-----------------------------------------------------------------------
Summary of changes:
nslcd/alias.c | 8 ++++----
nslcd/common.c | 2 +-
nslcd/common.h | 11 +++++++++++
nslcd/ether.c | 8 ++++----
nslcd/group.c | 24 ++++++++++++------------
nslcd/host.c | 10 +++++-----
nslcd/myldap.c | 8 ++++----
nslcd/netgroup.c | 6 +++---
nslcd/network.c | 10 +++++-----
nslcd/pam.c | 28 ++++++++++++++--------------
nslcd/passwd.c | 12 ++++++------
nslcd/protocol.c | 8 ++++----
nslcd/rpc.c | 8 ++++----
nslcd/service.c | 14 +++++++-------
nslcd/shadow.c | 10 +++++-----
nslcd/usermod.c | 8 ++++----
16 files changed, 93 insertions(+), 82 deletions(-)
hooks/post-receive
--
nss-pam-ldapd
--
To unsubscribe send an email to
nss-pam-ldapd-commits-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/nss-pam-ldapd-commits/
- nss-pam-ldapd branch master updated. 0.9.2-2-g9f02853,
Commits of the nss-pam-ldapd project