diff options
author | Roland Mainz <rmainz@redhat.com> | 2015-04-14 16:07:18 +0200 |
---|---|---|
committer | Simo Sorce <simo@redhat.com> | 2015-04-15 10:31:39 -0400 |
commit | 116e6c8f716e1104823c77f3d732513dd1b2a794 (patch) | |
tree | 0ac322b1403183d2ce364ab2240bc4cc57787156 | |
parent | bcea066dc65fd2fef6f0c26454f5ecc076d69430 (diff) | |
download | gss-proxy-116e6c8f716e1104823c77f3d732513dd1b2a794.tar.gz gss-proxy-116e6c8f716e1104823c77f3d732513dd1b2a794.tar.xz gss-proxy-116e6c8f716e1104823c77f3d732513dd1b2a794.zip |
Remove support for iniparse library
This library already does not support some features we need and
we want to drop its usage as the code quality is bad.
Fixes: https://fedorahosted.org/gss-proxy/ticket/139
Signed-off-by: Roland Mainz <rmainz@redhat.com>
Reviewed-by: Simo Sorce <simo@redhat.com>
-rw-r--r-- | proxy/Makefile.am | 2 | ||||
-rw-r--r-- | proxy/configure.ac | 13 | ||||
-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 |
5 files changed, 1 insertions, 272 deletions
diff --git a/proxy/Makefile.am b/proxy/Makefile.am index 47de3a2..8213625 100644 --- a/proxy/Makefile.am +++ b/proxy/Makefile.am @@ -132,7 +132,6 @@ dist_noinst_HEADERS = \ src/gp_export.h \ src/gp_conv.h \ src/gp_config.h \ - src/gp_config_iniparser.h \ src/gp_config_dinglibs.h \ src/gp_debug.h \ src/gp_rpc_creds.h \ @@ -146,7 +145,6 @@ dist_noinst_HEADERS = \ gssproxy_SOURCES = \ src/gp_config.c \ - src/gp_config_iniparser.c \ src/gp_config_dinglibs.c \ src/gp_init.c \ src/gp_socket.c \ diff --git a/proxy/configure.ac b/proxy/configure.ac index 6a02de2..26430f8 100644 --- a/proxy/configure.ac +++ b/proxy/configure.ac @@ -82,14 +82,6 @@ if test x$have_libverto = x; then AC_MSG_ERROR([Could not find VERTO headers]) fi -#Check for iniparser -have_iniparser= -AC_CHECK_HEADERS([iniparser.h], - [AC_CHECK_LIB(iniparser, iniparser_set, [ have_iniparser=1 ], - [AC_MSG_ERROR([Iniparser library must support iniparser_set])])], - [AC_MSG_WARN([Could not find Iniparser headers])] -) - #Check for libini_config PKG_CHECK_MODULES([LIBINI_CONFIG], [ini_config >= 1.0.0], [have_libini_config=1], [have_libini_config=]) if test x$have_libini_config = x; then @@ -106,11 +98,8 @@ if test x$have_libini_config = x1; then AC_DEFINE([WITH_DINGLIBS], [1], [Using ini_config]) INI_CFLAGS="$INI_CONFIG_CFLAGS" INI_LIBS="$INI_CONFIG_LIBS" -elif test x$have_iniparser = x1; then - AC_DEFINE([WITH_INIPARSER], [1], [Using iniparser]) - INI_LIBS="-liniparser" else - AC_MSG_ERROR([Neither iniparser nor ini_config development packages available]) + AC_MSG_ERROR([ini_config development packages not available]) fi AC_SUBST(INI_LIBS) 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); |