[CalendarServer-changes] [15265] CalendarServer/trunk/bin/keychain_unlock.py

source_changes at macosforge.org source_changes at macosforge.org
Mon Nov 2 10:21:15 PST 2015


Revision: 15265
          http://trac.calendarserver.org//changeset/15265
Author:   cdaboo at apple.com
Date:     2015-11-02 10:21:15 -0800 (Mon, 02 Nov 2015)
Log Message:
-----------
Better way to pass password to security tool.

Modified Paths:
--------------
    CalendarServer/trunk/bin/keychain_unlock.py

Modified: CalendarServer/trunk/bin/keychain_unlock.py
===================================================================
--- CalendarServer/trunk/bin/keychain_unlock.py	2015-11-02 16:14:17 UTC (rev 15264)
+++ CalendarServer/trunk/bin/keychain_unlock.py	2015-11-02 18:21:15 UTC (rev 15265)
@@ -25,7 +25,8 @@
 
     child = Popen(
         args=[
-            "/usr/bin/security", "show-keychain-info",
+            "/usr/bin/security",
+            "show-keychain-info",
             "login.keychain",
         ],
         stdout=PIPE, stderr=STDOUT,
@@ -50,13 +51,11 @@
 
     child = Popen(
         args=[
-            "/usr/bin/security", "unlock-keychain",
-            "-p", password,
-            "login.keychain",
+            "/usr/bin/security", "-i",
         ],
-        stdout=PIPE, stderr=STDOUT,
+        stdin=PIPE, stdout=PIPE, stderr=STDOUT,
     )
-    output, error = child.communicate()
+    output, error = child.communicate("unlock-keychain -p {} login.keychain\n".format(password))
 
     if child.returncode:
         print("Could not unlock login.keychain: {}".format(error if error else output))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20151102/9b8c04d1/attachment-0001.html>


More information about the calendarserver-changes mailing list