summaryrefslogtreecommitdiff
path: root/nsswitch/pam_winbind.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2014-08-13 16:36:28 -0700
committerJeremy Allison <jra@samba.org>2014-08-14 21:27:13 +0200
commit8bbf901f9349e9b33caa24fd2a2333c060952646 (patch)
treedff4d60c3e4c89ea8d597c6d4b4e130a77fd1dfc /nsswitch/pam_winbind.c
parent51bea0b767b4f1e76a7008604f4dd0788a5edeb2 (diff)
downloadsamba-8bbf901f9349e9b33caa24fd2a2333c060952646.tar.gz
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/pam_winbind.c')
-rw-r--r--nsswitch/pam_winbind.c44
1 files changed, 24 insertions, 20 deletions
diff --git a/nsswitch/pam_winbind.c b/nsswitch/pam_winbind.c
index a8883afd1de..98ec64fb69f 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,