Removing bug regarding security-server first use.
authorMarcin Niesluchowski <m.niesluchow@samsung.com>
Thu, 8 Aug 2013 17:26:18 +0000 (19:26 +0200)
committerBartlomiej Grzelewski <b.grzelewski@samsung.com>
Thu, 6 Feb 2014 16:13:21 +0000 (17:13 +0100)
[Issue#]        SSDWSSP-449
[Bug/Feature]   There should be difference between initiated password time and
                first function call regarding password so that difference should
                not cause SECURITY_SERVER_ERROR_PASSWORD_RETRY_TIMER error.
[Cause]         While security-server is called for the first time, it initiates
                itself.
[Solution]      N/A
[Verification]  Running security-server ss-password tests. There should be no
                error with SECURITY_SERVER_ERROR_PASSWORD_RETRY_TIMER (value -17).

Change-Id: I67243269fc8ed0476f614ab4143d81f4c12e24ee

src/server/security-server-password.c

index a13e6aa..9680c6b 100644 (file)
@@ -38,7 +38,18 @@ struct timeval prev_try;
 
 void initiate_try()
 {
+    long int temp_usec;
+
     gettimeofday(&prev_try, NULL);
+
+    temp_usec = prev_try.tv_usec - SECURITY_SERVER_PASSWORD_RETRY_TIMEOUT_MICROSECOND;
+    if (temp_usec >= 0)
+        prev_try.tv_usec = temp_usec;
+    else
+    {
+        prev_try.tv_sec = prev_try.tv_sec - 1;
+        prev_try.tv_usec = 1000000 + temp_usec;
+    }
 }
 
 int validate_pwd_file(char *filename)