diff options
author | David Sommerseth <dazo@users.sourceforge.net> | 2008-12-19 13:15:57 +0100 |
---|---|---|
committer | David Sommerseth <dazo@users.sourceforge.net> | 2008-12-19 13:15:57 +0100 |
commit | 6dbdc6f37600ec1bdc817c4dd8384e18ca344d07 (patch) | |
tree | 41d01d12d5924adde1f9f6a049e47b28a035a537 | |
parent | 25b869d4b5299eea0b1ab571ff69f0d9115619a8 (diff) | |
download | eurephia-6dbdc6f37600ec1bdc817c4dd8384e18ca344d07.tar.gz eurephia-6dbdc6f37600ec1bdc817c4dd8384e18ca344d07.tar.xz eurephia-6dbdc6f37600ec1bdc817c4dd8384e18ca344d07.zip |
users command: Added viewing login attempts and blacklist info for a specified user account
-rw-r--r-- | eurephiadm/commands/users.c | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/eurephiadm/commands/users.c b/eurephiadm/commands/users.c index de1a010..bc54eec 100644 --- a/eurephiadm/commands/users.c +++ b/eurephiadm/commands/users.c @@ -361,7 +361,7 @@ int show_user(eurephiaCTX *ctx, eurephiaSESSION *sess, eurephiaVALUES *cfg, int break; case 'l': - show_info = USERINFO_user | USERINFO_lastlog; + show_info = USERINFO_lastlog; break; case 'h': @@ -430,6 +430,36 @@ int show_user(eurephiaCTX *ctx, eurephiaSESSION *sess, eurephiaVALUES *cfg, int xmlPrint_certs(user_XP, "/eurephia/user/certificates/certificate"); } + if( show_info & USERINFO_lastlog ) { + xmlSaveFormatFileEnc("-", user_xml, "UTF-8", 1); + } + + if( (show_info & USERINFO_attempts) || (show_info & USERINFO_blacklist) ) { + xmlNode *atmpt = NULL, *blackl = NULL; + + atmpt = xmlFindNode(user_n, "attempts"); + blackl = xmlFindNode(user_n, "blacklist"); + + if( atmpt->children != NULL ) { + field_print_str("Login attempt information",""); + field_print_str("Failed attempts", xmlGetAttrValue(atmpt->properties, "attempts")); + field_print_str("First attempt", xmlGetNodeContent(atmpt, "first_attempt")); + field_print_str("Last attempt", xmlGetNodeContent(atmpt, "last_attempt")); + } else { + field_print_str("Login attempt information","Nothing registered"); + } + printf("\n"); + + if( blackl->children != NULL) { + field_print_str("Blacklist information",""); + field_print_str("Blacklisted", xmlGetNodeContent(blackl, "blacklisted")); + field_print_str("Last attempt", xmlGetNodeContent(blackl, "last_accessed")); + } else { + field_print_str("Blacklist information","Nothing registered"); + } + printf("\n"); + } + // Clean up xmlXPathFreeContext(user_XP); xmlFreeDoc(user_xml); |