mirror of
https://github.com/samba-team/samba.git
synced 2025-03-24 10:50:22 +03:00
Replace all uses of iniparser with tiniparser.
Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
This commit is contained in:
parent
51bea0b767
commit
8bbf901f93
@ -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,
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
|
@ -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}'
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -1382,7 +1382,7 @@ bld.SAMBA3_BINARY('ntlm_auth',
|
||||
deps='''
|
||||
talloc
|
||||
krb5samba
|
||||
iniparser
|
||||
tiniparser
|
||||
libsmb
|
||||
popt_samba3
|
||||
LIBNTLMSSP gse gensec''')
|
||||
|
Loading…
x
Reference in New Issue
Block a user