diff options
Diffstat (limited to 'proxy/src')
-rw-r--r-- | proxy/src/gp_config.c | 52 | ||||
-rw-r--r-- | proxy/src/gp_config_iniparser.c | 164 | ||||
-rw-r--r-- | proxy/src/gp_config_iniparser.h | 42 |
3 files changed, 0 insertions, 258 deletions
diff --git a/proxy/src/gp_config.c b/proxy/src/gp_config.c index d3af376..71e2ca6 100644 --- a/proxy/src/gp_config.c +++ b/proxy/src/gp_config.c @@ -567,58 +567,6 @@ void free_config(struct gp_config **cfg) *cfg = NULL; } -#ifdef WITH_INIPARSER -#include "gp_config_iniparser.h" - -int gp_config_init(const char *config_file, - struct gp_ini_context *ctx) -{ - return gp_iniparser_init(config_file, ctx); -} - -int gp_config_get_string(struct gp_ini_context *ctx, - const char *secname, - const char *keyname, - char **value) -{ - return gp_iniparser_get_string(ctx, secname, keyname, value); -} - -int gp_config_get_string_array(struct gp_ini_context *ctx, - const char *secname, - const char *keyname, - int *num_values, - char ***values) -{ - return ENOENT; -} - -int gp_config_get_int(struct gp_ini_context *ctx, - const char *secname, - const char *keyname, - int *value) -{ - return gp_iniparser_get_int(ctx, secname, keyname, value); -} - -int gp_config_get_nsec(struct gp_ini_context *ctx) -{ - return gp_iniparser_get_nsec(ctx); -} - -char *gp_config_get_secname(struct gp_ini_context *ctx, - int i) -{ - return gp_iniparser_get_secname(ctx, i); -} - -int gp_config_close(struct gp_ini_context *ctx) -{ - return gp_iniparser_close(ctx); -} - -#endif /* WITH_INIPARSER */ - #ifdef WITH_DINGLIBS #include "gp_config_dinglibs.h" diff --git a/proxy/src/gp_config_iniparser.c b/proxy/src/gp_config_iniparser.c deleted file mode 100644 index 45677d7..0000000 --- a/proxy/src/gp_config_iniparser.c +++ /dev/null @@ -1,164 +0,0 @@ -/* - GSS-PROXY - - Copyright (C) 2011 Red Hat, Inc. - Copyright (C) 2011 Simo Sorce <simo.sorce@redhat.com> - Copyright (C) 2012 Guenther Deschner <guenther.deschner@redhat.com> - - Permission is hereby granted, free of charge, to any person obtaining a - copy of this software and associated documentation files (the "Software"), - to deal in the Software without restriction, including without limitation - the rights to use, copy, modify, merge, publish, distribute, sublicense, - and/or sell copies of the Software, and to permit persons to whom the - Software is furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. -*/ - -#include "config.h" -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <errno.h> -#include "gp_proxy.h" -#include "gp_config.h" -#include "gp_config_iniparser.h" - -#ifdef WITH_INIPARSER - -#include <iniparser.h> - -int gp_iniparser_get_string(struct gp_ini_context *ctx, - const char *secname, - const char *key, - char **value) -{ - dictionary *dict; - char *skey; - char *val; - int ret; - - dict = (dictionary *)ctx->private_data; - - if (!value) { - return EINVAL; - } - - *value = NULL; - - ret = asprintf(&skey, "%s:%s", secname, key); - if (ret == -1) { - return ENOMEM; - } - - val = iniparser_getstring(dict, skey, NULL); - free(skey); - - if (!val) { - return ENOENT; - } - - *value = val; - - return 0; -} - -int gp_iniparser_get_int(struct gp_ini_context *ctx, - const char *secname, - const char *key, - int *value) -{ - dictionary *dict; - char *skey; - int ret; - - dict = (dictionary *)ctx->private_data; - - if (!value) { - return EINVAL; - } - - *value = -1; - - ret = asprintf(&skey, "%s:%s", secname, key); - if (ret == -1) { - return ENOMEM; - } - - ret = iniparser_getint(dict, skey, -1); - free(skey); - - if (ret == -1) { - return ENOENT; - } - - *value = ret; - - return 0; -} - -int gp_iniparser_init(const char *config_file, - struct gp_ini_context *ctx) -{ - dictionary *d; - - if (!ctx) { - return EINVAL; - } - - d = iniparser_load(config_file); - if (!d) { - return ENOENT; - } - - ctx->private_data = d; - - return 0; -} - -int gp_iniparser_close(struct gp_ini_context *ctx) -{ - dictionary *dict; - - if (!ctx) { - return 0; - } - - dict = (dictionary *)ctx->private_data; - - iniparser_freedict(dict); - - return 0; -} - -int gp_iniparser_get_nsec(struct gp_ini_context *ctx) -{ - dictionary *dict = dict = (dictionary *)ctx->private_data; - - return iniparser_getnsec(dict); -} - -char *gp_iniparser_get_secname(struct gp_ini_context *ctx, - int i) -{ - dictionary *dict = dict = (dictionary *)ctx->private_data; - char *value; - - value = iniparser_getsecname(dict, i); - if (!value) { - return NULL; - } - - return strdup(value); -} - -#endif /* WITH_INIPARSER */ diff --git a/proxy/src/gp_config_iniparser.h b/proxy/src/gp_config_iniparser.h deleted file mode 100644 index 8fc3200..0000000 --- a/proxy/src/gp_config_iniparser.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - GSS-PROXY - - Copyright (C) 2011 Red Hat, Inc. - Copyright (C) 2011 Simo Sorce <simo.sorce@redhat.com> - Copyright (C) 2012 Guenther Deschner <guenther.deschner@redhat.com> - - Permission is hereby granted, free of charge, to any person obtaining a - copy of this software and associated documentation files (the "Software"), - to deal in the Software without restriction, including without limitation - the rights to use, copy, modify, merge, publish, distribute, sublicense, - and/or sell copies of the Software, and to permit persons to whom the - Software is furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. -*/ - -#include "gp_config.h" - -int gp_iniparser_get_string(struct gp_ini_context *ctx, - const char *secname, - const char *key, - char **value); -int gp_iniparser_get_int(struct gp_ini_context *ctx, - const char *secname, - const char *key, - int *value); -int gp_iniparser_init(const char *config_file, - struct gp_ini_context *ctx); -int gp_iniparser_close(struct gp_ini_context *ctx); -int gp_iniparser_get_nsec(struct gp_ini_context *ctx); -char *gp_iniparser_get_secname(struct gp_ini_context *ctx, - int i); |