summaryrefslogtreecommitdiffstats
path: root/src/modules
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/UserConfigBackendKrb5/UserConfigBackendKrb5.cpp23
-rw-r--r--src/modules/UserConfigBackendKrb5/UserConfigBackendKrb5.h2
2 files changed, 25 insertions, 0 deletions
diff --git a/src/modules/UserConfigBackendKrb5/UserConfigBackendKrb5.cpp b/src/modules/UserConfigBackendKrb5/UserConfigBackendKrb5.cpp
index 5a577ad..9a43691 100644
--- a/src/modules/UserConfigBackendKrb5/UserConfigBackendKrb5.cpp
+++ b/src/modules/UserConfigBackendKrb5/UserConfigBackendKrb5.cpp
@@ -19,6 +19,7 @@
#include "UserConfigBackendKrb5.h"
#include <Core/ConfigEntry.h>
+#include <Core/ThreadManager.h>
#include <cstring>
@@ -125,6 +126,8 @@ void UserConfigBackendKrb5::checkUserInfo(const Common::UserInfo &userInfo) thro
}
void UserConfigBackendKrb5::addUser(const Common::UserInfo &userInfo) throw(Core::Exception) {
+ application->getThreadManager()->detach();
+
std::string princStr = userInfo.getUsername() + "@" + realm;
kadm5_principal_ent_rec princ;
@@ -169,6 +172,8 @@ void UserConfigBackendKrb5::updateUser(const Common::UserInfo &oldUserInfo, cons
}
void UserConfigBackendKrb5::deleteUser(const Common::UserInfo &userInfo) throw(Core::Exception) {
+ application->getThreadManager()->detach();
+
std::string princStr = userInfo.getUsername() + "@" + realm;
krb5_principal princ;
@@ -184,6 +189,24 @@ void UserConfigBackendKrb5::deleteUser(const Common::UserInfo &userInfo) throw(C
// throw Core::Exception("kadm5_delete_principal", Core::Exception::INTERNAL_ERRNO, err);
}
+void UserConfigBackendKrb5::setPassword(const Common::UserInfo &userInfo, const std::string &password) throw(Core::Exception) {
+ application->getThreadManager()->detach();
+
+ std::string princStr = userInfo.getUsername() + "@" + realm;
+ krb5_principal princ;
+
+ krb5_error_code err = krb5_parse_name(context, princStr.c_str(), &princ);
+ if(err)
+ throw Core::Exception("krb5_parse_name", Core::Exception::INTERNAL_ERRNO, err);
+
+ err = kadm5_chpass_principal(handle, princ, const_cast<char*>(password.c_str()));
+
+ krb5_free_principal(context, princ);
+
+ if(err)
+ throw Core::Exception("kadm5_chpass_principal", Core::Exception::INTERNAL_ERRNO, err);
+}
+
}
}
}
diff --git a/src/modules/UserConfigBackendKrb5/UserConfigBackendKrb5.h b/src/modules/UserConfigBackendKrb5/UserConfigBackendKrb5.h
index afb7663..6571220 100644
--- a/src/modules/UserConfigBackendKrb5/UserConfigBackendKrb5.h
+++ b/src/modules/UserConfigBackendKrb5/UserConfigBackendKrb5.h
@@ -58,6 +58,8 @@ class UserConfigBackendKrb5 : public Common::UserConfigBackend, private Core::Co
virtual void updateUser(const Common::UserInfo &oldUserInfo, const Common::UserInfo &userInfo) throw(Core::Exception);
virtual void deleteUser(const Common::UserInfo &userInfo) throw(Core::Exception);
+ virtual void setPassword(const Common::UserInfo &userInfo, const std::string &password) throw(Core::Exception);
+
public:
UserConfigBackendKrb5(Common::Application *application0) : application(application0), handle(0) {
krb5_error_code err = krb5_init_context(&context);