From b6b58d0d6142ada45ee015e1d1fe639746960b7b Mon Sep 17 00:00:00 2001 From: Nalin Dahyabhai Date: Oct 14 2011 14:52:52 +0000 Subject: - really fix these this time: - getcert: error out when "list -c" finds no matching CA (#743488) - getcert: error out when "list -i" finds no matching request (#743485) - tag 0.50 --- diff --git a/certmonger.spec b/certmonger.spec index fe6663d..89cb510 100644 --- a/certmonger.spec +++ b/certmonger.spec @@ -19,7 +19,7 @@ %endif Name: certmonger -Version: 0.49 +Version: 0.50 Release: 1%{?dist} Summary: Certificate status monitor and PKI enrollment client @@ -188,6 +188,11 @@ exit 0 %endif %changelog +* Fri Oct 14 2011 Nalin Dahyabhai 0.50-1 +- really fix these this time: + - getcert: error out when "list -c" finds no matching CA (#743488) + - getcert: error out when "list -i" finds no matching request (#743485) + * Wed Oct 12 2011 Nalin Dahyabhai 0.49-1 - when using an NSS database, skip loading the module database (#743042) - when using an NSS database, skip loading root certs diff --git a/configure.ac b/configure.ac index 1f13ade..9abf4f9 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT(certmonger,0.49) +AC_INIT(certmonger,0.50) AM_INIT_AUTOMAKE([foreign]) AC_CONFIG_MACRO_DIR(m4) AM_MAINTAINER_MODE diff --git a/src/getcert.c b/src/getcert.c index 4ad124f..b4d6b8e 100644 --- a/src/getcert.c +++ b/src/getcert.c @@ -87,13 +87,15 @@ ensure_path_is_absolute(void *parent, const char *path) } else { if (getcwd(buf, sizeof(buf)) == buf) { ret = talloc_asprintf(parent, "%s/%s", buf, path); - printf(_("Path \"%s\" is not absolute, attempting to " + printf(_("Path \"%s\" is not absolute, " + "attempting to " "use \"%s\" instead.\n"), path, ret); return ret; } else { - printf(_("Path \"%s\" is not absolute, and there " - "was an error determining the name of the " - "current directory.\n"), path); + printf(_("Path \"%s\" is not absolute, and " + "there was an error determining the " + "name of the current directory.\n"), + path); exit(1); } } @@ -108,7 +110,8 @@ ensure_path_is_directory(char *path) if (S_ISDIR(st.st_mode)) { return 0; } else { - printf(_("Path \"%s\" is not a directory.\n"), path); + printf(_("Path \"%s\" is not a directory.\n"), + path); return -1; } } else { @@ -1809,6 +1812,7 @@ list(const char *argv0, int argc, char **argv) char **requests, *s, *p, *nickname, *only_ca = DEFAULT_CA, *ca_name; char *dbdir = NULL, *dbnickname = NULL, *certfile = NULL, *id = NULL; char *nss_scheme; + const char *capath, *request; dbus_bool_t b; char *s1, *s2, *s3, *s4, *s5, *s6; long n1, n2; @@ -1861,6 +1865,33 @@ list(const char *argv0, int argc, char **argv) help(argv0, "list"); return 1; } + if (only_ca != NULL) { + capath = find_ca_by_name(globals.tctx, bus, only_ca, verbose); + if (capath == NULL) { + printf(_("No CA with name \"%s\" found.\n"), only_ca); + return 1; + } + } + if (id != NULL) { + request = find_request_by_name(globals.tctx, bus, id, verbose); + if (request == NULL) { + printf(_("No request found with specified " + "nickname.\n")); + return 1; + } + } else { + request = find_request_by_storage(globals.tctx, bus, + dbdir, dbnickname, NULL, + certfile, verbose); + if (request == NULL) { + if (((dbdir != NULL) && (dbnickname != NULL)) || + (certfile != NULL)) { + printf(_("No request found that matched " + "arguments.\n")); + return 1; + } + } + } requests = query_rep_ap(bus, CM_DBUS_BASE_PATH, CM_DBUS_BASE_INTERFACE, "get_requests", verbose, globals.tctx); for (i = 0; (requests != NULL) && (requests[i] != NULL); i++) {