From fa3a6652211076772b1b24a3a2216014a16e4054 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 29 May 2009 16:36:44 +0200 Subject: s4-smbtorture: add very basic LIBNETAPI testsuite. Guenther --- source4/torture/libnetapi/libnetapi.c | 78 +++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 source4/torture/libnetapi/libnetapi.c (limited to 'source4/torture/libnetapi/libnetapi.c') diff --git a/source4/torture/libnetapi/libnetapi.c b/source4/torture/libnetapi/libnetapi.c new file mode 100644 index 0000000000..761a67ff22 --- /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 . +*/ + +#include "includes.h" +#include "torture/smbtorture.h" +#include "auth/credentials/credentials.h" +#include "lib/cmdline/popt_common.h" +#include +#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; +} -- cgit From 3d07a929e6e0606d841694befdd236782a2036b5 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 29 May 2009 16:39:04 +0200 Subject: s4-smbtorture: add NETAPI-USER test. Guenther --- source4/torture/libnetapi/libnetapi.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/torture/libnetapi/libnetapi.c') diff --git a/source4/torture/libnetapi/libnetapi.c b/source4/torture/libnetapi/libnetapi.c index 761a67ff22..a023ee135f 100644 --- a/source4/torture/libnetapi/libnetapi.c +++ b/source4/torture/libnetapi/libnetapi.c @@ -68,6 +68,7 @@ NTSTATUS torture_libnetapi_init(void) suite = torture_suite_create(talloc_autofree_context(), "NETAPI"); + torture_suite_add_simple_test(suite, "USER", torture_libnetapi_user); torture_suite_add_simple_test(suite, "INITIALIZE", torture_libnetapi_initialize); suite->description = talloc_strdup(suite, "libnetapi convenience interface tests"); -- cgit From 0542fa9e7d584874612e414066b068548a4d4ec1 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 29 May 2009 16:49:29 +0200 Subject: s4-smbtorture: add NETAPI-GROUP test. Guenther --- source4/torture/libnetapi/libnetapi.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/torture/libnetapi/libnetapi.c') diff --git a/source4/torture/libnetapi/libnetapi.c b/source4/torture/libnetapi/libnetapi.c index a023ee135f..c3a27eba0c 100644 --- a/source4/torture/libnetapi/libnetapi.c +++ b/source4/torture/libnetapi/libnetapi.c @@ -68,6 +68,7 @@ NTSTATUS torture_libnetapi_init(void) suite = torture_suite_create(talloc_autofree_context(), "NETAPI"); + torture_suite_add_simple_test(suite, "GROUP", torture_libnetapi_group); torture_suite_add_simple_test(suite, "USER", torture_libnetapi_user); torture_suite_add_simple_test(suite, "INITIALIZE", torture_libnetapi_initialize); -- cgit