lists.arthurdejong.org
RSS feed

nss-pam-ldapd branch master updated. 0.9.0-61-g321d8a3

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

nss-pam-ldapd branch master updated. 0.9.0-61-g321d8a3



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  321d8a3574ca9165e882eae1035d4924d786af95 (commit)
       via  f18729e714c291257181023d65c0393cd022ca85 (commit)
       via  f54f2ad39caace08e1aa3c37578d117b4d8ce0a6 (commit)
       via  6f614828817112658ccb771a2ed3b5a2eef4801e (commit)
      from  f6c20eec9afda63fa0c2027818c88ab488dd4402 (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=321d8a3574ca9165e882eae1035d4924d786af95

commit 321d8a3574ca9165e882eae1035d4924d786af95
Author: Arthur de Jong <arthur@arthurdejong.org>
Date:   Sun Aug 25 19:09:17 2013 +0200

    Handle failure of getpeercred more gracefully

diff --git a/pynslcd/pynslcd.py b/pynslcd/pynslcd.py
index 5058d18..a5ae63b 100755
--- a/pynslcd/pynslcd.py
+++ b/pynslcd/pynslcd.py
@@ -178,10 +178,13 @@ def getpeercred(fd):
     """Return uid, gid and pid of calling application."""
     import struct
     import socket
-    SO_PEERCRED = getattr(socket, 'SO_PEERCRED', 17)
-    creds = fd.getsockopt(socket.SOL_SOCKET, SO_PEERCRED, 
struct.calcsize('3i'))
-    pid, uid, gid = struct.unpack('3i', creds)
-    return uid, gid, pid
+    try:
+        SO_PEERCRED = getattr(socket, 'SO_PEERCRED', 17)
+        creds = fd.getsockopt(socket.SOL_SOCKET, SO_PEERCRED, 
struct.calcsize('3i'))
+        pid, uid, gid = struct.unpack('3i', creds)
+        return uid, gid, pid
+    except socket.error:
+        return None, None, None
 
 
 handlers = {}
@@ -210,11 +213,8 @@ def acceptconnection(session):
         # indicate new connection to logging module (generates unique id)
         log_newsession()
         # log connection
-        try:
-            uid, gid, pid = getpeercred(conn)
-            logging.debug('connection from pid=%r uid=%r gid=%r', pid, uid, 
gid)
-        except:
-            raise  # FIXME: handle exception gracefully
+        uid, gid, pid = getpeercred(conn)
+        logging.debug('connection from pid=%r uid=%r gid=%r', pid, uid, gid)
         # create a stream object
         fp = TIOStream(conn)
         # read request

http://arthurdejong.org/git/nss-pam-ldapd/commit/?id=f18729e714c291257181023d65c0393cd022ca85

commit f18729e714c291257181023d65c0393cd022ca85
Author: Arthur de Jong <arthur@arthurdejong.org>
Date:   Sun Aug 25 18:14:31 2013 +0200

    Only run pynslcd tests if it is enabled

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 8444d0e..441af73 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -22,7 +22,10 @@ TESTS = test_dict test_set test_tio test_expr 
test_getpeercred test_cfg \
         test_myldap.sh test_common test_nsscmds.sh test_pamcmds.sh \
         test_manpages.sh
 if HAVE_PYTHON
-TESTS += test_pycompile.sh test_pylint.sh test_pynslcd_cache.py
+  TESTS += test_pycompile.sh test_pylint.sh
+endif
+if ENABLE_PYNSLCD
+  TESTS += test_pynslcd_cache.py
 endif
 
 AM_TESTS_ENVIRONMENT = PYTHON='@PYTHON@'; export PYTHON;

http://arthurdejong.org/git/nss-pam-ldapd/commit/?id=f54f2ad39caace08e1aa3c37578d117b4d8ce0a6

commit f54f2ad39caace08e1aa3c37578d117b4d8ce0a6
Author: Arthur de Jong <arthur@arthurdejong.org>
Date:   Sun Aug 25 17:08:52 2013 +0200

    Add configure test for Python modules
    
    This uses the AX_PYTHON_MODULE test to check for availability of used
    Python modules. All third-party modules and modules that are not a
    builtin for Python 2.5 are tested.
    
    This also splits the tests for the utils and pynslcd.

diff --git a/configure.ac b/configure.ac
index a586173..1a9dfdb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -60,8 +60,6 @@ AC_PROG_RANLIB
 AM_PROG_CC_C_O
 AC_USE_SYSTEM_EXTENSIONS
 AC_PROG_LN_S
-AM_PATH_PYTHON(2.5,, [:])
-AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != ":"])
 AM_PROG_AR
 
 # checks for tool to convert docbook to man
@@ -72,6 +70,14 @@ then
 fi
 AM_CONDITIONAL([GENMAN], [test "x${DOCBOOK2X_MAN}" != x])
 
+# check for Python and modules
+AM_PATH_PYTHON(2.5,, [:])
+AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != ":"])
+if test "x$PYTHON" != "x:"
+then
+  AX_PYTHON_MODULE(argparse)
+fi
+
 # check for debugging options
 AC_ARG_ENABLE(debug,
               AS_HELP_STRING([--enable-debug],
@@ -137,11 +143,11 @@ AC_ARG_ENABLE(utils,
               [enable_utils="auto"])
 if test "x$enable_utils" = "xauto"
 then
-  if test "x$PYTHON" = "x:"
+  if test "x$PYTHON" != "x:" && test "$HAVE_PYMOD_ARGPARSE" = "yes"
   then
-    enable_utils="no"
-  else
     enable_utils="yes"
+  else
+    enable_utils="no"
   fi
 fi
 AC_MSG_RESULT($enable_utils)
@@ -577,6 +583,18 @@ then
   LIBS="$pam_save_LIBS"
 fi
 
+# utils-specific tests
+if test "x$enable_utils" = "xyes"
+then
+  # check Python interpreter
+  AM_PATH_PYTHON(2.5,, AC_MSG_ERROR([Python is required]))
+  AX_PYTHON_MODULE(argparse)
+  if test "x$HAVE_PYMOD_ARGPARSE" != "xyes"
+  then
+    AC_MSG_ERROR(Required Python modules missing)
+  fi
+fi
+
 # nslcd daemon-specific tests
 if test "x$enable_nslcd" = "xyes"
 then
@@ -799,11 +817,24 @@ then
   AC_SUBST(nslcd_LIBS)
 fi
 
-# Python-specific tests
-if test "x$enable_pynslcd" = "xyes" || test "x$enable_utils" = "xyes"
+# pynslcd-specific tests
+if test "x$enable_pynslcd" = "xyes"
 then
   # check Python interpreter
   AM_PATH_PYTHON(2.5,, AC_MSG_ERROR([Python is required]))
+  AX_PYTHON_MODULE(daemon)
+  AX_PYTHON_MODULE(fcntl)
+  AX_PYTHON_MODULE(fnmatch)
+  AX_PYTHON_MODULE(ldap)
+  AX_PYTHON_MODULE(sqlite3)
+  if test "x$HAVE_PYMOD_DAEMON" != "xyes" || \
+     test "x$HAVE_PYMOD_FCNTL" != "xyes" || \
+     test "x$HAVE_PYMOD_FNMATCH" != "xyes" || \
+     test "x$HAVE_PYMOD_LDAP" != "xyes" || \
+     test "x$HAVE_PYMOD_SQLITE3" != "xyes"
+  then
+    AC_MSG_ERROR(Required Python modules missing)
+  fi
 fi
 
 AM_CONDITIONAL([NSS_FLAVOUR_GLIBC], [test "x${with_nss_flavour}" = xglibc])
diff --git a/m4/ax_python_module.m4 b/m4/ax_python_module.m4
new file mode 100644
index 0000000..3afc404
--- /dev/null
+++ b/m4/ax_python_module.m4
@@ -0,0 +1,49 @@
+# ===========================================================================
+#     http://www.gnu.org/software/autoconf-archive/ax_python_module.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_PYTHON_MODULE(modname[, fatal])
+#
+# DESCRIPTION
+#
+#   Checks for Python module.
+#
+#   If fatal is non-empty then absence of a module will trigger an error.
+#
+# LICENSE
+#
+#   Copyright (c) 2008 Andrew Collier
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved. This file is offered as-is, without any
+#   warranty.
+
+#serial 6
+
+AU_ALIAS([AC_PYTHON_MODULE], [AX_PYTHON_MODULE])
+AC_DEFUN([AX_PYTHON_MODULE],[
+    if test -z $PYTHON;
+    then
+        PYTHON="python"
+    fi
+    PYTHON_NAME=`basename $PYTHON`
+    AC_MSG_CHECKING($PYTHON_NAME module: $1)
+       $PYTHON -c "import $1" 2>/dev/null
+       if test $? -eq 0;
+       then
+               AC_MSG_RESULT(yes)
+               eval AS_TR_CPP(HAVE_PYMOD_$1)=yes
+       else
+               AC_MSG_RESULT(no)
+               eval AS_TR_CPP(HAVE_PYMOD_$1)=no
+               #
+               if test -n "$2"
+               then
+                       AC_MSG_ERROR(failed to find required module $1)
+                       exit 1
+               fi
+       fi
+])

http://arthurdejong.org/git/nss-pam-ldapd/commit/?id=6f614828817112658ccb771a2ed3b5a2eef4801e

commit 6f614828817112658ccb771a2ed3b5a2eef4801e
Author: Arthur de Jong <arthur@arthurdejong.org>
Date:   Sun Aug 25 16:07:46 2013 +0200

    Rearrange Python imports

diff --git a/pynslcd/attmap.py b/pynslcd/attmap.py
index 3545a96..b64a048 100644
--- a/pynslcd/attmap.py
+++ b/pynslcd/attmap.py
@@ -37,9 +37,10 @@ True
 '"${gecos:-$cn}"'
 """
 
+import re
+
 from ldap.filter import escape_filter_chars
 import ldap.dn
-import re
 
 from expr import Expression
 
diff --git a/pynslcd/group.py b/pynslcd/group.py
index 375af57..ffcc8d1 100644
--- a/pynslcd/group.py
+++ b/pynslcd/group.py
@@ -24,11 +24,11 @@ import logging
 from ldap.filter import escape_filter_chars
 import ldap
 
-import passwd
 import cache
 import cfg
 import common
 import constants
+import passwd
 import search
 
 
diff --git a/pynslcd/pynslcd.py b/pynslcd/pynslcd.py
index 73fc3cc..5058d18 100755
--- a/pynslcd/pynslcd.py
+++ b/pynslcd/pynslcd.py
@@ -19,7 +19,6 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 # 02110-1301 USA
 
-import daemon
 import logging
 import logging.handlers
 import os
@@ -28,14 +27,15 @@ import sys
 import syslog
 import threading
 
+import daemon
 import ldap
 
 from tio import TIOStream
 import cfg
 import common
 import constants
-import mypidfile
 import invalidator
+import mypidfile
 import search
 
 
diff --git a/pynslcd/tio.py b/pynslcd/tio.py
index 02b7ec6..ef0fda7 100644
--- a/pynslcd/tio.py
+++ b/pynslcd/tio.py
@@ -18,9 +18,9 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 # 02110-1301 USA
 
-import struct
 import os
 import socket
+import struct
 
 
 # definition for reading and writing INT32 values
diff --git a/utils/getent.py b/utils/getent.py
index 039a48c..bd27c11 100755
--- a/utils/getent.py
+++ b/utils/getent.py
@@ -27,8 +27,8 @@ import struct
 import sys
 
 from cmdline import VersionAction
-import constants
 from nslcd import NslcdClient
+import constants
 
 
 epilog = '''
diff --git a/utils/nslcd.py b/utils/nslcd.py
index 031319c..22d18b7 100644
--- a/utils/nslcd.py
+++ b/utils/nslcd.py
@@ -19,10 +19,10 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 # 02110-1301 USA
 
+import fcntl
 import os
 import socket
 import struct
-import fcntl
 
 import constants
 

-----------------------------------------------------------------------

Summary of changes:
 configure.ac           |   45 +++++++++++++++++++++++++++++++++++++-------
 m4/ax_python_module.m4 |   49 ++++++++++++++++++++++++++++++++++++++++++++++++
 pynslcd/attmap.py      |    3 ++-
 pynslcd/group.py       |    2 +-
 pynslcd/pynslcd.py     |   22 +++++++++++-----------
 pynslcd/tio.py         |    2 +-
 tests/Makefile.am      |    5 ++++-
 utils/getent.py        |    2 +-
 utils/nslcd.py         |    2 +-
 9 files changed, 108 insertions(+), 24 deletions(-)
 create mode 100644 m4/ax_python_module.m4


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/