diff options
author | Timothy Pearson <[email protected]> | 2012-06-11 03:35:58 -0500 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2012-06-11 03:35:58 -0500 |
commit | 477d5b0abbdf97e2e9d1594f6d07b9c522f09715 (patch) | |
tree | 42ec276feb64c637b2bb93f42fb49db6d18ab5fc /src | |
parent | 072098e10daf6fb9a0af0065d9b1130c5405bd0d (diff) | |
download | libtdeldap-477d5b0abbdf97e2e9d1594f6d07b9c522f09715.tar.gz libtdeldap-477d5b0abbdf97e2e9d1594f6d07b9c522f09715.zip |
Add kgetcred integration
Diffstat (limited to 'src')
-rw-r--r-- | src/libtdeldap.cpp | 18 | ||||
-rw-r--r-- | src/libtdeldap.h | 1 |
2 files changed, 19 insertions, 0 deletions
diff --git a/src/libtdeldap.cpp b/src/libtdeldap.cpp index 6d954a8..bad84ef 100644 --- a/src/libtdeldap.cpp +++ b/src/libtdeldap.cpp @@ -1226,6 +1226,24 @@ int LDAPManager::obtainKerberosTicket(LDAPCredentials creds, TQString principal, return 0; } +int LDAPManager::obtainKerberosServiceTicket(TQString principal, TQString *errstr) { + TQString ret; + TQString command = TQString("kgetcred \"%1\"").arg(principal); + FILE *output = popen(command.ascii(), "r"); + TQFile f; + f.open(IO_ReadOnly, output); + TQTextStream stream(&f); + ret = stream.readLine(); + f.close(); + pclose(output); + + if (ret != "") { + if (errstr) *errstr = ret; + return -1; + } + return 0; +} + int LDAPManager::destroyKerberosTicket(TQString principal, TQString *errstr) { TQString ret; TQString command = TQString("kdestroy --credential=\"%1\"").arg(principal); diff --git a/src/libtdeldap.h b/src/libtdeldap.h index 0edf803..1e7fb23 100644 --- a/src/libtdeldap.h +++ b/src/libtdeldap.h @@ -385,6 +385,7 @@ class LDAPManager : public TQObject { static KerberosTicketInfoList getKerberosTicketList(TQString cache=TQString::null, TQString *cacheFileName=0); static int getKerberosPassword(LDAPCredentials &creds, TQString prompt, bool requestServicePrincipal=false, TQWidget* parent=0); static int obtainKerberosTicket(LDAPCredentials creds, TQString principal, TQString *errstr=0); + static int obtainKerberosServiceTicket(TQString principal, TQString *errstr=0); static int destroyKerberosTicket(TQString principal, TQString *errstr=0); private: |