diff options
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/netapi/joindomain.c | 40 | ||||
-rw-r--r-- | source3/lib/netapi/user.c | 19 |
2 files changed, 53 insertions, 6 deletions
diff --git a/source3/lib/netapi/joindomain.c b/source3/lib/netapi/joindomain.c index 6bae363b14..edc45efe9e 100644 --- a/source3/lib/netapi/joindomain.c +++ b/source3/lib/netapi/joindomain.c @@ -113,6 +113,7 @@ WERROR NetJoinDomain_r(struct libnetapi_ctx *ctx, WERROR werr; unsigned int old_timeout = 0; struct dcerpc_binding_handle *b; + DATA_BLOB session_key; werr = libnetapi_open_pipe(ctx, r->in.server, &ndr_table_wkssvc.syntax_id, @@ -124,9 +125,16 @@ WERROR NetJoinDomain_r(struct libnetapi_ctx *ctx, b = pipe_cli->binding_handle; if (r->in.password) { + + status = cli_get_session_key(ctx, pipe_cli, &session_key); + if (!NT_STATUS_IS_OK(status)) { + werr = ntstatus_to_werror(status); + goto done; + } + encode_wkssvc_join_password_buffer(ctx, r->in.password, - &pipe_cli->auth->user_session_key, + &session_key, &encrypted_password); } @@ -246,6 +254,7 @@ WERROR NetUnjoinDomain_r(struct libnetapi_ctx *ctx, WERROR werr; unsigned int old_timeout = 0; struct dcerpc_binding_handle *b; + DATA_BLOB session_key; werr = libnetapi_open_pipe(ctx, r->in.server_name, &ndr_table_wkssvc.syntax_id, @@ -257,9 +266,16 @@ WERROR NetUnjoinDomain_r(struct libnetapi_ctx *ctx, b = pipe_cli->binding_handle; if (r->in.password) { + + status = cli_get_session_key(ctx, pipe_cli, &session_key); + if (!NT_STATUS_IS_OK(status)) { + werr = ntstatus_to_werror(status); + goto done; + } + encode_wkssvc_join_password_buffer(ctx, r->in.password, - &pipe_cli->auth->user_session_key, + &session_key, &encrypted_password); } @@ -436,6 +452,7 @@ WERROR NetGetJoinableOUs_r(struct libnetapi_ctx *ctx, NTSTATUS status; WERROR werr; struct dcerpc_binding_handle *b; + DATA_BLOB session_key; werr = libnetapi_open_pipe(ctx, r->in.server_name, &ndr_table_wkssvc.syntax_id, @@ -447,9 +464,16 @@ WERROR NetGetJoinableOUs_r(struct libnetapi_ctx *ctx, b = pipe_cli->binding_handle; if (r->in.password) { + + status = cli_get_session_key(ctx, pipe_cli, &session_key); + if (!NT_STATUS_IS_OK(status)) { + werr = ntstatus_to_werror(status); + goto done; + } + encode_wkssvc_join_password_buffer(ctx, r->in.password, - &pipe_cli->auth->user_session_key, + &session_key, &encrypted_password); } @@ -481,6 +505,7 @@ WERROR NetRenameMachineInDomain_r(struct libnetapi_ctx *ctx, NTSTATUS status; WERROR werr; struct dcerpc_binding_handle *b; + DATA_BLOB session_key; werr = libnetapi_open_pipe(ctx, r->in.server_name, &ndr_table_wkssvc.syntax_id, @@ -492,9 +517,16 @@ WERROR NetRenameMachineInDomain_r(struct libnetapi_ctx *ctx, b = pipe_cli->binding_handle; if (r->in.password) { + + status = cli_get_session_key(ctx, pipe_cli, &session_key); + if (!NT_STATUS_IS_OK(status)) { + werr = ntstatus_to_werror(status); + goto done; + } + encode_wkssvc_join_password_buffer(ctx, r->in.password, - &pipe_cli->auth->user_session_key, + &session_key, &encrypted_password); } diff --git a/source3/lib/netapi/user.c b/source3/lib/netapi/user.c index 51a093441f..29f609d7bc 100644 --- a/source3/lib/netapi/user.c +++ b/source3/lib/netapi/user.c @@ -29,6 +29,7 @@ #include "rpc_client/init_lsa.h" #include "../libcli/security/security.h" #include "../libds/common/flag_mapping.h" +#include "rpc_client/cli_pipe.h" /**************************************************************** ****************************************************************/ @@ -377,6 +378,7 @@ WERROR NetUserAdd_r(struct libnetapi_ctx *ctx, uint32_t rid = 0; struct USER_INFO_X uX; struct dcerpc_binding_handle *b = NULL; + DATA_BLOB session_key; ZERO_STRUCT(connect_handle); ZERO_STRUCT(domain_handle); @@ -481,10 +483,16 @@ WERROR NetUserAdd_r(struct libnetapi_ctx *ctx, goto done; } + status = cli_get_session_key(ctx, pipe_cli, &session_key); + if (!NT_STATUS_IS_OK(status)) { + werr = ntstatus_to_werror(status); + goto done; + } + uX.usriX_flags |= ACB_NORMAL; status = set_user_info_USER_INFO_X(ctx, pipe_cli, - &pipe_cli->auth->user_session_key, + &session_key, &user_handle, &uX); if (!NT_STATUS_IS_OK(status)) { @@ -1850,6 +1858,7 @@ WERROR NetUserSetInfo_r(struct libnetapi_ctx *ctx, struct USER_INFO_X uX; struct dcerpc_binding_handle *b = NULL; + DATA_BLOB session_key; ZERO_STRUCT(connect_handle); ZERO_STRUCT(domain_handle); @@ -1980,8 +1989,14 @@ WERROR NetUserSetInfo_r(struct libnetapi_ctx *ctx, goto done; } + status = cli_get_session_key(ctx, pipe_cli, &session_key); + if (!NT_STATUS_IS_OK(status)) { + werr = ntstatus_to_werror(status); + goto done; + } + status = set_user_info_USER_INFO_X(ctx, pipe_cli, - &pipe_cli->auth->user_session_key, + &session_key, &user_handle, &uX); if (!NT_STATUS_IS_OK(status)) { |