DescriptionInitialize IPC:ChannelHandle from existing HANDLE
1] Add a ctor to IPC:ChannelHandle that takes a pipe HANDLE.
2] Corresponding change in Channel::ChannelImpl::CreatePipe to
attach to the given pipe instead of creating a new one.
Being able to hand over a pipe handle to IPC::Channel in this way has
other advantages such as using anonymous pipes and safer connections
between process with different level of privileges. Here's how it
can be done:
Server Process:
- Create a server pipe, anonymous pipe is fine too.
- Server creates a client handle of pipe using CreateFile.
- Use DuplicateHandle to duplicate this handle for the client process.
- pass over the handle value to the client process, say using comman line.
Client process:
- Simply receive the handle from the server and hand it over to
IPC:Channel using IPC::ChannelHandle.
Apart from being more flexible, this is more secure as it removes
the 'connection window' while using names.
BUG=none
TEST=none
Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=118786
Patch Set 1 #
Total comments: 1
Patch Set 2 : added assignment operator #Patch Set 3 : fixed build error #
Total comments: 8
Patch Set 4 : copy handle instead of duplicate/close #Patch Set 5 : check DuplicateHandle error #Patch Set 6 : added dchecks #
Total comments: 4
Patch Set 7 : added a test #
Total comments: 1
Patch Set 8 : use #elif #
Total comments: 2
Patch Set 9 : return false instead of DCHECK for inconsistent pipe mode #Patch Set 10 : use string16 #
Messages
Total messages: 15 (0 generated)
|