Check password reuse in auth_passwd_check_passwd_available() 46/82946/1 accepted/tizen/common/20160809.183708 accepted/tizen/ivi/20160809.075316 accepted/tizen/mobile/20160809.075218 accepted/tizen/tv/20160809.075235 accepted/tizen/wearable/20160809.075254 submit/tizen/20160809.013103
authorjooseong lee <jooseong.lee@samsung.com>
Mon, 8 Aug 2016 08:29:12 +0000 (17:29 +0900)
committerjooseong lee <jooseong.lee@samsung.com>
Mon, 8 Aug 2016 08:34:15 +0000 (17:34 +0900)
Change-Id: I5709d224930acfb7a33d99add6d136c67fcef187
Signed-off-by: jooseong lee <jooseong.lee@samsung.com>
src/include/auth-passwd.h
src/server/service/password.cpp

index 24be828c5937ac843da7799889e07fd69c98d581..4d3549daf78be5c861b9002fd8e4aa0f973ee53a 100644 (file)
@@ -233,6 +233,8 @@ int auth_passwd_check_passwd_state(password_type passwd_type,
  * \return AUTH_PASSWD_API_SUCCESS
  * \return AUTH_PASSWD_API_ERROR_ACCESS_DENIED
  * \return AUTH_PASSWD_API_ERROR_SOCKET
+ * \return AUTH_PASSWD_API_ERROR_PASSWORD_REUSED
+ *              Typed string is an used password before
  * \return AUTH_PASSWD_API_ERROR_INVALID_MIN_LENGTH
  *              Typed string doesn't fulfill min length policy.
  * \return AUTH_PASSWD_API_ERROR_INVALID_MIN_COMPLEX_CHAR_NUM
index 2175ee4487e064b5be640439ed9d30a4c1da5619..f165c7f072768edbe34ae60a763eda3c0393c269 100644 (file)
@@ -141,9 +141,18 @@ int PasswordService::processCheckFunctions(PasswordHdrs hdr, MessageBuffer &buff
 
        case PasswordHdrs::HDR_CHK_PASSWD_AVAILABLE: {
                std::string challenge;
+               bool isPwdReused;
                Deserialization::Deserialize(buffer, passwdType);
                Deserialization::Deserialize(buffer, challenge);
-               result = m_policyManager.checkPolicy(passwdType, NO_PASSWORD, challenge, cur_user);
+               result = m_pwdManager.isPwdReused(passwdType, challenge, cur_user, isPwdReused);
+
+               if (result == AUTH_PASSWD_API_SUCCESS) {
+                       if(!isPwdReused)
+                               result = m_policyManager.checkPolicy(passwdType, NO_PASSWORD, challenge, cur_user);
+                       else
+                               result = AUTH_PASSWD_API_ERROR_PASSWORD_REUSED;
+               }
+
                break;
        }