Re: [PATCH] contrib: add a credential helper for Mac OS X's keychain
- From
John Szakmeister <john@szakmeister.net>
- Date
- Sep 14, 2011, 08:01 UTC
- Message-ID
- <CAEBDL5UprYM0=SgNQrsY8_aCGf+pxKc1NP0AFjJy8igzt3vDZQ@mail.gmail.com>
- In-Reply-To
- <1315683874-95583-1-git-send-email-jaysoffian@gmail.com>
On Sat, Sep 10, 2011 at 3:44 PM, Jay Soffian <jaysoffian@gmail.com> wrote:
Show 9 quoted lines
> A credential helper which uses /usr/bin/security to add, search, > and remove entries from the Mac OS X keychain. > > Tested with 10.6.8. > > Signed-off-by: Jay Soffian <jaysoffian@gmail.com> > --- > This is a quick script to explore the new credential API. A more robust > implementation would be to link to OS X's Security framework from C.
[snip]
Show 6 quoted lines
> +def add_internet_password(protocol, hostname, username, password): > + # We do this over a pipe so that we can provide the password more > + # securely than as an argument which would show up in ps output. > + # Unfortunately this is possibly less robust since the security man > + # page does not document how to quote arguments. Emprically it seems > + # that using the double-quote, escaping \ and " works properly.
I'm not sure this comment is correct... it looks like you're passing the password on the command line...
Show 8 quoted lines
> + username = username.replace('\\', '\\\\').replace('"', '\\"')
> + password = password.replace('\\', '\\\\').replace('"', '\\"')
> + command = ' '.join([
> + 'add-internet-password', '-U',
> + '-r', protocol,
> + '-s', hostname,
> + '-a "%s"' % username,
> + '-w "%s"' % password,...right here. :-(
-John