diff options
author | Robbie Harwood (frozencemetery) <rharwood@redhat.com> | 2015-08-25 14:10:37 -0400 |
---|---|---|
committer | Simo Sorce <simo@redhat.com> | 2015-09-04 14:25:09 -0400 |
commit | f2385558dd9542ca0a88f3386aa5833a23e5eb8b (patch) | |
tree | fbacdf78d30d92cbf752439cc2d9d200f225bfab /proxy/src/gssproxy.c | |
parent | 9f1a8a8777ae144ccf34c6406e9bc8fa930e0047 (diff) | |
download | gss-proxy-f2385558dd9542ca0a88f3386aa5833a23e5eb8b.tar.gz gss-proxy-f2385558dd9542ca0a88f3386aa5833a23e5eb8b.tar.xz gss-proxy-f2385558dd9542ca0a88f3386aa5833a23e5eb8b.zip |
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 <rharwood@redhat.com>
Reviewed-by: Simo Sorce <simo@redhat.com>
Diffstat (limited to 'proxy/src/gssproxy.c')
-rw-r--r-- | proxy/src/gssproxy.c | 11 |
1 files changed, 11 insertions, 0 deletions
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) { |