| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 #include <sys/wait.h> | 9 #include <sys/wait.h> |
| 10 | 10 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 // pipe may be NULL, but this function needs one. In that case, use a local | 101 // pipe may be NULL, but this function needs one. In that case, use a local |
| 102 // pipe. | 102 // pipe. |
| 103 FILE* local_pipe; | 103 FILE* local_pipe; |
| 104 FILE** pipe_pointer; | 104 FILE** pipe_pointer; |
| 105 if (pipe) { | 105 if (pipe) { |
| 106 pipe_pointer = pipe; | 106 pipe_pointer = pipe; |
| 107 } else { | 107 } else { |
| 108 pipe_pointer = &local_pipe; | 108 pipe_pointer = &local_pipe; |
| 109 } | 109 } |
| 110 | 110 |
| 111 // Deprecated in OS X 10.7. https://crbug.com/592663. | 111 // AuthorizationExecuteWithPrivileges is deprecated in macOS 10.7, but no good |
| 112 // replacement exists. https://crbug.com/593133. |
| 112 #pragma clang diagnostic push | 113 #pragma clang diagnostic push |
| 113 #pragma clang diagnostic ignored "-Wdeprecated-declarations" | 114 #pragma clang diagnostic ignored "-Wdeprecated-declarations" |
| 114 // AuthorizationExecuteWithPrivileges wants |char* const*| for |arguments|, | 115 // AuthorizationExecuteWithPrivileges wants |char* const*| for |arguments|, |
| 115 // but it doesn't actually modify the arguments, and that type is kind of | 116 // but it doesn't actually modify the arguments, and that type is kind of |
| 116 // silly and callers probably aren't dealing with that. Put the cast here | 117 // silly and callers probably aren't dealing with that. Put the cast here |
| 117 // to make things a little easier on callers. | 118 // to make things a little easier on callers. |
| 118 OSStatus status = AuthorizationExecuteWithPrivileges(authorization, | 119 OSStatus status = AuthorizationExecuteWithPrivileges(authorization, |
| 119 tool_path, | 120 tool_path, |
| 120 options, | 121 options, |
| 121 (char* const*)arguments, | 122 (char* const*)arguments, |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 } | 192 } |
| 192 } else { | 193 } else { |
| 193 *exit_status_pointer = -1; | 194 *exit_status_pointer = -1; |
| 194 } | 195 } |
| 195 | 196 |
| 196 return status; | 197 return status; |
| 197 } | 198 } |
| 198 | 199 |
| 199 } // namespace mac | 200 } // namespace mac |
| 200 } // namespace base | 201 } // namespace base |
| OLD | NEW |