From f2385558dd9542ca0a88f3386aa5833a23e5eb8b Mon Sep 17 00:00:00 2001 From: "Robbie Harwood (frozencemetery)" Date: Tue, 25 Aug 2015 14:10:37 -0400 Subject: Add support for config directories Option '-C|--configdir' has been added, and defaults to /etc/gssproxy. File "gssproxy.conf" and all files of the form "##-foo.conf" will be read from that directory. Ticket: https://fedorahosted.org/gss-proxy/ticket/122 Signed-off-by: Robbie Harwood Reviewed-by: Simo Sorce --- proxy/src/gssproxy.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'proxy/src/gssproxy.c') diff --git a/proxy/src/gssproxy.c b/proxy/src/gssproxy.c index 354d595..0e84859 100644 --- a/proxy/src/gssproxy.c +++ b/proxy/src/gssproxy.c @@ -36,6 +36,7 @@ int main(int argc, const char *argv[]) int opt_interactive = 0; int opt_version = 0; char *opt_config_file = NULL; + char *opt_config_dir = NULL; char *opt_config_socket = NULL; int opt_debug = 0; verto_ctx *vctx; @@ -55,6 +56,8 @@ int main(int argc, const char *argv[]) _("Run interactive (not a daemon)"), NULL}, \ {"config", 'c', POPT_ARG_STRING, &opt_config_file, 0, \ _("Specify a non-default config file"), NULL}, \ + {"configdir", 'C', POPT_ARG_STRING, &opt_config_dir, 0, \ + _("Specify a non-default config directory"), NULL}, \ {"socket", 's', POPT_ARG_STRING, &opt_config_socket, 0, \ _("Specify a custom default socket"), NULL}, \ {"debug", 'd', POPT_ARG_NONE, &opt_debug, 0, \ @@ -90,6 +93,13 @@ int main(int argc, const char *argv[]) return 1; } + if (opt_config_file && opt_config_dir) { + fprintf(stderr, "Option -C|--configdir is not allowed together with" + " -c|--config\n"); + poptPrintUsage(pc, stderr, 0); + return 1; + } + if (opt_interactive) { opt_daemon = 2; } @@ -97,6 +107,7 @@ int main(int argc, const char *argv[]) gpctx = calloc(1, sizeof(struct gssproxy_ctx)); gpctx->config = read_config(opt_config_file, + opt_config_dir, opt_config_socket, opt_daemon); if (!gpctx->config) { -- cgit