diff options
author | Andrew Bartlett <abartlet@samba.org> | 2003-04-23 09:26:07 +0000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2003-04-23 09:26:07 +0000 |
commit | a93057efcb6e639be05b7bdcb9729ed8f39f5f62 (patch) | |
tree | 14eae8d116dcaae971434032bba49b655d97d2ef | |
parent | 273a9bd7aa608d37b127b61d41773ba8135e38f7 (diff) | |
download | samba-a93057efcb6e639be05b7bdcb9729ed8f39f5f62.tar.gz samba-a93057efcb6e639be05b7bdcb9729ed8f39f5f62.tar.xz samba-a93057efcb6e639be05b7bdcb9729ed8f39f5f62.zip |
Add a check to ensure that the server returns the correct device type, not
just the correct error.
This should help us avoid breaking NT4 IPC$ connections, for example.
This has required that we don't overwrite the device type for IPC$ in our
tcon&X code, but only smbwrapper even uses it, and a server that doesn't send
a correct dev type breaks other things pretty badly.
In any case, I'll 'fix' smbwrapper :-).
Andrew Bartlett
-rw-r--r-- | source/libsmb/cliconnect.c | 3 | ||||
-rw-r--r-- | source/torture/torture.c | 31 |
2 files changed, 20 insertions, 14 deletions
diff --git a/source/libsmb/cliconnect.c b/source/libsmb/cliconnect.c index 4bfa694e634..9dddb6a1633 100644 --- a/source/libsmb/cliconnect.c +++ b/source/libsmb/cliconnect.c @@ -810,9 +810,6 @@ BOOL cli_send_tconX(struct cli_state *cli, clistr_pull(cli, cli->dev, smb_buf(cli->inbuf), sizeof(fstring), -1, STR_TERMINATE|STR_ASCII); - if (strcasecmp(share,"IPC$")==0) - fstrcpy(cli->dev, "IPC"); - if (cli->protocol >= PROTOCOL_NT1 && smb_buflen(cli->inbuf) == 3) { /* almost certainly win95 - enable bug fixes */ diff --git a/source/torture/torture.c b/source/torture/torture.c index 740fae44251..840b6ad2947 100644 --- a/source/torture/torture.c +++ b/source/torture/torture.c @@ -1066,6 +1066,7 @@ static BOOL run_tcon2_test(int dummy) static BOOL tcon_devtest(struct cli_state *cli, const char *myshare, const char *devtype, + const char *return_devtype, NTSTATUS expected_error) { BOOL status; @@ -1076,7 +1077,15 @@ static BOOL tcon_devtest(struct cli_state *cli, if (NT_STATUS_IS_OK(expected_error)) { if (status) { - ret = True; + if (strcmp(cli->dev, return_devtype) == 0) { + ret = True; + } else { + printf("tconX to share %s with type %s " + "succeeded but returned the wrong " + "device type (got [%s] but should have got [%s])\n", + myshare, devtype, cli->dev, return_devtype); + ret = False; + } } else { printf("tconX to share %s with type %s " "should have succeeded but failed\n", @@ -1125,34 +1134,34 @@ static BOOL run_tcon_devtype_test(int dummy) return False; } - if (!tcon_devtest(cli1, "IPC$", "A:", NT_STATUS_BAD_DEVICE_TYPE)) + if (!tcon_devtest(cli1, "IPC$", "A:", NULL, NT_STATUS_BAD_DEVICE_TYPE)) ret = False; - if (!tcon_devtest(cli1, "IPC$", "?????", NT_STATUS_OK)) + if (!tcon_devtest(cli1, "IPC$", "?????", "IPC", NT_STATUS_OK)) ret = False; - if (!tcon_devtest(cli1, "IPC$", "LPT:", NT_STATUS_BAD_DEVICE_TYPE)) + if (!tcon_devtest(cli1, "IPC$", "LPT:", NULL, NT_STATUS_BAD_DEVICE_TYPE)) ret = False; - if (!tcon_devtest(cli1, "IPC$", "IPC", NT_STATUS_OK)) + if (!tcon_devtest(cli1, "IPC$", "IPC", "IPC", NT_STATUS_OK)) ret = False; - if (!tcon_devtest(cli1, "IPC$", "FOOBA", NT_STATUS_BAD_DEVICE_TYPE)) + if (!tcon_devtest(cli1, "IPC$", "FOOBA", NULL, NT_STATUS_BAD_DEVICE_TYPE)) ret = False; - if (!tcon_devtest(cli1, share, "A:", NT_STATUS_OK)) + if (!tcon_devtest(cli1, share, "A:", "A:", NT_STATUS_OK)) ret = False; - if (!tcon_devtest(cli1, share, "?????", NT_STATUS_OK)) + if (!tcon_devtest(cli1, share, "?????", "A:", NT_STATUS_OK)) ret = False; - if (!tcon_devtest(cli1, share, "LPT:", NT_STATUS_BAD_DEVICE_TYPE)) + if (!tcon_devtest(cli1, share, "LPT:", NULL, NT_STATUS_BAD_DEVICE_TYPE)) ret = False; - if (!tcon_devtest(cli1, share, "IPC", NT_STATUS_BAD_DEVICE_TYPE)) + if (!tcon_devtest(cli1, share, "IPC", NULL, NT_STATUS_BAD_DEVICE_TYPE)) ret = False; - if (!tcon_devtest(cli1, share, "FOOBA", NT_STATUS_BAD_DEVICE_TYPE)) + if (!tcon_devtest(cli1, share, "FOOBA", NULL, NT_STATUS_BAD_DEVICE_TYPE)) ret = False; cli_shutdown(cli1); |