nss-pam-ldapd commit: r1524 - in nss-pam-ldapd: . nslcd
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
nss-pam-ldapd commit: r1524 - in nss-pam-ldapd: . nslcd
- 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 commit: r1524 - in nss-pam-ldapd: . nslcd
- Date: Sat, 27 Aug 2011 23:22:41 +0200 (CEST)
Author: arthur
Date: Sat Aug 27 23:22:40 2011
New Revision: 1524
URL: http://arthurdejong.org/viewvc/nss-pam-ldapd?view=rev&revision=1524
Log:
provide strtouid() and strtogid() functions that use strtoul() or strtoull()
(thanks Jakub Hrozek)
Modified:
nss-pam-ldapd/configure.ac
nss-pam-ldapd/nslcd/cfg.c
nss-pam-ldapd/nslcd/common.h
nss-pam-ldapd/nslcd/group.c
nss-pam-ldapd/nslcd/passwd.c
Modified: nss-pam-ldapd/configure.ac
==============================================================================
--- nss-pam-ldapd/configure.ac Sat Aug 27 22:57:18 2011 (r1523)
+++ nss-pam-ldapd/configure.ac Sat Aug 27 23:22:40 2011 (r1524)
@@ -303,6 +303,10 @@
AC_TYPE_UINT8_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
+AC_CHECK_SIZEOF(unsigned long int)
+AC_CHECK_SIZEOF(unsigned long long int)
+AC_CHECK_SIZEOF(uid_t)
+AC_CHECK_SIZEOF(gid_t)
# check for support for the __thread keyword
AC_CACHE_CHECK([whether $CC supports '__thread'], [mn_cv_c___thread_supported],
Modified: nss-pam-ldapd/nslcd/cfg.c
==============================================================================
--- nss-pam-ldapd/nslcd/cfg.c Sat Aug 27 22:57:18 2011 (r1523)
+++ nss-pam-ldapd/nslcd/cfg.c Sat Aug 27 23:22:40 2011 (r1524)
@@ -431,7 +431,7 @@
check_argumentcount(filename,lnr,keyword,get_token(line,token,sizeof(token))!=NULL);
/* check if it is a valid numerical uid */
errno=0;
- *var=(uid_t)strtol(token,&tmp,0);
+ *var=strtouid(token,&tmp,0);
if ((*token!='\0')&&(*tmp=='\0')&&(errno==0))
return;
/* find by name */
@@ -457,7 +457,7 @@
check_argumentcount(filename,lnr,keyword,get_token(line,token,sizeof(token))!=NULL);
/* check if it is a valid numerical gid */
errno=0;
- *var=(gid_t)strtol(token,&tmp,0);
+ *var=strtogid(token,&tmp,0);
if ((*token!='\0')&&(*tmp=='\0')&&(errno==0))
return;
/* find by name */
Modified: nss-pam-ldapd/nslcd/common.h
==============================================================================
--- nss-pam-ldapd/nslcd/common.h Sat Aug 27 22:57:18 2011 (r1523)
+++ nss-pam-ldapd/nslcd/common.h Sat Aug 27 23:22:40 2011 (r1524)
@@ -133,6 +133,24 @@
#endif /* _POSIX_HOST_NAME_MAX */
#endif /* not HOST_NAME_MAX */
+/* provide strtouid() function alias */
+#if SIZEOF_UID_T == SIZEOF_UNSIGNED_LONG_INT
+#define strtouid (uid_t)strtoul
+#elif SIZEOF_UID_T == SIZEOF_UNSIGNED_LONG_LONG_INT
+#define strtouid (uid_t)strtoull
+#else
+#error unable to find implementation for strtouid()
+#endif
+
+/* provide strtouid() function alias */
+#if SIZEOF_GID_T == SIZEOF_UNSIGNED_LONG_INT
+#define strtogid (gid_t)strtoul
+#elif SIZEOF_GID_T == SIZEOF_UNSIGNED_LONG_LONG_INT
+#define strtogid (gid_t)strtoull
+#else
+#error unable to find implementation for strtogid()
+#endif
+
/* these are the functions for initialising the database specific
modules */
void alias_init(void);
Modified: nss-pam-ldapd/nslcd/group.c
==============================================================================
--- nss-pam-ldapd/nslcd/group.c Sat Aug 27 22:57:18 2011 (r1523)
+++ nss-pam-ldapd/nslcd/group.c Sat Aug 27 23:22:40 2011 (r1524)
@@ -281,7 +281,7 @@
else
{
errno=0;
- gids[numgids]=(gid_t)strtol(gidvalues[numgids],&tmp,0);
+ gids[numgids]=strtogid(gidvalues[numgids],&tmp,0);
if ((*(gidvalues[numgids])=='\0')||(*tmp!='\0'))
{
log_log(LOG_WARNING,"group entry %s contains non-numeric %s value",
Modified: nss-pam-ldapd/nslcd/passwd.c
==============================================================================
--- nss-pam-ldapd/nslcd/passwd.c Sat Aug 27 22:57:18 2011 (r1523)
+++ nss-pam-ldapd/nslcd/passwd.c Sat Aug 27 23:22:40 2011 (r1524)
@@ -195,7 +195,7 @@
else
{
errno=0;
- uid=(uid_t)strtol(values[i],&tmp,0);
+ uid=strtouid(values[i],&tmp,0);
if ((*(values[i])=='\0')||(*tmp!='\0'))
{
log_log(LOG_WARNING,"passwd entry %s contains non-numeric %s value",
@@ -489,7 +489,7 @@
else
{
errno=0;
- uids[numuids]=(uid_t)strtol(tmpvalues[numuids],&tmp,0);
+ uids[numuids]=strtouid(tmpvalues[numuids],&tmp,0);
if ((*(tmpvalues[numuids])=='\0')||(*tmp!='\0'))
{
log_log(LOG_WARNING,"passwd entry %s contains non-numeric %s value",
@@ -527,7 +527,7 @@
return 0;
}
errno=0;
- gid=(gid_t)strtol(gidbuf,&tmp,0);
+ gid=strtogid(gidbuf,&tmp,0);
if ((gidbuf[0]=='\0')||(*tmp!='\0'))
{
log_log(LOG_WARNING,"passwd entry %s contains non-numeric %s value",
--
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 commit: r1524 - in nss-pam-ldapd: . nslcd,
Commits of the nss-pam-ldapd project