2 Samba Unix/Linux SMB client library
3 Distributed SMB/CIFS Server Management Utility
5 Copyright (C) 2004 Stefan Metzmacher <metze@samba.org>
6 Copyright (C) 2005 Andrew Bartlett <abartlet@samba.org>
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 #include "utils/net/net.h"
25 #include "libnet/libnet.h"
26 #include "librpc/gen_ndr/ndr_samr.h"
28 int net_samdump(struct net_context *ctx, int argc, const char **argv)
31 struct libnet_context *libnetctx;
32 union libnet_SamDump r;
34 libnetctx = libnet_context_init();
38 libnetctx->cred = ctx->credentials;
40 /* prepare password change */
41 r.generic.level = LIBNET_SAMDUMP_GENERIC;
42 r.generic.error_string = NULL;
44 /* do the domain join */
45 status = libnet_SamDump(libnetctx, ctx->mem_ctx, &r);
46 if (!NT_STATUS_IS_OK(status)) {
47 DEBUG(0,("libnet_SamDump returned %s: %s\n",
49 r.generic.error_string));
53 libnet_context_destroy(&libnetctx);
58 int net_samdump_usage(struct net_context *ctx, int argc, const char **argv)
60 d_printf("net samdump\n");
64 int net_samdump_help(struct net_context *ctx, int argc, const char **argv)
66 d_printf("Dumps the sam of the domain we are joined to.\n");