summaryrefslogtreecommitdiffstats
path: root/src/modules/UserConfigBackendKrb5/UserConfigBackendKrb5.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/UserConfigBackendKrb5/UserConfigBackendKrb5.cpp')
-rw-r--r--src/modules/UserConfigBackendKrb5/UserConfigBackendKrb5.cpp23
1 files changed, 23 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);
+}
+
}
}
}