Add kgetcred ability

pull/1/head
Timothy Pearson 13 years ago
parent 4973863521
commit 3dbc24a1be

@ -8,4 +8,4 @@ Terminal=false
DocPath=kerberostray/index.html DocPath=kerberostray/index.html
X-KDE-StartupNotify=true X-KDE-StartupNotify=true
X-DCOP-ServiceType=Multi X-DCOP-ServiceType=Multi
Categories=Qt;KDE;Utilities; Categories=Qt;KDE;Utility;

@ -51,6 +51,7 @@
#include <kdialogbase.h> #include <kdialogbase.h>
#include <kaction.h> #include <kaction.h>
#include <knotifydialog.h> #include <knotifydialog.h>
#include <klineeditdlg.h>
#include <libtdeldap.h> #include <libtdeldap.h>
#include "configdlg.h" #include "configdlg.h"
@ -67,6 +68,7 @@ TopLevel::TopLevel() : KSystemTray(), ticketWatch(0), m_refreshTimer(0), notifyE
getNewTGTAct = new KAction(i18n("&Obtain New Ticket Granting Ticket"), "add_user", 0, TQT_TQOBJECT(this), TQT_SLOT(getNewTGT()), actionCollection(), "getnewtgt"); getNewTGTAct = new KAction(i18n("&Obtain New Ticket Granting Ticket"), "add_user", 0, TQT_TQOBJECT(this), TQT_SLOT(getNewTGT()), actionCollection(), "getnewtgt");
getNewSTAct = new KAction(i18n("&Obtain New Primary Service Ticket"), "add_user", 0, TQT_TQOBJECT(this), TQT_SLOT(getNewServiceTicket()), actionCollection(), "getnewserviceticket"); getNewSTAct = new KAction(i18n("&Obtain New Primary Service Ticket"), "add_user", 0, TQT_TQOBJECT(this), TQT_SLOT(getNewServiceTicket()), actionCollection(), "getnewserviceticket");
getNewStandardSTAct = new KAction(i18n("&Obtain Authenticated Service Ticket"), "add_user", 0, TQT_TQOBJECT(this), TQT_SLOT(getNewServiceTicketWithExistingCreds()), actionCollection(), "getstandardserviceticket");
destroyAllAct = new KAction(i18n("&Destroy All Tickets"), "delete_user", 0, TQT_TQOBJECT(this), TQT_SLOT(destroyAllTickets()), actionCollection(), "destroyall"); destroyAllAct = new KAction(i18n("&Destroy All Tickets"), "delete_user", 0, TQT_TQOBJECT(this), TQT_SLOT(destroyAllTickets()), actionCollection(), "destroyall");
confAct = new KAction(i18n("&Configure..."), "configure", 0, TQT_TQOBJECT(this), TQT_SLOT(config()), actionCollection(), "configure"); confAct = new KAction(i18n("&Configure..."), "configure", 0, TQT_TQOBJECT(this), TQT_SLOT(config()), actionCollection(), "configure");
@ -80,6 +82,7 @@ TopLevel::TopLevel() : KSystemTray(), ticketWatch(0), m_refreshTimer(0), notifyE
menu->insertSeparator(); menu->insertSeparator();
getNewTGTAct->plug(menu); getNewTGTAct->plug(menu);
getNewSTAct->plug(menu); getNewSTAct->plug(menu);
getNewStandardSTAct->plug(menu);
destroyAllAct->plug(menu); destroyAllAct->plug(menu);
menu->insertSeparator(); menu->insertSeparator();
confAct->plug(menu); confAct->plug(menu);
@ -161,6 +164,15 @@ void TopLevel::updateTicketList() {
ticketWatch->startScan(); ticketWatch->startScan();
} }
if (m_ticketList.count() > 0) {
getNewStandardSTAct->setEnabled(true);
destroyAllAct->setEnabled(true);
}
else {
getNewStandardSTAct->setEnabled(false);
destroyAllAct->setEnabled(false);
}
repaint(); repaint();
} }
@ -231,6 +243,19 @@ void TopLevel::getNewServiceTicket() {
getNewTicket(true); getNewTicket(true);
} }
void TopLevel::getNewServiceTicketWithExistingCreds() {
TQString errorstring;
TQString service;
bool ok;
service = KLineEditDlg::getText(i18n("Enter the name of the Kerberos service principal you wish to obtain"), TQString::null, &ok, this);
if (ok) {
if (LDAPManager::obtainKerberosServiceTicket(service, &errorstring) != 0) {
KMessageBox::error(this, i18n("<qt>Failed to obtain service ticket<p>%1</qt>").arg(errorstring), i18n("Failed to obtain Kerberos service ticket"));
}
}
}
void TopLevel::destroyAllTickets() { void TopLevel::destroyAllTickets() {
if (system("kdestroy --all") != 0) { if (system("kdestroy --all") != 0) {
KMessageBox::error(this, i18n("Unable to destroy tickets!"), i18n("Internal Error")); KMessageBox::error(this, i18n("Unable to destroy tickets!"), i18n("Internal Error"));
@ -238,7 +263,7 @@ void TopLevel::destroyAllTickets() {
updateTicketList(); updateTicketList();
} }
void TopLevel::resizeEvent ( TQResizeEvent * ) void TopLevel::resizeEvent (TQResizeEvent *)
{ {
activeTicketsPixmap = loadSizedIcon("kerberos_activetickets", width()); activeTicketsPixmap = loadSizedIcon("kerberos_activetickets", width());
noTicketsPixmap = loadSizedIcon("kerberos_notickets", width()); noTicketsPixmap = loadSizedIcon("kerberos_notickets", width());
@ -357,7 +382,7 @@ void TopLevel::showTicketList() {
TQString listText = "<qt>"; TQString listText = "<qt>";
updateTicketList(); updateTicketList();
if (m_ticketList.count() <= 0) { if (m_ticketList.count() <= 0) {
listText += "<i>No Kerberos tickets to display!</i>"; listText += "No Kerberos tickets available";
} }
else { else {
i = 1; i = 1;

@ -68,6 +68,7 @@ private slots:
void updateMenu(); void updateMenu();
void getNewTGT(); void getNewTGT();
void getNewServiceTicket(); void getNewServiceTicket();
void getNewServiceTicketWithExistingCreds();
void getNewTicket(bool requestServiceTicket=false); void getNewTicket(bool requestServiceTicket=false);
void destroyAllTickets(); void destroyAllTickets();
void showTicketList(); void showTicketList();
@ -82,6 +83,7 @@ private:
KAction *confAct; KAction *confAct;
KAction *getNewTGTAct; KAction *getNewTGTAct;
KAction *getNewSTAct; KAction *getNewSTAct;
KAction *getNewStandardSTAct;
KAction *destroyAllAct; KAction *destroyAllAct;
TQPopupMenu *menu; TQPopupMenu *menu;
TQString lastTip; TQString lastTip;

Loading…
Cancel
Save