mirror of
https://github.com/samba-team/samba.git
synced 2025-12-06 16:23:49 +03:00
s3:libsmb: make use of proper allocated struct user_auth_info in SMBC_opendir_ctx()
We should avoid to dereference struct user_auth_info. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
committed by
Jeremy Allison
parent
87c3ff0f3b
commit
30013efe39
@@ -464,7 +464,7 @@ SMBC_opendir_ctx(SMBCCTX *context,
|
||||
int max_lmb_count;
|
||||
struct sockaddr_storage *ip_list;
|
||||
struct sockaddr_storage server_addr;
|
||||
struct user_auth_info u_info;
|
||||
struct user_auth_info *u_info;
|
||||
NTSTATUS status;
|
||||
|
||||
if (share[0] != (char)0 || path[0] != (char)0) {
|
||||
@@ -483,17 +483,12 @@ SMBC_opendir_ctx(SMBCCTX *context,
|
||||
? INT_MAX
|
||||
: smbc_getOptionBrowseMaxLmbCount(context));
|
||||
|
||||
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);
|
||||
u_info = user_auth_info_init(frame);
|
||||
if (u_info == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
set_cmdline_auth_info_username(u_info, user);
|
||||
set_cmdline_auth_info_password(u_info, password);
|
||||
|
||||
/*
|
||||
* We have server and share and path empty but options
|
||||
@@ -550,7 +545,7 @@ SMBC_opendir_ctx(SMBCCTX *context,
|
||||
|
||||
cli = get_ipc_connect_master_ip(talloc_tos(),
|
||||
&ip_list[i],
|
||||
&u_info,
|
||||
u_info,
|
||||
&wg_ptr);
|
||||
/* cli == NULL is the master browser refused to talk or
|
||||
could not be found */
|
||||
|
||||
Reference in New Issue
Block a user