[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-2582-gb2421c8

Günther Deschner gd at samba.org
Fri May 23 22:59:57 GMT 2008


The branch, v3-3-test has been updated
       via  b2421c81164da2a5ea4bb2391e4f2c410938db42 (commit)
      from  7c93190843e77764be4d0f6d4f0b93061c192c98 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test


- Log -----------------------------------------------------------------
commit b2421c81164da2a5ea4bb2391e4f2c410938db42
Author: Günther Deschner <gd at samba.org>
Date:   Sat May 24 00:58:45 2008 +0200

    drsuapi: fix the build.
    
    Guenther

-----------------------------------------------------------------------

Summary of changes:
 source/Makefile.in             |   13 +++--
 source/rpcclient/cmd_drsuapi.c |  111 ++++++++++++++++++++++++++++++++++++++++
 source/rpcclient/rpcclient.c   |    2 +
 3 files changed, 120 insertions(+), 6 deletions(-)
 create mode 100644 source/rpcclient/cmd_drsuapi.c


Changeset truncated at 500 lines:

diff --git a/source/Makefile.in b/source/Makefile.in
index b42a999..bd19562 100644
--- a/source/Makefile.in
+++ b/source/Makefile.in
@@ -275,7 +275,8 @@ SERVER_MUTEX_OBJ = lib/server_mutex.o
 PASSCHANGE_OBJ = libsmb/passchange.o
 
 LIBNDR_DRSUAPI_OBJ = librpc/ndr/ndr_drsuapi.o \
-		     librpc/ndr/ndr_compression.o
+		     librpc/ndr/ndr_compression.o \
+		     librpc/gen_ndr/ndr_drsuapi.o
 
 COMPRESSION_OBJ = lib/compression/mszip.o
 
@@ -290,8 +291,7 @@ LIBNDR_OBJ = librpc/ndr/ndr_basic.o \
 	     librpc/ndr/ndr_sec_helper.o \
 	     librpc/ndr/ndr_string.o \
 	     librpc/ndr/sid.o \
-	     librpc/ndr/uuid.o \
-	     $(DRSUAPI_OBJ)
+	     librpc/ndr/uuid.o
 
 RPCCLIENT_NDR_OBJ = rpc_client/ndr.o
 
@@ -309,8 +309,7 @@ LIBNDR_GEN_OBJ = librpc/gen_ndr/ndr_wkssvc.o \
 		 librpc/gen_ndr/ndr_notify.o \
 		 librpc/gen_ndr/ndr_xattr.o \
 		 librpc/gen_ndr/ndr_epmapper.o \
-		 librpc/gen_ndr/ndr_ntsvcs.o \
-		 librpc/gen_ndr/ndr_drsuapi.o
+		 librpc/gen_ndr/ndr_ntsvcs.o
 
 RPC_PARSE_OBJ0 = rpc_parse/parse_prs.o rpc_parse/parse_misc.o
 
@@ -461,7 +460,8 @@ LIBSMB_OBJ = libsmb/clientgen.o libsmb/cliconnect.o libsmb/clifile.o \
 	     $(LIBSAMBA_OBJ) \
 	     $(LIBNMB_OBJ) \
 	     $(LIBNBT_OBJ) \
-	     $(CLDAP_OBJ)
+	     $(CLDAP_OBJ) \
+	     $(DRSUAPI_OBJ)
 
 RPC_CLIENT_OBJ1 = rpc_client/cli_netlogon.o
 
@@ -803,6 +803,7 @@ RPCCLIENT_OBJ1 = rpcclient/rpcclient.o rpcclient/cmd_lsarpc.o \
 		 rpcclient/cmd_dssetup.o rpcclient/cmd_echo.o \
 		 rpcclient/cmd_shutdown.o rpcclient/cmd_test.o \
 		 rpcclient/cmd_wkssvc.o rpcclient/cmd_ntsvcs.o \
+		 rpcclient/cmd_drsuapi.o \
 		 $(DISPLAY_SEC_OBJ)
 
 RPCCLIENT_OBJ = $(RPCCLIENT_OBJ1) \
diff --git a/source/rpcclient/cmd_drsuapi.c b/source/rpcclient/cmd_drsuapi.c
new file mode 100644
index 0000000..759985d
--- /dev/null
+++ b/source/rpcclient/cmd_drsuapi.c
@@ -0,0 +1,111 @@
+/*
+   Unix SMB/CIFS implementation.
+   RPC pipe client
+
+   Copyright (C) Guenther Deschner 2008
+
+   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 "rpcclient.h"
+
+static WERROR cmd_drsuapi_cracknames(struct rpc_pipe_client *cli,
+				     TALLOC_CTX *mem_ctx, int argc,
+				     const char **argv)
+{
+	NTSTATUS status;
+	WERROR werr;
+	int i;
+
+	struct GUID bind_guid;
+	struct drsuapi_DsBindInfoCtr bind_info;
+	struct policy_handle bind_handle;
+
+	int32_t level = 1;
+	union drsuapi_DsNameRequest req;
+	struct drsuapi_DsNameRequest1 req1;
+	int32_t level_out;
+	union drsuapi_DsNameCtr ctr;
+	struct drsuapi_DsNameString names[1];
+
+	if (argc < 2) {
+		printf("usage: %s name\n", argv[0]);
+		return WERR_OK;
+	}
+
+	ZERO_STRUCT(bind_info);
+
+	GUID_from_string(DRSUAPI_DS_BIND_GUID, &bind_guid);
+
+	status = rpccli_drsuapi_DsBind(cli, mem_ctx,
+				       &bind_guid,
+				       NULL,
+				       &bind_handle,
+				       &werr);
+
+	if (!NT_STATUS_IS_OK(status)) {
+		return ntstatus_to_werror(status);
+	}
+
+	ZERO_STRUCT(req1);
+
+	names[0].str = argv[1];
+
+	req1.codepage		= 1252; /* german */
+	req1.language		= 0x00000407; /* german */
+	req1.count		= 1;
+	req1.names		= names;
+	req1.format_flags	= DRSUAPI_DS_NAME_FLAG_NO_FLAGS;
+	req1.format_offered	= DRSUAPI_DS_NAME_FORMAT_UKNOWN;
+	req1.format_desired	= DRSUAPI_DS_NAME_FORMAT_FQDN_1779;
+
+	req.req1 = req1;
+
+	status = rpccli_drsuapi_DsCrackNames(cli, mem_ctx,
+					     &bind_handle,
+					     level,
+					     &req,
+					     &level_out,
+					     &ctr,
+					     &werr);
+
+	if (!NT_STATUS_IS_OK(status)) {
+		return ntstatus_to_werror(status);
+	}
+
+	if (!W_ERROR_IS_OK(werr)) {
+		return werr;
+	}
+
+	for (i=0; i < ctr.ctr1->count; i++) {
+		printf("status: %d\n",
+			ctr.ctr1->array[i].status);
+		printf("dns_domain_name: %s\n",
+			ctr.ctr1->array[i].dns_domain_name);
+		printf("result_name: %s\n",
+			ctr.ctr1->array[i].result_name);
+	}
+
+	return werr;
+}
+
+/* List of commands exported by this module */
+
+struct cmd_set drsuapi_commands[] = {
+
+	{ "DRSUAPI" },
+	{ "dscracknames", RPC_RTYPE_WERROR, NULL, cmd_drsuapi_cracknames, PI_DRSUAPI, NULL, "Crack Name", "" },
+	{ NULL }
+};
diff --git a/source/rpcclient/rpcclient.c b/source/rpcclient/rpcclient.c
index c4be970..cf0533d 100644
--- a/source/rpcclient/rpcclient.c
+++ b/source/rpcclient/rpcclient.c
@@ -506,6 +506,7 @@ extern struct cmd_set shutdown_commands[];
 extern struct cmd_set test_commands[];
 extern struct cmd_set wkssvc_commands[];
 extern struct cmd_set ntsvcs_commands[];
+extern struct cmd_set drsuapi_commands[];
 
 static struct cmd_set *rpcclient_command_list[] = {
 	rpcclient_commands,
@@ -521,6 +522,7 @@ static struct cmd_set *rpcclient_command_list[] = {
  	test_commands,
 	wkssvc_commands,
 	ntsvcs_commands,
+	drsuapi_commands,
 	NULL
 };
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list