Part 1 of 2 of kdm rename

pull/2/head
Timothy Pearson 12 years ago
parent 3f0da3b610
commit 264c611722

@ -4,8 +4,8 @@
description "smart card login monitor"
start on (filesystem
and started kdm-trinity)
stop on stopping kdm-trinity
and started tdm-trinity)
stop on stopping tdm-trinity
script
if [ -e /usr/bin/smartauthmon ]; then

@ -293,7 +293,7 @@ while [[ 1 == 1 ]]; do
waserror=0
noactivesessions=0
$result=$(/opt/trinity/bin/kdmctl -g list)
$result=$(/opt/trinity/bin/tdmctl -g list)
if [[ $result == "ok" ]]; then
noactivesessions=1
result="okbutempty"
@ -302,7 +302,7 @@ while [[ 1 == 1 ]]; do
resultbkp=$result
if [[ $errcode -eq 0 ]]; then
# Allow KDM to finish starting
# Allow TDM to finish starting
if [[ $waserror -eq 1 ]]; then
sleep 10
fi
@ -360,7 +360,7 @@ while [[ 1 == 1 ]]; do
if [[ $lverify == $cverify ]]; then
su $smartcard_username -c "export DISPLAY=$udisplay; /opt/trinity/bin/dcop kdesktop KScreensaverIface quit"
su $smartcard_username -c "export DISPLAY=$udisplay; /opt/trinity/bin/dcop kdesktop KScreensaverIface enable false"
/opt/trinity/bin/kdmctl activate $udisplay
/opt/trinity/bin/tdmctl activate $udisplay
else
echo "EUnauthorized SmartCard Inserted" > /tmp/ksocket-global/kdesktoplockcontrol &
fi
@ -427,10 +427,10 @@ while [[ 1 == 1 ]]; do
echo "The next display to start will be $newdisplay"
rm $SECURE_DIRECTORY/originalxdm
/opt/trinity/bin/kdmctl -g reserve
/opt/trinity/bin/kdmctl -g login $newdisplay now $smartcard_username $(cat $SECURE_DIRECTORY/password)
/opt/trinity/bin/tdmctl -g reserve
/opt/trinity/bin/tdmctl -g login $newdisplay now $smartcard_username $(cat $SECURE_DIRECTORY/password)
sleep 2
/opt/trinity/bin/kdmctl -g activate $newdisplay
/opt/trinity/bin/tdmctl -g activate $newdisplay
udisplay=$newdisplay
fi
@ -497,7 +497,7 @@ while [[ 1 == 1 ]]; do
result="ok"
timeout=0
errcode=0
$result=$(/opt/trinity/bin/kdmctl -g list)
$result=$(/opt/trinity/bin/tdmctl -g list)
if [[ $result == "ok" ]]; then
noactivesessions=1
result="okbutempty"
@ -553,7 +553,7 @@ while [[ 1 == 1 ]]; do
timeout=0
blankresult=""
while [[ $blankresult != "true" ]]; do
/opt/trinity/bin/kdmctl -g activate $udisplay
/opt/trinity/bin/tdmctl -g activate $udisplay
su $smartcard_username -c "export DISPLAY=$udisplay; /opt/trinity/bin/dcop kdesktop KScreensaverIface enable true"
su $smartcard_username -c "export DISPLAY=$udisplay; /opt/trinity/bin/dcop kdesktop KScreensaverIface lock"
blankresult=$(su $smartcard_username -c "export DISPLAY=$udisplay; /opt/trinity/bin/dcop kdesktop KScreensaverIface isBlanked")

@ -47,9 +47,9 @@
// Some internal constants
#define CREATE_LIFE_CYCLE "01"
#define KDM_CONTROL_FIFO_DIR "/tmp/ksocket-global/kdm"
#define KDM_CONTROL_FIFO_FILE "/tmp/ksocket-global/kdm/kdmctl-%1"
#define KDM_CONTROL_FIFO_SAK_FILE "/tmp/ksocket-global/kdm/kdmctl-sak-%1"
#define TDM_CONTROL_FIFO_DIR "/tmp/ksocket-global/tdm"
#define TDM_CONTROL_FIFO_FILE "/tmp/ksocket-global/tdm/tdmctl-%1"
#define TDM_CONTROL_FIFO_SAK_FILE "/tmp/ksocket-global/tdm/tdmctl-sak-%1"
// In ckpass.o
extern "C" {
@ -538,7 +538,7 @@ int main (int argc, char *argv[])
int waserror=0;
int noactivesessions=0;
result = exec(TRINITY_BIN_PREFIX "kdmctl -g list");
result = exec(TRINITY_BIN_PREFIX "tdmctl -g list");
if (result == "ok") {
noactivesessions=1;
result="okbutempty";
@ -547,7 +547,7 @@ int main (int argc, char *argv[])
TQString resultbkp=result;
if (errcode == 0) {
// Allow KDM to finish starting
// Allow TDM to finish starting
if (waserror == 1) {
sleep(10);
}
@ -582,7 +582,7 @@ int main (int argc, char *argv[])
if (check_password(smartcard_username.ascii(), smartcard_password.ascii()) == 0) {
systemexec((TQString("su %1 -c \"export DISPLAY=%2; " TRINITY_BIN_PREFIX "dcop kdesktop KScreensaverIface quit\"").arg(smartcard_username).arg(udisplay)).ascii());
systemexec((TQString("su %1 -c \"export DISPLAY=%2; " TRINITY_BIN_PREFIX "dcop kdesktop KScreensaverIface enable false\"").arg(smartcard_username).arg(udisplay)).ascii());
systemexec((TQString(TRINITY_BIN_PREFIX "kdmctl activate %1").arg(udisplay)).ascii());
systemexec((TQString(TRINITY_BIN_PREFIX "tdmctl activate %1").arg(udisplay)).ascii());
}
else {
systemexec("echo \"EUnauthorized SmartCard Inserted\" > /tmp/ksocket-global/kdesktoplockcontrol &");
@ -600,7 +600,7 @@ int main (int argc, char *argv[])
if (foundsession == 0) {
printf("[DEBUG 400.c] Existing session not found, starting new...\n\r"); fflush(stdout);
// Get directory listing of kdm control socket directory
// Get directory listing of tdm control socket directory
// Also start new X server if needed
bool have_valid_display = false;
bool display_has_sak = false;
@ -609,7 +609,7 @@ int main (int argc, char *argv[])
while (have_valid_display == false) {
display_has_sak = false;
writeerror = false;
TQDir dr(KDM_CONTROL_FIFO_DIR);
TQDir dr(TDM_CONTROL_FIFO_DIR);
dr.setFilter( TQDir::System );
dr.setSorting( TQDir::Name );
const TQFileInfoList *list = dr.entryInfoList();
@ -622,8 +622,8 @@ int main (int argc, char *argv[])
TQString tempdisplaystr;
tempdisplaystr = fi->fileName();
printf( "%s\n", fi->fileName().latin1() ); fflush(stdout);
if (fi->fileName().contains("kdmctl-sak-")) {
tempdisplaystr = tempdisplaystr.replace("kdmctl-sak-", "");
if (fi->fileName().contains("tdmctl-sak-")) {
tempdisplaystr = tempdisplaystr.replace("tdmctl-sak-", "");
tempdisplayint = tempdisplaystr.toInt(&isint);
if (isint) {
if (tempdisplayint < newdisplayint) {
@ -632,8 +632,8 @@ int main (int argc, char *argv[])
}
}
}
else if (fi->fileName().contains("kdmctl-")) {
tempdisplaystr = tempdisplaystr.replace("kdmctl-", "");
else if (fi->fileName().contains("tdmctl-")) {
tempdisplaystr = tempdisplaystr.replace("tdmctl-", "");
tempdisplayint = tempdisplaystr.toInt(&isint);
if (isint) {
if (tempdisplayint < newdisplayint) {
@ -645,10 +645,10 @@ int main (int argc, char *argv[])
++it;
}
if (display_has_sak) {
if (writefile(TQString(KDM_CONTROL_FIFO_SAK_FILE).arg(newdisplayint), "CLOSE\n") < 0) {
if (writefile(TQString(TDM_CONTROL_FIFO_SAK_FILE).arg(newdisplayint), "CLOSE\n") < 0) {
// Uh oh, something failed...
printf("Unable to write to KDM control socket %s\n\r", (TQString(KDM_CONTROL_FIFO_SAK_FILE).arg(newdisplayint)).ascii()); fflush(stdout);
unlink((TQString(KDM_CONTROL_FIFO_SAK_FILE).arg(newdisplayint)).ascii());
printf("Unable to write to TDM control socket %s\n\r", (TQString(TDM_CONTROL_FIFO_SAK_FILE).arg(newdisplayint)).ascii()); fflush(stdout);
unlink((TQString(TDM_CONTROL_FIFO_SAK_FILE).arg(newdisplayint)).ascii());
writeerror = true;
}
else {
@ -656,7 +656,7 @@ int main (int argc, char *argv[])
int status = -1;
int timeout_counter = 0;
while ((status != 0) && (timeout_counter < 30)) {
status = stat((TQString(KDM_CONTROL_FIFO_FILE).arg(newdisplayint)).ascii(), &buffer);
status = stat((TQString(TDM_CONTROL_FIFO_FILE).arg(newdisplayint)).ascii(), &buffer);
timeout_counter++;
usleep(100000);
}
@ -664,16 +664,16 @@ int main (int argc, char *argv[])
}
else {
// Make sure the control socket is writable
if (writefile(TQString(KDM_CONTROL_FIFO_FILE).arg(newdisplayint), "PING\n") < 0) {
if (writefile(TQString(TDM_CONTROL_FIFO_FILE).arg(newdisplayint), "PING\n") < 0) {
// Uh oh, something failed...
printf("Unable to write to KDM control socket %s\n\r", (TQString(KDM_CONTROL_FIFO_FILE).arg(newdisplayint)).ascii()); fflush(stdout);
unlink((TQString(KDM_CONTROL_FIFO_FILE).arg(newdisplayint)).ascii());
printf("Unable to write to TDM control socket %s\n\r", (TQString(TDM_CONTROL_FIFO_FILE).arg(newdisplayint)).ascii()); fflush(stdout);
unlink((TQString(TDM_CONTROL_FIFO_FILE).arg(newdisplayint)).ascii());
writeerror = true;
}
}
if (newdisplayint == (MAXIMUM_VTS+1)) {
writeerror = true;
systemexec(TRINITY_BIN_PREFIX "kdmctl -g reserve");
systemexec(TRINITY_BIN_PREFIX "tdmctl -g reserve");
usleep(3000000);
}
if (writeerror)
@ -683,7 +683,7 @@ int main (int argc, char *argv[])
}
else
{
// KDM is probably not running yet, as its control directory does not exist
// TDM is probably not running yet, as its control directory does not exist
// Wait for 10 seconds and try again
usleep(10000000);
}
@ -694,12 +694,12 @@ int main (int argc, char *argv[])
// Construct login string
TQString logincommand = TQString("LOGIN\t%1\t%2\n").arg(smartcard_username).arg(smartcard_password);
if (writefile(TQString(KDM_CONTROL_FIFO_FILE).arg(newdisplayint), logincommand) < 0) {
if (writefile(TQString(TDM_CONTROL_FIFO_FILE).arg(newdisplayint), logincommand) < 0) {
// Uh oh, something failed...
printf("Unable to write to KDM control socket %s\n\r", (TQString(KDM_CONTROL_FIFO_FILE).arg(newdisplayint)).ascii()); fflush(stdout);
printf("Unable to write to TDM control socket %s\n\r", (TQString(TDM_CONTROL_FIFO_FILE).arg(newdisplayint)).ascii()); fflush(stdout);
}
systemexec((TQString(TRINITY_BIN_PREFIX "kdmctl -g activate %1").arg(newdisplay)).ascii());
systemexec((TQString(TRINITY_BIN_PREFIX "tdmctl -g activate %1").arg(newdisplay)).ascii());
udisplay=newdisplay;
}
@ -765,7 +765,7 @@ int main (int argc, char *argv[])
result="ok";
timeout=0;
errcode=0;
result = exec(TRINITY_BIN_PREFIX "kdmctl -g list");
result = exec(TRINITY_BIN_PREFIX "tdmctl -g list");
if (result == "ok") {
noactivesessions=1;
result="okbutempty";
@ -800,7 +800,7 @@ int main (int argc, char *argv[])
timeout=0;
blankresult="";
while (blankresult != "true") {
systemexec((TQString(TRINITY_BIN_PREFIX "kdmctl -g activate %1").arg(udisplay)).ascii());
systemexec((TQString(TRINITY_BIN_PREFIX "tdmctl -g activate %1").arg(udisplay)).ascii());
systemexec((TQString("su %1 -c \"export DISPLAY=%2; " TRINITY_BIN_PREFIX "dcop kdesktop KScreensaverIface enable true\"").arg(smartcard_username).arg(udisplay)).ascii());
systemexec((TQString("su %1 -c \"export DISPLAY=%2; " TRINITY_BIN_PREFIX "dcop kdesktop KScreensaverIface lock\"").arg(smartcard_username).arg(udisplay)).ascii());
int retcode;

Loading…
Cancel
Save