[debian-edu-commits] debian-edu/upstream/ 56/71: Rewrite how Popen() is used to ensure the script wait for the subprocesses to start before looking for their status (Closes: #634829). Patch from Wolfgang Schulze-Zachau.
Petter Reinholdtsen
pere at moszumanska.debian.org
Mon Jun 9 18:25:40 UTC 2014
This is an automated email from the git hooks/post-receive script.
pere pushed a commit to branch master
in repository libpam-mklocaluser.
commit b0046017294244def7321c9c96d1a748b5e0f834
Author: Petter Reinholdtsen <pere at hungry.com>
Date: Thu Jul 28 14:25:11 2011 +0000
Rewrite how Popen() is used to ensure the script wait for the
subprocesses to start before looking for their status (Closes:
#634829). Patch from Wolfgang Schulze-Zachau.
---
debian/changelog | 5 +++--
debian/pam-python.py | 16 ++++++++++------
2 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 603d6be..066ce14 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,7 +1,8 @@
libpam-mklocaluser (0.7) unstable; urgency=low
- * Avoid Popen() problem by throwing away unused output from
- subprocesses (Closes: #634829).
+ * Rewrite how Popen() is used to ensure the script wait for the
+ subprocesses to start before looking for their status (Closes:
+ #634829). Patch from Wolfgang Schulze-Zachau.
* Update standards-version from 3.9.1 to 3.9.2. No changes needed.
-- Petter Reinholdtsen <pere at debian.org> Tue, 26 Jul 2011 12:48:15 +0200
diff --git a/debian/pam-python.py b/debian/pam-python.py
index 1b14577..6138547 100755
--- a/debian/pam-python.py
+++ b/debian/pam-python.py
@@ -16,10 +16,12 @@ import time
import syslog
def runcmd(pamh, cmd):
- # Throwing away stdout, to avoid crash (race?) reported in #634829
- # Change to stdout=subprocess.PIPE to collect output.
- proc = subprocess.Popen(cmd, shell=True, stdout=None,)
-# output = proc.communicate()[0]
+ proc = subprocess.Popen(cmd, shell=True, stdout=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
def check_and_create_localuser(pamh, user):
@@ -55,8 +57,10 @@ def check_and_create_localuser(pamh, user):
# Ignore users with existing entry in /etc/passwd
cmd = "/bin/grep \"^%s:\" /etc/passwd >/dev/null" % user
- proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE,)
- result = proc.communicate()
+ proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, )
+ while proc.poll() == None:
+ pass
+ result = proc.communicate(input=None)[0]
if proc.returncode == 0:
return pamh.PAM_SUCCESS
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-edu/upstream/libpam-mklocaluser.git
More information about the debian-edu-commits
mailing list