summaryrefslogtreecommitdiffstats
path: root/eurephiadm
diff options
context:
space:
mode:
authorDavid Sommerseth <dazo@users.sourceforge.net>2008-12-10 22:48:56 +0100
committerDavid Sommerseth <dazo@users.sourceforge.net>2008-12-10 22:48:56 +0100
commit866c76a6bd60a1dabdfe593339030a09324e8aa2 (patch)
tree4a2101c60eabef6d43e70a8f73df94cb27703d75 /eurephiadm
parent762fc375f6316407c7d3489d53de336146fc1960 (diff)
downloadeurephia-866c76a6bd60a1dabdfe593339030a09324e8aa2.tar.gz
eurephia-866c76a6bd60a1dabdfe593339030a09324e8aa2.tar.xz
eurephia-866c76a6bd60a1dabdfe593339030a09324e8aa2.zip
Updated eDBadminGetUserInfo(...) to take filtering parameter
Diffstat (limited to 'eurephiadm')
-rw-r--r--eurephiadm/commands/users.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/eurephiadm/commands/users.c b/eurephiadm/commands/users.c
index 92c7610..ca7c65c 100644
--- a/eurephiadm/commands/users.c
+++ b/eurephiadm/commands/users.c
@@ -189,7 +189,7 @@ int show_user(eurephiaCTX *ctx, eurephiaSESSION *sess, eurephiaVALUES *cfg, int
eurephiaUSERINFO *user = NULL;
char *uname = NULL;
int i, uid = 0;
- long int show_info = 0; // USERINFO_certs
+ long int show_info = USERINFO_user | USERINFO_certs;
e_options activargs[] = {
{"--uid", "-i", 1},
@@ -223,11 +223,11 @@ int show_user(eurephiaCTX *ctx, eurephiaSESSION *sess, eurephiaVALUES *cfg, int
case 'a':
case 'b':
- // show_info = USERINFO_attempts | USERINFO_blacklist
+ show_info = USERINFO_attempts | USERINFO_blacklist;
break;
case 'l':
- // show_info = USERINFO_lastlog
+ show_info = USERINFO_user | USERINFO_lastlog;
break;
case 'h':
@@ -255,21 +255,21 @@ int show_user(eurephiaCTX *ctx, eurephiaSESSION *sess, eurephiaVALUES *cfg, int
user = eAdminPopulateUSERINFO(uid, uname, NULL, NULL, NULL, NULL);
assert(user != NULL);
- if( eDBadminGetUserInfo(ctx, user) == 0 ) {
+ if( eDBadminGetUserInfo(ctx, show_info, user) == 0 ) {
fprintf(stderr, "%s: User not found\n", MODULE);
return 1;
}
- field_print_int("User id", user->uid);
- field_print_str("User name", user->username);
- field_print_str("Last accessed", user->last_accessed);
- field_print_str("Activated", user->activated);
- field_print_str("Dectivated", user->deactivated);
- printf("\n");
-
- // Only show this block if show_info == USERINFO_certs
- // if( (show_info == USERINFO_certs) && (user->certlist != NULL) && (user->certlist->num_certs > 0) ) {
+ if( show_info & USERINFO_user ) {
+ field_print_int("User id", user->uid);
+ field_print_str("User name", user->username);
+ field_print_str("Last accessed", user->last_accessed);
+ field_print_str("Activated", user->activated);
+ field_print_str("Dectivated", user->deactivated);
+ printf("\n");
+ }
+ // Show associated certificates if we have that info
if( (user->certlist != NULL) && (user->certlist->num_certs > 0) ) {
eurephiaCERTINFO *crt = NULL;
@@ -289,8 +289,10 @@ int show_user(eurephiaCTX *ctx, eurephiaSESSION *sess, eurephiaVALUES *cfg, int
printf("---------------------------------------------------------------------"
"----------\n");
} else {
- // Only show this line if show_info == USERINFO_certs
- field_print_str("Associated certificates", "None");
+ // If we wanted to show associated certs, and didn't find any - inform about it
+ if( (show_info & USERINFO_certs) == USERINFO_certs ) {
+ field_print_str("Associated certificates", "None");
+ }
}
return 0;
@@ -363,7 +365,7 @@ int account_activation(eurephiaCTX *ctx, eurephiaSESSION *sess, eurephiaVALUES *
user = eAdminPopulateUSERINFO(uid, uname, NULL, NULL, NULL, NULL);
assert(user != NULL);
- if( eDBadminGetUserInfo(ctx, user) == 0 ) {
+ if( eDBadminGetUserInfo(ctx, USERINFO_user, user) == 0 ) {
fprintf(stderr, "%s: User not found\n", MODULE);
return 1;
}