if (!err && !in_identity ) { err = check_error (KIM_NULL_PARAMETER_ERR); }
if (!err && !out_password) { err = check_error (KIM_NULL_PARAMETER_ERR); }
- /* Short circuit if password saving is disabled */
+ if (!err && !kim_library_allow_home_directory_access ()) {
+ err = check_error (ENOENT); /* simulate no password found */
+ }
+
if (!err && !kim_os_identity_allow_save_password ()) {
err = kim_os_identity_remove_saved_password (in_identity);
if (!err) {
- /* simulate no password found */
- err = check_error (ENOENT);
+ err = check_error (ENOENT); /* simulate no password found */
}
}
err = kim_string_create_from_buffer (out_password, buffer, length);
}
- if (name ) { kim_string_free (&name); }
- if (realm ) { kim_string_free (&realm); }
+ kim_string_free (&name);
+ kim_string_free (&realm);
if (buffer) { SecKeychainItemFreeContent (NULL, buffer); }
return check_error (err);
if (!err && !in_identity) { err = check_error (KIM_NULL_PARAMETER_ERR); }
if (!err && !in_password) { err = check_error (KIM_NULL_PARAMETER_ERR); }
- /* Short circuit if password saving is disabled */
+ if (!err && !kim_library_allow_home_directory_access ()) {
+ return KIM_NO_ERROR; /* simulate no error */
+ }
+
if (!err && !kim_os_identity_allow_save_password ()) {
return kim_os_identity_remove_saved_password (in_identity);
}
UInt32 namelen = strlen (name);
UInt32 realmlen = strlen (realm);
- // Add the password to the keychain
+ /* Add the password to the keychain */
err = SecKeychainAddGenericPassword (nil,
realmlen, realm,
namelen, name,
&itemRef);
if (err == errSecDuplicateItem) {
- // We've already stored a password for this principal
- // but it might have changed so update it
+ /* We've already stored a password for this principal
+ * but it might have changed so update it */
void *buffer = NULL;
UInt32 length = 0;
}
} else if (!err) {
- // We added a new entry, add a descriptive label
+ /* We added a new entry, add a descriptive label */
SecKeychainAttributeList *copiedAttrs = NULL;
SecKeychainAttributeInfo attrInfo;
UInt32 tag = 7;
if (itemRef) { CFRelease (itemRef); }
}
- if (name ) { kim_string_free (&name); }
- if (realm) { kim_string_free (&realm); }
+ kim_string_free (&name);
+ kim_string_free (&realm);
return check_error (err);
}
if (!err && !in_identity) { err = check_error (KIM_NULL_PARAMETER_ERR); }
+ if (!err && !kim_library_allow_home_directory_access ()) {
+ return KIM_NO_ERROR; /* simulate no error */
+ }
+
if (!err) {
err = kim_identity_get_components_string (in_identity, &name);
}
if (itemRef) { CFRelease (itemRef); }
}
- if (name ) { kim_string_free (&name); }
- if (realm) { kim_string_free (&realm); }
+ kim_string_free (&name);
+ kim_string_free (&realm);
return check_error (err);
}