diff options
author | Robert Collins <rbtcollins@hotmail.com> | 2002-01-15 17:29:10 +0300 |
---|---|---|
committer | Robert Collins <rbtcollins@hotmail.com> | 2002-01-15 17:29:10 +0300 |
commit | bd342571ef1890936baeae9cc38c5b32f7fda5a3 (patch) | |
tree | ec3265eea4b1c53d30e5cd0d69de35cd0486764e /winsup | |
parent | 8e03995af57e82c17d169188867b43a57018a11e (diff) |
2002-01-16 Robert Collins <rbtcollins@hotmail.com>
* cygserver.cc (transport): Correct scope.
(client_request_attach_tty::serve): Add more debug information.
Fix erroneous use of transport instead of conn.
* cygserver_transport_pipes.cc (transport_layer_pipes::close): More debug.
(transport_layer_pipes::read): Ditto.
(transport_layer_pipes::write): Ditto.
(transport_layer_pipes::impersonate_client): Ditto.
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/cygwin/ChangeLog | 10 | ||||
-rwxr-xr-x | winsup/cygwin/cygserver.cc | 13 | ||||
-rwxr-xr-x | winsup/cygwin/cygserver_transport_pipes.cc | 14 |
3 files changed, 30 insertions, 7 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 362f54e34..41148a2a7 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,13 @@ +2002-01-16 Robert Collins <rbtcollins@hotmail.com> + + * cygserver.cc (transport): Correct scope. + (client_request_attach_tty::serve): Add more debug information. + Fix erroneous use of transport instead of conn. + * cygserver_transport_pipes.cc (transport_layer_pipes::close): More debug. + (transport_layer_pipes::read): Ditto. + (transport_layer_pipes::write): Ditto. + (transport_layer_pipes::impersonate_client): Ditto. + Mon Oct 8 7:41:00 2001 Robert Collins <rbtcollins@hotmail.com> * cygserver.cc (server_request::process): Rename client_request_shm_get to diff --git a/winsup/cygwin/cygserver.cc b/winsup/cygwin/cygserver.cc index 24a90dc20..343b0960d 100755 --- a/winsup/cygwin/cygserver.cc +++ b/winsup/cygwin/cygserver.cc @@ -36,7 +36,7 @@ #define debug_printf if (DEBUG) printf GENERIC_MAPPING access_mapping; -class transport_layer_base *transport; +static class transport_layer_base *transport; DWORD request_count = 0; @@ -187,12 +187,14 @@ client_request_attach_tty::serve(transport_layer_base *conn, class process_cache } #if DEBUG - printf ("%ld:(%p,%p) -> %ld\n", req.master_pid, + printf ("pid %ld:(%p,%p) -> pid %ld\n", req.master_pid, req.from_master, req.to_master, req.pid); #endif + debug_printf ("opening process %ld\n", req.master_pid); from_process_handle = OpenProcess (PROCESS_DUP_HANDLE, FALSE, req.master_pid); + debug_printf ("opening process %ld\n", req.pid); to_process_handle = OpenProcess (PROCESS_DUP_HANDLE, FALSE, req.pid); if (!from_process_handle || !to_process_handle) { @@ -201,14 +203,17 @@ client_request_attach_tty::serve(transport_layer_base *conn, class process_cache goto out; } - transport->impersonate_client (); + debug_printf ("Impersonating client\n"); + conn->impersonate_client (); + debug_printf ("about to open thread token\n"); rc = OpenThreadToken (GetCurrentThread (), TOKEN_QUERY, TRUE, &token_handle); - transport->revert_to_self (); + debug_printf ("opened thread token, rc=%lu\n", rc); + conn->revert_to_self (); if (!rc) { diff --git a/winsup/cygwin/cygserver_transport_pipes.cc b/winsup/cygwin/cygserver_transport_pipes.cc index d9accce1e..5b5a017c9 100755 --- a/winsup/cygwin/cygserver_transport_pipes.cc +++ b/winsup/cygwin/cygserver_transport_pipes.cc @@ -104,6 +104,7 @@ transport_layer_pipes::accept () void transport_layer_pipes::close() { + debug_printf ("closing pipe %p\n", pipe); if (pipe && pipe != INVALID_HANDLE_VALUE) { FlushFileBuffers (pipe); @@ -115,11 +116,12 @@ transport_layer_pipes::close() ssize_t transport_layer_pipes::read (char *buf, size_t len) { - DWORD bytes_read, rc; + debug_printf ("reading from pipe %p\n", pipe); if (!pipe || pipe == INVALID_HANDLE_VALUE) return -1; - rc = ReadFile (pipe, buf, len, &bytes_read, NULL); + DWORD bytes_read; + DWORD rc = ReadFile (pipe, buf, len, &bytes_read, NULL); if (!rc) { debug_printf ("error reading from pipe (%lu)\n", GetLastError ()); @@ -131,6 +133,7 @@ transport_layer_pipes::read (char *buf, size_t len) ssize_t transport_layer_pipes::write (char *buf, size_t len) { + debug_printf ("writing to pipe %p\n", pipe); DWORD bytes_written, rc; if (!pipe || pipe == INVALID_HANDLE_VALUE) return -1; @@ -183,8 +186,13 @@ transport_layer_pipes::connect () void transport_layer_pipes::impersonate_client () { + debug_printf ("impersonating pipe %p\n", pipe); if (pipe && pipe != INVALID_HANDLE_VALUE) - ImpersonateNamedPipeClient (pipe); + { + BOOL rv = ImpersonateNamedPipeClient (pipe); + if (!rv) + debug_printf ("Failed to Impersonate the client, (%lu)\n", GetLastError ()); + } debug_printf("I am who you are\n"); } |