OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/mac/authorization_util.h" | 5 #include "base/mac/authorization_util.h" |
6 | 6 |
7 #import <Foundation/Foundation.h> | 7 #import <Foundation/Foundation.h> |
8 #include <sys/wait.h> | 8 #include <sys/wait.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 namespace base { | 22 namespace base { |
23 namespace mac { | 23 namespace mac { |
24 | 24 |
25 AuthorizationRef GetAuthorizationRightsWithPrompt( | 25 AuthorizationRef GetAuthorizationRightsWithPrompt( |
26 AuthorizationRights* rights, | 26 AuthorizationRights* rights, |
27 CFStringRef prompt, | 27 CFStringRef prompt, |
28 AuthorizationFlags extraFlags) { | 28 AuthorizationFlags extraFlags) { |
29 // Create an empty AuthorizationRef. | 29 // Create an empty AuthorizationRef. |
30 ScopedAuthorizationRef authorization; | 30 ScopedAuthorizationRef authorization; |
31 OSStatus status = AuthorizationCreate(NULL, | 31 OSStatus status = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment, |
32 kAuthorizationEmptyEnvironment, | |
33 kAuthorizationFlagDefaults, | 32 kAuthorizationFlagDefaults, |
34 &authorization); | 33 authorization.get_pointer()); |
35 if (status != errAuthorizationSuccess) { | 34 if (status != errAuthorizationSuccess) { |
36 OSSTATUS_LOG(ERROR, status) << "AuthorizationCreate"; | 35 OSSTATUS_LOG(ERROR, status) << "AuthorizationCreate"; |
37 return NULL; | 36 return NULL; |
38 } | 37 } |
39 | 38 |
40 AuthorizationFlags flags = kAuthorizationFlagDefaults | | 39 AuthorizationFlags flags = kAuthorizationFlagDefaults | |
41 kAuthorizationFlagInteractionAllowed | | 40 kAuthorizationFlagInteractionAllowed | |
42 kAuthorizationFlagExtendRights | | 41 kAuthorizationFlagExtendRights | |
43 kAuthorizationFlagPreAuthorize | | 42 kAuthorizationFlagPreAuthorize | |
44 extraFlags; | 43 extraFlags; |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 } | 186 } |
188 } else { | 187 } else { |
189 *exit_status_pointer = -1; | 188 *exit_status_pointer = -1; |
190 } | 189 } |
191 | 190 |
192 return status; | 191 return status; |
193 } | 192 } |
194 | 193 |
195 } // namespace mac | 194 } // namespace mac |
196 } // namespace base | 195 } // namespace base |
OLD | NEW |