|
-
December 30th, 2003, 05:15 AM
#1
Open remote pipe with specific username and password?
I want to open a named pipe on a remote NT workstation from my own workstation. But the user that I am currently logged in as doesn't exist on the remote workstation. So I want to open the pipe with a particular user name and password that does exist on the remote machine. (Note that there is no domain or directory services to synchronise accounts between the two machines.)
Normally, I connect to a named pipe with CreateFile("\\RemoteMachineName\pipe\pipename", ...). I notice that CreateFile() takes a LPSECURITY_ATTRIBUTES lpSecurityAttributes parameter, which is normally NULL. Can I specify a remote user and password through lpSecurityAttributes? If so, how do I set this up? If not, how else could I do what I want?
-
December 30th, 2003, 07:25 AM
#2
Finally found a solution myself.
If you already have a connection to the remote machine with a particular user name and password, then the pipe will try to use the same user name and password. This can be achieved with 'net use':
Code:
>net use \\server\IPC$ /user:username password
The programmatic way to do this is using the WNetAddConnection2() function. So the full solution is to call WNetAddConnection2() with the required user name and password, then open the pipe in the normal way.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|