[SCM] Samba Shared Repository - branch master updated - f18296151d1d8774b861ef6bd751b48ef9ee2f92

Jelmer Vernooij jelmer at samba.org
Thu Oct 23 20:00:10 GMT 2008


The branch, master has been updated
       via  f18296151d1d8774b861ef6bd751b48ef9ee2f92 (commit)
       via  9d2d66610947a78c33616b7df7e9bf0c224b73e6 (commit)
       via  6b5d0b32b68a65121b05ca4f250807576a9ff23e (commit)
       via  22f566c39b564c39eca40a76bf1dfece96d7ece5 (commit)
      from  0b68762af7055bb3f60e28ab543dcad2736028e9 (commit)

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


- Log -----------------------------------------------------------------
commit f18296151d1d8774b861ef6bd751b48ef9ee2f92
Merge: 9d2d66610947a78c33616b7df7e9bf0c224b73e6 0b68762af7055bb3f60e28ab543dcad2736028e9
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Thu Oct 23 21:59:15 2008 +0200

    Merge branch 'master' of ssh://git.samba.org/data/git/samba

commit 9d2d66610947a78c33616b7df7e9bf0c224b73e6
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Thu Oct 23 21:49:40 2008 +0200

    Make lp_tls_* return absolute paths.

commit 6b5d0b32b68a65121b05ca4f250807576a9ff23e
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Thu Oct 23 21:30:41 2008 +0200

    Move subunit ui ops out of smbtorture to the torture library.

commit 22f566c39b564c39eca40a76bf1dfece96d7ece5
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Thu Oct 23 21:08:13 2008 +0200

    Move set_sockaddr_port to libutil.

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

Summary of changes:
 lib/util/util_net.c           |   14 ++++++
 source3/lib/util_sock.c       |   12 -----
 source4/lib/tls/tls.c         |   10 ++--
 source4/lib/torture/config.mk |    2 +-
 source4/lib/torture/subunit.c |   96 +++++++++++++++++++++++++++++++++++++++++
 source4/lib/torture/torture.c |   37 ++++++++++++++-
 source4/lib/torture/torture.h |    2 +
 source4/param/loadparm.c      |   31 +++++++++++--
 source4/param/param.h         |   10 ++--
 source4/torture/smbtorture.c  |   76 +--------------------------------
 10 files changed, 184 insertions(+), 106 deletions(-)
 create mode 100644 source4/lib/torture/subunit.c


Changeset truncated at 500 lines:

diff --git a/lib/util/util_net.c b/lib/util/util_net.c
index eb5e225..228393a 100644
--- a/lib/util/util_net.c
+++ b/lib/util/util_net.c
@@ -408,3 +408,17 @@ bool is_address_any(const struct sockaddr *psa)
 	}
 	return false;
 }
+
+void set_sockaddr_port(struct sockaddr *psa, uint16_t port)
+{
+#if defined(HAVE_IPV6)
+	if (psa->sa_family == AF_INET6) {
+		((struct sockaddr_in6 *)psa)->sin6_port = htons(port);
+	}
+#endif
+	if (psa->sa_family == AF_INET) {
+		((struct sockaddr_in *)psa)->sin_port = htons(port);
+	}
+}
+
+
diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c
index 667dbf6..5721f41 100644
--- a/source3/lib/util_sock.c
+++ b/source3/lib/util_sock.c
@@ -241,18 +241,6 @@ static int get_socket_port(int fd)
 }
 #endif
 
-void set_sockaddr_port(struct sockaddr_storage *psa, uint16 port)
-{
-#if defined(HAVE_IPV6)
-	if (psa->ss_family == AF_INET6) {
-		((struct sockaddr_in6 *)psa)->sin6_port = htons(port);
-	}
-#endif
-	if (psa->ss_family == AF_INET) {
-		((struct sockaddr_in *)psa)->sin_port = htons(port);
-	}
-}
-
 const char *client_name(int fd)
 {
 	return get_peer_name(fd,false);
diff --git a/source4/lib/tls/tls.c b/source4/lib/tls/tls.c
index f72aafe..24e4632 100644
--- a/source4/lib/tls/tls.c
+++ b/source4/lib/tls/tls.c
@@ -357,11 +357,11 @@ struct tls_params *tls_initialise(TALLOC_CTX *mem_ctx, struct loadparm_context *
 	struct tls_params *params;
 	int ret;
 	TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx);
-	const char *keyfile = private_path(tmp_ctx, lp_ctx, lp_tls_keyfile(lp_ctx));
-	const char *certfile = private_path(tmp_ctx, lp_ctx, lp_tls_certfile(lp_ctx));
-	const char *cafile = private_path(tmp_ctx, lp_ctx, lp_tls_cafile(lp_ctx));
-	const char *crlfile = private_path(tmp_ctx, lp_ctx, lp_tls_crlfile(lp_ctx));
-	const char *dhpfile = private_path(tmp_ctx, lp_ctx, lp_tls_dhpfile(lp_ctx));
+	const char *keyfile = lp_tls_keyfile(tmp_ctx, lp_ctx);
+	const char *certfile = lp_tls_certfile(tmp_ctx, lp_ctx);
+	const char *cafile = lp_tls_cafile(tmp_ctx, lp_ctx);
+	const char *crlfile = lp_tls_crlfile(tmp_ctx, lp_ctx);
+	const char *dhpfile = lp_tls_dhpfile(tmp_ctx, lp_ctx);
 	void tls_cert_generate(TALLOC_CTX *, const char *, const char *, const char *);
 	params = talloc(mem_ctx, struct tls_params);
 	if (params == NULL) {
diff --git a/source4/lib/torture/config.mk b/source4/lib/torture/config.mk
index 49e7b1a..8a7f2a3 100644
--- a/source4/lib/torture/config.mk
+++ b/source4/lib/torture/config.mk
@@ -9,6 +9,6 @@ torture_VERSION = 0.0.1
 torture_SOVERSION = 0
 
 PC_FILES += $(libtorturesrcdir)/torture.pc
-torture_OBJ_FILES = $(addprefix $(libtorturesrcdir)/, torture.o)
+torture_OBJ_FILES = $(addprefix $(libtorturesrcdir)/, torture.o subunit.o)
 
 PUBLIC_HEADERS += $(libtorturesrcdir)/torture.h
diff --git a/source4/lib/torture/subunit.c b/source4/lib/torture/subunit.c
new file mode 100644
index 0000000..40d9b97
--- /dev/null
+++ b/source4/lib/torture/subunit.c
@@ -0,0 +1,96 @@
+/* 
+   Unix SMB/CIFS implementation.
+   Samba utility functions
+   Copyright (C) Jelmer Vernooij <jelmer at samba.org> 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 "lib/torture/torture.h"
+
+static void subunit_init(struct torture_context *ctx) 
+{
+	/* FIXME: register segv and bus handler */
+}
+
+static void subunit_suite_start(struct torture_context *ctx,
+				struct torture_suite *suite)
+{
+}
+
+static void subunit_print_testname(struct torture_context *ctx, 
+				   struct torture_tcase *tcase,
+				   struct torture_test *test)
+{
+	if (!strcmp(tcase->name, test->name)) {
+		printf("%s", test->name);
+	} else {
+		printf("%s.%s", tcase->name, test->name);
+	}
+}
+
+static void subunit_test_start(struct torture_context *ctx, 
+			       struct torture_tcase *tcase,
+			       struct torture_test *test)
+{
+	printf("test: ");
+	subunit_print_testname(ctx, tcase, test);	
+	printf("\n");
+}
+
+static void subunit_test_result(struct torture_context *context, 
+				enum torture_result res, const char *reason)
+{
+	switch (res) {
+	case TORTURE_OK:
+		printf("success: ");
+		break;
+	case TORTURE_FAIL:
+		printf("failure: ");
+		break;
+	case TORTURE_ERROR:
+		printf("error: ");
+		break;
+	case TORTURE_SKIP:
+		printf("skip: ");
+		break;
+	}
+	subunit_print_testname(context, context->active_tcase, context->active_test);	
+
+	if (reason)
+		printf(" [\n%s\n]", reason);
+	printf("\n");
+}
+
+static void subunit_comment(struct torture_context *test,
+			    const char *comment)
+{
+	fprintf(stderr, "%s", comment);
+}
+
+static void subunit_warning(struct torture_context *test,
+			    const char *comment)
+{
+	fprintf(stderr, "WARNING!: %s\n", comment);
+}
+
+const struct torture_ui_ops torture_subunit_ui_ops = {
+	.init = subunit_init,
+	.comment = subunit_comment,
+	.warning = subunit_warning,
+	.test_start = subunit_test_start,
+	.test_result = subunit_test_result,
+	.suite_start = subunit_suite_start
+};
diff --git a/source4/lib/torture/torture.c b/source4/lib/torture/torture.c
index ba7168f..54ddc79 100644
--- a/source4/lib/torture/torture.c
+++ b/source4/lib/torture/torture.c
@@ -24,8 +24,11 @@
 #include "param/param.h"
 #include "system/filesys.h"
 
+/**
+ * Initialize a torture context
+ */
 struct torture_context *torture_context_init(struct event_context *event_ctx, 
-					     const struct torture_ui_ops *ui_ops)
+											 const struct torture_ui_ops *ui_ops)
 {
 	struct torture_context *torture = talloc_zero(event_ctx, 
 						      struct torture_context);
@@ -59,6 +62,9 @@ _PUBLIC_ NTSTATUS torture_temp_dir(struct torture_context *tctx,
 	return NT_STATUS_OK;
 }
 
+/**
+ * Comment on the status/progress of a test
+ */
 void torture_comment(struct torture_context *context, const char *comment, ...)
 {
 	va_list ap;
@@ -75,6 +81,9 @@ void torture_comment(struct torture_context *context, const char *comment, ...)
 	talloc_free(tmp);
 }
 
+/**
+ * Print a warning about the current test
+ */
 void torture_warning(struct torture_context *context, const char *comment, ...)
 {
 	va_list ap;
@@ -91,6 +100,9 @@ void torture_warning(struct torture_context *context, const char *comment, ...)
 	talloc_free(tmp);
 }
 
+/**
+ * Store the result of a torture test.
+ */
 void torture_result(struct torture_context *context, 
 		    enum torture_result result, const char *fmt, ...)
 {
@@ -108,6 +120,9 @@ void torture_result(struct torture_context *context,
 	va_end(ap);
 }
 
+/**
+ * Create a new torture suite
+ */
 struct torture_suite *torture_suite_create(TALLOC_CTX *ctx, const char *name)
 {
 	struct torture_suite *suite = talloc_zero(ctx, struct torture_suite);
@@ -119,6 +134,9 @@ struct torture_suite *torture_suite_create(TALLOC_CTX *ctx, const char *name)
 	return suite;
 }
 
+/**
+ * Set the setup() and teardown() functions for a testcase.
+ */
 void torture_tcase_set_fixture(struct torture_tcase *tcase, 
 		bool (*setup) (struct torture_context *, void **),
 		bool (*teardown) (struct torture_context *, void *))
@@ -140,6 +158,9 @@ static bool wrap_test_with_testcase_const(struct torture_context *torture_ctx,
 	return fn(torture_ctx, tcase->data, test->data);
 }
 
+/**
+ * Add a test that uses const data to a testcase
+ */
 struct torture_test *torture_tcase_add_test_const(struct torture_tcase *tcase,
 		const char *name,
 		bool (*run) (struct torture_context *, const void *tcase_data,
@@ -160,7 +181,9 @@ struct torture_test *torture_tcase_add_test_const(struct torture_tcase *tcase,
 	return test;
 }
 
-
+/**
+ * Add a new testcase
+ */
 bool torture_suite_init_tcase(struct torture_suite *suite, 
 			      struct torture_tcase *tcase, 
 			      const char *name)
@@ -189,6 +212,9 @@ struct torture_tcase *torture_suite_add_tcase(struct torture_suite *suite,
 	return tcase;
 }
 
+/**
+ * Run a torture test suite.
+ */
 bool torture_run_suite(struct torture_context *context, 
 		       struct torture_suite *suite)
 {
@@ -472,6 +498,9 @@ struct torture_tcase *torture_suite_add_simple_test(
 	return tcase;
 }
 
+/**
+ * Add a child testsuite to a testsuite.
+ */
 bool torture_suite_add_suite(struct torture_suite *suite, 
 			     struct torture_suite *child)
 {
@@ -486,7 +515,9 @@ bool torture_suite_add_suite(struct torture_suite *suite,
 	return true;
 }
 
-
+/**
+ * Find the child testsuite with the specified name.
+ */
 struct torture_suite *torture_find_suite(struct torture_suite *parent, 
 					 const char *name)
 {
diff --git a/source4/lib/torture/torture.h b/source4/lib/torture/torture.h
index 0f966a5..ea5cd70 100644
--- a/source4/lib/torture/torture.h
+++ b/source4/lib/torture/torture.h
@@ -393,4 +393,6 @@ bool torture_suite_init_tcase(struct torture_suite *suite,
 struct torture_context *torture_context_init(struct event_context *event_ctx, 
 					     const struct torture_ui_ops *ui_ops);
 
+extern const struct torture_ui_ops torture_subunit_ui_ops;
+
 #endif /* __TORTURE_UI_H__ */
diff --git a/source4/param/loadparm.c b/source4/param/loadparm.c
index 0c29de6..2808cb9 100644
--- a/source4/param/loadparm.c
+++ b/source4/param/loadparm.c
@@ -616,11 +616,6 @@ _PUBLIC_ FN_GLOBAL_INTEGER(lp_kpasswd_port, kpasswd_port)
 _PUBLIC_ FN_GLOBAL_INTEGER(lp_web_port, web_port)
 _PUBLIC_ FN_GLOBAL_STRING(lp_swat_directory, swat_directory)
 _PUBLIC_ FN_GLOBAL_BOOL(lp_tls_enabled, tls_enabled)
-_PUBLIC_ FN_GLOBAL_STRING(lp_tls_keyfile, tls_keyfile)
-_PUBLIC_ FN_GLOBAL_STRING(lp_tls_certfile, tls_certfile)
-_PUBLIC_ FN_GLOBAL_STRING(lp_tls_cafile, tls_cafile)
-_PUBLIC_ FN_GLOBAL_STRING(lp_tls_crlfile, tls_crlfile)
-_PUBLIC_ FN_GLOBAL_STRING(lp_tls_dhpfile, tls_dhpfile)
 _PUBLIC_ FN_GLOBAL_STRING(lp_share_backend, szShareBackend)
 _PUBLIC_ FN_GLOBAL_STRING(lp_sam_url, szSAM_URL)
 _PUBLIC_ FN_GLOBAL_STRING(lp_idmap_url, szIDMAP_URL)
@@ -2638,3 +2633,29 @@ void lp_smbcli_session_options(struct loadparm_context *lp_ctx,
 	options->ntlmv2_auth = lp_client_ntlmv2_auth(lp_ctx);
 	options->plaintext_auth = lp_client_plaintext_auth(lp_ctx);
 }
+
+_PUBLIC_ const char *lp_tls_keyfile(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx)
+{
+	return private_path(mem_ctx, lp_ctx, lp_ctx->globals->tls_keyfile);
+}
+
+_PUBLIC_ const char *lp_tls_certfile(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx)
+{
+	return private_path(mem_ctx, lp_ctx, lp_ctx->globals->tls_certfile);
+}
+
+_PUBLIC_ const char *lp_tls_cafile(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx)
+{
+	return private_path(mem_ctx, lp_ctx, lp_ctx->globals->tls_cafile);
+}
+
+_PUBLIC_ const char *lp_tls_crlfile(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx)
+{
+	return private_path(mem_ctx, lp_ctx, lp_ctx->globals->tls_crlfile);
+}
+
+_PUBLIC_ const char *lp_tls_dhpfile(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx)
+{
+	return private_path(mem_ctx, lp_ctx, lp_ctx->globals->tls_dhpfile);
+}
+
diff --git a/source4/param/param.h b/source4/param/param.h
index 4c6e8b7..9c20931 100644
--- a/source4/param/param.h
+++ b/source4/param/param.h
@@ -78,11 +78,11 @@ int lp_kpasswd_port(struct loadparm_context *);
 int lp_web_port(struct loadparm_context *);
 const char *lp_swat_directory(struct loadparm_context *);
 bool lp_tls_enabled(struct loadparm_context *);
-const char *lp_tls_keyfile(struct loadparm_context *);
-const char *lp_tls_certfile(struct loadparm_context *);
-const char *lp_tls_cafile(struct loadparm_context *);
-const char *lp_tls_crlfile(struct loadparm_context *);
-const char *lp_tls_dhpfile(struct loadparm_context *);
+const char *lp_tls_keyfile(TALLOC_CTX *mem_ctx, struct loadparm_context *);
+const char *lp_tls_certfile(TALLOC_CTX *mem_ctx, struct loadparm_context *);
+const char *lp_tls_cafile(TALLOC_CTX *mem_ctx, struct loadparm_context *);
+const char *lp_tls_crlfile(TALLOC_CTX *mem_ctx, struct loadparm_context *);
+const char *lp_tls_dhpfile(TALLOC_CTX *mem_ctx, struct loadparm_context *);
 const char *lp_share_backend(struct loadparm_context *);
 const char *lp_sam_url(struct loadparm_context *);
 const char *lp_idmap_url(struct loadparm_context *);
diff --git a/source4/torture/smbtorture.c b/source4/torture/smbtorture.c
index 8d195f1..19f1d1a 100644
--- a/source4/torture/smbtorture.c
+++ b/source4/torture/smbtorture.c
@@ -365,80 +365,6 @@ const static struct torture_ui_ops std_ui_ops = {
 	.test_result = simple_test_result
 };
 
-static void subunit_init(struct torture_context *ctx) 
-{
-	/* FIXME: register segv and bus handler */
-}
-
-static void subunit_suite_start(struct torture_context *ctx,
-				struct torture_suite *suite)
-{
-}
-
-static void subunit_print_testname(struct torture_context *ctx, 
-				   struct torture_tcase *tcase,
-				   struct torture_test *test)
-{
-	if (!strcmp(tcase->name, test->name)) {
-		printf("%s", test->name);
-	} else {
-		printf("%s.%s", tcase->name, test->name);
-	}
-}
-
-static void subunit_test_start(struct torture_context *ctx, 
-			       struct torture_tcase *tcase,
-			       struct torture_test *test)
-{
-	printf("test: ");
-	subunit_print_testname(ctx, tcase, test);	
-	printf("\n");
-}
-
-static void subunit_test_result(struct torture_context *context, 
-				enum torture_result res, const char *reason)
-{
-	switch (res) {
-	case TORTURE_OK:
-		printf("success: ");
-		break;
-	case TORTURE_FAIL:
-		printf("failure: ");
-		break;
-	case TORTURE_ERROR:
-		printf("error: ");
-		break;
-	case TORTURE_SKIP:
-		printf("skip: ");
-		break;
-	}
-	subunit_print_testname(context, context->active_tcase, context->active_test);	
-
-	if (reason)
-		printf(" [\n%s\n]", reason);
-	printf("\n");
-}
-
-static void subunit_comment(struct torture_context *test,
-			    const char *comment)
-{
-	fprintf(stderr, "%s", comment);
-}
-
-static void subunit_warning(struct torture_context *test,
-			    const char *comment)
-{
-	fprintf(stderr, "WARNING!: %s\n", comment);
-}
-
-const static struct torture_ui_ops subunit_ui_ops = {
-	.init = subunit_init,
-	.comment = subunit_comment,
-	.warning = subunit_warning,
-	.test_start = subunit_test_start,
-	.test_result = subunit_test_result,
-	.suite_start = subunit_suite_start
-};
 
 static void quiet_suite_start(struct torture_context *ctx,
 			      struct torture_suite *suite)
@@ -693,7 +619,7 @@ int main(int argc,char *argv[])
 	if (!strcmp(ui_ops_name, "simple")) {
 		ui_ops = &std_ui_ops;
 	} else if (!strcmp(ui_ops_name, "subunit")) {
-		ui_ops = &subunit_ui_ops;
+		ui_ops = &torture_subunit_ui_ops;
 	} else if (!strcmp(ui_ops_name, "quiet")) {
 		ui_ops = &quiet_ui_ops;
 	} else {


-- 
Samba Shared Repository


More information about the samba-cvs mailing list