summaryrefslogtreecommitdiff
path: root/source4/utils/net/net_password.c
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-04-25 10:04:20 +0100
committerJelmer Vernooij <jelmer@samba.org>2008-04-25 10:04:20 +0100
commitcc9c4aaa8d02c4c31c9e9a4bb53e5941683fcc31 (patch)
treed0b116699dee35372ed335834989e1c885e8f94a /source4/utils/net/net_password.c
parentd1432d617e6ed04c33ca214d7f3b0099bdf53065 (diff)
parent240d959005f5fd80a38b3734b39dd5d6e425a566 (diff)
downloadsamba-cc9c4aaa8d02c4c31c9e9a4bb53e5941683fcc31.tar.gz
samba-cc9c4aaa8d02c4c31c9e9a4bb53e5941683fcc31.tar.bz2
samba-cc9c4aaa8d02c4c31c9e9a4bb53e5941683fcc31.zip
Merge branch 'v4-0-test' of ssh://git.samba.org/data/git/samba into v4-0-gmake3
Conflicts: source/Makefile source/auth/config.mk source/auth/gensec/config.mk source/build/m4/public.m4 source/build/make/python.mk source/build/make/rules.mk source/build/smb_build/header.pm source/build/smb_build/main.pl source/build/smb_build/makefile.pm source/dsdb/config.mk source/dsdb/samdb/ldb_modules/config.mk source/kdc/config.mk source/lib/events/config.mk source/lib/events/events.c source/lib/ldb/config.mk source/lib/nss_wrapper/config.mk source/lib/policy/config.mk source/lib/util/config.mk source/libcli/smb2/config.mk source/libnet/config.mk source/librpc/config.mk source/nbt_server/config.mk source/ntptr/ntptr_base.c source/ntvfs/posix/config.mk source/ntvfs/sysdep/config.mk source/param/config.mk source/rpc_server/config.mk source/rpc_server/service_rpc.c source/scripting/ejs/config.mk source/scripting/python/config.mk source/smb_server/config.mk source/smbd/server.c source/torture/config.mk source/torture/smb2/config.mk source/wrepl_server/config.mk (This used to be commit 13bbd420681519894a4036729c43273912c9b402)
Diffstat (limited to 'source4/utils/net/net_password.c')
-rw-r--r--source4/utils/net/net_password.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/source4/utils/net/net_password.c b/source4/utils/net/net_password.c
index 1fcb772e4c..55f7c3c31d 100644
--- a/source4/utils/net/net_password.c
+++ b/source4/utils/net/net_password.c
@@ -22,6 +22,7 @@
#include "utils/net/net.h"
#include "libnet/libnet.h"
#include "system/filesys.h"
+#include "lib/events/events.h"
#include "auth/credentials/credentials.h"
/*
@@ -46,13 +47,13 @@ static int net_password_change(struct net_context *ctx, int argc, const char **a
if (argc > 0 && argv[0]) {
new_password = argv[0];
} else {
- password_prompt = talloc_asprintf(ctx->mem_ctx, "Enter new password for account [%s\\%s]:",
+ password_prompt = talloc_asprintf(ctx, "Enter new password for account [%s\\%s]:",
cli_credentials_get_domain(ctx->credentials),
cli_credentials_get_username(ctx->credentials));
new_password = getpass(password_prompt);
}
- libnetctx = libnet_context_init(NULL, ctx->lp_ctx);
+ libnetctx = libnet_context_init(ctx->event_ctx, ctx->lp_ctx);
if (!libnetctx) {
return -1;
}
@@ -66,7 +67,7 @@ static int net_password_change(struct net_context *ctx, int argc, const char **a
r.generic.in.newpassword = new_password;
/* do password change */
- status = libnet_ChangePassword(libnetctx, ctx->mem_ctx, &r);
+ status = libnet_ChangePassword(libnetctx, ctx, &r);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("net_password_change: %s\n",r.generic.out.error_string));
return -1;
@@ -101,10 +102,10 @@ static int net_password_set(struct net_context *ctx, int argc, const char **argv
case 0: /* no args -> fail */
return net_password_set_usage(ctx, argc, argv);
case 1: /* only DOM\\user; prompt for password */
- tmp = talloc_strdup(ctx->mem_ctx, argv[0]);
+ tmp = talloc_strdup(ctx, argv[0]);
break;
case 2: /* DOM\\USER and password */
- tmp = talloc_strdup(ctx->mem_ctx, argv[0]);
+ tmp = talloc_strdup(ctx, argv[0]);
new_password = argv[1];
break;
default: /* too mayn args -> fail */
@@ -115,19 +116,19 @@ static int net_password_set(struct net_context *ctx, int argc, const char **argv
if ((p = strchr_m(tmp,'\\'))) {
*p = 0;
domain_name = tmp;
- account_name = talloc_strdup(ctx->mem_ctx, p+1);
+ account_name = talloc_strdup(ctx, p+1);
} else {
account_name = tmp;
domain_name = cli_credentials_get_domain(ctx->credentials);
}
if (!new_password) {
- password_prompt = talloc_asprintf(ctx->mem_ctx, "Enter new password for account [%s\\%s]:",
+ password_prompt = talloc_asprintf(ctx, "Enter new password for account [%s\\%s]:",
domain_name, account_name);
new_password = getpass(password_prompt);
}
- libnetctx = libnet_context_init(NULL, ctx->lp_ctx);
+ libnetctx = libnet_context_init(ctx->event_ctx, ctx->lp_ctx);
if (!libnetctx) {
return -1;
}
@@ -140,7 +141,7 @@ static int net_password_set(struct net_context *ctx, int argc, const char **argv
r.generic.in.newpassword = new_password;
/* do password change */
- status = libnet_SetPassword(libnetctx, ctx->mem_ctx, &r);
+ status = libnet_SetPassword(libnetctx, ctx, &r);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("net_password_set: %s\n",r.generic.out.error_string));
return -1;