summaryrefslogtreecommitdiffstats
path: root/src/modules/UserConfigBackendKrb5
diff options
context:
space:
mode:
authorMatthias Schiffer <matthias@gamezock.de>2009-08-16 03:01:12 +0200
committerMatthias Schiffer <matthias@gamezock.de>2009-08-16 03:01:12 +0200
commitb6f7d36a544a7a8c18c815ef4158cf684108d06d (patch)
tree417e12f98f5b2c6d03bd740999532e61d60a664a /src/modules/UserConfigBackendKrb5
parentc1cb92bc30256171bfafb22cf8512142afee97cf (diff)
downloadmad-b6f7d36a544a7a8c18c815ef4158cf684108d06d.tar
mad-b6f7d36a544a7a8c18c815ef4158cf684108d06d.zip
Passwörter können gesetzt werden
Diffstat (limited to 'src/modules/UserConfigBackendKrb5')
-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);