]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Do an early exit on negprot failure
authorVolker Lendecke <vl@samba.org>
Tue, 28 Feb 2017 15:03:45 +0000 (15:03 +0000)
committerKarolin Seeger <kseeger@samba.org>
Mon, 13 Mar 2017 12:03:15 +0000 (13:03 +0100)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12610

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Böhme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit cf9acf9a3da932fca115967eb3d9d9ed48fcbbfc)

Autobuild-User(v4-4-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-4-test): Mon Mar 13 13:03:15 CET 2017 on sn-devel-144

source3/smbd/negprot.c

index 793306ad0e0289c39db6cc2df0dec487c5caf4a1..176dbd79943421029353a59772adfa1fc4a5adce 100644 (file)
@@ -723,17 +723,26 @@ void reply_negprot(struct smb_request *req)
                        break;
        }
 
-       if(choice != -1) {
-               fstrcpy(remote_proto,supported_protocols[protocol].short_name);
-               reload_services(sconn, conn_snum_used, true);
-               supported_protocols[protocol].proto_reply_fn(req, choice);
-               DEBUG(3,("Selected protocol %s\n",supported_protocols[protocol].proto_name));
-       } else {
-               DEBUG(0,("No protocol supported !\n"));
+       if (choice == -1) {
+               bool ok;
+
+               DBG_NOTICE("No protocol supported !\n");
                reply_outbuf(req, 1, 0);
                SSVAL(req->outbuf, smb_vwv0, choice);
+
+               ok = srv_send_smb(xconn, (char *)req->outbuf,
+                                       false, 0, false, NULL);
+               if (!ok) {
+                       DBG_NOTICE("srv_send_smb failed\n");
+               }
+               exit_server_cleanly("no protocol supported\n");
        }
 
+       fstrcpy(remote_proto,supported_protocols[protocol].short_name);
+       reload_services(sconn, conn_snum_used, true);
+       supported_protocols[protocol].proto_reply_fn(req, choice);
+       DEBUG(3,("Selected protocol %s\n",supported_protocols[protocol].proto_name));
+
        DEBUG( 5, ( "negprot index=%d\n", choice ) );
 
        /* We always have xconn->smb1.signing_state also for >= SMB2_02 */