Part 1 of 2 of kdm rename

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

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

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

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

Loading…
Cancel
Save