lists.arthurdejong.org
RSS feed

nss-pam-ldapd commit: r1400 - in nss-pam-ldapd: common nslcd nss pam

[Date Prev][Date Next] [Thread Prev][Thread Next]

nss-pam-ldapd commit: r1400 - in nss-pam-ldapd: common nslcd nss pam



Author: arthur
Date: Sat Mar 19 16:14:24 2011
New Revision: 1400
URL: http://arthurdejong.org/viewvc/nss-pam-ldapd?view=rev&revision=1400

Log:
small code improvements

Modified:
   nss-pam-ldapd/common/expr.c
   nss-pam-ldapd/nslcd/myldap.h
   nss-pam-ldapd/nslcd/nslcd.c
   nss-pam-ldapd/nss/common.h
   nss-pam-ldapd/nss/prototypes.h
   nss-pam-ldapd/pam/common.h
   nss-pam-ldapd/pam/pam.c

Modified: nss-pam-ldapd/common/expr.c
==============================================================================
--- nss-pam-ldapd/common/expr.c Sat Mar 19 16:13:31 2011        (r1399)
+++ nss-pam-ldapd/common/expr.c Sat Mar 19 16:14:24 2011        (r1400)
@@ -2,7 +2,7 @@
    expr.c - limited shell-like expression parsing functions
    This file is part of the nss-pam-ldapd library.
 
-   Copyright (C) 2009, 2010 Arthur de Jong
+   Copyright (C) 2009, 2010, 2011 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
@@ -221,6 +221,7 @@
         break;
       case '\\': /* escaped character, unescape */
         i++;
+        /* no break needed here */
       default: /* just skip */
         i++;
     }

Modified: nss-pam-ldapd/nslcd/myldap.h
==============================================================================
--- nss-pam-ldapd/nslcd/myldap.h        Sat Mar 19 16:13:31 2011        (r1399)
+++ nss-pam-ldapd/nslcd/myldap.h        Sat Mar 19 16:14:24 2011        (r1400)
@@ -2,7 +2,7 @@
    myldap.h - simple interface to do LDAP requests
    This file is part of the nss-pam-ldapd library.
 
-   Copyright (C) 2007, 2008, 2009, 2010 Arthur de Jong
+   Copyright (C) 2007, 2008, 2009, 2010, 2011 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
@@ -137,7 +137,7 @@
 MUST_USE int myldap_escape(const char *src,char *buffer,size_t buflen);
 
 /* Set the debug level globally. Returns an LDAP status code. */
-int myldap_set_debuglevel(int i);
+int myldap_set_debuglevel(int level);
 
 /* Perform an EXOP password modification call. Returns an LDAP status code. */
 int myldap_passwd(

Modified: nss-pam-ldapd/nslcd/nslcd.c
==============================================================================
--- nss-pam-ldapd/nslcd/nslcd.c Sat Mar 19 16:13:31 2011        (r1399)
+++ nss-pam-ldapd/nslcd/nslcd.c Sat Mar 19 16:14:24 2011        (r1400)
@@ -309,14 +309,14 @@
     log_log(LOG_ERR,"fctnl(F_GETFL) failed: %s",strerror(errno));
     if (close(sock))
       log_log(LOG_WARNING,"problem closing socket: %s",strerror(errno));
-    exit(1);
+    exit(EXIT_FAILURE);
   }
   if (fcntl(sock,F_SETFL,i|O_NONBLOCK)<0)
   {
     log_log(LOG_ERR,"fctnl(F_SETFL,O_NONBLOCK) failed: %s",strerror(errno));
     if (close(sock))
       log_log(LOG_WARNING,"problem closing socket: %s",strerror(errno));
-    exit(1);
+    exit(EXIT_FAILURE);
   }
   /* create the directory if needed */
   mkdirname(filename);

Modified: nss-pam-ldapd/nss/common.h
==============================================================================
--- nss-pam-ldapd/nss/common.h  Sat Mar 19 16:13:31 2011        (r1399)
+++ nss-pam-ldapd/nss/common.h  Sat Mar 19 16:14:24 2011        (r1400)
@@ -2,7 +2,7 @@
    common.h - common functions for NSS lookups
 
    Copyright (C) 2006 West Consulting
-   Copyright (C) 2006, 2007, 2008, 2009, 2010 Arthur de Jong
+   Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 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
@@ -82,7 +82,7 @@
 
 /* check validity of passed buffer (Glibc flavour) */
 #define NSS_BUFCHECK \
-  if ((buffer==NULL)||(buflen<=0)) \
+  if ((buffer==NULL)||(buflen==0)) \
   { \
       *errnop=EINVAL; \
       return NSS_STATUS_UNAVAIL; \

Modified: nss-pam-ldapd/nss/prototypes.h
==============================================================================
--- nss-pam-ldapd/nss/prototypes.h      Sat Mar 19 16:13:31 2011        (r1399)
+++ nss-pam-ldapd/nss/prototypes.h      Sat Mar 19 16:14:24 2011        (r1400)
@@ -72,7 +72,7 @@
 /* group - groups of users */
 nss_status_t _nss_ldap_getgrnam_r(const char *name,struct group *result,char 
*buffer,size_t buflen,int *errnop);
 nss_status_t _nss_ldap_getgrgid_r(gid_t gid,struct group *result,char 
*buffer,size_t buflen,int *errnop);
-nss_status_t _nss_ldap_initgroups_dyn(const char *user,gid_t group,long int 
*start,long int *size,gid_t **groupsp,long int limit,int *errnop);
+nss_status_t _nss_ldap_initgroups_dyn(const char *user,gid_t skipgroup,long 
int *start,long int *size,gid_t **groupsp,long int limit,int *errnop);
 nss_status_t _nss_ldap_setgrent(int stayopen);
 nss_status_t _nss_ldap_getgrent_r(struct group *result,char *buffer,size_t 
buflen,int *errnop);
 nss_status_t _nss_ldap_endgrent(void);

Modified: nss-pam-ldapd/pam/common.h
==============================================================================
--- nss-pam-ldapd/pam/common.h  Sat Mar 19 16:13:31 2011        (r1399)
+++ nss-pam-ldapd/pam/common.h  Sat Mar 19 16:14:24 2011        (r1400)
@@ -1,7 +1,7 @@
 /*
    common.h - common functions for PAM lookups
 
-   Copyright (C) 2009, 2010 Arthur de Jong
+   Copyright (C) 2009, 2010, 2011 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
@@ -95,6 +95,6 @@
    status code */
 #define READ_PAM_CODE(fp,i) \
   READ_TYPE(fp,tmpint32,int32_t); \
-  i=nslcd2pam_rc(tmpint32);
+  i=nslcd2pam_rc(pamh,tmpint32);
 
 #endif /* not PAM__COMMON_H */

Modified: nss-pam-ldapd/pam/pam.c
==============================================================================
--- nss-pam-ldapd/pam/pam.c     Sat Mar 19 16:13:31 2011        (r1399)
+++ nss-pam-ldapd/pam/pam.c     Sat Mar 19 16:14:24 2011        (r1400)
@@ -2,7 +2,7 @@
    pam.c - pam module functions
 
    Copyright (C) 2009 Howard Chu
-   Copyright (C) 2009, 2010 Arthur de Jong
+   Copyright (C) 2009, 2010, 2011 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
@@ -225,7 +225,7 @@
 }
 
 /* map a NSLCD PAM status code to a PAM status code */
-static int nslcd2pam_rc(int rc)
+static int nslcd2pam_rc(pam_handle_t *pamh,int rc)
 {
 #define map(i) case NSLCD_##i: return i;
   switch(rc) {
@@ -242,7 +242,9 @@
     map(PAM_AUTHTOK_DISABLE_AGING);
     map(PAM_IGNORE);
     map(PAM_ABORT);
-    default: return PAM_ABORT;
+    default:
+      pam_syslog(pamh,LOG_ERR,"unknown NSLCD_PAM_* code returned: %d",rc);
+      return PAM_ABORT;
   }
 }
 
-- 
To unsubscribe send an email to
nss-pam-ldapd-commits-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/nss-pam-ldapd-commits