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 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
782 | 782 |
783 ssize_t bytes_written = 1; | 783 ssize_t bytes_written = 1; |
784 int fd_written = -1; | 784 int fd_written = -1; |
785 | 785 |
786 if (message_send_bytes_written_ == 0 && | 786 if (message_send_bytes_written_ == 0 && |
787 !msg->file_descriptor_set()->empty()) { | 787 !msg->file_descriptor_set()->empty()) { |
788 // This is the first chunk of a message which has descriptors to send | 788 // This is the first chunk of a message which has descriptors to send |
789 struct cmsghdr *cmsg; | 789 struct cmsghdr *cmsg; |
790 const unsigned num_fds = msg->file_descriptor_set()->size(); | 790 const unsigned num_fds = msg->file_descriptor_set()->size(); |
791 | 791 |
792 DCHECK_LE(num_fds, FileDescriptorSet::MAX_DESCRIPTORS_PER_MESSAGE); | 792 DCHECK_LE(num_fds, static_cast<unsigned>( |
| 793 FileDescriptorSet::MAX_DESCRIPTORS_PER_MESSAGE)); |
793 if (msg->file_descriptor_set()->ContainsDirectoryDescriptor()) { | 794 if (msg->file_descriptor_set()->ContainsDirectoryDescriptor()) { |
794 LOG(FATAL) << "Panic: attempting to transport directory descriptor over" | 795 LOG(FATAL) << "Panic: attempting to transport directory descriptor over" |
795 " IPC. Aborting to maintain sandbox isolation."; | 796 " IPC. Aborting to maintain sandbox isolation."; |
796 // If you have hit this then something tried to send a file descriptor | 797 // If you have hit this then something tried to send a file descriptor |
797 // to a directory over an IPC channel. Since IPC channels span | 798 // to a directory over an IPC channel. Since IPC channels span |
798 // sandboxes this is very bad: the receiving process can use openat | 799 // sandboxes this is very bad: the receiving process can use openat |
799 // with ".." elements in the path in order to reach the real | 800 // with ".." elements in the path in order to reach the real |
800 // filesystem. | 801 // filesystem. |
801 } | 802 } |
802 | 803 |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1205 void Channel::ResetToAcceptingConnectionState() { | 1206 void Channel::ResetToAcceptingConnectionState() { |
1206 channel_impl_->ResetToAcceptingConnectionState(); | 1207 channel_impl_->ResetToAcceptingConnectionState(); |
1207 } | 1208 } |
1208 | 1209 |
1209 // static | 1210 // static |
1210 bool Channel::IsNamedServerInitialized(const std::string& channel_id) { | 1211 bool Channel::IsNamedServerInitialized(const std::string& channel_id) { |
1211 return ChannelImpl::IsNamedServerInitialized(channel_id); | 1212 return ChannelImpl::IsNamedServerInitialized(channel_id); |
1212 } | 1213 } |
1213 | 1214 |
1214 } // namespace IPC | 1215 } // namespace IPC |
OLD | NEW |