summaryrefslogtreecommitdiffstats
path: root/source/torture
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2001-11-25 02:35:37 +0000
committerAndrew Bartlett <abartlet@samba.org>2001-11-25 02:35:37 +0000
commitadc7a6048c13342b79b6228beafb5142c50f318d (patch)
treef5d9f53878ac4aff6aa706bcbb0c36de5e1b686c /source/torture
parentea0331354e5968aa0a25c0b12379a56c72d7946b (diff)
downloadsamba-adc7a6048c13342b79b6228beafb5142c50f318d.tar.gz
samba-adc7a6048c13342b79b6228beafb5142c50f318d.tar.xz
samba-adc7a6048c13342b79b6228beafb5142c50f318d.zip
Add a new torture test to extract a NT->DOS error map from an NT member of a
samba domain. The PDC must be running a special authenticaion module that spits out NT errors based on username. Andrew Bartlett
Diffstat (limited to 'source/torture')
-rw-r--r--source/torture/torture.c74
1 files changed, 74 insertions, 0 deletions
diff --git a/source/torture/torture.c b/source/torture/torture.c
index e2c65bc1d3f..234f3d33354 100644
--- a/source/torture/torture.c
+++ b/source/torture/torture.c
@@ -2856,7 +2856,80 @@ static BOOL run_dirtest(int dummy)
return correct;
}
+static BOOL run_error_map_extract(int dummy) {
+
+ static struct cli_state c_dos;
+ static struct cli_state c_nt;
+
+ uint32 error;
+
+ uint32 flgs2, errnum;
+ uint8 errclass;
+
+ NTSTATUS nt_status;
+
+ fstring user;
+
+ open_nbt_connection(&c_nt);
+ open_nbt_connection(&c_dos);
+
+ c_dos.force_dos_errors = True;
+ if (!cli_negprot(&c_dos)) {
+ printf("%s rejected the DOS-error negprot (%s)\n",host, cli_errstr(&c_dos));
+ cli_shutdown(&c_dos);
+ return False;
+ }
+ if (!cli_negprot(&c_nt)) {
+ printf("%s rejected the NT-error negprot (%s)\n",host, cli_errstr(&c_nt));
+ cli_shutdown(&c_nt);
+ return False;
+ }
+
+ for (error=(0xc0000000 | 0x1); error < (0xc0000000| 0xFFF); error++) {
+ snprintf(user, sizeof(user), "%X", error);
+
+ if (!cli_session_setup(&c_nt, user,
+ password, strlen(password),
+ password, strlen(password),
+ workgroup)) {
+ flgs2 = SVAL(c_nt.inbuf,smb_flg2);
+
+ /* Case #1: 32-bit NT errors */
+ if (flgs2 & FLAGS2_32_BIT_ERROR_CODES) {
+ nt_status = NT_STATUS(IVAL(c_nt.inbuf,smb_rcls));
+ } else {
+ printf("** Dos error on NT connection! (%s)\n", cli_errstr(&c_nt));
+ nt_status = NT_STATUS(0xc0000000);
+ }
+ } else {
+ printf("** Session setup succeeded. This shouldn't happen...\n");
+ }
+
+ if (!cli_session_setup(&c_dos, user,
+ password, strlen(password),
+ password, strlen(password),
+ workgroup)) {
+ flgs2 = SVAL(c_dos.inbuf,smb_flg2), errnum;
+
+ /* Case #1: 32-bit NT errors */
+ if (flgs2 & FLAGS2_32_BIT_ERROR_CODES) {
+ printf("** NT error on DOS connection! (%s)\n", cli_errstr(&c_nt));
+ errnum = errclass = 0;
+ } else {
+ cli_dos_error(&c_dos, &errclass, &errnum);
+ }
+ } else {
+ printf("** Session setup succeeded. This shouldn't happen...\n");
+ }
+ if (NT_STATUS_V(nt_status) == error) {
+ printf("\t{%s,\t%s,\t%s}\n", smb_dos_err_class(errclass), smb_dos_err_name(errclass, errnum), get_nt_error_c_code(nt_status));
+ } else {
+ printf("/*\t{ This NT error code was 'sqashed'\n\t from %s to %s \n\t during the session setup }\n*/\n", get_nt_error_c_code(NT_STATUS(error)), get_nt_error_c_code(nt_status));
+ }
+ }
+ return True;
+}
static double create_procs(BOOL (*fn)(int), BOOL *result)
{
@@ -2992,6 +3065,7 @@ static struct {
{"NTTRANSSCAN", torture_nttrans_scan, 0},
{"UTABLE", torture_utable, 0},
{"CASETABLE", torture_casetable, 0},
+ {"ERRMAPEXTRACT", run_error_map_extract, 0},
{NULL, NULL, 0}};