Replace all uses of iniparser with tiniparser.
authorJeremy Allison <jra@samba.org>
Wed, 13 Aug 2014 23:36:28 +0000 (16:36 -0700)
committerJeremy Allison <jra@samba.org>
Thu, 14 Aug 2014 19:27:13 +0000 (21:27 +0200)
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
nsswitch/pam_winbind.c
nsswitch/pam_winbind.h
nsswitch/wscript_build
source3/utils/ntlm_auth.c
source3/wscript_build

index a8883afd1dee282f5a8fdf0187612f9755838d13..98ec64fb69f81760e90a77686d1bb13e761ca784 100644 (file)
@@ -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,
index 2a9dd0e344ab649a43f90455ac6c6c6a8f2d7d21..13542b2968f002dba0b99139563a020969dce895 100644 (file)
@@ -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;
 };
 
index 77dccef49e1a678952709f5f0ee4b0294f929761..8ceb9ad6f2b816c35fdbb6c5fdfeba89afc0463d 100644 (file)
@@ -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}'
index f0cd24bf58fce9592abd0bd283942257b16994ea..f907742a2685821b25cb949831691ec6a0d17ede 100644 (file)
@@ -36,7 +36,7 @@
 #include "auth/credentials/credentials.h"
 #include "librpc/crypto/gse.h"
 #include "smb_krb5.h"
-#include <iniparser.h>
+#include "lib/util/tiniparser.h"
 #include "../lib/crypto/arcfour.h"
 #include "libads/kerberos_proto.h"
 #include "nsswitch/winbind_client.h"
@@ -416,23 +416,23 @@ static bool get_require_membership_sid(void) {
 int get_pam_winbind_config()
 {
        int ctrl = 0;
-       dictionary *d = NULL;
+       struct tiniparser_dictionary *d = NULL;
 
        if (!opt_pam_winbind_conf || !*opt_pam_winbind_conf) {
                opt_pam_winbind_conf = PAM_WINBIND_CONFIG_FILE;
        }
 
-       d = iniparser_load(discard_const_p(char, opt_pam_winbind_conf));
+       d = tiniparser_load(opt_pam_winbind_conf);
 
        if (!d) {
                return 0;
        }
 
-       if (iniparser_getboolean(d, discard_const_p(char, "global:krb5_auth"), false)) {
+       if (tiniparser_getboolean(d, "global:krb5_auth", false)) {
                ctrl |= WINBIND_KRB5_AUTH;
        }
 
-       iniparser_freedict(d);
+       tiniparser_freedict(d);
 
        return ctrl;
 }
index d6550b0104e1f0d7c1ea45dfaafd98c870615f91..4365d61ba78891eb0157479c8c233d650af35af8 100755 (executable)
@@ -1382,7 +1382,7 @@ bld.SAMBA3_BINARY('ntlm_auth',
                  deps='''
                  talloc
                  krb5samba
-                 iniparser
+                 tiniparser
                  libsmb
                  popt_samba3
                  LIBNTLMSSP gse gensec''')