[debian-edu-commits] r79921 - trunk/src/libpam-mklocaluser/debian

pere at alioth.debian.org pere at alioth.debian.org
Sat May 4 09:51:47 UTC 2013


Author: pere
Date: 2013-05-04 09:51:46 +0000 (Sat, 04 May 2013)
New Revision: 79921

Modified:
   trunk/src/libpam-mklocaluser/debian/changelog
   trunk/src/libpam-mklocaluser/debian/pam-python.py
Log:
Rewrite runcmd() to work with Python om Wheezy.

Modified: trunk/src/libpam-mklocaluser/debian/changelog
===================================================================
--- trunk/src/libpam-mklocaluser/debian/changelog	2013-05-04 09:51:01 UTC (rev 79920)
+++ trunk/src/libpam-mklocaluser/debian/changelog	2013-05-04 09:51:46 UTC (rev 79921)
@@ -10,6 +10,7 @@
     more info during testing.
   * Make sure syslog message make it clear that both passwd and shadow
     is updated by the module.
+  * Rewrite runcmd() to work with Python om Wheezy.
 
  -- Petter Reinholdtsen <pere at debian.org>  Sat, 04 May 2013 08:25:53 +0200
 

Modified: trunk/src/libpam-mklocaluser/debian/pam-python.py
===================================================================
--- trunk/src/libpam-mklocaluser/debian/pam-python.py	2013-05-04 09:51:01 UTC (rev 79920)
+++ trunk/src/libpam-mklocaluser/debian/pam-python.py	2013-05-04 09:51:46 UTC (rev 79921)
@@ -27,15 +27,17 @@
     for filename in files:
       os.chown(os.path.join(root, filename), uid, gid)
 
-# FIXME This function always report an error
 def runcmd(pamh, cmd):
-  proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE,)
+  proc = subprocess.Popen(cmd, shell=True, \
+                            stdout=subprocess.PIPE, \
+                            stderr=subprocess.PIPE,)
   while proc.poll() == None:
     pass
-  result = proc.communicate(input=None)[0]
-  if result != 0:
-    syslog.syslog("Command %(command)s failed with %(msg)s" % ( cmd, proc.stderr.read()) )
-#  print "output: %s" % output
+  (resultstdout, resultstderr) = proc.communicate(input=None)
+  if proc.returncode != 0:
+    msg = "Command '%s' failed with %s" % ( cmd, resultstderr.strip())
+    syslog.syslog(msg)
+#    print "output: %s" % msg
 
 def check_and_create_localuser(pamh, user):
   # Location of local users




More information about the debian-edu-commits mailing list