OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ipc/ipc_channel_posix.h" | 5 #include "ipc/ipc_channel_posix.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #include <stddef.h> | 9 #include <stddef.h> |
10 #include <sys/types.h> | 10 #include <sys/types.h> |
(...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
931 DCHECK(HasAcceptedConnection()); | 931 DCHECK(HasAcceptedConnection()); |
932 #if defined(OS_MACOSX) | 932 #if defined(OS_MACOSX) |
933 uid_t peer_euid; | 933 uid_t peer_euid; |
934 gid_t peer_gid; | 934 gid_t peer_gid; |
935 if (getpeereid(pipe_, &peer_euid, &peer_gid) != 0) { | 935 if (getpeereid(pipe_, &peer_euid, &peer_gid) != 0) { |
936 PLOG(ERROR) << "getpeereid " << pipe_; | 936 PLOG(ERROR) << "getpeereid " << pipe_; |
937 return false; | 937 return false; |
938 } | 938 } |
939 *client_euid = peer_euid; | 939 *client_euid = peer_euid; |
940 return true; | 940 return true; |
| 941 #elif defined(OS_SOLARIS) |
| 942 return false; |
941 #else | 943 #else |
942 struct ucred cred; | 944 struct ucred cred; |
943 socklen_t cred_len = sizeof(cred); | 945 socklen_t cred_len = sizeof(cred); |
944 if (getsockopt(pipe_, SOL_SOCKET, SO_PEERCRED, &cred, &cred_len) != 0) { | 946 if (getsockopt(pipe_, SOL_SOCKET, SO_PEERCRED, &cred, &cred_len) != 0) { |
945 PLOG(ERROR) << "getsockopt " << pipe_; | 947 PLOG(ERROR) << "getsockopt " << pipe_; |
946 return false; | 948 return false; |
947 } | 949 } |
948 if (cred_len < sizeof(cred)) { | 950 if (cred_len < sizeof(cred)) { |
949 NOTREACHED() << "Truncated ucred from SO_PEERCRED?"; | 951 NOTREACHED() << "Truncated ucred from SO_PEERCRED?"; |
950 return false; | 952 return false; |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1194 | 1196 |
1195 bool Channel::GetClientEuid(uid_t* client_euid) const { | 1197 bool Channel::GetClientEuid(uid_t* client_euid) const { |
1196 return channel_impl_->GetClientEuid(client_euid); | 1198 return channel_impl_->GetClientEuid(client_euid); |
1197 } | 1199 } |
1198 | 1200 |
1199 void Channel::ResetToAcceptingConnectionState() { | 1201 void Channel::ResetToAcceptingConnectionState() { |
1200 channel_impl_->ResetToAcceptingConnectionState(); | 1202 channel_impl_->ResetToAcceptingConnectionState(); |
1201 } | 1203 } |
1202 | 1204 |
1203 } // namespace IPC | 1205 } // namespace IPC |
OLD | NEW |