From ffa73c412e1190024ae0bf4758174d1b21c16e13 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 1 Mar 2010 23:03:41 +0100 Subject: s4-net: Convert user subcommand to Python. --- source4/utils/net/config.mk | 3 +- source4/utils/net/net.c | 1 - source4/utils/net/net_user.c | 125 ---------------------------------------- source4/utils/net/wscript_build | 2 +- 4 files changed, 2 insertions(+), 129 deletions(-) delete mode 100644 source4/utils/net/net_user.c (limited to 'source4/utils') 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 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 . -*/ - -#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 [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', -- cgit