summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--eurephiadm/commands/lastlog.c39
1 files changed, 31 insertions, 8 deletions
diff --git a/eurephiadm/commands/lastlog.c b/eurephiadm/commands/lastlog.c
index 9813876..77235ec 100644
--- a/eurephiadm/commands/lastlog.c
+++ b/eurephiadm/commands/lastlog.c
@@ -68,14 +68,23 @@ void xmlPrint_lastlog(xmlXPathContext *xpathCTX, int verb, const char *xpath) {
memset(&tmp, 0, 66);
printf(" %-10.10s %-22.22s %19.19s %19.19s\n",
"Status", "Login", "Logout", "Session closed");
- if( verb == 1 ) {
+ switch( verb ) {
+ case 1:
printf(" %-10.10s %-22.22s %19.19s %19.19s\n",
"Protocol", "Remote:port", "VPN MAC", "VPN IP");
printf(" %-37.37s %37.37s\n", "Common name", "Organisation");
+ break;
+ case 2:
+ printf(" %-10.10s %-22.22s %19.19s %19.19s\n",
+ "Protocol", "Remote:port", "VPN MAC", "VPN IP");
+ printf(" %-37.37s %37.37s\n", "Common name / Username", "Organisation");
+ break;
+ }
#ifdef FIREWALL
+ if( verb > 0 ) {
printf(" %-37.37s %37.37s\n", "Firewall access profile", "FW Destination");
-#endif
}
+#endif
printf("---------------------------------------------------------------------"
"----------\n");
@@ -98,7 +107,7 @@ void xmlPrint_lastlog(xmlXPathContext *xpathCTX, int verb, const char *xpath) {
defaultValue(xmlGetNodeContent(session_n, "session_closed"), "-")
);
- if( verb == 1 ) {
+ if( verb > 0 ) {
snprintf(tmp, 64, "%s:%s",
xmlGetNodeContent(conn, "remote_host"),
xmlGetNodeContent(conn, "remote_port"));
@@ -109,10 +118,24 @@ void xmlPrint_lastlog(xmlXPathContext *xpathCTX, int verb, const char *xpath) {
xmlGetNodeContent(conn, "vpn_ipaddr")
);
- printf(" %-37.37s %37.37s\n",
- xmlGetNodeContent(cert, "common_name"),
- xmlGetNodeContent(cert, "organisation")
- );
+ switch( verb ) {
+ case 1:
+ printf(" %-37.37s %37.37s\n",
+ xmlGetNodeContent(cert, "common_name"),
+ xmlGetNodeContent(cert, "organisation")
+ );
+ break;
+ case 2:
+ snprintf(tmp, 64, "%s / %s",
+ xmlGetNodeContent(cert, "common_name"),
+ xmlGetNodeContent(session_n, "username"));
+ printf(" %-37.37s %37.37s\n",
+ tmp,
+ xmlGetNodeContent(cert, "organisation")
+ );
+ break;
+ }
+
#ifdef FIREWALL
printf(" %-37.37s %37.37s\n",
defaultValue(xmlExtractContent(acpr), "(not set)"),
@@ -235,7 +258,7 @@ int cmd_Lastlog(eurephiaCTX *ctx, eurephiaSESSION *sess, eurephiaVALUES *cfg, in
break;
case 'v':
- verb = 1;
+ verb = 2;
break;
default: