summaryrefslogtreecommitdiff
path: root/source4/utils
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2010-03-01 23:03:41 +0100
committerJelmer Vernooij <jelmer@samba.org>2010-04-09 11:53:00 +0200
commitffa73c412e1190024ae0bf4758174d1b21c16e13 (patch)
tree21a812f4c00746404d0e9181a77b9704ebb0608c /source4/utils
parent8149094eddebd9a0e8b7c123c2ed54d00164bb26 (diff)
downloadsamba-ffa73c412e1190024ae0bf4758174d1b21c16e13.tar.gz
samba-ffa73c412e1190024ae0bf4758174d1b21c16e13.tar.bz2
samba-ffa73c412e1190024ae0bf4758174d1b21c16e13.zip
s4-net: Convert user subcommand to Python.
Diffstat (limited to 'source4/utils')
-rw-r--r--source4/utils/net/config.mk3
-rw-r--r--source4/utils/net/net.c1
-rw-r--r--source4/utils/net/net_user.c125
-rw-r--r--source4/utils/net/wscript_build2
4 files changed, 2 insertions, 129 deletions
diff --git a/source4/utils/net/config.mk b/source4/utils/net/config.mk
index 496d339bf8..5b9414092e 100644
--- a/source4/utils/net/config.mk
+++ b/source4/utils/net/config.mk
@@ -42,8 +42,7 @@ net_OBJ_FILES = $(addprefix $(utilssrcdir)/net/, \
net_machinepw.o \
net_password.o \
net_join.o \
- net_vampire.o \
- net_user.o)
+ net_vampire.o)
$(eval $(call proto_header_template,$(utilssrcdir)/net/net_proto.h,$(net_OBJ_FILES:.o=.c)))
diff --git a/source4/utils/net/net.c b/source4/utils/net/net.c
index 1eafe4dd78..545bc0f523 100644
--- a/source4/utils/net/net.c
+++ b/source4/utils/net/net.c
@@ -201,7 +201,6 @@ static const struct net_functable net_functable[] = {
{"samdump", "dump the sam of a domain\n", net_samdump, net_samdump_usage},
{"vampire", "join and syncronise an AD domain onto the local server\n", net_vampire, net_vampire_usage},
{"samsync", "synchronise into the local ldb the sam of an NT4 domain\n", net_samsync_ldb, net_samsync_ldb_usage},
- {"user", "manage user accounts\n", net_user, net_user_usage},
{"machinepw", "Get a machine password out of our SAM\n", net_machinepw, net_machinepw_usage},
{"drs", "Implements functionality offered by repadmin.exe utility in Windows\n", net_drs, net_drs_usage},
{NULL, NULL, NULL, NULL}
diff --git a/source4/utils/net/net_user.c b/source4/utils/net/net_user.c
deleted file mode 100644
index c4b8ecb0c2..0000000000
--- a/source4/utils/net/net_user.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- Samba Unix/Linux SMB client library
- Distributed SMB/CIFS Server Management Utility
-
- Copyright (C) Rafal Szczesniak <mimir@samba.org> 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 3 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, see <http://www.gnu.org/licenses/>.
-*/
-
-#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)
-{
- NTSTATUS status;
- struct libnet_context *lnet_ctx;
- struct 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, argv[0]);
- break;
- default:
- return net_user_usage(ctx, argc, argv);
- }
-
- /* libnet context init and its params */
- lnet_ctx = libnet_context_init(ctx->event_ctx, ctx->lp_ctx);
- if (!lnet_ctx) return -1;
-
- lnet_ctx->cred = ctx->credentials;
-
- /* calling CreateUser function */
- r.in.user_name = user_name;
- r.in.domain_name = cli_credentials_get_domain(lnet_ctx->cred);
-
- 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));
- return -1;
- }
-
- talloc_free(lnet_ctx);
- 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, argv[0]);
- break;
- default:
- return net_user_usage(ctx, argc, argv);
- }
-
- /* libnet context init and its params */
- lnet_ctx = libnet_context_init(ctx->event_ctx, ctx->lp_ctx);
- if (!lnet_ctx) return -1;
-
- lnet_ctx->cred = ctx->credentials;
-
- /* calling DeleteUser function */
- r.in.user_name = user_name;
- r.in.domain_name = cli_credentials_get_domain(lnet_ctx->cred);
-
- 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));
- 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 }
-};
-
-
-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_usage(struct net_context *ctx, int argc, const char **argv)
-{
- d_printf("net user <command> [options]\n");
- return 0;
-}
diff --git a/source4/utils/net/wscript_build b/source4/utils/net/wscript_build
index 8f63608ea6..a7cdb10c2c 100644
--- a/source4/utils/net/wscript_build
+++ b/source4/utils/net/wscript_build
@@ -10,7 +10,7 @@ bld.SAMBA_MODULE('net_drs',
bld.SAMBA_BINARY('net',
- source='net.c net_machinepw.c net_password.c net_join.c net_vampire.c net_user.c',
+ source='net.c net_machinepw.c net_password.c net_join.c net_vampire.c',
autoproto='net_proto.h',
installdir='BINDIR',
deps='LIBSAMBA-HOSTCONFIG LIBSAMBA-UTIL LIBSAMBA-NET popt POPT_SAMBA POPT_CREDENTIALS net_drs',