diff options
author | David Sommerseth <dazo@users.sourceforge.net> | 2009-04-01 00:14:24 +0200 |
---|---|---|
committer | David Sommerseth <dazo@users.sourceforge.net> | 2009-04-01 00:14:24 +0200 |
commit | e4a21814a495cc13f812c37c7d485d9c4c0888b0 (patch) | |
tree | a0a21e024b1d0f999a40ad1d2c32e008d8f08cbb /eurephiadm/commands/usercerts.c | |
parent | afdfa16296a9879c6c8fa1e0b8aebe8d1cddc2d6 (diff) | |
download | eurephia-e4a21814a495cc13f812c37c7d485d9c4c0888b0.tar.gz eurephia-e4a21814a495cc13f812c37c7d485d9c4c0888b0.tar.xz eurephia-e4a21814a495cc13f812c37c7d485d9c4c0888b0.zip |
Rewrote eurephiadm/usercerts to use XSLT for listing
Diffstat (limited to 'eurephiadm/commands/usercerts.c')
-rw-r--r-- | eurephiadm/commands/usercerts.c | 49 |
1 files changed, 7 insertions, 42 deletions
diff --git a/eurephiadm/commands/usercerts.c b/eurephiadm/commands/usercerts.c index c886c3b..3c070ab 100644 --- a/eurephiadm/commands/usercerts.c +++ b/eurephiadm/commands/usercerts.c @@ -43,7 +43,7 @@ #include "../argparser.h" #include "../field_print.h" - +#include "../xsltparser.h" void display_usercerts_help(int page) { switch( page ) { @@ -93,9 +93,13 @@ int help_UserCerts2(eurephiaCTX *ctx, eurephiaSESSION *sess, eurephiaVALUES *cfg int list_usercerts(eurephiaCTX *ctx, eurephiaSESSION *sess, eurephiaVALUES *cfg, int argc, char **argv) { xmlDoc *list_xml = NULL; - xmlNode *list_n = NULL, *tmp_n = NULL; int i = 0; char *sortkeys = NULL; +#ifdef FIREWALL + const char *xsltparams[] = { "firewall", "'1'", NULL}; +#else + const char *xsltparams[] = { "firewall", "'0'", NULL}; +#endif e_options listargs[] = { {"--sort", "-S", 1}, @@ -127,46 +131,7 @@ int list_usercerts(eurephiaCTX *ctx, eurephiaSESSION *sess, eurephiaVALUES *cfg, return 1; } - list_n = eurephiaXML_getRoot(ctx, list_xml, "usercerts_links", 1); - if( list_n == NULL ) { - fprintf(stderr, "%s: Error retrieving user/certificate link list\n", MODULE); - xmlFreeDoc(list_xml); - return 1; - } - - printf(" UICID - Registered\n" - " U: [uid] Username\n" - " C: [certid] Common name/Organisation (cert.depth)\n" - " A: [accessprofile] Access profile name\n"); - printf("----------------------------------------------------------------------------\n"); - - for( list_n = list_n->children; list_n != NULL; list_n = list_n->next ) { - printf(" %5.5s - %s\n", - xmlGetAttrValue(list_n->properties, "uicid"), - xmlGetAttrValue(list_n->properties, "registered")); - - tmp_n = xmlFindNode(list_n, "username"); - printf(" U: [%3.3s] %s\n", - xmlGetAttrValue(tmp_n->properties, "uid"), - defaultValue(xmlGetNodeContent(list_n, "username"), "(unknown user account)")); - - tmp_n = xmlFindNode(list_n, "certificate"); - printf(" C: [%3.3s] %s/%s (%s)\n", - xmlGetAttrValue(tmp_n->properties, "certid"), - defaultValue(xmlGetNodeContent(tmp_n, "common_name"), "-"), - defaultValue(xmlGetNodeContent(tmp_n, "organisation"), "-"), - xmlGetAttrValue(tmp_n->properties, "depth")); - - tmp_n = xmlFindNode(list_n, "access_profile"); - printf(" A: [%3.3s] %s\n", - xmlGetAttrValue(tmp_n->properties, "accessprofile"), - defaultValue(xmlGetNodeContent(list_n, "access_profile"), "")); - - if( list_n->next != NULL ) { - printf("\n"); - } - } - printf("----------------------------------------------------------------------------\n"); + xslt_print_xmldoc(stdout, cfg, list_xml, "usercerts.xsl", xsltparams); xmlFreeDoc(list_xml); return 0; } |