diff options
-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); |