summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/libnet/libnet.h6
-rw-r--r--source4/libnet/libnet_rpc.c6
-rw-r--r--source4/utils/net/net_join.c4
-rw-r--r--source4/utils/net/net_password.c8
-rw-r--r--source4/utils/net/net_time.c4
-rw-r--r--source4/utils/net/net_user.c6
6 files changed, 10 insertions, 24 deletions
diff --git a/source4/libnet/libnet.h b/source4/libnet/libnet.h
index 0e91853bf1..5fb825df4d 100644
--- a/source4/libnet/libnet.h
+++ b/source4/libnet/libnet.h
@@ -25,11 +25,7 @@ struct libnet_context {
* a client env context
* a user env context
*/
- struct {
- const char *account_name;
- const char *domain_name;
- const char *password;
- } user;
+ struct cli_credentials *credentials;
};
#include "libnet/libnet_passwd.h"
diff --git a/source4/libnet/libnet_rpc.c b/source4/libnet/libnet_rpc.c
index 97660f4eb5..221ccf77ea 100644
--- a/source4/libnet/libnet_rpc.c
+++ b/source4/libnet/libnet_rpc.c
@@ -102,9 +102,9 @@ static NTSTATUS libnet_rpc_connect_standard(struct libnet_context *ctx, TALLOC_C
r->standard.in.dcerpc_iface_uuid,
r->standard.in.dcerpc_iface_version,
lp_netbios_name(),
- ctx->user.domain_name,
- ctx->user.account_name,
- ctx->user.password);
+ cli_credentials_get_domain(ctx->credentials),
+ cli_credentials_get_username(ctx->credentials),
+ cli_credentials_get_password(ctx->credentials));
if (!NT_STATUS_IS_OK(status)) {
r->standard.out.error_string = talloc_asprintf(mem_ctx,
"dcerpc_pipe_connect to pipe %s failed with %s\n",
diff --git a/source4/utils/net/net_join.c b/source4/utils/net/net_join.c
index 3a0a52cab5..212b8270ff 100644
--- a/source4/utils/net/net_join.c
+++ b/source4/utils/net/net_join.c
@@ -61,9 +61,7 @@ int net_join(struct net_context *ctx, int argc, const char **argv)
if (!libnetctx) {
return -1;
}
- libnetctx->user.account_name= cli_credentials_get_username(ctx->credentials);
- libnetctx->user.domain_name = cli_credentials_get_domain(ctx->credentials);
- libnetctx->user.password = cli_credentials_get_password(ctx->credentials);
+ libnetctx->credentials = ctx->credentials;
/* prepare password change */
r.generic.level = LIBNET_JOIN_GENERIC;
diff --git a/source4/utils/net/net_password.c b/source4/utils/net/net_password.c
index a68c0b1c6a..08660fe2a0 100644
--- a/source4/utils/net/net_password.c
+++ b/source4/utils/net/net_password.c
@@ -57,9 +57,7 @@ static int net_password_change(struct net_context *ctx, int argc, const char **a
if (!libnetctx) {
return -1;
}
- libnetctx->user.account_name= cli_credentials_get_username(ctx->credentials);
- libnetctx->user.domain_name = cli_credentials_get_domain(ctx->credentials);
- libnetctx->user.password = cli_credentials_get_password(ctx->credentials);
+ libnetctx->credentials = ctx->credentials;
/* prepare password change */
r.generic.level = LIBNET_CHANGE_PASSWORD_GENERIC;
@@ -134,9 +132,7 @@ static int net_password_set(struct net_context *ctx, int argc, const char **argv
if (!libnetctx) {
return -1;
}
- libnetctx->user.account_name= cli_credentials_get_username(ctx->credentials);
- libnetctx->user.domain_name = cli_credentials_get_domain(ctx->credentials);
- libnetctx->user.password = cli_credentials_get_password(ctx->credentials);
+ libnetctx->credentials = ctx->credentials;
/* prepare password change */
r.generic.level = LIBNET_SET_PASSWORD_GENERIC;
diff --git a/source4/utils/net/net_time.c b/source4/utils/net/net_time.c
index df3b52a4ab..a89f80417c 100644
--- a/source4/utils/net/net_time.c
+++ b/source4/utils/net/net_time.c
@@ -47,9 +47,7 @@ int net_time(struct net_context *ctx, int argc, const char **argv)
if (!libnetctx) {
return -1;
}
- libnetctx->user.account_name= cli_credentials_get_username(ctx->credentials);
- libnetctx->user.domain_name = cli_credentials_get_domain(ctx->credentials);
- libnetctx->user.password = cli_credentials_get_password(ctx->credentials);
+ libnetctx->credentials = ctx->credentials;
/* prepare to get the time */
r.generic.level = LIBNET_REMOTE_TOD_GENERIC;
diff --git a/source4/utils/net/net_user.c b/source4/utils/net/net_user.c
index 82f80b9e60..40e821bf83 100644
--- a/source4/utils/net/net_user.c
+++ b/source4/utils/net/net_user.c
@@ -47,14 +47,12 @@ static int net_user_add(struct net_context *ctx, int argc, const char **argv)
lnet_ctx = libnet_context_init();
if (!lnet_ctx) return -1;
- lnet_ctx->user.domain_name = cli_credentials_get_domain(ctx->credentials);
- lnet_ctx->user.account_name = cli_credentials_get_username(ctx->credentials);
- lnet_ctx->user.password = cli_credentials_get_password(ctx->credentials);
+ lnet_ctx->credentials = ctx->credentials;
/* calling CreateUser function */
r.generic.level = LIBNET_CREATE_USER_GENERIC;
r.generic.in.user_name = user_name;
- r.generic.in.domain_name = lnet_ctx->user.domain_name;
+ r.generic.in.domain_name = cli_credentials_get_domain(lnet_ctx->credentials);
status = libnet_CreateUser(lnet_ctx, ctx->mem_ctx, &r);
if (!NT_STATUS_IS_OK(status)) {