dealing with some stack overflow bug somewhere around the use of
authorLuke Leighton <lkcl@samba.org>
Thu, 16 Oct 1997 13:38:16 +0000 (13:38 +0000)
committerLuke Leighton <lkcl@samba.org>
Thu, 16 Oct 1997 13:38:16 +0000 (13:38 +0000)
deal_with_credentials() by moving important code to the beginning
of the function :-) :-) :-).

the new seed (old_cred + time + 1) was getting corrupted.
(This used to be commit dab35ce5d61d53bce6ede44e56d9393645c0d67e)

source3/pipenetlog.c

index 4d28e3bef0fb2936ec9ffbc2d8d7d98f60128456..32096b3b843181e9d2e2c8147d557a961e62d9a9 100644 (file)
@@ -390,6 +390,17 @@ static BOOL deal_with_credentials(user_struct *vuser,
        UTIME new_clnt_time;
        uint32 new_cred;
 
+       DEBUG(5,("deal_with_credentials: %d\n", __LINE__));
+
+       /* increment client time by one second */
+       new_clnt_time.time = clnt_cred->timestamp.time + 1;
+
+       /* first 4 bytes of the new seed is old client 4 bytes + clnt time + 1 */
+       new_cred = IVAL(vuser->dc.clnt_cred.data, 0);
+       new_cred += new_clnt_time.time;
+
+       DEBUG(5,("deal_with_credentials: new_cred[0]=%lx\n", new_cred));
+
        /* doesn't matter that server time is 0 */
        srv_cred->timestamp.time = 0;
 
@@ -400,25 +411,16 @@ static BOOL deal_with_credentials(user_struct *vuser,
                return False;
        }
 
-       /* increment client time by one second */
-       new_clnt_time.time = clnt_cred->timestamp.time + 1;
-
        DEBUG(5,("deal_with_credentials: new_clnt_time=%lx\n", new_clnt_time.time));
 
        /* create server credentials for inclusion in the reply */
        cred_create(vuser->dc.sess_key, &(vuser->dc.clnt_cred), new_clnt_time,
                    &(srv_cred->challenge));
        
-       DEBUG(5,("deal_with_credentials: %d\n", __LINE__));
-
        DEBUG(5,("deal_with_credentials: clnt_cred[0]=%lx\n",
                  vuser->dc.clnt_cred.data[0]));
 
-       new_cred = IVAL(vuser->dc.clnt_cred.data, 0);
-       new_cred += new_clnt_time.time;
-
-       DEBUG(5,("deal_with_credentials: new_cred[0]=%lx\n", new_cred));
-
+       /* store new seed in client and server credentials */
        SIVAL(vuser->dc.clnt_cred.data, 0, new_cred);
        SIVAL(vuser->dc.srv_cred .data, 0, new_cred);