diff options
| author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-09-21 07:55:44 +0000 |
|---|---|---|
| committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-09-21 07:55:44 +0000 |
| commit | 214716561bc27c38b414e93e1dc28e77a6951c5c (patch) | |
| tree | b5445bddcebd43558c4ceed0077b90a76abded52 /src/smartauthmon.cpp | |
| parent | 08211e05a207d8b5f92627c12cf2c2ef1ebd57bf (diff) | |
| download | smartcardauth-214716561bc27c38b414e93e1dc28e77a6951c5c.tar.gz smartcardauth-214716561bc27c38b414e93e1dc28e77a6951c5c.zip | |
Enhance smartauthmon VT detection on login
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/smartcardauth@1254814 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/smartauthmon.cpp')
| -rw-r--r-- | src/smartauthmon.cpp | 48 |
1 files changed, 29 insertions, 19 deletions
diff --git a/src/smartauthmon.cpp b/src/smartauthmon.cpp index db109a5..f122cc0 100644 --- a/src/smartauthmon.cpp +++ b/src/smartauthmon.cpp @@ -573,7 +573,7 @@ int main (int argc, char *argv[]) usebasedisplay=1; } } - if (!resultbkp.contains(",vt")) { + if (!resultbkp.contains(":")) { newdisplay = exec("ls /var/run/xdmctl/ | grep 'xdmctl-:0'"); printf("[DEBUG 400.d] %s\n\r", newdisplay.ascii()); if (newdisplay != "") { @@ -582,30 +582,40 @@ int main (int argc, char *argv[]) } printf("[DEBUG 400.e] Creating new session\n\r"); + if (usebasedisplay) { + printf("[DEBUG 400.e] Using base display\n\r"); + } // Attempt login - // Find next sequential inactive display - // FIXME - // This assumes the original VT is on display 0 at all times - int minvt = 0; - TQStringList sessionList = TQStringList::split('\t', result, false); - for (newdisplayint = minvt; newdisplayint<MAXIMUM_VTS; newdisplayint++) { - bool displayfound = false; - for ( TQStringList::Iterator it = sessionList.begin(); it != sessionList.end(); ++it ) { - TQStringList sessionInfoList = TQStringList::split(',', *it, true); - if ((*(sessionInfoList.at(0))).startsWith(TQString(":%1").tqarg(newdisplayint))) { - displayfound = true; - } - } - if (displayfound == false) { - break; - } - } +// // Find next sequential inactive display +// // FIXME +// // This assumes the original VT is on display 0 at all times, +// // which is not always true +// int minvt = 0; +// TQStringList sessionList = TQStringList::split('\t', result, false); +// for (newdisplayint = minvt; newdisplayint<MAXIMUM_VTS; newdisplayint++) { +// bool displayfound = false; +// for ( TQStringList::Iterator it = sessionList.begin(); it != sessionList.end(); ++it ) { +// TQStringList sessionInfoList = TQStringList::split(',', *it, true); +// if ((*(sessionInfoList.at(0))).startsWith(TQString(":%1").tqarg(newdisplayint))) { +// displayfound = true; +// } +// } +// if (displayfound == false) { +// break; +// } +// } + + // This external bash code does not assume that the original VT is on display 0 at all times, + // but it is a bit sloppy to have to call it from here. FIXME + newdisplayint = systemexec("smartauth_displayfinder"); newdisplay = TQString(":%1").tqarg(newdisplayint); printf("[DEBUG 400.f] The next display to start will be %s\n\r", newdisplay.ascii()); - systemexec(TRINITY_BIN_PREFIX "kdmctl -g reserve"); + if (!usebasedisplay) { + systemexec(TRINITY_BIN_PREFIX "kdmctl -g reserve"); + } TQString kdmctl_command = TQString("login\t%1\tnow\t%2\t%3\n").tqarg(newdisplay).tqarg(smartcard_username).tqarg(smartcard_password); FILE* kdmctlpipe = popen(TRINITY_BIN_PREFIX "kdmctl -g -", "w"); if (pipe) { |
