瀏覽代碼

Merge pull request #313 from vance-od/patch-1

auth: fixed issue when during registration nonce expired, after backwards time shift
Daniel-Constantin Mierla 10 年之前
父節點
當前提交
c078256b92
共有 1 個文件被更改,包括 7 次插入1 次删除
  1. 7 1
      modules/auth/nonce.c

+ 7 - 1
modules/auth/nonce.c

@@ -357,7 +357,13 @@ int check_nonce(auth_body_t* auth, str* secret1, str* secret2,
 		   different length (for example because of different auth.
 		   different length (for example because of different auth.
 		   checks)..  Therefore we force credentials to be rebuilt by UAC
 		   checks)..  Therefore we force credentials to be rebuilt by UAC
 		   without prompting for password */
 		   without prompting for password */
-		return 4;
+		/* if current time is less than start time, reset the start time 
+            	(e.g., after start, the system clock was set in the past) */ 
+        	t=time(0); 
+        	if (t < up_since) 
+			up_since = t;
+		if (since < t)
+			return 4; 
 	}
 	}
 	t=time(0);
 	t=time(0);
 	if (unlikely((since > t) && ((since-t) > nonce_auth_max_drift) )){
 	if (unlikely((since > t) && ((since-t) > nonce_auth_max_drift) )){