[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha7-1890-gfa3a665

Günther Deschner gd at samba.org
Fri May 29 16:00:35 GMT 2009


The branch, master has been updated
       via  fa3a6652211076772b1b24a3a2216014a16e4054 (commit)
      from  7b8d30d1bb6403183dceaaff987a8a96700bb942 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit fa3a6652211076772b1b24a3a2216014a16e4054
Author: Günther Deschner <gd at samba.org>
Date:   Fri May 29 16:36:44 2009 +0200

    s4-smbtorture: add very basic LIBNETAPI testsuite.
    
    Guenther

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

Summary of changes:
 source3/samba4.m4                     |    1 +
 source4/configure.ac                  |    1 +
 source4/torture/config.mk             |    1 +
 source4/torture/libnetapi/config.m4   |   28 ++++++++++++
 source4/torture/libnetapi/config.mk   |   15 ++++++
 source4/torture/libnetapi/libnetapi.c |   78 +++++++++++++++++++++++++++++++++
 source4/torture/torture.c             |    1 +
 7 files changed, 125 insertions(+), 0 deletions(-)
 create mode 100644 source4/torture/libnetapi/config.m4
 create mode 100644 source4/torture/libnetapi/config.mk
 create mode 100644 source4/torture/libnetapi/libnetapi.c


Changeset truncated at 500 lines:

diff --git a/source3/samba4.m4 b/source3/samba4.m4
index 9e86f3f..6b7c140 100644
--- a/source3/samba4.m4
+++ b/source3/samba4.m4
@@ -128,6 +128,7 @@ SMB_INCLUDE_MK(lib/ldb/python.mk)
 SMB_ENABLE(swig_ldb,YES)
 
 m4_include(lib/tls/config.m4)
+m4_include(torture/libnetapi/config.m4)
 
 dnl m4_include(auth/kerberos/config.m4)
 m4_include(auth/gensec/config.m4)
diff --git a/source4/configure.ac b/source4/configure.ac
index 82dd134..943a7c4 100644
--- a/source4/configure.ac
+++ b/source4/configure.ac
@@ -99,6 +99,7 @@ SMB_INCLUDED_LIB_PKGCONFIG(LIBLDB, ldb = LDB_REQUIRED_VERSION,
 SMB_INCLUDE_MK(lib/ldb/python.mk) 
 
 m4_include(lib/tls/config.m4)
+m4_include(torture/libnetapi/config.m4)
 
 dnl m4_include(auth/kerberos/config.m4)
 m4_include(auth/gensec/config.m4)
diff --git a/source4/torture/config.mk b/source4/torture/config.mk
index 72747a7..dd1d5ea 100644
--- a/source4/torture/config.mk
+++ b/source4/torture/config.mk
@@ -89,6 +89,7 @@ $(eval $(call proto_header_template,$(torturesrcdir)/raw/proto.h,$(TORTURE_RAW_O
 
 mkinclude smb2/config.mk
 mkinclude winbind/config.mk
+mkinclude libnetapi/config.mk
 
 [SUBSYSTEM::TORTURE_NDR]
 PRIVATE_DEPENDENCIES = torture SERVICE_SMB
diff --git a/source4/torture/libnetapi/config.m4 b/source4/torture/libnetapi/config.m4
new file mode 100644
index 0000000..4372490
--- /dev/null
+++ b/source4/torture/libnetapi/config.m4
@@ -0,0 +1,28 @@
+###############################
+# start SMB_EXT_LIB_NETAPI
+# check for netapi.h and -lnetapi
+
+use_netapi=auto
+AC_ARG_ENABLE(netapi,
+AS_HELP_STRING([--enable-netapi],[Turn on netapi support (default=yes)]),
+    [if test x$enable_netapi = xno; then
+        use_netapi=no
+    fi])
+
+
+#if test x$use_netapi = xauto && pkg-config --exists netapi; then
+#	SMB_EXT_LIB_FROM_PKGCONFIG(NETAPI, netapi < 0.1,
+#							   [use_netapi=yes],
+#							   [use_netapi=no])
+#fi
+
+if test x$use_netapi = xauto; then
+	AC_CHECK_HEADERS(netapi.h)
+	AC_CHECK_LIB_EXT(netapi, NETAPI_LIBS, libnetapi_init)
+	if test x"$ac_cv_header_netapi_h" = x"yes" -a x"$ac_cv_lib_ext_netapi_libnetapi_init" = x"yes";then
+		SMB_ENABLE(NETAPI,YES)
+	else
+		SMB_ENABLE(TORTURE_LIBNETAPI,NO)
+	fi
+	SMB_EXT_LIB(NETAPI, $NETAPI_LIBS)
+fi
diff --git a/source4/torture/libnetapi/config.mk b/source4/torture/libnetapi/config.mk
new file mode 100644
index 0000000..ea4166c
--- /dev/null
+++ b/source4/torture/libnetapi/config.mk
@@ -0,0 +1,15 @@
+#################################
+# Start SUBSYSTEM TORTURE_LIBNETAPI
+[MODULE::TORTURE_LIBNETAPI]
+SUBSYSTEM = smbtorture
+OUTPUT_TYPE = MERGED_OBJ
+INIT_FUNCTION = torture_libnetapi_init
+PRIVATE_DEPENDENCIES = \
+		POPT_CREDENTIALS \
+		NETAPI
+# End SUBSYSTEM TORTURE_LIBNETAPI
+#################################
+
+TORTURE_LIBNETAPI_OBJ_FILES = $(addprefix $(torturesrcdir)/libnetapi/, libnetapi.o)
+
+$(eval $(call proto_header_template,$(torturesrcdir)/libnetapi/proto.h,$(TORTURE_LIBNETAPI_OBJ_FILES:.o=.c)))
diff --git a/source4/torture/libnetapi/libnetapi.c b/source4/torture/libnetapi/libnetapi.c
new file mode 100644
index 0000000..761a67f
--- /dev/null
+++ b/source4/torture/libnetapi/libnetapi.c
@@ -0,0 +1,78 @@
+/*
+   Unix SMB/CIFS implementation.
+   SMB torture tester
+   Copyright (C) Guenther Deschner 2009
+
+   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 "torture/smbtorture.h"
+#include "auth/credentials/credentials.h"
+#include "lib/cmdline/popt_common.h"
+#include <netapi.h>
+#include "torture/libnetapi/proto.h"
+
+bool torture_libnetapi_init_context(struct torture_context *tctx,
+				    struct libnetapi_ctx **ctx_p)
+{
+	NET_API_STATUS status;
+	struct libnetapi_ctx *ctx;
+
+	status = libnetapi_init(&ctx);
+	if (status != 0) {
+		return false;
+	}
+
+	libnetapi_set_debuglevel(ctx,
+		talloc_asprintf(ctx, "%d", DEBUGLEVEL));
+	libnetapi_set_username(ctx,
+		cli_credentials_get_username(cmdline_credentials));
+	libnetapi_set_password(ctx,
+		cli_credentials_get_password(cmdline_credentials));
+
+	*ctx_p = ctx;
+
+	return true;
+}
+
+static bool torture_libnetapi_initialize(struct torture_context *tctx)
+{
+        NET_API_STATUS status;
+	struct libnetapi_ctx *ctx;
+
+	status = libnetapi_init(&ctx);
+	if (status != 0) {
+		return false;
+	}
+
+	libnetapi_free(ctx);
+
+	return true;
+}
+
+NTSTATUS torture_libnetapi_init(void)
+{
+	struct torture_suite *suite;
+
+	suite = torture_suite_create(talloc_autofree_context(), "NETAPI");
+
+	torture_suite_add_simple_test(suite, "INITIALIZE", torture_libnetapi_initialize);
+
+	suite->description = talloc_strdup(suite, "libnetapi convenience interface tests");
+
+	torture_register_suite(suite);
+
+	return NT_STATUS_OK;
+}
diff --git a/source4/torture/torture.c b/source4/torture/torture.c
index a9ec325..de4fd59 100644
--- a/source4/torture/torture.c
+++ b/source4/torture/torture.c
@@ -57,6 +57,7 @@ _PUBLIC_ int torture_init(void)
 	extern NTSTATUS torture_rpc_init(void);
 	extern NTSTATUS torture_smb2_init(void);
 	extern NTSTATUS torture_net_init(void);
+	extern NTSTATUS torture_libnetapi_init(void);
 	extern NTSTATUS torture_raw_init(void);
 	extern NTSTATUS torture_unix_init(void);
 	extern NTSTATUS torture_winbind_init(void);


-- 
Samba Shared Repository


More information about the samba-cvs mailing list