s3:libsmb: restructure cli_negprot_done() secblob handling a bit
authorStefan Metzmacher <metze@samba.org>
Tue, 13 Sep 2011 19:12:44 +0000 (21:12 +0200)
committerStefan Metzmacher <metze@samba.org>
Thu, 15 Sep 2011 10:12:26 +0000 (12:12 +0200)
metze

source3/libsmb/cliconnect.c

index 545a02bef6d42f271b8d78aac03a5704e04eba0f..5449fcf3129555463e64d4bc2d80ff0c9d25651f 100644 (file)
@@ -2679,7 +2679,6 @@ static void cli_negprot_done(struct tevent_req *subreq)
                /* this time arrives in real GMT */
                ts = interpret_long_date(((char *)(vwv+11))+1);
                cli->servertime = ts.tv_sec;
-               cli->secblob = data_blob(bytes, num_bytes);
                server_capabilities = IVAL(vwv + 9, 1);
                if (server_capabilities & CAP_RAW_MODE) {
                        server_readbraw = true;
@@ -2688,15 +2687,19 @@ static void cli_negprot_done(struct tevent_req *subreq)
                if (server_capabilities & CAP_LOCK_AND_READ) {
                        server_lockread = true;
                }
-               /* work out if they sent us a workgroup */
-               if (!(server_capabilities & CAP_EXTENDED_SECURITY) &&
-                   smb_buflen(inbuf) > 8) {
-                       ssize_t ret;
-                       status = smb_bytes_talloc_string(
-                               cli, (char *)inbuf, &cli->server_domain,
-                               bytes + 8, num_bytes - 8, &ret);
-                       if (tevent_req_nterror(req, status)) {
-                               return;
+               if (server_capabilities & CAP_EXTENDED_SECURITY) {
+                       cli->secblob = data_blob(bytes, num_bytes);
+               } else {
+                       cli->secblob = data_blob(bytes, num_bytes);
+                       /* work out if they sent us a workgroup */
+                       if (num_bytes > 8) {
+                               ssize_t ret;
+                               status = smb_bytes_talloc_string(
+                                       cli, (char *)inbuf, &cli->server_domain,
+                                       bytes + 8, num_bytes - 8, &ret);
+                               if (tevent_req_nterror(req, status)) {
+                                       return;
+                               }
                        }
                }