diff options
Diffstat (limited to 'source3/libsmb')
-rw-r--r-- | source3/libsmb/cliconnect.c | 10 | ||||
-rw-r--r-- | source3/libsmb/libsmbclient.c | 19 |
2 files changed, 18 insertions, 11 deletions
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c index 14140811d2..fdf7491d80 100644 --- a/source3/libsmb/cliconnect.c +++ b/source3/libsmb/cliconnect.c @@ -1776,13 +1776,15 @@ NTSTATUS cli_raw_tcon(struct cli_state *cli, struct cli_state *get_ipc_connect(char *server, struct sockaddr_storage *server_ss, - struct user_auth_info *user_info) + const struct user_auth_info *user_info) { struct cli_state *cli; NTSTATUS nt_status; nt_status = cli_full_connection(&cli, NULL, server, server_ss, 0, "IPC$", "IPC", - user_info->username, lp_workgroup(), user_info->password, + user_info->username ? user_info->username : "", + lp_workgroup(), + user_info->password ? user_info->password : "", CLI_FULL_CONNECTION_ANONYMOUS_FALLBACK, Undefined, NULL); if (NT_STATUS_IS_OK(nt_status)) { @@ -1814,7 +1816,7 @@ struct cli_state *get_ipc_connect(char *server, struct cli_state *get_ipc_connect_master_ip(TALLOC_CTX *ctx, struct ip_service *mb_ip, - struct user_auth_info *user_info, + const struct user_auth_info *user_info, char **pp_workgroup_out) { char addr[INET6_ADDRSTRLEN]; @@ -1868,7 +1870,7 @@ struct cli_state *get_ipc_connect_master_ip(TALLOC_CTX *ctx, */ struct cli_state *get_ipc_connect_master_ip_bcast(TALLOC_CTX *ctx, - struct user_auth_info *user_info, + const struct user_auth_info *user_info, char **pp_workgroup_out) { struct ip_service *ip_list; diff --git a/source3/libsmb/libsmbclient.c b/source3/libsmb/libsmbclient.c index b654ea07f0..de2eaa7cfa 100644 --- a/source3/libsmb/libsmbclient.c +++ b/source3/libsmb/libsmbclient.c @@ -2794,8 +2794,17 @@ smbc_opendir_ctx(SMBCCTX *context, ? INT_MAX : context->options.browse_max_lmb_count); - pstrcpy(u_info.username, user); - pstrcpy(u_info.password, password); + memset(&u_info, '\0', sizeof(u_info)); + u_info.username = talloc_strdup(frame,user); + u_info.password = talloc_strdup(frame,password); + if (!u_info.username || !u_info.password) { + if (dir) { + SAFE_FREE(dir->fname); + SAFE_FREE(dir); + } + TALLOC_FREE(frame); + return NULL; + } /* * We have server and share and path empty but options @@ -2912,7 +2921,7 @@ smbc_opendir_ctx(SMBCCTX *context, } TALLOC_FREE(frame); return NULL; - + } /* @@ -3181,19 +3190,15 @@ smbc_closedir_ctx(SMBCCTX *context, if (!context || !context->internal || !context->internal->_initialized) { - errno = EINVAL; TALLOC_FREE(frame); return -1; - } if (!dir || !DLIST_CONTAINS(context->internal->_files, dir)) { - errno = EBADF; TALLOC_FREE(frame); return -1; - } smbc_remove_dir(dir); /* Clean it up */ |