lists.arthurdejong.org
RSS feed

nss-pam-ldapd branch master updated. 0.9.7-1-ga3da150

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

nss-pam-ldapd branch master updated. 0.9.7-1-ga3da150



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  a3da150a81ebe23b59d6cbc4f2899cc50cd81225 (commit)
      from  c286bb51ea052cc8b27ee034cd1e67999a746e91 (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=a3da150a81ebe23b59d6cbc4f2899cc50cd81225

commit a3da150a81ebe23b59d6cbc4f2899cc50cd81225
Author: Arthur de Jong <arthur@arthurdejong.org>
Date:   Tue Aug 30 18:48:03 2016 +0200

    Replace Python assertions with exceptions
    
    The assertions can be optimised out when compiling the modules with -O
    which would break the protocol handling. This ensures that errors are
    properly handled even if optimisation is enabled.
    
    Thanks Yu-Chun Huang for reporting this.
    https://github.com/arthurdejong/nss-pam-ldapd/issues/14

diff --git a/utils/nslcd.py b/utils/nslcd.py
index 22d18b7..0ea8257 100644
--- a/utils/nslcd.py
+++ b/utils/nslcd.py
@@ -96,8 +96,11 @@ class NslcdClient(object):
             # flush the stream
             self.fp.flush()
             # read and check response version number
-            assert self.read_int32() == constants.NSLCD_VERSION
-            assert self.read_int32() == self.action
+            if self.read_int32() != constants.NSLCD_VERSION:
+                raise IOError('NSLCD protocol error')
+            if self.read_int32() != self.action:
+                raise IOError('NSLCD protocol error')
+            # reset action to ensure that it is only the first time
             self.action = None
         # get the NSLCD_RESULT_* marker and return it
         return self.read_int32()
@@ -125,7 +128,8 @@ def usermod(username, asroot=False, password=None, 
args=None):
         con.write_string(v)
     con.write_int32(constants.NSLCD_USERMOD_END)
     # read the response
-    assert con.get_response() == constants.NSLCD_RESULT_BEGIN
+    if con.get_response() != constants.NSLCD_RESULT_BEGIN:
+        raise IOError('NSLCD protocol error')
     response = {}
     while True:
         key = con.read_int32()

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

Summary of changes:
 utils/nslcd.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
nss-pam-ldapd
-- 
To unsubscribe send an email to
nss-pam-ldapd-commits-unsubscribe@lists.arthurdejong.org or see
https://lists.arthurdejong.org/nss-pam-ldapd-commits/