mirror of
https://github.com/samba-team/samba.git
synced 2025-08-02 00:22:11 +03:00
Robustness-fixes for NetJoinDomain().
Guenther
(This used to be commit 2d5236cc37
)
This commit is contained in:
committed by
Volker Lendecke
parent
1484b1d174
commit
ac512a5bb2
@ -35,6 +35,8 @@ WERROR NetJoinDomain(const char *server_name,
|
|||||||
WERROR werr;
|
WERROR werr;
|
||||||
unsigned int old_timeout;
|
unsigned int old_timeout;
|
||||||
|
|
||||||
|
ZERO_STRUCT(encrypted_password);
|
||||||
|
|
||||||
mem_ctx = talloc_init("NetJoinDomain");
|
mem_ctx = talloc_init("NetJoinDomain");
|
||||||
if (!mem_ctx) {
|
if (!mem_ctx) {
|
||||||
werr = WERR_NOMEM;
|
werr = WERR_NOMEM;
|
||||||
@ -68,10 +70,12 @@ WERROR NetJoinDomain(const char *server_name,
|
|||||||
goto done;
|
goto done;
|
||||||
};
|
};
|
||||||
|
|
||||||
encode_wkssvc_join_password_buffer(mem_ctx,
|
if (password) {
|
||||||
password,
|
encode_wkssvc_join_password_buffer(mem_ctx,
|
||||||
&cli->user_session_key,
|
password,
|
||||||
&encrypted_password);
|
&cli->user_session_key,
|
||||||
|
&encrypted_password);
|
||||||
|
}
|
||||||
|
|
||||||
old_timeout = cli_set_timeout(cli, 60000);
|
old_timeout = cli_set_timeout(cli, 60000);
|
||||||
|
|
||||||
@ -82,13 +86,16 @@ WERROR NetJoinDomain(const char *server_name,
|
|||||||
join_flags);
|
join_flags);
|
||||||
if (!NT_STATUS_IS_OK(status)) {
|
if (!NT_STATUS_IS_OK(status)) {
|
||||||
werr = ntstatus_to_werror(status);
|
werr = ntstatus_to_werror(status);
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
werr = WERR_OK;
|
werr = WERR_OK;
|
||||||
|
|
||||||
done:
|
done:
|
||||||
cli_set_timeout(cli, old_timeout);
|
if (cli) {
|
||||||
cli_shutdown(cli);
|
cli_set_timeout(cli, old_timeout);
|
||||||
|
cli_shutdown(cli);
|
||||||
|
}
|
||||||
TALLOC_FREE(mem_ctx);
|
TALLOC_FREE(mem_ctx);
|
||||||
|
|
||||||
return werr;
|
return werr;
|
||||||
|
Reference in New Issue
Block a user