summaryrefslogtreecommitdiff
path: root/source4/torture/winbind
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2007-09-21 14:22:23 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 15:07:07 -0500
commit1429bd9b0c7a0a2e7021b1d0ae9d7bff4c33629f (patch)
tree8a2cbf776ea4ffd963042fc51bbb585c5165556f /source4/torture/winbind
parentac8271a57c7e1ab1d2258319bc80e88ff0c3138c (diff)
downloadsamba-1429bd9b0c7a0a2e7021b1d0ae9d7bff4c33629f.tar.gz
samba-1429bd9b0c7a0a2e7021b1d0ae9d7bff4c33629f.tar.bz2
samba-1429bd9b0c7a0a2e7021b1d0ae9d7bff4c33629f.zip
r25293: add WINBIND-STRUCT-CHECK_MACHACC test
metze (This used to be commit 8684167fd804fb04fc36e49f61027e9d44beb3ba)
Diffstat (limited to 'source4/torture/winbind')
-rw-r--r--source4/torture/winbind/struct_based.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/source4/torture/winbind/struct_based.c b/source4/torture/winbind/struct_based.c
index d935d098c6..1006b3c23b 100644
--- a/source4/torture/winbind/struct_based.c
+++ b/source4/torture/winbind/struct_based.c
@@ -24,6 +24,7 @@
#include "nsswitch/winbind_client.h"
#include "libcli/security/security.h"
#include "param/param.h"
+#include "auth/pam_errors.h"
#define DO_STRUCT_REQ_REP_EXT(op,req,rep,expected,strict,warnaction,cmt) do { \
NSS_STATUS __got, __expected = (expected); \
@@ -195,6 +196,56 @@ static bool torture_winbind_struct_domain_name(struct torture_context *torture)
return true;
}
+static bool torture_winbind_struct_check_machacc(struct torture_context *torture)
+{
+ bool ok;
+ bool strict = torture_setting_bool(torture, "strict mode", false);
+ struct winbindd_response rep;
+
+ ZERO_STRUCT(rep);
+
+ torture_comment(torture, "Running WINBINDD_CHECK_MACHACC (struct based)\n");
+
+ ok = true;
+ DO_STRUCT_REQ_REP_EXT(WINBINDD_CHECK_MACHACC, NULL, &rep,
+ NSS_STATUS_SUCCESS, strict, ok = false,
+ "WINBINDD_CHECK_MACHACC");
+
+ if (!ok) {
+ torture_assert(torture,
+ strlen(rep.data.auth.nt_status_string)>0,
+ "Failed with empty nt_status_string");
+
+ torture_warning(torture,"%s:%s:%s:%d\n",
+ nt_errstr(NT_STATUS(rep.data.auth.nt_status)),
+ rep.data.auth.nt_status_string,
+ rep.data.auth.error_string,
+ rep.data.auth.pam_error);
+ return true;
+ }
+
+ torture_assert_ntstatus_ok(torture,
+ NT_STATUS(rep.data.auth.nt_status),
+ "WINBINDD_CHECK_MACHACC ok: nt_status");
+
+ torture_assert_str_equal(torture,
+ rep.data.auth.nt_status_string,
+ nt_errstr(NT_STATUS_OK),
+ "WINBINDD_CHECK_MACHACC ok:nt_status_string");
+
+ torture_assert_str_equal(torture,
+ rep.data.auth.error_string,
+ nt_errstr(NT_STATUS_OK),
+ "WINBINDD_CHECK_MACHACC ok: error_string");
+
+ torture_assert_int_equal(torture,
+ rep.data.auth.pam_error,
+ nt_status_to_pam(NT_STATUS_OK),
+ "WINBINDD_CHECK_MACHACC ok: pam_error");
+
+ return true;
+}
+
struct torture_trust_domain {
const char *netbios_name;
const char *dns_name;
@@ -449,6 +500,7 @@ struct torture_suite *torture_winbind_struct_init(void)
torture_suite_add_simple_test(suite, "PRIV_PIPE_DIR", torture_winbind_struct_priv_pipe_dir);
torture_suite_add_simple_test(suite, "NETBIOS_NAME", torture_winbind_struct_netbios_name);
torture_suite_add_simple_test(suite, "DOMAIN_NAME", torture_winbind_struct_domain_name);
+ torture_suite_add_simple_test(suite, "CHECK_MACHACC", torture_winbind_struct_check_machacc);
torture_suite_add_simple_test(suite, "LIST_TRUSTDOM", torture_winbind_struct_list_trustdom);
torture_suite_add_simple_test(suite, "DOMAIN_INFO", torture_winbind_struct_domain_info);
torture_suite_add_simple_test(suite, "GETDCNAME", torture_winbind_struct_getdcname);