diff --git a/include/User.h b/include/User.h index 233ed454ef..893e9405a7 100644 --- a/include/User.h +++ b/include/User.h @@ -60,7 +60,7 @@ public: /** * Returns user password - * @return username User's hostname + * @return the User's password */ const string& get_password() const { @@ -126,6 +126,15 @@ public: return rc; }; + /** + * Returns user password + * @return the user's auth driver + */ + const string& get_auth_driver() const + { + return auth_driver; + }; + /** * Sets the user auth driver. * diff --git a/src/rm/RequestManagerUser.cc b/src/rm/RequestManagerUser.cc index b7503323ac..91f7bfc012 100644 --- a/src/rm/RequestManagerUser.cc +++ b/src/rm/RequestManagerUser.cc @@ -61,6 +61,11 @@ int UserChangePassword::user_action(User * user, string new_pass = xmlrpc_c::value_string(paramList.getString(2)); + if (user->get_auth_driver() == UserPool::CORE_AUTH) + { + new_pass = SSLTools::sha1_digest(new_pass); + } + int rc = user->set_password(new_pass, error_str); if ( rc == 0 ) @@ -85,6 +90,11 @@ int UserChangeAuth::user_action(User * user, int rc; + if (new_auth == UserPool::CORE_AUTH) + { + new_pass = SSLTools::sha1_digest(new_pass); + } + // The password may be invalid, try to change it first rc = user->set_password(new_pass, error_str);