summaryrefslogtreecommitdiffstats
path: root/eurephiadm/eurephiadm.c
diff options
context:
space:
mode:
authorDavid Sommerseth <dazo@users.sourceforge.net>2008-12-03 00:06:55 +0100
committerDavid Sommerseth <dazo@users.sourceforge.net>2008-12-03 00:06:55 +0100
commit985c50e52b6fcdeb4e60e63e984243069ad79be4 (patch)
tree0bbf4d6fd521cc14fb7cc9552922d221fa8cd66b /eurephiadm/eurephiadm.c
parentf4040e08913d7ad586329cef926f287994f8ca0c (diff)
downloadeurephia-985c50e52b6fcdeb4e60e63e984243069ad79be4.tar.gz
eurephia-985c50e52b6fcdeb4e60e63e984243069ad79be4.tar.xz
eurephia-985c50e52b6fcdeb4e60e63e984243069ad79be4.zip
Changed the logout behaviour to avoid login and/or access control check when user is about to logout
Diffstat (limited to 'eurephiadm/eurephiadm.c')
-rw-r--r--eurephiadm/eurephiadm.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/eurephiadm/eurephiadm.c b/eurephiadm/eurephiadm.c
index 3d9d71c..929bb07 100644
--- a/eurephiadm/eurephiadm.c
+++ b/eurephiadm/eurephiadm.c
@@ -40,7 +40,7 @@
#include "get_console_input.h"
#include "commands.h"
-#define EUREPHIADMVERSION "1.0"
+#define EUREPHIADMVERSION "0.9.2_beta"
#define MAX_ARGUMENTS 64
@@ -88,7 +88,7 @@ int cmd_Help(eurephiaCTX *ctx, eurephiaSESSION *sess, eurephiaVALUES *cfg, int a
int cmd_Logout(eurephiaCTX *ctx, eurephiaSESSION *sess, eurephiaVALUES *cfg, int argc, char **argv) {
int rc = 0;
- rc = eDBadminLogout(ctx, sess);
+ rc = eDBadminLogout(ctx, argv[1]);
fprintf(stdout, "%s\n", (rc == 1 ? "Logged out succesfully" : "Logout failed."));
return (rc == 0);
}
@@ -314,6 +314,14 @@ int main(int argc, char **argv) {
}
session = do_login(ctx, call_fnc->accesslvl);
} else {
+ // If we are logging out, do so here - without checking the session
+ if( strcmp(call_fnc->command, "logout") == 0) {
+ char *logout_argv[] = { sesskey_file };
+ rc = cmd_Logout(ctx, NULL, cfg, 0, logout_argv);
+ remove_session_file(ctx);
+ goto exit;
+ }
+
// Session file found, check if it still is a valid session
if( eDBadminValidateSession(ctx, sesskey_file, call_fnc->accesslvl) ) {;
// If valid, load this session
@@ -321,11 +329,6 @@ int main(int argc, char **argv) {
} else {
// If not valid, remove session file and go to login
remove_session_file(ctx);
- if( strcmp(call_fnc->command, "logout") == 0) {
- fprintf(stderr, "You are already logged out\n");
- rc = 0;
- goto exit;
- }
session = do_login(ctx, call_fnc->accesslvl);
}
}