From 082a5684738e7b9fce7466d7e7519816605b0958 Mon Sep 17 00:00:00 2001 From: Rafal Szczesniak Date: Mon, 14 Feb 2005 00:59:52 +0000 Subject: r5381: Added net_user.c with net tool interface for managing user accounts. rafal (This used to be commit 3005f0408c647fcab65c11de9bf680f7f5831492) --- source4/utils/net/net_user.c | 95 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 source4/utils/net/net_user.c (limited to 'source4/utils/net/net_user.c') diff --git a/source4/utils/net/net_user.c b/source4/utils/net/net_user.c new file mode 100644 index 0000000000..a28d774d36 --- /dev/null +++ b/source4/utils/net/net_user.c @@ -0,0 +1,95 @@ +/* + Samba Unix/Linux SMB client library + Distributed SMB/CIFS Server Management Utility + + Copyright (C) Rafal Szczesniak 2005 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "includes.h" +#include "utils/net/net.h" +#include "libnet/libnet.h" +#include "librpc/gen_ndr/ndr_samr.h" + +static int net_user_add(struct net_context *ctx, int argc, const char **argv) +{ + NTSTATUS status; + struct libnet_context *lnet_ctx; + union libnet_CreateUser r; + char *user_name; + + /* command line argument preparation */ + switch (argc) { + case 0: + return net_user_usage(ctx, argc, argv); + break; + case 1: + user_name = talloc_strdup(ctx->mem_ctx, argv[0]); + break; + default: + return net_user_usage(ctx, argc, argv); + } + + /* libnet context init and its params */ + lnet_ctx = libnet_context_init(); + if (!lnet_ctx) return -1; + + lnet_ctx->user.domain_name = ctx->user.domain_name; + lnet_ctx->user.account_name = ctx->user.account_name; + lnet_ctx->user.password = ctx->user.password; + + /* 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; + + status = libnet_CreateUser(lnet_ctx, ctx->mem_ctx, &r); + if (!NT_STATUS_IS_OK(status)) { + DEBUG(0, ("Failed to add user account: %s\n", + r.generic.out.error_string)); + return -1; + } + + libnet_context_destroy(&lnet_ctx); + return 0; +} + + +static const struct net_functable net_user_functable[] = { + { "add", net_user_add, net_user_usage, net_user_help }, + { NULL, NULL } +}; + + +int net_user(struct net_context *ctx, int argc, const char **argv) +{ + return net_run_function(ctx, argc, argv, net_user_functable, net_user_usage); +} + + +int net_user_help(struct net_context *ctx, int argc, const char **argv) +{ + d_printf("User accounts management:\n"); + d_printf("\t\tadd\t creates new account\n"); + return 0; +} + + +int net_user_usage(struct net_context *ctx, int argc, const char **argv) +{ + d_printf("net user [options]\n"); + return 0; +} -- cgit From 530d46f6748a17ca8500a861f53c0d4f451b2005 Mon Sep 17 00:00:00 2001 From: Rafal Szczesniak Date: Tue, 15 Feb 2005 01:11:20 +0000 Subject: r5400: Slightly better handling of help messages in net tool. rafal (This used to be commit 5cebb4feedf7d6542c497fe55763d66f51b1c989) --- source4/utils/net/net_user.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'source4/utils/net/net_user.c') diff --git a/source4/utils/net/net_user.c b/source4/utils/net/net_user.c index a28d774d36..845eed0665 100644 --- a/source4/utils/net/net_user.c +++ b/source4/utils/net/net_user.c @@ -69,7 +69,8 @@ static int net_user_add(struct net_context *ctx, int argc, const char **argv) static const struct net_functable net_user_functable[] = { - { "add", net_user_add, net_user_usage, net_user_help }, + { "add", net_user_add, net_user_usage, net_user_help }, + { "help", net_user_help, net_user_usage, net_user_help }, { NULL, NULL } }; @@ -83,7 +84,7 @@ int net_user(struct net_context *ctx, int argc, const char **argv) int net_user_help(struct net_context *ctx, int argc, const char **argv) { d_printf("User accounts management:\n"); - d_printf("\t\tadd\t creates new account\n"); + d_printf("\tadd\t\tcreates new account\n"); return 0; } -- cgit From 308c7d26c1f9f91ff6667430a8a1a7b4cf4a3a7e Mon Sep 17 00:00:00 2001 From: Rafal Szczesniak Date: Wed, 16 Feb 2005 21:54:01 +0000 Subject: r5425: Convert function tables to new structure (with description) and remove unnecessary help functions as help is generated automatically. Usage functions with precise information about usage of each leaf node remain. rafal (This used to be commit eb66180d14a14cafbfc0df2b39eeaf4ad7bb43a9) --- source4/utils/net/net_user.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'source4/utils/net/net_user.c') diff --git a/source4/utils/net/net_user.c b/source4/utils/net/net_user.c index 845eed0665..4a472e6997 100644 --- a/source4/utils/net/net_user.c +++ b/source4/utils/net/net_user.c @@ -69,8 +69,7 @@ static int net_user_add(struct net_context *ctx, int argc, const char **argv) static const struct net_functable net_user_functable[] = { - { "add", net_user_add, net_user_usage, net_user_help }, - { "help", net_user_help, net_user_usage, net_user_help }, + { "add", "create new user account\n", net_user_add, net_user_usage }, { NULL, NULL } }; @@ -81,14 +80,6 @@ int net_user(struct net_context *ctx, int argc, const char **argv) } -int net_user_help(struct net_context *ctx, int argc, const char **argv) -{ - d_printf("User accounts management:\n"); - d_printf("\tadd\t\tcreates new account\n"); - return 0; -} - - int net_user_usage(struct net_context *ctx, int argc, const char **argv) { d_printf("net user [options]\n"); -- cgit From 02075be0bbc2095073f8898350fded64a7c97c79 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 21 Mar 2005 02:08:38 +0000 Subject: r5917: First step in using the new cli_credentials structure. This patch puts support for it into popt_common, adds a few utility functions (in lib/credentials.c) and the callback functions for the command-line (lib/cmdline/credentials.c). Comments are welcome :-) (This used to be commit 1d49b57c50fe8c2683ea23e9df41ce8ad774db98) --- source4/utils/net/net_user.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source4/utils/net/net_user.c') diff --git a/source4/utils/net/net_user.c b/source4/utils/net/net_user.c index 4a472e6997..82f80b9e60 100644 --- a/source4/utils/net/net_user.c +++ b/source4/utils/net/net_user.c @@ -47,9 +47,9 @@ 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 = ctx->user.domain_name; - lnet_ctx->user.account_name = ctx->user.account_name; - lnet_ctx->user.password = ctx->user.password; + 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); /* calling CreateUser function */ r.generic.level = LIBNET_CREATE_USER_GENERIC; -- cgit From 34cde065139fdc76f6aa529426cfc1f68a394d54 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 21 Mar 2005 18:42:32 +0000 Subject: r5924: Use cli_credentials in libnet/. (This used to be commit e5bc6f4f1716568ae7022d61b5b35ee047b58414) --- source4/utils/net/net_user.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'source4/utils/net/net_user.c') 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)) { -- cgit From 0a40093ef39a46b9df82d6d0486b70b354d9dde5 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 3 Jun 2005 21:30:07 +0000 Subject: r7249: Cope with struct member rename (This used to be commit e7549f33f5fb06d8b2a8f31745545cc7b9c8d4f9) --- source4/utils/net/net_user.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/utils/net/net_user.c') diff --git a/source4/utils/net/net_user.c b/source4/utils/net/net_user.c index 40e821bf83..690b393e50 100644 --- a/source4/utils/net/net_user.c +++ b/source4/utils/net/net_user.c @@ -47,12 +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->credentials = ctx->credentials; + lnet_ctx->cred = ctx->credentials; /* calling CreateUser function */ r.generic.level = LIBNET_CREATE_USER_GENERIC; r.generic.in.user_name = user_name; - r.generic.in.domain_name = cli_credentials_get_domain(lnet_ctx->credentials); + r.generic.in.domain_name = cli_credentials_get_domain(lnet_ctx->cred); status = libnet_CreateUser(lnet_ctx, ctx->mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { -- cgit From 9bbfe84cb9a405e710a174b0ddac273d154fa861 Mon Sep 17 00:00:00 2001 From: Rafal Szczesniak Date: Tue, 7 Jun 2005 23:26:13 +0000 Subject: r7382: Convert net_user code so that is can be compiled against changed CreateUser call. Doesn't work yet, but the test passes. rafal (This used to be commit a50ebd4a16ac141214cc24b3390da78a209b4284) --- source4/utils/net/net_user.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'source4/utils/net/net_user.c') diff --git a/source4/utils/net/net_user.c b/source4/utils/net/net_user.c index 690b393e50..b1bf85d6f2 100644 --- a/source4/utils/net/net_user.c +++ b/source4/utils/net/net_user.c @@ -28,7 +28,7 @@ static int net_user_add(struct net_context *ctx, int argc, const char **argv) { NTSTATUS status; struct libnet_context *lnet_ctx; - union libnet_CreateUser r; + struct libnet_CreateUser r; char *user_name; /* command line argument preparation */ @@ -50,14 +50,14 @@ static int net_user_add(struct net_context *ctx, int argc, const char **argv) lnet_ctx->cred = ctx->credentials; /* calling CreateUser function */ - r.generic.level = LIBNET_CREATE_USER_GENERIC; - r.generic.in.user_name = user_name; - r.generic.in.domain_name = cli_credentials_get_domain(lnet_ctx->cred); + r.level = LIBNET_CREATE_USER_GENERIC; + r.in.user_name = user_name; + r.in.domain_name = cli_credentials_get_domain(lnet_ctx->cred); status = libnet_CreateUser(lnet_ctx, ctx->mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("Failed to add user account: %s\n", - r.generic.out.error_string)); + r.out.error_string)); return -1; } -- cgit From af237084ecd4f9928c6c282b9c5c73598d5c73d6 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 16 Jun 2005 11:36:09 +0000 Subject: r7633: this patch started as an attempt to make the dcerpc code use a given event_context for the socket_connect() call, so that when things that use dcerpc are running alongside anything else it doesn't block the whole process during a connect. Then of course I needed to change any code that created a dcerpc connection (such as the auth code) to also take an event context, and anything that called that and so on .... thus the size of the patch. There were 3 places where I punted: - abartlet wanted me to add a gensec_set_event_context() call instead of adding it to the gensec init calls. Andrew, my apologies for not doing this. I didn't do it as adding a new parameter allowed me to catch all the callers with the compiler. Now that its done, we could go back and use gensec_set_event_context() - the ejs code calls auth initialisation, which means it should pass in the event context from the web server. I punted on that. Needs fixing. - I used a NULL event context in dcom_get_pipe(). This is equivalent to what we did already, but should be fixed to use a callers event context. Jelmer, can you think of a clean way to do that? I also cleaned up a couple of things: - libnet_context_destroy() makes no sense. I removed it. - removed some unused vars in various places (This used to be commit 3a3025485bdb8f600ab528c0b4b4eef0c65e3fc9) --- source4/utils/net/net_user.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/utils/net/net_user.c') diff --git a/source4/utils/net/net_user.c b/source4/utils/net/net_user.c index b1bf85d6f2..dabb4a0d61 100644 --- a/source4/utils/net/net_user.c +++ b/source4/utils/net/net_user.c @@ -44,7 +44,7 @@ static int net_user_add(struct net_context *ctx, int argc, const char **argv) } /* libnet context init and its params */ - lnet_ctx = libnet_context_init(); + lnet_ctx = libnet_context_init(NULL); if (!lnet_ctx) return -1; lnet_ctx->cred = ctx->credentials; @@ -61,7 +61,7 @@ static int net_user_add(struct net_context *ctx, int argc, const char **argv) return -1; } - libnet_context_destroy(&lnet_ctx); + talloc_free(lnet_ctx); return 0; } -- cgit From d4de4c2d210d2e8c9b5aedf70695594809ad6a0b Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 30 Dec 2005 13:16:54 +0000 Subject: r12608: Remove some unused #include lines. (This used to be commit 70e7449318aa0e9d2639c76730a7d1683b2f4981) --- source4/utils/net/net_user.c | 1 - 1 file changed, 1 deletion(-) (limited to 'source4/utils/net/net_user.c') diff --git a/source4/utils/net/net_user.c b/source4/utils/net/net_user.c index dabb4a0d61..82ee208534 100644 --- a/source4/utils/net/net_user.c +++ b/source4/utils/net/net_user.c @@ -22,7 +22,6 @@ #include "includes.h" #include "utils/net/net.h" #include "libnet/libnet.h" -#include "librpc/gen_ndr/ndr_samr.h" static int net_user_add(struct net_context *ctx, int argc, const char **argv) { -- cgit From 58f78fa182c4b4a046b957c89988d34ea2125696 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 13 Jan 2006 03:39:49 +0000 Subject: r12892: Add a 'Migrate from Windows' page to our installation section in SWAT. Doing this required reworking ejsnet, particularly so it could take a set of credentials, not just a username and password argument. This required fixing the ejsnet.js test script, which now adds and deletes a user, and is run from 'make test'. This should prevent it being broken again. Deleting a user from ejsnet required that the matching backend be added to libnet, hooking fortunetly onto already existing code for the actual deletion. The js credentials interface now handles the 'set machine account' flag. New functions have been added to provision.js to wrap the basic operations (so we can write a command line version, as well as the web based version). Andrew Bartlett (This used to be commit a5e7c17c348c45e61699cc1626a0d5eae2df4636) --- source4/utils/net/net_user.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'source4/utils/net/net_user.c') diff --git a/source4/utils/net/net_user.c b/source4/utils/net/net_user.c index 82ee208534..ecc1834fcf 100644 --- a/source4/utils/net/net_user.c +++ b/source4/utils/net/net_user.c @@ -64,9 +64,51 @@ static int net_user_add(struct net_context *ctx, int argc, const char **argv) return 0; } +static int net_user_delete(struct net_context *ctx, int argc, const char **argv) +{ + NTSTATUS status; + struct libnet_context *lnet_ctx; + struct libnet_DeleteUser r; + char *user_name; + + /* command line argument preparation */ + switch (argc) { + case 0: + return net_user_usage(ctx, argc, argv); + break; + case 1: + user_name = talloc_strdup(ctx->mem_ctx, argv[0]); + break; + default: + return net_user_usage(ctx, argc, argv); + } + + /* libnet context init and its params */ + lnet_ctx = libnet_context_init(NULL); + if (!lnet_ctx) return -1; + + lnet_ctx->cred = ctx->credentials; + + /* calling DeleteUser function */ + r.level = LIBNET_DELETE_USER_GENERIC; + r.in.user_name = user_name; + r.in.domain_name = cli_credentials_get_domain(lnet_ctx->cred); + + status = libnet_DeleteUser(lnet_ctx, ctx->mem_ctx, &r); + if (!NT_STATUS_IS_OK(status)) { + DEBUG(0, ("Failed to delete user account: %s\n", + r.out.error_string)); + return -1; + } + + talloc_free(lnet_ctx); + return 0; +} + static const struct net_functable net_user_functable[] = { { "add", "create new user account\n", net_user_add, net_user_usage }, + { "delete", "delete an existing user account\n", net_user_delete, net_user_usage }, { NULL, NULL } }; -- cgit From 3f16241a1d3243447d0244ebac05b447aec94df8 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 14 Mar 2006 01:29:56 +0000 Subject: r14363: Remove credentials.h from the global includes. (This used to be commit 98c4c3051391c6f89df5d133665f51bef66b1563) --- source4/utils/net/net_user.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/utils/net/net_user.c') diff --git a/source4/utils/net/net_user.c b/source4/utils/net/net_user.c index ecc1834fcf..75eec9716d 100644 --- a/source4/utils/net/net_user.c +++ b/source4/utils/net/net_user.c @@ -22,6 +22,7 @@ #include "includes.h" #include "utils/net/net.h" #include "libnet/libnet.h" +#include "auth/credentials/credentials.h" static int net_user_add(struct net_context *ctx, int argc, const char **argv) { -- cgit From 787d67c2cd780656cb5e6c0884c485f287b72c49 Mon Sep 17 00:00:00 2001 From: Rafal Szczesniak Date: Mon, 29 May 2006 22:01:31 +0000 Subject: r15941: We don't use call levels, at the moment. Remove them until we do. rafal (This used to be commit 592387a769521d221a89d374ef72c6123160cfed) --- source4/utils/net/net_user.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'source4/utils/net/net_user.c') diff --git a/source4/utils/net/net_user.c b/source4/utils/net/net_user.c index 75eec9716d..7bb6fa3d61 100644 --- a/source4/utils/net/net_user.c +++ b/source4/utils/net/net_user.c @@ -50,7 +50,6 @@ static int net_user_add(struct net_context *ctx, int argc, const char **argv) lnet_ctx->cred = ctx->credentials; /* calling CreateUser function */ - r.level = LIBNET_CREATE_USER_GENERIC; r.in.user_name = user_name; r.in.domain_name = cli_credentials_get_domain(lnet_ctx->cred); @@ -91,7 +90,6 @@ static int net_user_delete(struct net_context *ctx, int argc, const char **argv) lnet_ctx->cred = ctx->credentials; /* calling DeleteUser function */ - r.level = LIBNET_DELETE_USER_GENERIC; r.in.user_name = user_name; r.in.domain_name = cli_credentials_get_domain(lnet_ctx->cred); -- cgit From 0479a2f1cbae51fcd8dbdc3c148c808421fb4d25 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 10 Jul 2007 02:07:03 +0000 Subject: r23792: convert Samba4 to GPLv3 There are still a few tidyups of old FSF addresses to come (in both s3 and s4). More commits soon. (This used to be commit fcf38a38ac691abd0fa51b89dc951a08e89fdafa) --- source4/utils/net/net_user.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'source4/utils/net/net_user.c') diff --git a/source4/utils/net/net_user.c b/source4/utils/net/net_user.c index 7bb6fa3d61..a8d13c0315 100644 --- a/source4/utils/net/net_user.c +++ b/source4/utils/net/net_user.c @@ -6,7 +6,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -15,8 +15,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see . */ #include "includes.h" -- cgit From 4c4323009fa83f00ed319de59a3aad48fcd65994 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 7 Dec 2007 02:37:04 +0100 Subject: r26327: Explicit loadparm_context for RPC client functions. (This used to be commit eeb2251d22b3d6e0379444a73af69d1014692b07) --- source4/utils/net/net_user.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/utils/net/net_user.c') diff --git a/source4/utils/net/net_user.c b/source4/utils/net/net_user.c index a8d13c0315..39d50e7d8b 100644 --- a/source4/utils/net/net_user.c +++ b/source4/utils/net/net_user.c @@ -43,7 +43,7 @@ static int net_user_add(struct net_context *ctx, int argc, const char **argv) } /* libnet context init and its params */ - lnet_ctx = libnet_context_init(NULL); + lnet_ctx = libnet_context_init(NULL, ctx->lp_ctx); if (!lnet_ctx) return -1; lnet_ctx->cred = ctx->credentials; @@ -83,7 +83,7 @@ static int net_user_delete(struct net_context *ctx, int argc, const char **argv) } /* libnet context init and its params */ - lnet_ctx = libnet_context_init(NULL); + lnet_ctx = libnet_context_init(NULL, ctx->lp_ctx); if (!lnet_ctx) return -1; lnet_ctx->cred = ctx->credentials; -- cgit From 4f51b0246db3242ee02ee16905cba13a5dc5633a Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Mon, 14 Apr 2008 12:43:37 -0400 Subject: Fix problems with event context not being the parent. (This used to be commit 957c4d893acf9e6db06a3fc3a4687ab6bb238635) --- source4/utils/net/net_user.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'source4/utils/net/net_user.c') diff --git a/source4/utils/net/net_user.c b/source4/utils/net/net_user.c index 39d50e7d8b..57cef6b383 100644 --- a/source4/utils/net/net_user.c +++ b/source4/utils/net/net_user.c @@ -21,6 +21,7 @@ #include "includes.h" #include "utils/net/net.h" #include "libnet/libnet.h" +#include "lib/events/events.h" #include "auth/credentials/credentials.h" static int net_user_add(struct net_context *ctx, int argc, const char **argv) @@ -36,14 +37,14 @@ static int net_user_add(struct net_context *ctx, int argc, const char **argv) return net_user_usage(ctx, argc, argv); break; case 1: - user_name = talloc_strdup(ctx->mem_ctx, argv[0]); + user_name = talloc_strdup(ctx, argv[0]); break; default: return net_user_usage(ctx, argc, argv); } /* libnet context init and its params */ - lnet_ctx = libnet_context_init(NULL, ctx->lp_ctx); + lnet_ctx = libnet_context_init(event_context_find(ctx), ctx->lp_ctx); if (!lnet_ctx) return -1; lnet_ctx->cred = ctx->credentials; @@ -52,7 +53,7 @@ static int net_user_add(struct net_context *ctx, int argc, const char **argv) r.in.user_name = user_name; r.in.domain_name = cli_credentials_get_domain(lnet_ctx->cred); - status = libnet_CreateUser(lnet_ctx, ctx->mem_ctx, &r); + status = libnet_CreateUser(lnet_ctx, ctx, &r); if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("Failed to add user account: %s\n", r.out.error_string)); @@ -76,14 +77,14 @@ static int net_user_delete(struct net_context *ctx, int argc, const char **argv) return net_user_usage(ctx, argc, argv); break; case 1: - user_name = talloc_strdup(ctx->mem_ctx, argv[0]); + user_name = talloc_strdup(ctx, argv[0]); break; default: return net_user_usage(ctx, argc, argv); } /* libnet context init and its params */ - lnet_ctx = libnet_context_init(NULL, ctx->lp_ctx); + lnet_ctx = libnet_context_init(event_context_find(ctx), ctx->lp_ctx); if (!lnet_ctx) return -1; lnet_ctx->cred = ctx->credentials; @@ -92,7 +93,7 @@ static int net_user_delete(struct net_context *ctx, int argc, const char **argv) r.in.user_name = user_name; r.in.domain_name = cli_credentials_get_domain(lnet_ctx->cred); - status = libnet_DeleteUser(lnet_ctx, ctx->mem_ctx, &r); + status = libnet_DeleteUser(lnet_ctx, ctx, &r); if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("Failed to delete user account: %s\n", r.out.error_string)); -- cgit From a5d52174bd993b32d01d26a795a56df4a92eba45 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 16 Apr 2008 22:30:15 +0200 Subject: Avoid event_find_context() when the event context is already available in the net utility. (This used to be commit d40804777edf41889bd461f63f7a07cc1cc60e27) --- source4/utils/net/net_user.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/utils/net/net_user.c') diff --git a/source4/utils/net/net_user.c b/source4/utils/net/net_user.c index 57cef6b383..c4b8ecb0c2 100644 --- a/source4/utils/net/net_user.c +++ b/source4/utils/net/net_user.c @@ -44,7 +44,7 @@ static int net_user_add(struct net_context *ctx, int argc, const char **argv) } /* libnet context init and its params */ - lnet_ctx = libnet_context_init(event_context_find(ctx), ctx->lp_ctx); + lnet_ctx = libnet_context_init(ctx->event_ctx, ctx->lp_ctx); if (!lnet_ctx) return -1; lnet_ctx->cred = ctx->credentials; @@ -84,7 +84,7 @@ static int net_user_delete(struct net_context *ctx, int argc, const char **argv) } /* libnet context init and its params */ - lnet_ctx = libnet_context_init(event_context_find(ctx), ctx->lp_ctx); + lnet_ctx = libnet_context_init(ctx->event_ctx, ctx->lp_ctx); if (!lnet_ctx) return -1; lnet_ctx->cred = ctx->credentials; -- cgit