diff options
author | Jeremy Allison <jra@samba.org> | 2014-08-13 16:36:28 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2014-08-14 21:27:13 +0200 |
commit | 8bbf901f9349e9b33caa24fd2a2333c060952646 (patch) | |
tree | dff4d60c3e4c89ea8d597c6d4b4e130a77fd1dfc /nsswitch | |
parent | 51bea0b767b4f1e76a7008604f4dd0788a5edeb2 (diff) | |
download | samba-8bbf901f9349e9b33caa24fd2a2333c060952646.tar.gz samba-8bbf901f9349e9b33caa24fd2a2333c060952646.tar.xz samba-8bbf901f9349e9b33caa24fd2a2333c060952646.zip |
Replace all uses of iniparser with tiniparser.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Diffstat (limited to 'nsswitch')
-rw-r--r-- | nsswitch/pam_winbind.c | 44 | ||||
-rw-r--r-- | nsswitch/pam_winbind.h | 5 | ||||
-rw-r--r-- | nsswitch/wscript_build | 2 |
3 files changed, 27 insertions, 24 deletions
diff --git a/nsswitch/pam_winbind.c b/nsswitch/pam_winbind.c index a8883afd1d..98ec64fb69 100644 --- a/nsswitch/pam_winbind.c +++ b/nsswitch/pam_winbind.c @@ -345,10 +345,14 @@ static void _pam_log_state_datum(struct pwb_context *ctx, * key = * for a key like above newer iniparser will return a zero-length * string, previously iniparser would return NULL + * + * JRA: For compatibility, tiniparser behaves like iniparser. */ -static char *iniparser_getstring_nonempty(dictionary *d, char *key, char *def) +static const char *tiniparser_getstring_nonempty(struct tiniparser_dictionary *d, + const char *key, + const char *def) { - char *ret = iniparser_getstring(d, key, def); + const char *ret = tiniparser_getstring(d, key, def); if (ret && strlen(ret) == 0) { ret = NULL; } @@ -394,13 +398,13 @@ static int _pam_parse(const pam_handle_t *pamh, int argc, const char **argv, enum pam_winbind_request_type type, - dictionary **result_d) + struct tiniparser_dictionary **result_d) { int ctrl = 0; const char *config_file = NULL; int i; const char **v; - dictionary *d = NULL; + struct tiniparser_dictionary *d = NULL; if (flags & PAM_SILENT) { ctrl |= WINBIND_SILENT; @@ -418,51 +422,51 @@ static int _pam_parse(const pam_handle_t *pamh, config_file = PAM_WINBIND_CONFIG_FILE; } - d = iniparser_load(discard_const_p(char, config_file)); + d = tiniparser_load(config_file); if (d == NULL) { goto config_from_pam; } - if (iniparser_getboolean(d, discard_const_p(char, "global:debug"), false)) { + if (tiniparser_getboolean(d, "global:debug", false)) { ctrl |= WINBIND_DEBUG_ARG; } - if (iniparser_getboolean(d, discard_const_p(char, "global:debug_state"), false)) { + if (tiniparser_getboolean(d, "global:debug_state", false)) { ctrl |= WINBIND_DEBUG_STATE; } - if (iniparser_getboolean(d, discard_const_p(char, "global:cached_login"), false)) { + if (tiniparser_getboolean(d, "global:cached_login", false)) { ctrl |= WINBIND_CACHED_LOGIN; } - if (iniparser_getboolean(d, discard_const_p(char, "global:krb5_auth"), false)) { + if (tiniparser_getboolean(d, "global:krb5_auth", false)) { ctrl |= WINBIND_KRB5_AUTH; } - if (iniparser_getboolean(d, discard_const_p(char, "global:silent"), false)) { + if (tiniparser_getboolean(d, "global:silent", false)) { ctrl |= WINBIND_SILENT; } - if (iniparser_getstring_nonempty(d, discard_const_p(char, "global:krb5_ccache_type"), NULL) != NULL) { + if (tiniparser_getstring_nonempty(d, "global:krb5_ccache_type", NULL) != NULL) { ctrl |= WINBIND_KRB5_CCACHE_TYPE; } - if ((iniparser_getstring_nonempty(d, discard_const_p(char, "global:require-membership-of"), NULL) + if ((tiniparser_getstring_nonempty(d, "global:require-membership-of", NULL) != NULL) || - (iniparser_getstring_nonempty(d, discard_const_p(char, "global:require_membership_of"), NULL) + (tiniparser_getstring_nonempty(d, "global:require_membership_of", NULL) != NULL)) { ctrl |= WINBIND_REQUIRED_MEMBERSHIP; } - if (iniparser_getboolean(d, discard_const_p(char, "global:try_first_pass"), false)) { + if (tiniparser_getboolean(d, "global:try_first_pass", false)) { ctrl |= WINBIND_TRY_FIRST_PASS_ARG; } - if (iniparser_getint(d, discard_const_p(char, "global:warn_pwd_expire"), 0)) { + if (tiniparser_getint(d, "global:warn_pwd_expire", 0)) { ctrl |= WINBIND_WARN_PWD_EXPIRE; } - if (iniparser_getboolean(d, discard_const_p(char, "global:mkhomedir"), false)) { + if (tiniparser_getboolean(d, "global:mkhomedir", false)) { ctrl |= WINBIND_MKHOMEDIR; } @@ -516,7 +520,7 @@ config_from_pam: *result_d = d; } else { if (d) { - iniparser_freedict(d); + tiniparser_freedict(d); } } @@ -530,7 +534,7 @@ static int _pam_winbind_free_context(struct pwb_context *ctx) } if (ctx->dict) { - iniparser_freedict(ctx->dict); + tiniparser_freedict(ctx->dict); } return 0; @@ -2292,7 +2296,7 @@ static const char *get_conf_item_string(struct pwb_context *ctx, goto out; } - parm_opt = iniparser_getstring_nonempty(ctx->dict, key, NULL); + parm_opt = tiniparser_getstring_nonempty(ctx->dict, key, NULL); TALLOC_FREE(key); _pam_log_debug(ctx, LOG_INFO, "CONFIG file: %s '%s'\n", @@ -2340,7 +2344,7 @@ static int get_config_item_int(struct pwb_context *ctx, goto out; } - parm_opt = iniparser_getint(ctx->dict, key, -1); + parm_opt = tiniparser_getint(ctx->dict, key, -1); TALLOC_FREE(key); _pam_log_debug(ctx, LOG_INFO, diff --git a/nsswitch/pam_winbind.h b/nsswitch/pam_winbind.h index 2a9dd0e344..13542b2968 100644 --- a/nsswitch/pam_winbind.h +++ b/nsswitch/pam_winbind.h @@ -55,6 +55,7 @@ #include "system/time.h" #include <talloc.h> #include "libwbclient/wbclient.h" +#include "lib/util/tiniparser.h" #define MODULE_NAME "pam_winbind" #define PAM_SM_AUTH @@ -66,8 +67,6 @@ #define PAM_WINBIND_CONFIG_FILE "/etc/security/pam_winbind.conf" #endif -#include <iniparser.h> - #ifdef HAVE_LIBINTL_H #include <libintl.h> #endif @@ -212,7 +211,7 @@ struct pwb_context { int flags; int argc; const char **argv; - dictionary *dict; + struct tiniparser_dictionary *dict; uint32_t ctrl; }; diff --git a/nsswitch/wscript_build b/nsswitch/wscript_build index 77dccef49e..8ceb9ad6f2 100644 --- a/nsswitch/wscript_build +++ b/nsswitch/wscript_build @@ -81,7 +81,7 @@ elif (host_os.rfind('aix') > -1): if bld.CONFIG_SET('WITH_PAM_MODULES') and bld.CONFIG_SET('HAVE_PAM_START'): bld.SAMBA_LIBRARY('pamwinbind', source='pam_winbind.c', - deps='talloc wbclient winbind-client iniparser pam samba_intl', + deps='talloc wbclient winbind-client tiniparser pam samba_intl', cflags='-DLOCALEDIR=\"%s/locale\"' % bld.env.DATADIR, realname='pam_winbind.so', install_path='${PAMMODULESDIR}' |