diff options
author | Gerald Carter <jerry@samba.org> | 2000-07-14 16:54:07 +0000 |
---|---|---|
committer | Gerald Carter <jerry@samba.org> | 2000-07-14 16:54:07 +0000 |
commit | 02fd5b08b55b8ff60eb9f78d5d61f889d102cad0 (patch) | |
tree | bef82eaea92d19fce12c7b6fe3081f1309842a06 /source3/lib | |
parent | 7a88bb6baab1762798fcf4b6d1a17c59e5d98f83 (diff) | |
download | samba-02fd5b08b55b8ff60eb9f78d5d61f889d102cad0.tar.gz samba-02fd5b08b55b8ff60eb9f78d5d61f889d102cad0.tar.bz2 samba-02fd5b08b55b8ff60eb9f78d5d61f889d102cad0.zip |
Fixed a bug in cmd_interp.c where if user%pass was entered on
the command line, the password would still be cached in memory
in plain text for the lifetime of the rpcclient command line session.
removed loopback connection functions from msrpc-client.c since
we don't support that in the server code now anyways. simplify,
simplify, ...
--jerry
(This used to be commit 8599e1bc394b1caee2483ec72d439a34d3f30629)
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/cmd_interp.c | 11 | ||||
-rw-r--r-- | source3/lib/msrpc-client.c | 198 |
2 files changed, 3 insertions, 206 deletions
diff --git a/source3/lib/cmd_interp.c b/source3/lib/cmd_interp.c index 5dbb4f9074..201a244385 100644 --- a/source3/lib/cmd_interp.c +++ b/source3/lib/cmd_interp.c @@ -1011,13 +1011,7 @@ static uint32 cmd_set(struct client_info *info, int argc, char *argv[]) *lp = 0; pstrcpy(password, lp + 1); cmd_set_options |= CMD_PASS; - memset(strchr(optarg, '%') + 1, 'X', - strlen(password)); - } - if (usr.ntc.user_name[0] == 0 - && password[0] == 0) - { - cmd_set_options |= CMD_NOPW; + memset(lp+1, 'X', strlen(password)); } break; } @@ -1195,7 +1189,8 @@ static uint32 cmd_set(struct client_info *info, int argc, char *argv[]) { report(out_hnd, "FAILED\n"); } - usr_creds = NULL; + /* ???? --jerry + usr_creds = NULL; */ } if (cmd_str != NULL) { diff --git a/source3/lib/msrpc-client.c b/source3/lib/msrpc-client.c index 8d7efb6fb9..60924ed81c 100644 --- a/source3/lib/msrpc-client.c +++ b/source3/lib/msrpc-client.c @@ -27,29 +27,6 @@ extern int DEBUGLEVEL; /**************************************************************************** -open the msrpcent sockets -****************************************************************************/ -static BOOL ncalrpc_l_connect(struct msrpc_local *msrpc, const char *pipe_name) -{ - fstring path; - fstring pname; - fstrcpy(pname, pipe_name); - strlower(pname); - slprintf(path, sizeof(path) - 1, "%s/.msrpc/%s", LOCKDIR, pname); - - fstrcpy(msrpc->pipe_name, pipe_name); - - msrpc->fd = open_pipe_sock(path); - - if (msrpc->fd == -1) - { - return False; - } - - return True; -} - -/**************************************************************************** read an msrpc pdu from a fd. The timeout is in milliseconds. ****************************************************************************/ @@ -153,136 +130,6 @@ BOOL msrpc_receive(int fd, prs_struct *ps) } /**************************************************************************** -close the socket descriptor -****************************************************************************/ -static void ncalrpc_l_close_socket(struct msrpc_local *msrpc) -{ - if (msrpc->fd != -1) - { - close(msrpc->fd); - } - msrpc->fd = -1; -} - -static BOOL ncalrpc_l_authenticate(struct msrpc_local *msrpc) -{ - int sock = msrpc->fd; - uint32 len; - char *data; - prs_struct ps; - uint32 status; - - uint16 command; - - command = AGENT_CMD_CON; - - if (!create_user_creds(&ps, msrpc->pipe_name, 0x0, command, - msrpc->nt.key.pid, NULL)) - { - DEBUG(0, ("could not parse credentials\n")); - close(sock); - return False; - } - - len = ps.data_offset; - data = prs_data(&ps, 0); - - SIVAL(data, 0, len); - -#ifdef DEBUG_PASSWORD - DEBUG(100, ("data len: %d\n", len)); - dump_data(100, data, len); -#endif - - if (write_socket(sock, data, len) <= 0) - { - DEBUG(0, ("write failed\n")); - return False; - } - len = read_data(sock, (char*)&status, sizeof(status)); - - return len == sizeof(status) && status == 0x0; -} - - -/**************************************************************************** -shutdown a msrpcent structure -****************************************************************************/ -void ncalrpc_l_shutdown(struct msrpc_local *msrpc) -{ - DEBUG(10, ("msrpc_shutdown\n")); - if (msrpc->outbuf) - { - free(msrpc->outbuf); - } - if (msrpc->inbuf) - { - free(msrpc->inbuf); - } - ncalrpc_l_close_socket(msrpc); - memset(msrpc, 0, sizeof(*msrpc)); -} - -/**************************************************************************** -initialise a msrpcent structure -****************************************************************************/ -struct msrpc_local *ncalrpc_l_initialise(struct msrpc_local *msrpc, - const vuser_key * key) -{ - if (!msrpc) - { - msrpc = (struct msrpc_local *)malloc(sizeof(*msrpc)); - if (!msrpc) - return NULL; - ZERO_STRUCTP(msrpc); - } - - if (msrpc->initialised) - { - ncalrpc_l_shutdown(msrpc); - } - - ZERO_STRUCTP(msrpc); - - msrpc->fd = -1; - msrpc->outbuf = (char *)malloc(CLI_BUFFER_SIZE + 4); - msrpc->inbuf = (char *)malloc(CLI_BUFFER_SIZE + 4); - if (!msrpc->outbuf || !msrpc->inbuf) - { - return False; - } - - msrpc->initialised = 1; - - if (key != NULL) - { - msrpc->nt.key = *key; - } - else - { - NET_USER_INFO_3 usr; -#if 0 - uid_t uid = getuid(); - gid_t gid = getgid(); - char *name = uidtoname(uid); -#endif - - ZERO_STRUCT(usr); - - msrpc->nt.key.pid = sys_getpid(); - -#if 0 /* comment ou by JERRY */ - msrpc->nt.key.vuid = register_vuid(msrpc->nt.key.pid, - uid, gid, - name, name, False, &usr); -#endif /* comment ou by JERRY */ - } - - return msrpc; -} - - -/**************************************************************************** open the msrpcent sockets ****************************************************************************/ BOOL msrpc_connect(struct msrpc_state *msrpc, const char *pipe_name) @@ -554,48 +401,3 @@ BOOL msrpc_establish_connection(struct msrpc_state *msrpc, return True; } -/**************************************************************************** -establishes a connection right up to doing tconX, reading in a password. -****************************************************************************/ -BOOL ncalrpc_l_establish_connection(struct msrpc_local *msrpc, - const char *pipe_name) -{ - if (strnequal("\\PIPE\\", pipe_name, 6)) - { - pipe_name = &pipe_name[6]; - } - - DEBUG(5, ("ncalrpc_l_establish_connection: connecting to %s\n", - pipe_name)); - - /* establish connection */ - - if (!msrpc->initialised) - { - return False; - } - - if (msrpc->fd == -1) - { - if (!ncalrpc_l_connect(msrpc, pipe_name)) - { - DEBUG(1, - ("ncalrpc_l_establish_connection: failed %s)\n", - pipe_name)); - - return False; - } - } - - if (!ncalrpc_l_authenticate(msrpc)) - { - DEBUG(0, ("authenticate failed\n")); - close(msrpc->fd); - msrpc->fd = -1; - return False; - } - - return True; -} - - |