Check for tsak presence on lock engage

Fix tsak not exiting on request
Clean up build warnings
pull/2/head
Timothy Pearson 12 years ago
parent e899b7beb6
commit 22d0a673d7

@ -1635,6 +1635,18 @@ bool LockProcess::checkPass()
if (trinity_desktop_lock_closing_windows) if (trinity_desktop_lock_closing_windows)
return 0; return 0;
if (trinity_desktop_lock_use_sak) {
// Verify SAK operational status
KProcess* checkSAKProcess = new KProcess;
*checkSAKProcess << "tdmtsak" << "check";
checkSAKProcess->start(KProcess::Block, KProcess::NoCommunication);
int retcode = checkSAKProcess->exitStatus();
delete checkSAKProcess;
if (retcode != 0) {
trinity_desktop_lock_use_sak = false;
}
}
if (trinity_desktop_lock_use_sak) { if (trinity_desktop_lock_use_sak) {
// Wait for SAK press before continuing... // Wait for SAK press before continuing...
SAKDlg inDlg( this ); SAKDlg inDlg( this );

@ -354,7 +354,6 @@ KPamGreeter::textPrompt( const char *prompt, bool echo, bool nonBlocking )
} }
else if (m_themer) { else if (m_themer) {
kg_debug("themer found!"); kg_debug("themer found!");
KdmItem *pw_label = 0;
KdmLabel *tdmlabel = static_cast<KdmLabel*>(m_themer->findNode("pw-label")); KdmLabel *tdmlabel = static_cast<KdmLabel*>(m_themer->findNode("pw-label"));
if (tdmlabel) { if (tdmlabel) {

@ -607,14 +607,14 @@ KWinbindGreeter::slotEndDomainList()
TQString current = domainCombo->currentText(); TQString current = domainCombo->currentText();
for (int i = 0; i < domainList.count(); ++i) { for (unsigned int i = 0; i < domainList.count(); ++i) {
if (i < domainCombo->count()) if (i < (uint)domainCombo->count())
domainCombo->changeItem(domainList[i], i); domainCombo->changeItem(domainList[i], i);
else else
domainCombo->insertItem(domainList[i], i); domainCombo->insertItem(domainList[i], i);
} }
while (domainCombo->count() > domainList.count()) while ((uint)domainCombo->count() > domainList.count())
domainCombo->removeItem(domainCombo->count()-1); domainCombo->removeItem(domainCombo->count()-1);
domainCombo->setCurrentItem( current ); domainCombo->setCurrentItem( current );

@ -121,10 +121,14 @@ int main (int argc, char *argv[])
int verifier_result = tde_sak_verify_calling_process(); int verifier_result = tde_sak_verify_calling_process();
bool isdm = false; bool isdm = false;
bool checkonly = false;
if (argc == 2) { if (argc == 2) {
if (strcmp(argv[1], "dm") == 0) { if (strcmp(argv[1], "dm") == 0) {
isdm = true; isdm = true;
} }
if (strcmp(argv[1], "check") == 0) {
checkonly = true;
}
} }
if (!isdm) { if (!isdm) {
@ -139,6 +143,14 @@ int main (int argc, char *argv[])
// OK, the calling process is authorized to retrieve SAK data // OK, the calling process is authorized to retrieve SAK data
// First, flush the buffer // First, flush the buffer
mPipe_fd = open(FIFO_FILE, O_RDONLY | O_NONBLOCK); mPipe_fd = open(FIFO_FILE, O_RDONLY | O_NONBLOCK);
if (checkonly) {
if (mPipe_fd < 0) {
return 6; // SAK not available
}
else {
return 0;
}
}
numread = 1; numread = 1;
while (numread > 0) { while (numread > 0) {
numread = read(mPipe_fd, readbuf, 6); numread = read(mPipe_fd, readbuf, 6);
@ -177,4 +189,4 @@ int main (int argc, char *argv[])
else { else {
return verifier_result; return verifier_result;
} }
} }

@ -108,7 +108,6 @@ void signal_callback_handler(int signum)
{ {
// Terminate program // Terminate program
throw exit_exception(signum); throw exit_exception(signum);
exit(signum);
} }
/* termination handler */ /* termination handler */
@ -395,7 +394,7 @@ int main (int argc, char *argv[])
struct input_event event; struct input_event event;
struct input_event revev; struct input_event revev;
struct uinput_user_dev devinfo={{0},{0}}; struct uinput_user_dev devinfo={{0},{0}};
int devout[MAX_KEYBOARDS], rd, i, value, size = sizeof (struct input_event); int devout[MAX_KEYBOARDS], rd, i, size = sizeof (struct input_event);
char name[256] = "Unknown"; char name[256] = "Unknown";
bool ctrl_down = false; bool ctrl_down = false;
bool alt_down = false; bool alt_down = false;
@ -579,8 +578,6 @@ int main (int argc, char *argv[])
} }
} }
value = ev[0].value;
if (ev[0].value == 0 && ev[0].type == 1) { // Read the key release event if (ev[0].value == 0 && ev[0].type == 1) { // Read the key release event
if (keycode[(ev[0].code)]) { if (keycode[(ev[0].code)]) {
if (strcmp(keycode[(ev[0].code)], "<control>") == 0) ctrl_down = false; if (strcmp(keycode[(ev[0].code)], "<control>") == 0) ctrl_down = false;
@ -713,7 +710,7 @@ int main (int argc, char *argv[])
} }
} }
catch(exit_exception& e) { catch(exit_exception& e) {
exit(e.c); tsak_friendly_termination();
} }
return 6; return 6;

Loading…
Cancel
Save