s3: Fix cli_bad_session_request
authorVolker Lendecke <vl@samba.org>
Sun, 29 May 2011 16:49:14 +0000 (18:49 +0200)
committerVolker Lendecke <vl@samba.org>
Sun, 29 May 2011 19:10:26 +0000 (21:10 +0200)
We expect a negative session response with a 0x82 error (called name not
present), not a 0x82 message

source3/torture/torture.c

index 36c300b360a400138f5049f8a21ad22b64e46f38..47f4efd5d801b52b90d9637a0b882f9793f5a53a 100644 (file)
@@ -211,6 +211,8 @@ static bool cli_bad_session_request(int fd,
        uint8_t *inbuf;
        int err;
        bool ret = false;
+       uint8_t message_type;
+       uint8_t error;
 
        frame = talloc_stackframe();
 
@@ -262,8 +264,23 @@ static bool cli_bad_session_request(int fd,
                goto fail;
        }
 
-        if (CVAL(inbuf,0) != 0x82) {
-                /* This is the wrong place to put the error... JRA. */
+       message_type = CVAL(inbuf, 0);
+       if (message_type != 0x83) {
+               d_fprintf(stderr, "Expected msg type 0x83, got 0x%2.2x\n",
+                         message_type);
+               goto fail;
+        }
+
+       if (smb_len(inbuf) != 1) {
+               d_fprintf(stderr, "Expected smb_len 1, got %d\n",
+                         (int)smb_len(inbuf));
+               goto fail;
+        }
+
+       error = CVAL(inbuf, 4);
+       if (error !=  0x82) {
+               d_fprintf(stderr, "Expected error 0x82, got %d\n",
+                         (int)error);
                goto fail;
         }