Do not build the session request if it si not used anyway
[kai/samba.git] / source3 / libsmb / cliconnect.c
index b0fdc9920b1eccc816a719b8e5124102df40b1a4..8b7ac7d718496812c878fc6ddc4226dc14f936c6 100644 (file)
@@ -1397,6 +1397,10 @@ bool cli_session_request(struct cli_state *cli,
        char *p;
        int len = 4;
 
+       /* 445 doesn't have session request */
+       if (cli->port == 445)
+               return True;
+
        memcpy(&(cli->calling), calling, sizeof(*calling));
        memcpy(&(cli->called ), called , sizeof(*called ));
 
@@ -1410,10 +1414,6 @@ bool cli_session_request(struct cli_state *cli,
        name_mangle(cli->calling.name, p, cli->calling.name_type);
        len += name_len(p);
 
-       /* 445 doesn't have session request */
-       if (cli->port == 445)
-               return True;
-
        /* send a session request (RFC 1002) */
        /* setup the packet length
          * Remove four bytes from the length count, since the length