summaryrefslogtreecommitdiffstats
path: root/tdm/kfrontend/kgapp.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2015-09-18 15:54:06 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2015-09-18 15:54:06 -0500
commit9ea67803526cec0439175b8dc2ee5f0e7b87bc89 (patch)
treeab6d82eb81e1794f99d4665a3b4f99db36a704bb /tdm/kfrontend/kgapp.cpp
parent46d9df235b2b98b057e2bc9719b7d3416bd5438f (diff)
downloadtdebase-9ea67803526cec0439175b8dc2ee5f0e7b87bc89.tar.gz
tdebase-9ea67803526cec0439175b8dc2ee5f0e7b87bc89.zip
Stabilize cryptographic card login
Fix some coding style issues
Diffstat (limited to 'tdm/kfrontend/kgapp.cpp')
-rw-r--r--tdm/kfrontend/kgapp.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/tdm/kfrontend/kgapp.cpp b/tdm/kfrontend/kgapp.cpp
index 65e6cf0d8..86a67cbad 100644
--- a/tdm/kfrontend/kgapp.cpp
+++ b/tdm/kfrontend/kgapp.cpp
@@ -34,6 +34,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#endif
#include "sakdlg.h"
+#include <kuser.h>
#include <kprocess.h>
#include <tdecmdlineargs.h>
#include <kcrash.h>
@@ -342,6 +343,7 @@ kg_main( const char *argv0 )
XSetIOErrorHandler( xIOErr );
TQString login_user;
+ TQString login_card_user;
TQString login_session_wm;
Display *dpy = tqt_xdisplay();
@@ -499,6 +501,7 @@ kg_main( const char *argv0 )
Debug( "left event loop\n" );
login_user = static_cast<KGreeter*>(dialog)->curUser;
+ login_card_user = static_cast<KGreeter*>(dialog)->cardLoginUser;
login_session_wm = static_cast<KGreeter*>(dialog)->curWMSession;
if (rslt != ex_greet) {
@@ -522,6 +525,24 @@ kg_main( const char *argv0 )
KGVerify::done();
+ KUser userinfo(login_user);
+ if (userinfo.isValid()) {
+ TQString fileName = userinfo.homeDir() + "/.tde_card_login_state";
+ TQFile flagFile(fileName);
+ if ((login_card_user != TQString::null) && (login_user == login_card_user)) {
+ // Card was likely used to log in
+ if (flagFile.open(IO_WriteOnly)) {
+ flagFile.writeBlock("1\n", 2);
+ fchown(flagFile.handle(), userinfo.uid(), userinfo.gid());
+ flagFile.close();
+ }
+ }
+ else {
+ // Card was not used to log in
+ flagFile.remove();
+ }
+ }
+
if (kbdl) {
kbdl->closeStdin();
kbdl->detach();