From 477d5b0abbdf97e2e9d1594f6d07b9c522f09715 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Mon, 11 Jun 2012 03:35:58 -0500 Subject: Add kgetcred integration --- src/libtdeldap.cpp | 18 ++++++++++++++++++ src/libtdeldap.h | 1 + 2 files changed, 19 insertions(+) (limited to 'src') 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: -- cgit v1.2.1