]> git.saurik.com Git - apple/security.git/blobdiff - OSX/libsecurity_keychain/lib/SecPassword.cpp
Security-58286.20.16.tar.gz
[apple/security.git] / OSX / libsecurity_keychain / lib / SecPassword.cpp
index c5989d05be1732f5ee7a8642f7c642cbb3b652d7..6ac71ed4a4cd47b4857119da4dcad84a2156914a 100644 (file)
@@ -30,6 +30,8 @@
 #include <Security/Authorization.h>
 #include <Security/AuthorizationTagsPriv.h>
 
+#include <os/activity.h>
+
 #if 0
 static CFTypeID
 SecPasswordGetTypeID(void)
@@ -46,6 +48,9 @@ OSStatus
 SecGenericPasswordCreate(SecKeychainAttributeList *searchAttrList, SecKeychainAttributeList *itemAttrList, SecPasswordRef *itemRef)
 {
     BEGIN_SECAPI
+    os_activity_t activity = os_activity_create("SecGenericPasswordCreate", OS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_IF_NONE_PRESENT);
+    os_activity_scope(activity);
+    os_release(activity);
     KCThrowParamErrIf_( (itemRef == NULL) );
     KCThrowParamErrIf_( (searchAttrList == NULL) ^ (itemAttrList == NULL) ); // Both or neither
     
@@ -60,6 +65,9 @@ OSStatus
 SecPasswordSetInitialAccess(SecPasswordRef itemRef, SecAccessRef accessRef)
 {
        BEGIN_SECAPI
+    os_activity_t activity = os_activity_create("SecPasswordSetInitialAccess", OS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_IF_NONE_PRESENT);
+    os_activity_scope(activity);
+    os_release(activity);
        PasswordImpl::required(itemRef)->setAccess(Access::required(accessRef));
        END_SECAPI
 }
@@ -68,6 +76,9 @@ OSStatus
 SecPasswordAction(SecPasswordRef itemRef, CFTypeRef message, UInt32 flags, UInt32 *length, const void **data)
 {
     BEGIN_SECAPI
+    os_activity_t activity = os_activity_create("SecPasswordAction", OS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_IF_NONE_PRESENT);
+    os_activity_scope(activity);
+    os_release(activity);
 
     Password passwordRef = PasswordImpl::required(itemRef);
     
@@ -179,7 +190,7 @@ SecPasswordAction(SecPasswordRef itemRef, CFTypeRef message, UInt32 flags, UInt3
                                             
         AuthorizationItemSet envSet = { sizeof(envRights) / sizeof(*envRights), envRights };
 
-           secdebug("SecPassword", "dialog(%s)%s%s%s.", right.name, tries?" retry":"", keychain?" show-add-keychain":"", addToKeychain?" save-to-keychain":"");
+           secinfo("SecPassword", "dialog(%s)%s%s%s.", right.name, tries?" retry":"", keychain?" show-add-keychain":"", addToKeychain?" save-to-keychain":"");
 
         status = AuthorizationCopyRights(authRef, &rightSet, &envSet, kAuthorizationFlagDefaults|kAuthorizationFlagInteractionAllowed|kAuthorizationFlagExtendRights, NULL);
         
@@ -224,19 +235,21 @@ SecPasswordAction(SecPasswordRef itemRef, CFTypeRef message, UInt32 flags, UInt3
                     if (data) 
                         *data = passwordData;
                                                
-                                       secdebug("SecPassword", "Got password (%u,%p).", (unsigned int)passwordLength, passwordData);
+                                       secinfo("SecPassword", "Got password (%u,%p).", (unsigned int)passwordLength, passwordData);
                 }
                 else if (!strcmp(AGENT_ADD_TO_KEYCHAIN, item.name))
                 {
                     bool remember = (item.value && item.valueLength == strlen("YES") && !memcmp("YES", static_cast<char *>(item.value), item.valueLength));
                                        passwordRef->setRememberInKeychain(remember);
                                        if (remember)
-                                               secdebug("SecPassword", "User wants to add the password to the Keychain.");
+                                               secinfo("SecPassword", "User wants to add the password to the Keychain.");
                 }
             }
         }
-        
-        AuthorizationFreeItemSet(returnedInfo);
+
+        if(returnedInfo) {
+            AuthorizationFreeItemSet(returnedInfo);
+        }
         AuthorizationFree(authRef, 0);
         
     }