]> git.saurik.com Git - apple/security.git/blobdiff - OSX/authd/authtoken.c
Security-57740.1.18.tar.gz
[apple/security.git] / OSX / authd / authtoken.c
index 51f93105570d0da48975b26db8bec619e15c01f3..6f123e6f7bed7f3d4a6043f8cf4674a51867091f 100644 (file)
@@ -292,13 +292,15 @@ auth_token_least_privileged(auth_token_t auth)
 uid_t
 auth_token_get_uid(auth_token_t auth)
 {
-    return auth ? auth->auditInfo.euid : (uid_t)-2;
+    assert(auth); // marked non-null
+    return auth->auditInfo.euid;
 }
 
 pid_t
 auth_token_get_pid(auth_token_t auth)
 {
-    return auth ? auth->auditInfo.pid : -1;
+    assert(auth); // marked non-null
+    return auth->auditInfo.pid;
 }
 
 session_t
@@ -479,14 +481,13 @@ auth_token_apple_signed(auth_token_t auth)
 
 bool auth_token_is_creator(auth_token_t auth, process_t proc)
 {
+    assert(proc); // marked non-null
     __block bool creator = false;
-    if (proc) {
-        dispatch_sync(auth->dispatch_queue, ^{
-            if (auth->creator == proc) {
-                creator = true;
-            }
-        });
-    }
+    dispatch_sync(auth->dispatch_queue, ^{
+        if (auth->creator == proc) {
+            creator = true;
+        }
+    });
     return creator;
 }