Re: CoreWLAN CWKeychainCopyPassword() Linker issue
Re: CoreWLAN CWKeychainCopyPassword() Linker issue
- Subject: Re: CoreWLAN CWKeychainCopyPassword() Linker issue
- From: "Quinn \"The Eskimo!\"" <email@hidden>
- Date: Thu, 20 Dec 2012 08:47:17 +0000
On 19 Dec 2012, at 18:23, vikas jain <email@hidden> wrote:
> I have one more question CWKeychainCopyPassword gives me the password only when I'm running my program as user and not as root. when I run the program as root CWKeychainCopyPassword return's state -25308 user interaction not allowed. I run my program as daemon. Why is that this error occur as root has permission to access the keychain.
First of all you should make sure the password is actually /in/ the System keychain. I'd expect that to be the case for a Wi-Fi password, but it's important to be sure. You can check this using Keychain Utility.
Second, make sure you've unlocked the System keychain. A root process should be able to unlock the System keychain (using SecKeychainUnlock) without any UI but, again, it's important to check that this is working.
Finally, check the ACL on the keychain item. If the ACL denies access to your program, the keychain will try to put up a dialog asking the user whether it's OK. It won't be able to do that for a daemon, and this is the error you'll get.
When dealing with keychain ACLs it's vital that your code is signed. This ensures that your program has a consistent identity from run to run. Without this the code identity changes each time you rebuild the program, meaning the ACL has to change each time as well.
Share and Enjoy
--
Quinn "The Eskimo!" <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden