{"action":"created","issue":{"url":"https://api.github.com/repos/jaraco/keyring/issues/219","repository_url":"https://api.github.com/repos/jaraco/keyring","labels_url":"https://api.github.com/repos/jaraco/keyring/issues/219/labels{/name}","comments_url":"https://api.github.com/repos/jaraco/keyring/issues/219/comments","events_url":"https://api.github.com/repos/jaraco/keyring/issues/219/events","html_url":"https://github.com/jaraco/keyring/issues/219","id":149388108,"number":219,"title":"Can't fetch password from system","user":{"login":"rgardam","id":857801,"avatar_url":"https://avatars.githubusercontent.com/u/857801?v=3","gravatar_id":"","url":"https://api.github.com/users/rgardam","html_url":"https://github.com/rgardam","followers_url":"https://api.github.com/users/rgardam/followers","following_url":"https://api.github.com/users/rgardam/following{/other_user}","gists_url":"https://api.github.com/users/rgardam/gists{/gist_id}","starred_url":"https://api.github.com/users/rgardam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rgardam/subscriptions","organizations_url":"https://api.github.com/users/rgardam/orgs","repos_url":"https://api.github.com/users/rgardam/repos","events_url":"https://api.github.com/users/rgardam/events{/privacy}","received_events_url":"https://api.github.com/users/rgardam/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/jaraco/keyring/labels/invalid","name":"invalid","color":"e6e6e6"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":13,"created_at":"2016-04-19T08:37:17Z","updated_at":"2016-07-15T19:53:17Z","closed_at":"2016-05-26T14:29:35Z","body":"I am seeing this error on Yosemite (10.10.5 (14F27))\r\n\r\nkeyring.backends._OS_X_API.Error: (-25293, \"Can't fetch password from system\")\r\n\r\nedit: it works if I enable all applications to use the password from the keychain.\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/jaraco/keyring/issues/comments/233054095","html_url":"https://github.com/jaraco/keyring/issues/219#issuecomment-233054095","issue_url":"https://api.github.com/repos/jaraco/keyring/issues/219","id":233054095,"user":{"login":"n8henrie","id":1234956,"avatar_url":"https://avatars.githubusercontent.com/u/1234956?v=3","gravatar_id":"","url":"https://api.github.com/users/n8henrie","html_url":"https://github.com/n8henrie","followers_url":"https://api.github.com/users/n8henrie/followers","following_url":"https://api.github.com/users/n8henrie/following{/other_user}","gists_url":"https://api.github.com/users/n8henrie/gists{/gist_id}","starred_url":"https://api.github.com/users/n8henrie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/n8henrie/subscriptions","organizations_url":"https://api.github.com/users/n8henrie/orgs","repos_url":"https://api.github.com/users/n8henrie/repos","events_url":"https://api.github.com/users/n8henrie/events{/privacy}","received_events_url":"https://api.github.com/users/n8henrie/received_events","type":"User","site_admin":false},"created_at":"2016-07-15T19:53:17Z","updated_at":"2016-07-15T19:53:17Z","body":"I'm still working to get this figured out.\r\n\r\nTo that end, I've made a test keychain credential `keyring_test`, with user: `foo` and pass: `bar`.\r\n\r\nI'm still getting [error 25293 / errSecAuthFailed](https://developer.apple.com/library/mac/documentation/Security/Reference/keychainservices/#//apple_ref/c/econst/errSecAuthFailed) under Python 3.5.2, but I'm able to retrieve the test password under 2.7.12.\r\n\r\nI've simplified the new ctypes OSX API to the following test script:\r\n\r\n```python3\r\nimport ctypes\r\n\r\nsec_path = \"/System/Library/Frameworks/Security.framework/Versions/A/Security\"\r\nkc = ctypes.CDLL(sec_path).SecKeychainFindGenericPassword\r\n\r\nkc.argtypes = (\r\n    ctypes.c_void_p,\r\n    ctypes.c_uint32,\r\n    ctypes.c_char_p,\r\n    ctypes.c_uint32,\r\n    ctypes.c_char_p,\r\n    ctypes.POINTER(ctypes.c_uint32),  # passwordLength\r\n    ctypes.POINTER(ctypes.c_void_p),  # passwordData\r\n    ctypes.POINTER(ctypes.c_void_p),  # itemRef\r\n)\r\n\r\nlength = ctypes.c_uint32()\r\ndata = ctypes.c_void_p()\r\n\r\nkc(None, len(\"keyring_test\"), \"keyring_test\".encode(\"utf-8\"), len(\"foo\"),\r\n        \"foo\".encode(\"utf-8\"), length, data, None,)\r\n\r\npassword = ctypes.create_string_buffer(length.value)\r\nctypes.memmove(password, data.value, length.value)\r\n\r\nprint(password.raw.decode(\"utf-8\"))\r\n```\r\n\r\nInterestingly, I found that I *do* get the popup to \"allow\" and subsequently *can* access it under the following Python versions (with keyring 9.3.1):\r\n\r\n1. python 2.7.12, installed by homebrew\r\n2. python 2.7.9, installed by pyenv\r\n3. either of the above python2, in a virtualenv\r\n\r\n4. python 3.5.1, installed by homebrew (real path `Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/bin/python3.5`)\r\n5. python 3.5.2, installed by pyenv\r\n6. 3.5.2 from homebrew, in a virtualenv created by `virtualenv`\r\n\r\nI am **not** able to get it to work (get the error from above) in the following settings:\r\n\r\n7. python 3.5.2, installed by homebrew (real path `Cellar/python3/3.5.2/Frameworks/Python.framework/Versions/3.5/bin/python3.5`)\r\n8. python 3.5.2 from homebrew, in a virtualenv created by [`pyvenv`](https://docs.python.org/3/using/scripts.html#pyvenv-creating-virtual-environments) using `--symlinks`\r\n9. python 3.5.2 from homebrew, in a virtualenv created by [`pyvenv`](https://docs.python.org/3/using/scripts.html#pyvenv-creating-virtual-environments) using `--copies`\r\n\r\n---\r\n\r\nThis is really confusing at this point. Specifically,\r\n\r\n- I'm surprised that \\#4 works whereas \\#7 doesn't (both homebrew installed, similar path with frameworks, [the python3 formula](https://github.com/Homebrew/homebrew-core/blob/master/Formula/python3.rb) doesn't seem to have crazy changes in the interim)\r\n- I'm surprised that \\#6 works while \\#9 doesn't (at first I thought it was because pyvenv uses symlinks by default, but the `--copies` flag didn't make a difference)\r\n\r\nIt clearly doesn't seem to be a problem with Python, since 3.5.2 from pyenv works, as well as 3.5.2 from homebrew in a virtualenv installed virtualenv (but not a pyvenv installed virtualenv).\r\n\r\nAny other ideas?"}}
{"actor":{"display_login":"n8henrie"}}