nss-pam-ldapd commit: r1887 - in nss-pam-ldapd: nslcd tests
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
nss-pam-ldapd commit: r1887 - in nss-pam-ldapd: nslcd tests
- From: Commits of the nss-pam-ldapd project <nss-pam-ldapd-commits [at] lists.arthurdejong.org>
- To: nss-pam-ldapd-commits [at] lists.arthurdejong.org
- Reply-to: nss-pam-ldapd-users [at] lists.arthurdejong.org
- Subject: nss-pam-ldapd commit: r1887 - in nss-pam-ldapd: nslcd tests
- Date: Sun, 30 Dec 2012 15:12:09 +0100 (CET)
Author: arthur
Date: Sun Dec 30 15:12:09 2012
New Revision: 1887
URL: http://arthurdejong.org/viewvc/nss-pam-ldapd?revision=1887&view=revision
Log:
remove the ldc_ prefix from struct ldap_config fields
Modified:
nss-pam-ldapd/nslcd/alias.c
nss-pam-ldapd/nslcd/cfg.c
nss-pam-ldapd/nslcd/cfg.h
nss-pam-ldapd/nslcd/common.h
nss-pam-ldapd/nslcd/ether.c
nss-pam-ldapd/nslcd/group.c
nss-pam-ldapd/nslcd/host.c
nss-pam-ldapd/nslcd/myldap.c
nss-pam-ldapd/nslcd/netgroup.c
nss-pam-ldapd/nslcd/network.c
nss-pam-ldapd/nslcd/nslcd.c
nss-pam-ldapd/nslcd/pam.c
nss-pam-ldapd/nslcd/passwd.c
nss-pam-ldapd/nslcd/protocol.c
nss-pam-ldapd/nslcd/rpc.c
nss-pam-ldapd/nslcd/service.c
nss-pam-ldapd/nslcd/shadow.c
nss-pam-ldapd/tests/test_cfg.c
nss-pam-ldapd/tests/test_myldap.c
Modified: nss-pam-ldapd/nslcd/alias.c
==============================================================================
--- nss-pam-ldapd/nslcd/alias.c Sun Dec 30 14:24:40 2012 (r1886)
+++ nss-pam-ldapd/nslcd/alias.c Sun Dec 30 15:12:09 2012 (r1887)
@@ -79,10 +79,10 @@
/* set up search bases */
if (alias_bases[0] == NULL)
for (i = 0; i < NSS_LDAP_CONFIG_MAX_BASES; i++)
- alias_bases[i] = nslcd_cfg->ldc_bases[i];
+ alias_bases[i] = nslcd_cfg->bases[i];
/* set up scope */
if (alias_scope == LDAP_SCOPE_DEFAULT)
- alias_scope = nslcd_cfg->ldc_scope;
+ alias_scope = nslcd_cfg->scope;
/* set up attribute list */
alias_attrs[0] = attmap_alias_cn;
alias_attrs[1] = attmap_alias_rfc822MailMember;
Modified: nss-pam-ldapd/nslcd/cfg.c
==============================================================================
--- nss-pam-ldapd/nslcd/cfg.c Sun Dec 30 14:24:40 2012 (r1886)
+++ nss-pam-ldapd/nslcd/cfg.c Sun Dec 30 15:12:09 2012 (r1887)
@@ -88,53 +88,53 @@
{
int i;
memset(cfg, 0, sizeof(struct ldap_config));
- cfg->ldc_threads = 5;
- cfg->ldc_uidname = NULL;
- cfg->ldc_uid = NOUID;
- cfg->ldc_gid = NOGID;
- cfg->ldc_ignorecase = 0;
+ cfg->threads = 5;
+ cfg->uidname = NULL;
+ cfg->uid = NOUID;
+ cfg->gid = NOGID;
+ cfg->ignorecase = 0;
for (i = 0; i < (NSS_LDAP_CONFIG_URI_MAX + 1); i++)
{
- cfg->ldc_uris[i].uri = NULL;
- cfg->ldc_uris[i].firstfail = 0;
- cfg->ldc_uris[i].lastfail = 0;
+ cfg->uris[i].uri = NULL;
+ cfg->uris[i].firstfail = 0;
+ cfg->uris[i].lastfail = 0;
}
#ifdef LDAP_VERSION3
- cfg->ldc_version = LDAP_VERSION3;
+ cfg->version = LDAP_VERSION3;
#else /* LDAP_VERSION3 */
- cfg->ldc_version = LDAP_VERSION2;
+ cfg->version = LDAP_VERSION2;
#endif /* not LDAP_VERSION3 */
- cfg->ldc_binddn = NULL;
- cfg->ldc_bindpw = NULL;
- cfg->ldc_rootpwmoddn = NULL;
- cfg->ldc_rootpwmodpw = NULL;
- cfg->ldc_sasl_mech = NULL;
- cfg->ldc_sasl_realm = NULL;
- cfg->ldc_sasl_authcid = NULL;
- cfg->ldc_sasl_authzid = NULL;
- cfg->ldc_sasl_secprops = NULL;
+ cfg->binddn = NULL;
+ cfg->bindpw = NULL;
+ cfg->rootpwmoddn = NULL;
+ cfg->rootpwmodpw = NULL;
+ cfg->sasl_mech = NULL;
+ cfg->sasl_realm = NULL;
+ cfg->sasl_authcid = NULL;
+ cfg->sasl_authzid = NULL;
+ cfg->sasl_secprops = NULL;
#ifdef LDAP_OPT_X_SASL_NOCANON
- cfg->ldc_sasl_canonicalize = -1;
+ cfg->sasl_canonicalize = -1;
#endif /* LDAP_OPT_X_SASL_NOCANON */
for (i = 0; i < NSS_LDAP_CONFIG_MAX_BASES; i++)
- cfg->ldc_bases[i] = NULL;
- cfg->ldc_scope = LDAP_SCOPE_SUBTREE;
- cfg->ldc_deref = LDAP_DEREF_NEVER;
- cfg->ldc_referrals = 1;
- cfg->ldc_bind_timelimit = 10;
- cfg->ldc_timelimit = LDAP_NO_LIMIT;
- cfg->ldc_idle_timelimit = 0;
- cfg->ldc_reconnect_sleeptime = 1;
- cfg->ldc_reconnect_retrytime = 10;
+ cfg->bases[i] = NULL;
+ cfg->scope = LDAP_SCOPE_SUBTREE;
+ cfg->deref = LDAP_DEREF_NEVER;
+ cfg->referrals = 1;
+ cfg->bind_timelimit = 10;
+ cfg->timelimit = LDAP_NO_LIMIT;
+ cfg->idle_timelimit = 0;
+ cfg->reconnect_sleeptime = 1;
+ cfg->reconnect_retrytime = 10;
#ifdef LDAP_OPT_X_TLS
- cfg->ldc_ssl_on = SSL_OFF;
+ cfg->ssl_on = SSL_OFF;
#endif /* LDAP_OPT_X_TLS */
- cfg->ldc_restart = 1;
- cfg->ldc_pagesize = 0;
- cfg->ldc_nss_initgroups_ignoreusers = NULL;
+ cfg->restart = 1;
+ cfg->pagesize = 0;
+ cfg->nss_initgroups_ignoreusers = NULL;
for (i = 0; i < NSS_LDAP_CONFIG_MAX_AUTHZ_SEARCHES; i++)
- cfg->ldc_pam_authz_search[i] = NULL;
- cfg->ldc_nss_min_uid = 0;
+ cfg->pam_authz_search[i] = NULL;
+ cfg->nss_min_uid = 0;
parse_validnames_statement(__FILE__, __LINE__, "",
"/^[a-z0-9._@$][a-z0-9._@$
\\~-]*[a-z0-9._@$~-]$/i",
cfg);
@@ -166,7 +166,7 @@
int i;
log_log(LOG_DEBUG, "add_uri(%s)", uri);
/* find the place where to insert the URI */
- for (i = 0; cfg->ldc_uris[i].uri != NULL; i++)
+ for (i = 0; cfg->uris[i].uri != NULL; i++)
/* nothing */ ;
/* check for room */
if (i >= NSS_LDAP_CONFIG_URI_MAX)
@@ -176,7 +176,7 @@
exit(EXIT_FAILURE);
}
/* append URI to list */
- cfg->ldc_uris[i].uri = xstrdup(uri);
+ cfg->uris[i].uri = xstrdup(uri);
}
#ifdef HAVE_LDAP_DOMAIN2HOSTLIST
@@ -698,7 +698,7 @@
/* get the list of bases to update */
bases = base_get_var(get_map(&line));
if (bases == NULL)
- bases = cfg->ldc_bases;
+ bases = cfg->bases;
/* find the spot in the list of bases */
for (i = 0; i < NSS_LDAP_CONFIG_MAX_BASES; i++)
{
@@ -722,7 +722,7 @@
int *var;
var = scope_get_var(get_map(&line));
if (var == NULL)
- var = &cfg->ldc_scope;
+ var = &cfg->scope;
check_argumentcount(filename, lnr, keyword, (line != NULL) && (*line !=
'\0'));
*var = parse_scope(filename, lnr, line);
}
@@ -792,8 +792,8 @@
char *username, *next;
struct passwd *pwent;
check_argumentcount(filename, lnr, keyword, (line != NULL) && (*line !=
'\0'));
- if (cfg->ldc_nss_initgroups_ignoreusers == NULL)
- cfg->ldc_nss_initgroups_ignoreusers = set_new();
+ if (cfg->nss_initgroups_ignoreusers == NULL)
+ cfg->nss_initgroups_ignoreusers = set_new();
while (get_token(&line, token, sizeof(token)) != NULL)
{
if (strcasecmp(token, "alllocal") == 0)
@@ -801,7 +801,7 @@
/* go over all users (this will work because nslcd is not yet running) */
setpwent();
while ((pwent = getpwent()) != NULL)
- set_add(cfg->ldc_nss_initgroups_ignoreusers, pwent->pw_name);
+ set_add(cfg->nss_initgroups_ignoreusers, pwent->pw_name);
endpwent();
}
else
@@ -823,7 +823,7 @@
if (pwent == NULL)
log_log(LOG_ERR, "%s:%d: user '%s' does not exist",
filename, lnr, username);
- set_add(cfg->ldc_nss_initgroups_ignoreusers, username);
+ set_add(cfg->nss_initgroups_ignoreusers, username);
}
}
}
@@ -839,7 +839,7 @@
check_argumentcount(filename, lnr, keyword, (line != NULL) && (*line !=
'\0'));
/* find free spot for search filter */
for (i = 0;
- (i < NSS_LDAP_CONFIG_MAX_AUTHZ_SEARCHES) &&
(cfg->ldc_pam_authz_search[i] != NULL);
+ (i < NSS_LDAP_CONFIG_MAX_AUTHZ_SEARCHES) && (cfg->pam_authz_search[i]
!= NULL);
i++)
/* nothing */ ;
if (i >= NSS_LDAP_CONFIG_MAX_AUTHZ_SEARCHES)
@@ -848,9 +848,9 @@
filename, lnr, NSS_LDAP_CONFIG_MAX_AUTHZ_SEARCHES);
exit(EXIT_FAILURE);
}
- cfg->ldc_pam_authz_search[i] = xstrdup(line);
+ cfg->pam_authz_search[i] = xstrdup(line);
/* check the variables used in the expression */
- set = expr_vars(cfg->ldc_pam_authz_search[i], NULL);
+ set = expr_vars(cfg->pam_authz_search[i], NULL);
list = set_tolist(set);
for (i = 0; list[i] != NULL; i++)
{
@@ -918,23 +918,22 @@
/* runtime options */
if (strcasecmp(keyword, "threads") == 0)
{
- get_int(filename, lnr, keyword, &line, &cfg->ldc_threads);
+ get_int(filename, lnr, keyword, &line, &cfg->threads);
get_eol(filename, lnr, keyword, &line);
}
else if (strcasecmp(keyword, "uid") == 0)
{
- get_uid(filename, lnr, keyword, &line, &cfg->ldc_uid, &cfg->ldc_gid,
- &cfg->ldc_uidname);
+ get_uid(filename, lnr, keyword, &line, &cfg->uid, &cfg->gid,
&cfg->uidname);
get_eol(filename, lnr, keyword, &line);
}
else if (strcasecmp(keyword, "gid") == 0)
{
- get_gid(filename, lnr, keyword, &line, &cfg->ldc_gid);
+ get_gid(filename, lnr, keyword, &line, &cfg->gid);
get_eol(filename, lnr, keyword, &line);
}
else if (strcasecmp(keyword, "ignorecase") == 0)
{
- get_boolean(filename, lnr, keyword, &line, &cfg->ldc_ignorecase);
+ get_boolean(filename, lnr, keyword, &line, &cfg->ignorecase);
get_eol(filename, lnr, keyword, &line);
}
/* general connection options */
@@ -971,26 +970,26 @@
}
else if (strcasecmp(keyword, "ldap_version") == 0)
{
- get_int(filename, lnr, keyword, &line, &cfg->ldc_version);
+ get_int(filename, lnr, keyword, &line, &cfg->version);
get_eol(filename, lnr, keyword, &line);
}
else if (strcasecmp(keyword, "binddn") == 0)
{
- get_restdup(filename, lnr, keyword, &line, &cfg->ldc_binddn);
+ get_restdup(filename, lnr, keyword, &line, &cfg->binddn);
}
else if (strcasecmp(keyword, "bindpw") == 0)
{
check_permissions(filename, keyword);
- get_restdup(filename, lnr, keyword, &line, &cfg->ldc_bindpw);
+ get_restdup(filename, lnr, keyword, &line, &cfg->bindpw);
}
else if (strcasecmp(keyword, "rootpwmoddn") == 0)
{
- get_restdup(filename, lnr, keyword, &line, &cfg->ldc_rootpwmoddn);
+ get_restdup(filename, lnr, keyword, &line, &cfg->rootpwmoddn);
}
else if (strcasecmp(keyword, "rootpwmodpw") == 0)
{
check_permissions(filename, keyword);
- get_restdup(filename, lnr, keyword, &line, &cfg->ldc_rootpwmodpw);
+ get_restdup(filename, lnr, keyword, &line, &cfg->rootpwmodpw);
}
/* SASL authentication options */
else if (strcasecmp(keyword, "use_sasl") == 0)
@@ -1000,27 +999,27 @@
}
else if (strcasecmp(keyword, "sasl_mech") == 0)
{
- get_strdup(filename, lnr, keyword, &line, &cfg->ldc_sasl_mech);
+ get_strdup(filename, lnr, keyword, &line, &cfg->sasl_mech);
get_eol(filename, lnr, keyword, &line);
}
else if (strcasecmp(keyword, "sasl_realm") == 0)
{
- get_strdup(filename, lnr, keyword, &line, &cfg->ldc_sasl_realm);
+ get_strdup(filename, lnr, keyword, &line, &cfg->sasl_realm);
get_eol(filename, lnr, keyword, &line);
}
else if (strcasecmp(keyword, "sasl_authcid") == 0)
{
- get_strdup(filename, lnr, keyword, &line, &cfg->ldc_sasl_authcid);
+ get_strdup(filename, lnr, keyword, &line, &cfg->sasl_authcid);
get_eol(filename, lnr, keyword, &line);
}
else if (strcasecmp(keyword, "sasl_authzid") == 0)
{
- get_strdup(filename, lnr, keyword, &line, &cfg->ldc_sasl_authzid);
+ get_strdup(filename, lnr, keyword, &line, &cfg->sasl_authzid);
get_eol(filename, lnr, keyword, &line);
}
else if (strcasecmp(keyword, "sasl_secprops") == 0)
{
- get_strdup(filename, lnr, keyword, &line, &cfg->ldc_sasl_secprops);
+ get_strdup(filename, lnr, keyword, &line, &cfg->sasl_secprops);
get_eol(filename, lnr, keyword, &line);
}
#ifdef LDAP_OPT_X_SASL_NOCANON
@@ -1029,13 +1028,13 @@
(strcasecmp(keyword, "ldap_sasl_canonicalize") == 0) ||
(strcasecmp(keyword, "sasl_canon") == 0))
{
- get_boolean(filename, lnr, keyword, &line, &cfg->ldc_sasl_canonicalize);
+ get_boolean(filename, lnr, keyword, &line, &cfg->sasl_canonicalize);
get_eol(filename, lnr, keyword, &line);
}
else if (strcasecmp(keyword, "sasl_nocanon") == 0)
{
- get_boolean(filename, lnr, keyword, &line, &cfg->ldc_sasl_canonicalize);
- cfg->ldc_sasl_canonicalize = !cfg->ldc_sasl_canonicalize;
+ get_boolean(filename, lnr, keyword, &line, &cfg->sasl_canonicalize);
+ cfg->sasl_canonicalize = !cfg->sasl_canonicalize;
get_eol(filename, lnr, keyword, &line);
}
#endif /* LDAP_OPT_X_SASL_NOCANON */
@@ -1058,13 +1057,13 @@
check_argumentcount(filename, lnr, keyword,
(get_token(&line, token, sizeof(token)) != NULL));
if (strcasecmp(token, "never") == 0)
- cfg->ldc_deref = LDAP_DEREF_NEVER;
+ cfg->deref = LDAP_DEREF_NEVER;
else if (strcasecmp(token, "searching") == 0)
- cfg->ldc_deref = LDAP_DEREF_SEARCHING;
+ cfg->deref = LDAP_DEREF_SEARCHING;
else if (strcasecmp(token, "finding") == 0)
- cfg->ldc_deref = LDAP_DEREF_FINDING;
+ cfg->deref = LDAP_DEREF_FINDING;
else if (strcasecmp(token, "always") == 0)
- cfg->ldc_deref = LDAP_DEREF_ALWAYS;
+ cfg->deref = LDAP_DEREF_ALWAYS;
else
{
log_log(LOG_ERR, "%s:%d: wrong argument: '%s'", filename, lnr, token);
@@ -1074,7 +1073,7 @@
}
else if (strcasecmp(keyword, "referrals") == 0)
{
- get_boolean(filename, lnr, keyword, &line, &cfg->ldc_referrals);
+ get_boolean(filename, lnr, keyword, &line, &cfg->referrals);
get_eol(filename, lnr, keyword, &line);
}
else if (strcasecmp(keyword, "filter") == 0)
@@ -1088,17 +1087,17 @@
/* timing/reconnect options */
else if (strcasecmp(keyword, "bind_timelimit") == 0)
{
- get_int(filename, lnr, keyword, &line, &cfg->ldc_bind_timelimit);
+ get_int(filename, lnr, keyword, &line, &cfg->bind_timelimit);
get_eol(filename, lnr, keyword, &line);
}
else if (strcasecmp(keyword, "timelimit") == 0)
{
- get_int(filename, lnr, keyword, &line, &cfg->ldc_timelimit);
+ get_int(filename, lnr, keyword, &line, &cfg->timelimit);
get_eol(filename, lnr, keyword, &line);
}
else if (strcasecmp(keyword, "idle_timelimit") == 0)
{
- get_int(filename, lnr, keyword, &line, &cfg->ldc_idle_timelimit);
+ get_int(filename, lnr, keyword, &line, &cfg->idle_timelimit);
get_eol(filename, lnr, keyword, &line);
}
else if (strcasecmp(keyword, "reconnect_tries") == 0)
@@ -1106,7 +1105,7 @@
filename, lnr, keyword);
else if (!strcasecmp(keyword, "reconnect_sleeptime"))
{
- get_int(filename, lnr, keyword, &line, &cfg->ldc_reconnect_sleeptime);
+ get_int(filename, lnr, keyword, &line, &cfg->reconnect_sleeptime);
get_eol(filename, lnr, keyword, &line);
}
else if ((strcasecmp(keyword, "reconnect_retrytime") == 0) ||
@@ -1115,7 +1114,7 @@
if (strcasecmp(keyword, "reconnect_maxsleeptime") == 0)
log_log(LOG_WARNING, "%s:%d: option %s has been renamed to
reconnect_retrytime",
filename, lnr, keyword);
- get_int(filename, lnr, keyword, &line, &cfg->ldc_reconnect_retrytime);
+ get_int(filename, lnr, keyword, &line, &cfg->reconnect_retrytime);
get_eol(filename, lnr, keyword, &line);
}
#ifdef LDAP_OPT_X_TLS
@@ -1126,9 +1125,9 @@
(get_token(&line, token, sizeof(token)) != NULL));
if ((strcasecmp(token, "start_tls") == 0) ||
(strcasecmp(token, "starttls") == 0))
- cfg->ldc_ssl_on = SSL_START_TLS;
+ cfg->ssl_on = SSL_START_TLS;
else if (parse_boolean(filename, lnr, token))
- cfg->ldc_ssl_on = SSL_LDAPS;
+ cfg->ssl_on = SSL_LDAPS;
get_eol(filename, lnr, keyword, &line);
}
else if ((strcasecmp(keyword, "tls_reqcert") == 0) ||
@@ -1207,12 +1206,12 @@
{
log_log(LOG_WARNING, "%s:%d: option %s is currently untested (and may be
removed in an upcoming release)",
filename, lnr, keyword);
- get_boolean(filename, lnr, keyword, &line, &cfg->ldc_restart);
+ get_boolean(filename, lnr, keyword, &line, &cfg->restart);
get_eol(filename, lnr, keyword, &line);
}
else if (strcasecmp(keyword, "pagesize") == 0)
{
- get_int(filename, lnr, keyword, &line, &cfg->ldc_pagesize);
+ get_int(filename, lnr, keyword, &line, &cfg->pagesize);
get_eol(filename, lnr, keyword, &line);
}
else if (strcasecmp(keyword, "nss_initgroups_ignoreusers") == 0)
@@ -1226,8 +1225,7 @@
}
else if (strcasecmp(keyword, "nss_min_uid") == 0)
{
- get_uid(filename, lnr, keyword, &line, &cfg->ldc_nss_min_uid, NULL,
- NULL);
+ get_uid(filename, lnr, keyword, &line, &cfg->nss_min_uid, NULL, NULL);
get_eol(filename, lnr, keyword, &line);
}
else if (strcasecmp(keyword, "validnames") == 0)
@@ -1296,7 +1294,7 @@
log_log(LOG_ERR, "%s:1: the password is empty", filename);
exit(EXIT_FAILURE);
}
- cfg->ldc_bindpw = strdup(linebuf);
+ cfg->bindpw = strdup(linebuf);
/* check if there is no more data in the file */
if (fgets(linebuf, sizeof(linebuf), fp) != NULL)
{
@@ -1386,30 +1384,30 @@
bindpw_read(NSLCD_BINDPW_PATH, nslcd_cfg);
#endif /* NSLCD_BINDPW_PATH */
/* do some sanity checks */
- if (nslcd_cfg->ldc_uris[0].uri == NULL)
+ if (nslcd_cfg->uris[0].uri == NULL)
{
log_log(LOG_ERR, "no URIs defined in config");
exit(EXIT_FAILURE);
}
/* if ssl is on each URI should start with ldaps */
#ifdef LDAP_OPT_X_TLS
- if (nslcd_cfg->ldc_ssl_on == SSL_LDAPS)
+ if (nslcd_cfg->ssl_on == SSL_LDAPS)
{
- for (i = 0; nslcd_cfg->ldc_uris[i].uri != NULL; i++)
+ for (i = 0; nslcd_cfg->uris[i].uri != NULL; i++)
{
- if (strncasecmp(nslcd_cfg->ldc_uris[i].uri, "ldaps://", 8) != 0)
+ if (strncasecmp(nslcd_cfg->uris[i].uri, "ldaps://", 8) != 0)
log_log(LOG_WARNING, "%s doesn't start with ldaps:// and \"ssl on\" is
specified",
- nslcd_cfg->ldc_uris[i].uri);
+ nslcd_cfg->uris[i].uri);
}
}
/* TODO: check that if some tls options are set the ssl option should be set
to on (just warn) */
#endif /* LDAP_OPT_X_TLS */
/* if basedn is not yet set, get if from the rootDSE */
- if (nslcd_cfg->ldc_bases[0] == NULL)
- nslcd_cfg->ldc_bases[0] = get_base_from_rootdse();
+ if (nslcd_cfg->bases[0] == NULL)
+ nslcd_cfg->bases[0] = get_base_from_rootdse();
/* TODO: handle the case gracefully when no LDAP server is available yet */
/* see if we have a valid basedn */
- if ((nslcd_cfg->ldc_bases[0] == NULL) || (nslcd_cfg->ldc_bases[0][0] ==
'\0'))
+ if ((nslcd_cfg->bases[0] == NULL) || (nslcd_cfg->bases[0][0] == '\0'))
{
log_log(LOG_ERR, "no base defined in config and couldn't get one from
server");
exit(EXIT_FAILURE);
Modified: nss-pam-ldapd/nslcd/cfg.h
==============================================================================
--- nss-pam-ldapd/nslcd/cfg.h Sun Dec 30 14:24:40 2012 (r1886)
+++ nss-pam-ldapd/nslcd/cfg.h Sun Dec 30 15:12:09 2012 (r1887)
@@ -80,73 +80,73 @@
struct ldap_config {
/* the number of threads to start */
- int ldc_threads;
+ int threads;
/* the user name specified in the uid option */
- char *ldc_uidname;
+ char *uidname;
/* the user id nslcd should be run as */
- uid_t ldc_uid;
+ uid_t uid;
/* the group id nslcd should be run as */
- gid_t ldc_gid;
+ gid_t gid;
/* whether or not case should be ignored in lookups */
- int ldc_ignorecase;
+ int ignorecase;
/* NULL terminated list of URIs */
- struct myldap_uri ldc_uris[NSS_LDAP_CONFIG_URI_MAX + 1];
+ struct myldap_uri uris[NSS_LDAP_CONFIG_URI_MAX + 1];
/* protocol version */
- int ldc_version;
+ int version;
/* bind DN */
- char *ldc_binddn;
+ char *binddn;
/* bind cred */
- char *ldc_bindpw;
+ char *bindpw;
/* bind DN for password modification by administrator */
- char *ldc_rootpwmoddn;
+ char *rootpwmoddn;
/* bind password for password modification by root */
- char *ldc_rootpwmodpw;
+ char *rootpwmodpw;
/* sasl mech */
- char *ldc_sasl_mech;
+ char *sasl_mech;
/* sasl realm */
- char *ldc_sasl_realm;
+ char *sasl_realm;
/* sasl authentication id */
- char *ldc_sasl_authcid;
+ char *sasl_authcid;
/* sasl authorization id */
- char *ldc_sasl_authzid;
+ char *sasl_authzid;
/* sasl security */
- char *ldc_sasl_secprops;
+ char *sasl_secprops;
#ifdef LDAP_OPT_X_SASL_NOCANON
/* whether host name should be canonicalised */
- int ldc_sasl_canonicalize;
+ int sasl_canonicalize;
#endif /* LDAP_OPT_X_SASL_NOCANON */
/* base DN, eg. dc=gnu,dc=org */
- const char *ldc_bases[NSS_LDAP_CONFIG_MAX_BASES];
+ const char *bases[NSS_LDAP_CONFIG_MAX_BASES];
/* scope for searches */
- int ldc_scope;
+ int scope;
/* dereference aliases/links */
- int ldc_deref;
+ int deref;
/* chase referrals */
- int ldc_referrals;
+ int referrals;
/* bind timelimit */
- int ldc_bind_timelimit;
+ int bind_timelimit;
/* search timelimit */
- int ldc_timelimit;
+ int timelimit;
/* idle timeout */
- int ldc_idle_timelimit;
+ int idle_timelimit;
/* seconds to sleep; doubled until max */
- int ldc_reconnect_sleeptime;
+ int reconnect_sleeptime;
/* maximum seconds to sleep */
- int ldc_reconnect_retrytime;
+ int reconnect_retrytime;
#ifdef LDAP_OPT_X_TLS
/* SSL enabled */
- enum ldap_ssl_options ldc_ssl_on;
+ enum ldap_ssl_options ssl_on;
#endif /* LDAP_OPT_X_TLS */
/* whether the LDAP library should restart the select(2) system call when
interrupted */
- int ldc_restart;
+ int restart;
/* set to a greater than 0 to enable handling of paged results with the
specified size */
- int ldc_pagesize;
+ int pagesize;
/* the users for which no initgroups() searches should be done */
- SET *ldc_nss_initgroups_ignoreusers;
+ SET *nss_initgroups_ignoreusers;
/* the searches that should be performed to do autorisation checks */
- char *ldc_pam_authz_search[NSS_LDAP_CONFIG_MAX_AUTHZ_SEARCHES];
+ char *pam_authz_search[NSS_LDAP_CONFIG_MAX_AUTHZ_SEARCHES];
/* minimum uid for users retreived from LDAP */
- uid_t ldc_nss_min_uid;
+ uid_t nss_min_uid;
/* the regular expression to determine valid names */
regex_t validnames;
/* whether password changing should be denied and user prompted with
Modified: nss-pam-ldapd/nslcd/common.h
==============================================================================
--- nss-pam-ldapd/nslcd/common.h Sun Dec 30 14:24:40 2012 (r1886)
+++ nss-pam-ldapd/nslcd/common.h Sun Dec 30 15:12:09 2012 (r1887)
@@ -285,7 +285,7 @@
/* macro to compare strings which uses the ignorecase config option to
determine whether or not to do a case-sensitive match */
#define STR_CMP(str1, str2) \
- (nslcd_cfg->ldc_ignorecase == 1 ? \
+ (nslcd_cfg->ignorecase == 1 ? \
strcasecmp(str1, str2) : strcmp(str1, str2))
#endif /* not NSLCD__COMMON_H */
Modified: nss-pam-ldapd/nslcd/ether.c
==============================================================================
--- nss-pam-ldapd/nslcd/ether.c Sun Dec 30 14:24:40 2012 (r1886)
+++ nss-pam-ldapd/nslcd/ether.c Sun Dec 30 15:12:09 2012 (r1887)
@@ -92,10 +92,10 @@
/* set up search bases */
if (ether_bases[0] == NULL)
for (i = 0; i < NSS_LDAP_CONFIG_MAX_BASES; i++)
- ether_bases[i] = nslcd_cfg->ldc_bases[i];
+ ether_bases[i] = nslcd_cfg->bases[i];
/* set up scope */
if (ether_scope == LDAP_SCOPE_DEFAULT)
- ether_scope = nslcd_cfg->ldc_scope;
+ ether_scope = nslcd_cfg->scope;
/* set up attribute list */
ether_attrs[0] = attmap_ether_cn;
ether_attrs[1] = attmap_ether_macAddress;
Modified: nss-pam-ldapd/nslcd/group.c
==============================================================================
--- nss-pam-ldapd/nslcd/group.c Sun Dec 30 14:24:40 2012 (r1886)
+++ nss-pam-ldapd/nslcd/group.c Sun Dec 30 15:12:09 2012 (r1887)
@@ -142,10 +142,10 @@
/* set up search bases */
if (group_bases[0] == NULL)
for (i = 0; i < NSS_LDAP_CONFIG_MAX_BASES; i++)
- group_bases[i] = nslcd_cfg->ldc_bases[i];
+ group_bases[i] = nslcd_cfg->bases[i];
/* set up scope */
if (group_scope == LDAP_SCOPE_DEFAULT)
- group_scope = nslcd_cfg->ldc_scope;
+ group_scope = nslcd_cfg->scope;
/* special case when gidNumber references objectSid */
if (strncasecmp(attmap_group_gidNumber, "objectSid:", 10) == 0)
{
@@ -344,8 +344,8 @@
log_log(LOG_WARNING, "request denied by validnames option");
return -1;
}
- if ((nslcd_cfg->ldc_nss_initgroups_ignoreusers != NULL) &&
- set_contains(nslcd_cfg->ldc_nss_initgroups_ignoreusers, name))
+ if ((nslcd_cfg->nss_initgroups_ignoreusers != NULL) &&
+ set_contains(nslcd_cfg->nss_initgroups_ignoreusers, name))
{
log_log(LOG_DEBUG, "ignored group member");
/* just end the request, returning no results */
Modified: nss-pam-ldapd/nslcd/host.c
==============================================================================
--- nss-pam-ldapd/nslcd/host.c Sun Dec 30 14:24:40 2012 (r1886)
+++ nss-pam-ldapd/nslcd/host.c Sun Dec 30 15:12:09 2012 (r1887)
@@ -93,10 +93,10 @@
/* set up search bases */
if (host_bases[0] == NULL)
for (i = 0; i < NSS_LDAP_CONFIG_MAX_BASES; i++)
- host_bases[i] = nslcd_cfg->ldc_bases[i];
+ host_bases[i] = nslcd_cfg->bases[i];
/* set up scope */
if (host_scope == LDAP_SCOPE_DEFAULT)
- host_scope = nslcd_cfg->ldc_scope;
+ host_scope = nslcd_cfg->scope;
/* set up attribute list */
host_attrs[0] = attmap_host_cn;
host_attrs[1] = attmap_host_ipHostNumber;
Modified: nss-pam-ldapd/nslcd/myldap.c
==============================================================================
--- nss-pam-ldapd/nslcd/myldap.c Sun Dec 30 14:24:40 2012 (r1886)
+++ nss-pam-ldapd/nslcd/myldap.c Sun Dec 30 15:12:09 2012 (r1887)
@@ -90,7 +90,7 @@
char bindpw[64];
/* timestamp of last activity */
time_t lastactivity;
- /* index into ldc_uris: currently connected LDAP uri */
+ /* index into uris: currently connected LDAP uri */
int current_uri;
/* a list of searches registered with this session */
struct myldap_search *searches[MAX_SEARCHES_IN_SESSION];
@@ -349,44 +349,44 @@
switch (interact->id)
{
case SASL_CB_GETREALM:
- if (cfg->ldc_sasl_realm)
+ if (cfg->sasl_realm)
{
log_log(LOG_DEBUG, "do_sasl_interact(): returning sasl_realm \"%s\"",
- cfg->ldc_sasl_realm);
- interact->result = cfg->ldc_sasl_realm;
- interact->len = strlen(cfg->ldc_sasl_realm);
+ cfg->sasl_realm);
+ interact->result = cfg->sasl_realm;
+ interact->len = strlen(cfg->sasl_realm);
}
else
log_log(LOG_DEBUG, "do_sasl_interact(): were asked for sasl_realm
but we don't have any");
break;
case SASL_CB_AUTHNAME:
- if (cfg->ldc_sasl_authcid)
+ if (cfg->sasl_authcid)
{
log_log(LOG_DEBUG, "do_sasl_interact(): returning sasl_authcid
\"%s\"",
- cfg->ldc_sasl_authcid);
- interact->result = cfg->ldc_sasl_authcid;
- interact->len = strlen(cfg->ldc_sasl_authcid);
+ cfg->sasl_authcid);
+ interact->result = cfg->sasl_authcid;
+ interact->len = strlen(cfg->sasl_authcid);
}
else
log_log(LOG_DEBUG, "do_sasl_interact(): were asked for sasl_authcid
but we don't have any");
break;
case SASL_CB_USER:
- if (cfg->ldc_sasl_authzid)
+ if (cfg->sasl_authzid)
{
log_log(LOG_DEBUG, "do_sasl_interact(): returning sasl_authzid
\"%s\"",
- cfg->ldc_sasl_authzid);
- interact->result = cfg->ldc_sasl_authzid;
- interact->len = strlen(cfg->ldc_sasl_authzid);
+ cfg->sasl_authzid);
+ interact->result = cfg->sasl_authzid;
+ interact->len = strlen(cfg->sasl_authzid);
}
else
log_log(LOG_DEBUG, "do_sasl_interact(): were asked for sasl_authzid
but we don't have any");
break;
case SASL_CB_PASS:
- if (cfg->ldc_bindpw)
+ if (cfg->bindpw)
{
log_log(LOG_DEBUG, "do_sasl_interact(): returning bindpw \"***\"");
- interact->result = cfg->ldc_bindpw;
- interact->len = strlen(cfg->ldc_bindpw);
+ interact->result = cfg->bindpw;
+ interact->len = strlen(cfg->bindpw);
}
else
log_log(LOG_DEBUG, "do_sasl_interact(): were asked for bindpw but we
don't have any");
@@ -424,7 +424,7 @@
#endif /* HAVE_LDAP_SASL_INTERACTIVE_BIND_S */
#ifdef LDAP_OPT_X_TLS
/* check if StartTLS is requested */
- if (nslcd_cfg->ldc_ssl_on == SSL_START_TLS)
+ if (nslcd_cfg->ssl_on == SSL_START_TLS)
{
log_log(LOG_DEBUG, "ldap_start_tls_s()");
errno = 0;
@@ -448,59 +448,59 @@
/* perform SASL bind if requested and available on platform */
#ifdef HAVE_LDAP_SASL_INTERACTIVE_BIND_S
/* TODO: store this information in the session */
- if (nslcd_cfg->ldc_sasl_mech != NULL)
+ if (nslcd_cfg->sasl_mech != NULL)
{
/* do a SASL bind */
- if (nslcd_cfg->ldc_sasl_secprops != NULL)
+ if (nslcd_cfg->sasl_secprops != NULL)
{
log_log(LOG_DEBUG, "ldap_set_option(LDAP_OPT_X_SASL_SECPROPS,\"%s\")",
- nslcd_cfg->ldc_sasl_secprops);
- LDAP_SET_OPTION(ld, LDAP_OPT_X_SASL_SECPROPS, (void
*)nslcd_cfg->ldc_sasl_secprops);
+ nslcd_cfg->sasl_secprops);
+ LDAP_SET_OPTION(ld, LDAP_OPT_X_SASL_SECPROPS, (void
*)nslcd_cfg->sasl_secprops);
}
#ifdef HAVE_SASL_INTERACT_T
- if (nslcd_cfg->ldc_binddn != NULL)
+ if (nslcd_cfg->binddn != NULL)
log_log(LOG_DEBUG, "ldap_sasl_interactive_bind_s(\"%s\",\"%s\")
(uri=\"%s\")",
- nslcd_cfg->ldc_binddn, nslcd_cfg->ldc_sasl_mech, uri);
+ nslcd_cfg->binddn, nslcd_cfg->sasl_mech, uri);
else
log_log(LOG_DEBUG, "ldap_sasl_interactive_bind_s(NULL,\"%s\")
(uri=\"%s\")",
- nslcd_cfg->ldc_sasl_mech, uri);
- return ldap_sasl_interactive_bind_s(ld, nslcd_cfg->ldc_binddn,
- nslcd_cfg->ldc_sasl_mech, NULL, NULL,
+ nslcd_cfg->sasl_mech, uri);
+ return ldap_sasl_interactive_bind_s(ld, nslcd_cfg->binddn,
+ nslcd_cfg->sasl_mech, NULL, NULL,
LDAP_SASL_QUIET, do_sasl_interact,
(void *)nslcd_cfg);
#else /* HAVE_SASL_INTERACT_T */
- if (nslcd_cfg->ldc_bindpw != NULL)
+ if (nslcd_cfg->bindpw != NULL)
{
- cred.bv_val = nslcd_cfg->ldc_bindpw;
- cred.bv_len = strlen(nslcd_cfg->ldc_bindpw);
+ cred.bv_val = nslcd_cfg->bindpw;
+ cred.bv_len = strlen(nslcd_cfg->bindpw);
}
else
{
cred.bv_val = "";
cred.bv_len = 0;
}
- if (nslcd_cfg->ldc_binddn != NULL)
+ if (nslcd_cfg->binddn != NULL)
log_log(LOG_DEBUG, "ldap_sasl_bind_s(\"%s\",\"%s\",%s) (uri=\"%s\")",
- nslcd_cfg->ldc_binddn, nslcd_cfg->ldc_sasl_mech,
- nslcd_cfg->ldc_bindpw ? "\"***\"" : "NULL", uri);
+ nslcd_cfg->binddn, nslcd_cfg->sasl_mech,
+ nslcd_cfg->bindpw ? "\"***\"" : "NULL", uri);
else
log_log(LOG_DEBUG, "ldap_sasl_bind_s(NULL,\"%s\",%s) (uri=\"%s\")",
- nslcd_cfg->ldc_sasl_mech,
- nslcd_cfg->ldc_bindpw ? "\"***\"" : "NULL", uri);
- return ldap_sasl_bind_s(ld, nslcd_cfg->ldc_binddn,
- nslcd_cfg->ldc_sasl_mech, &cred, NULL, NULL, NULL);
+ nslcd_cfg->sasl_mech,
+ nslcd_cfg->bindpw ? "\"***\"" : "NULL", uri);
+ return ldap_sasl_bind_s(ld, nslcd_cfg->binddn,
+ nslcd_cfg->sasl_mech, &cred, NULL, NULL, NULL);
#endif /* not HAVE_SASL_INTERACT_T */
}
#endif /* HAVE_LDAP_SASL_INTERACTIVE_BIND_S */
/* do a simple bind */
- if (nslcd_cfg->ldc_binddn)
+ if (nslcd_cfg->binddn)
log_log(LOG_DEBUG, "ldap_simple_bind_s(\"%s\",%s) (uri=\"%s\")",
- nslcd_cfg->ldc_binddn, nslcd_cfg->ldc_bindpw ? "\"***\"" : "NULL",
+ nslcd_cfg->binddn, nslcd_cfg->bindpw ? "\"***\"" : "NULL",
uri);
else
log_log(LOG_DEBUG, "ldap_simple_bind_s(NULL,%s) (uri=\"%s\")",
- nslcd_cfg->ldc_bindpw ? "\"***\"" : "NULL", uri);
- return ldap_simple_bind_s(ld, nslcd_cfg->ldc_binddn, nslcd_cfg->ldc_bindpw);
+ nslcd_cfg->bindpw ? "\"***\"" : "NULL", uri);
+ return ldap_simple_bind_s(ld, nslcd_cfg->binddn, nslcd_cfg->bindpw);
}
#ifdef HAVE_LDAP_SET_REBIND_PROC
@@ -592,8 +592,8 @@
/* set timeout options on socket to avoid hang in some cases (a little
more than the normal timeout so this should only be triggered in cases
where the library behaves incorrectly) */
- if (nslcd_cfg->ldc_timelimit)
- set_socket_timeout(ld, nslcd_cfg->ldc_timelimit, 500000);
+ if (nslcd_cfg->timelimit)
+ set_socket_timeout(ld, nslcd_cfg->timelimit, 500000);
return LDAP_SUCCESS;
}
@@ -639,41 +639,41 @@
#endif /* HAVE_LDAP_SET_REBIND_PROC */
/* set the protocol version to use */
log_log(LOG_DEBUG, "ldap_set_option(LDAP_OPT_PROTOCOL_VERSION,%d)",
- nslcd_cfg->ldc_version);
+ nslcd_cfg->version);
LDAP_SET_OPTION(session->ld, LDAP_OPT_PROTOCOL_VERSION,
- &nslcd_cfg->ldc_version);
+ &nslcd_cfg->version);
/* set some other options */
log_log(LOG_DEBUG, "ldap_set_option(LDAP_OPT_DEREF,%d)",
- nslcd_cfg->ldc_deref);
- LDAP_SET_OPTION(session->ld, LDAP_OPT_DEREF, &nslcd_cfg->ldc_deref);
+ nslcd_cfg->deref);
+ LDAP_SET_OPTION(session->ld, LDAP_OPT_DEREF, &nslcd_cfg->deref);
log_log(LOG_DEBUG, "ldap_set_option(LDAP_OPT_TIMELIMIT,%d)",
- nslcd_cfg->ldc_timelimit);
- LDAP_SET_OPTION(session->ld, LDAP_OPT_TIMELIMIT, &nslcd_cfg->ldc_timelimit);
- tv.tv_sec = nslcd_cfg->ldc_bind_timelimit;
+ nslcd_cfg->timelimit);
+ LDAP_SET_OPTION(session->ld, LDAP_OPT_TIMELIMIT, &nslcd_cfg->timelimit);
+ tv.tv_sec = nslcd_cfg->bind_timelimit;
tv.tv_usec = 0;
#ifdef LDAP_OPT_TIMEOUT
log_log(LOG_DEBUG, "ldap_set_option(LDAP_OPT_TIMEOUT,%d)",
- nslcd_cfg->ldc_timelimit);
+ nslcd_cfg->timelimit);
LDAP_SET_OPTION(session->ld, LDAP_OPT_TIMEOUT, &tv);
#endif /* LDAP_OPT_TIMEOUT */
#ifdef LDAP_OPT_NETWORK_TIMEOUT
log_log(LOG_DEBUG, "ldap_set_option(LDAP_OPT_NETWORK_TIMEOUT,%d)",
- nslcd_cfg->ldc_timelimit);
+ nslcd_cfg->timelimit);
LDAP_SET_OPTION(session->ld, LDAP_OPT_NETWORK_TIMEOUT, &tv);
#endif /* LDAP_OPT_NETWORK_TIMEOUT */
#ifdef LDAP_X_OPT_CONNECT_TIMEOUT
log_log(LOG_DEBUG, "ldap_set_option(LDAP_X_OPT_CONNECT_TIMEOUT,%d)",
- nslcd_cfg->ldc_timelimit);
+ nslcd_cfg->timelimit);
LDAP_SET_OPTION(session->ld, LDAP_X_OPT_CONNECT_TIMEOUT, &tv);
#endif /* LDAP_X_OPT_CONNECT_TIMEOUT */
log_log(LOG_DEBUG, "ldap_set_option(LDAP_OPT_REFERRALS,%s)",
- nslcd_cfg->ldc_referrals ? "LDAP_OPT_ON" : "LDAP_OPT_OFF");
+ nslcd_cfg->referrals ? "LDAP_OPT_ON" : "LDAP_OPT_OFF");
LDAP_SET_OPTION(session->ld, LDAP_OPT_REFERRALS,
- nslcd_cfg->ldc_referrals ? LDAP_OPT_ON : LDAP_OPT_OFF);
+ nslcd_cfg->referrals ? LDAP_OPT_ON : LDAP_OPT_OFF);
log_log(LOG_DEBUG, "ldap_set_option(LDAP_OPT_RESTART,%s)",
- nslcd_cfg->ldc_restart ? "LDAP_OPT_ON" : "LDAP_OPT_OFF");
+ nslcd_cfg->restart ? "LDAP_OPT_ON" : "LDAP_OPT_OFF");
LDAP_SET_OPTION(session->ld, LDAP_OPT_RESTART,
- nslcd_cfg->ldc_restart ? LDAP_OPT_ON : LDAP_OPT_OFF);
+ nslcd_cfg->restart ? LDAP_OPT_ON : LDAP_OPT_OFF);
#ifdef LDAP_OPT_CONNECT_CB
/* register a connection callback */
cb.lc_add = connect_cb;
@@ -683,8 +683,8 @@
#endif /* LDAP_OPT_CONNECT_CB */
#ifdef LDAP_OPT_X_TLS
/* if SSL is desired, then enable it */
- if ((nslcd_cfg->ldc_ssl_on == SSL_LDAPS) ||
- (strncasecmp(nslcd_cfg->ldc_uris[session->current_uri].uri, "ldaps://",
8) == 0))
+ if ((nslcd_cfg->ssl_on == SSL_LDAPS) ||
+ (strncasecmp(nslcd_cfg->uris[session->current_uri].uri, "ldaps://", 8)
== 0))
{
/* use tls */
i = LDAP_OPT_X_TLS_HARD;
@@ -693,12 +693,12 @@
}
#endif /* LDAP_OPT_X_TLS */
#ifdef LDAP_OPT_X_SASL_NOCANON
- if (nslcd_cfg->ldc_sasl_canonicalize >= 0)
+ if (nslcd_cfg->sasl_canonicalize >= 0)
{
log_log(LOG_DEBUG, "ldap_set_option(LDAP_OPT_X_SASL_NOCANON,%s)",
- nslcd_cfg->ldc_sasl_canonicalize ? "LDAP_OPT_OFF" : "LDAP_OPT_ON");
+ nslcd_cfg->sasl_canonicalize ? "LDAP_OPT_OFF" : "LDAP_OPT_ON");
LDAP_SET_OPTION(session->ld, LDAP_OPT_X_SASL_NOCANON,
- nslcd_cfg->ldc_sasl_canonicalize ? LDAP_OPT_OFF :
LDAP_OPT_ON);
+ nslcd_cfg->sasl_canonicalize ? LDAP_OPT_OFF : LDAP_OPT_ON);
}
#endif /* LDAP_OPT_X_SASL_NOCANON */
/* if nothing above failed, everything should be fine */
@@ -717,9 +717,9 @@
/* set timeout options on socket to avoid hang in some cases
(we set a short timeout because we don't care too much about properly
shutting down the connection) */
- if (nslcd_cfg->ldc_timelimit)
+ if (nslcd_cfg->timelimit)
{
- sec = nslcd_cfg->ldc_timelimit / 2;
+ sec = nslcd_cfg->timelimit / 2;
if (!sec)
sec = 1;
set_socket_timeout(session->ld, sec, 0);
@@ -773,7 +773,7 @@
return;
}
/* check if we should time out the connection */
- if ((session->ld != NULL) && (nslcd_cfg->ldc_idle_timelimit > 0))
+ if ((session->ld != NULL) && (nslcd_cfg->idle_timelimit > 0))
{
/* if we have any running searches, don't time out */
for (i = 0; i < MAX_SEARCHES_IN_SESSION; i++)
@@ -781,7 +781,7 @@
return;
/* consider timeout (there are no running searches) */
time(¤t_time);
- if ((session->lastactivity + nslcd_cfg->ldc_idle_timelimit) < current_time)
+ if ((session->lastactivity + nslcd_cfg->idle_timelimit) < current_time)
{
log_log(LOG_DEBUG, "myldap_session_check(): idle_timelimit reached");
do_close(session);
@@ -803,13 +803,13 @@
session->lastactivity = 0;
/* open the connection */
log_log(LOG_DEBUG, "ldap_initialize(%s)",
- nslcd_cfg->ldc_uris[session->current_uri].uri);
+ nslcd_cfg->uris[session->current_uri].uri);
errno = 0;
- rc = ldap_initialize(&(session->ld),
nslcd_cfg->ldc_uris[session->current_uri].uri);
+ rc = ldap_initialize(&(session->ld),
nslcd_cfg->uris[session->current_uri].uri);
if (rc != LDAP_SUCCESS)
{
myldap_err(LOG_WARNING, session->ld, rc, "ldap_initialize(%s) failed",
- nslcd_cfg->ldc_uris[session->current_uri].uri);
+ nslcd_cfg->uris[session->current_uri].uri);
if (session->ld != NULL)
do_close(session);
return rc;
@@ -829,13 +829,13 @@
/* bind to the server */
errno = 0;
rc = do_bind(session->ld, session->binddn, session->bindpw,
- nslcd_cfg->ldc_uris[session->current_uri].uri);
+ nslcd_cfg->uris[session->current_uri].uri);
if (rc != LDAP_SUCCESS)
{
/* log actual LDAP error code */
myldap_err((session->binddn[0] == '\0') ? LOG_WARNING : LOG_DEBUG,
session->ld, rc, "failed to bind to LDAP server %s",
- nslcd_cfg->ldc_uris[session->current_uri].uri);
+ nslcd_cfg->uris[session->current_uri].uri);
do_close(session);
return rc;
}
@@ -866,9 +866,9 @@
if (rc != LDAP_SUCCESS)
return rc;
/* if we're using paging, build a page control */
- if ((nslcd_cfg->ldc_pagesize > 0) && (search->scope != LDAP_SCOPE_BASE))
+ if ((nslcd_cfg->pagesize > 0) && (search->scope != LDAP_SCOPE_BASE))
{
- rc = ldap_create_page_control(search->session->ld, nslcd_cfg->ldc_pagesize,
+ rc = ldap_create_page_control(search->session->ld, nslcd_cfg->pagesize,
NULL, 0, &serverCtrls[0]);
if (rc == LDAP_SUCCESS)
{
@@ -970,7 +970,7 @@
for (start_uri = 0; start_uri < NSS_LDAP_CONFIG_URI_MAX; start_uri++)
dotry[start_uri] = 1;
/* keep trying until we time out */
- endtime = time(NULL) + nslcd_cfg->ldc_reconnect_retrytime;
+ endtime = time(NULL) + nslcd_cfg->reconnect_retrytime;
while (1)
{
nexttry = endtime;
@@ -979,12 +979,12 @@
start_uri = search->session->current_uri;
do
{
- current_uri = &(nslcd_cfg->ldc_uris[search->session->current_uri]);
+ current_uri = &(nslcd_cfg->uris[search->session->current_uri]);
/* only try this URI if we should */
if (!dotry[search->session->current_uri])
{ /* skip this URI */ }
- else if ((current_uri->lastfail > (current_uri->firstfail +
nslcd_cfg->ldc_reconnect_retrytime)) &&
- ((t = time(NULL)) < (current_uri->lastfail +
nslcd_cfg->ldc_reconnect_retrytime)))
+ else if ((current_uri->lastfail > (current_uri->firstfail +
nslcd_cfg->reconnect_retrytime)) &&
+ ((t = time(NULL)) < (current_uri->lastfail +
nslcd_cfg->reconnect_retrytime)))
{
/* we are in a hard fail state and have retried not long ago */
log_log(LOG_DEBUG, "not retrying server %s which failed just %d
second(s) ago and has been failing for %d seconds",
@@ -1028,16 +1028,16 @@
(rc == LDAP_AUTH_METHOD_NOT_SUPPORTED))
dotry[search->session->current_uri] = 0;
/* check when we should try this URI again */
- else if (t <= (current_uri->firstfail +
nslcd_cfg->ldc_reconnect_retrytime))
+ else if (t <= (current_uri->firstfail +
nslcd_cfg->reconnect_retrytime))
{
- t += nslcd_cfg->ldc_reconnect_sleeptime;
+ t += nslcd_cfg->reconnect_sleeptime;
if (t < nexttry)
nexttry = t;
}
}
/* try the next URI (with wrap-around) */
search->session->current_uri++;
- if (nslcd_cfg->ldc_uris[search->session->current_uri].uri == NULL)
+ if (nslcd_cfg->uris[search->session->current_uri].uri == NULL)
search->session->current_uri = 0;
}
while (search->session->current_uri != start_uri);
@@ -1184,11 +1184,11 @@
return NULL;
}
/* set up a timelimit value for operations */
- if (nslcd_cfg->ldc_timelimit == LDAP_NO_LIMIT)
+ if (nslcd_cfg->timelimit == LDAP_NO_LIMIT)
tvp = NULL;
else
{
- tv.tv_sec = nslcd_cfg->ldc_timelimit;
+ tv.tv_sec = nslcd_cfg->timelimit;
tv.tv_usec = 0;
tvp = &tv;
}
@@ -1299,7 +1299,7 @@
/* try the next page */
serverctrls[0] = NULL;
serverctrls[1] = NULL;
- rc = ldap_create_page_control(search->session->ld,
nslcd_cfg->ldc_pagesize,
+ rc = ldap_create_page_control(search->session->ld, nslcd_cfg->pagesize,
search->cookie, 0, &serverctrls[0]);
if (rc != LDAP_SUCCESS)
{
Modified: nss-pam-ldapd/nslcd/netgroup.c
==============================================================================
--- nss-pam-ldapd/nslcd/netgroup.c Sun Dec 30 14:24:40 2012 (r1886)
+++ nss-pam-ldapd/nslcd/netgroup.c Sun Dec 30 15:12:09 2012 (r1887)
@@ -80,10 +80,10 @@
/* set up search bases */
if (netgroup_bases[0] == NULL)
for (i = 0; i < NSS_LDAP_CONFIG_MAX_BASES; i++)
- netgroup_bases[i] = nslcd_cfg->ldc_bases[i];
+ netgroup_bases[i] = nslcd_cfg->bases[i];
/* set up scope */
if (netgroup_scope == LDAP_SCOPE_DEFAULT)
- netgroup_scope = nslcd_cfg->ldc_scope;
+ netgroup_scope = nslcd_cfg->scope;
/* set up attribute list */
netgroup_attrs[0] = attmap_netgroup_cn;
netgroup_attrs[1] = attmap_netgroup_nisNetgroupTriple;
Modified: nss-pam-ldapd/nslcd/network.c
==============================================================================
--- nss-pam-ldapd/nslcd/network.c Sun Dec 30 14:24:40 2012 (r1886)
+++ nss-pam-ldapd/nslcd/network.c Sun Dec 30 15:12:09 2012 (r1887)
@@ -92,10 +92,10 @@
/* set up search bases */
if (network_bases[0] == NULL)
for (i = 0; i < NSS_LDAP_CONFIG_MAX_BASES; i++)
- network_bases[i] = nslcd_cfg->ldc_bases[i];
+ network_bases[i] = nslcd_cfg->bases[i];
/* set up scope */
if (network_scope == LDAP_SCOPE_DEFAULT)
- network_scope = nslcd_cfg->ldc_scope;
+ network_scope = nslcd_cfg->scope;
/* set up attribute list */
network_attrs[0] = attmap_network_cn;
network_attrs[1] = attmap_network_ipNetworkNumber;
Modified: nss-pam-ldapd/nslcd/nslcd.c
==============================================================================
--- nss-pam-ldapd/nslcd/nslcd.c Sun Dec 30 14:24:40 2012 (r1886)
+++ nss-pam-ldapd/nslcd/nslcd.c Sun Dec 30 15:12:09 2012 (r1887)
@@ -277,7 +277,7 @@
if (mkdir(path, (mode_t)0755) == 0)
{
/* if directory was just created, set correct ownership */
- if (lchown(path, nslcd_cfg->ldc_uid, nslcd_cfg->ldc_gid) < 0)
+ if (lchown(path, nslcd_cfg->uid, nslcd_cfg->gid) < 0)
log_log(LOG_WARNING, "problem setting permissions for %s: %s",
path, strerror(errno));
}
@@ -574,11 +574,11 @@
FD_ZERO(&fds);
FD_SET(nslcd_serversocket, &fds);
/* set up our timeout value */
- tv.tv_sec = nslcd_cfg->ldc_idle_timelimit;
+ tv.tv_sec = nslcd_cfg->idle_timelimit;
tv.tv_usec = 0;
/* wait for a new connection */
j = select(nslcd_serversocket + 1, &fds, NULL, NULL,
- nslcd_cfg->ldc_idle_timelimit > 0 ? &tv : NULL);
+ nslcd_cfg->idle_timelimit > 0 ? &tv : NULL);
/* check result of select() */
if (j < 0)
{
@@ -754,16 +754,16 @@
}
/* create socket */
nslcd_serversocket = create_socket(NSLCD_SOCKET);
- if ((nslcd_cfg->ldc_gid != NOGID) && (nslcd_cfg->ldc_uidname != NULL))
+ if ((nslcd_cfg->gid != NOGID) && (nslcd_cfg->uidname != NULL))
{
#ifdef HAVE_INITGROUPS
/* load supplementary groups */
- if (initgroups(nslcd_cfg->ldc_uidname, nslcd_cfg->ldc_gid) < 0)
+ if (initgroups(nslcd_cfg->uidname, nslcd_cfg->gid) < 0)
log_log(LOG_WARNING, "cannot initgroups(\"%s\",%d) (ignored): %s",
- nslcd_cfg->ldc_uidname, (int)nslcd_cfg->ldc_gid,
strerror(errno));
+ nslcd_cfg->uidname, (int)nslcd_cfg->gid, strerror(errno));
else
log_log(LOG_DEBUG, "initgroups(\"%s\",%d) done",
- nslcd_cfg->ldc_uidname, (int)nslcd_cfg->ldc_gid);
+ nslcd_cfg->uidname, (int)nslcd_cfg->gid);
#else /* not HAVE_INITGROUPS */
#ifdef HAVE_SETGROUPS
/* just drop all supplemental groups */
@@ -778,26 +778,26 @@
#endif /* not HAVE_INITGROUPS */
}
/* change to nslcd gid */
- if (nslcd_cfg->ldc_gid != NOGID)
+ if (nslcd_cfg->gid != NOGID)
{
- if (setgid(nslcd_cfg->ldc_gid) != 0)
+ if (setgid(nslcd_cfg->gid) != 0)
{
log_log(LOG_ERR, "cannot setgid(%d): %s",
- (int)nslcd_cfg->ldc_gid, strerror(errno));
+ (int)nslcd_cfg->gid, strerror(errno));
exit(EXIT_FAILURE);
}
- log_log(LOG_DEBUG, "setgid(%d) done", (int)nslcd_cfg->ldc_gid);
+ log_log(LOG_DEBUG, "setgid(%d) done", (int)nslcd_cfg->gid);
}
/* change to nslcd uid */
- if (nslcd_cfg->ldc_uid != NOUID)
+ if (nslcd_cfg->uid != NOUID)
{
- if (setuid(nslcd_cfg->ldc_uid) != 0)
+ if (setuid(nslcd_cfg->uid) != 0)
{
log_log(LOG_ERR, "cannot setuid(%d): %s",
- (int)nslcd_cfg->ldc_uid, strerror(errno));
+ (int)nslcd_cfg->uid, strerror(errno));
exit(EXIT_FAILURE);
}
- log_log(LOG_DEBUG, "setuid(%d) done", (int)nslcd_cfg->ldc_uid);
+ log_log(LOG_DEBUG, "setuid(%d) done", (int)nslcd_cfg->uid);
}
/* block all these signals so our worker threads won't handle them */
sigemptyset(&signalmask);
@@ -812,13 +812,13 @@
pthread_sigmask(SIG_BLOCK, &signalmask, &oldmask);
/* start worker threads */
log_log(LOG_INFO, "accepting connections");
- nslcd_threads = (pthread_t *)malloc(nslcd_cfg->ldc_threads *
sizeof(pthread_t));
+ nslcd_threads = (pthread_t *)malloc(nslcd_cfg->threads * sizeof(pthread_t));
if (nslcd_threads == NULL)
{
log_log(LOG_CRIT, "main(): malloc() failed to allocate memory");
exit(EXIT_FAILURE);
}
- for (i = 0; i < nslcd_cfg->ldc_threads; i++)
+ for (i = 0; i < nslcd_cfg->threads; i++)
{
if (pthread_create(&nslcd_threads[i], NULL, worker, NULL))
{
@@ -846,7 +846,7 @@
log_log(LOG_INFO, "caught signal %s (%d), shutting down",
signame(nslcd_exitsignal), nslcd_exitsignal);
/* cancel all running threads */
- for (i = 0; i < nslcd_cfg->ldc_threads; i++)
+ for (i = 0; i < nslcd_cfg->threads; i++)
if (pthread_cancel(nslcd_threads[i]))
log_log(LOG_WARNING, "failed to stop thread %d (ignored): %s",
i, strerror(errno));
@@ -858,7 +858,7 @@
ts.tv_sec = time(NULL) + 3;
ts.tv_nsec = 0;
#endif /* HAVE_PTHREAD_TIMEDJOIN_NP */
- for (i = 0; i < nslcd_cfg->ldc_threads; i++)
+ for (i = 0; i < nslcd_cfg->threads; i++)
{
#ifdef HAVE_PTHREAD_TIMEDJOIN_NP
pthread_timedjoin_np(nslcd_threads[i], NULL, &ts);
Modified: nss-pam-ldapd/nslcd/pam.c
==============================================================================
--- nss-pam-ldapd/nslcd/pam.c Sun Dec 30 14:24:40 2012 (r1886)
+++ nss-pam-ldapd/nslcd/pam.c Sun Dec 30 15:12:09 2012 (r1887)
@@ -274,18 +274,18 @@
WRITE_INT32(fp, NSLCD_ACTION_PAM_AUTHC);
/* if the username is blank and rootpwmoddn is configured, try to
authenticate as administrator, otherwise validate request as usual */
- if ((*username == '\0') && (nslcd_cfg->ldc_rootpwmoddn != NULL))
+ if ((*username == '\0') && (nslcd_cfg->rootpwmoddn != NULL))
{
- userdn = nslcd_cfg->ldc_rootpwmoddn;
+ userdn = nslcd_cfg->rootpwmoddn;
/* if the caller is root we will allow the use of the rootpwmodpw option */
- if ((*password == '\0') && (calleruid == 0) && (nslcd_cfg->ldc_rootpwmodpw
!= NULL))
+ if ((*password == '\0') && (calleruid == 0) && (nslcd_cfg->rootpwmodpw !=
NULL))
{
- if (strlen(nslcd_cfg->ldc_rootpwmodpw) >= sizeof(password))
+ if (strlen(nslcd_cfg->rootpwmodpw) >= sizeof(password))
{
log_log(LOG_ERR, "nslcd_pam_authc(): rootpwmodpw will not fit in
password");
return -1;
}
- strcpy(password, nslcd_cfg->ldc_rootpwmodpw);
+ strcpy(password, nslcd_cfg->rootpwmodpw);
}
}
else
@@ -396,7 +396,7 @@
const char *res;
int i;
/* go over all pam_authz_search options */
- for (i = 0; (i < NSS_LDAP_CONFIG_MAX_AUTHZ_SEARCHES) &&
(nslcd_cfg->ldc_pam_authz_search[i] != NULL); i++)
+ for (i = 0; (i < NSS_LDAP_CONFIG_MAX_AUTHZ_SEARCHES) &&
(nslcd_cfg->pam_authz_search[i] != NULL); i++)
{
if (dict == NULL)
{
@@ -417,7 +417,7 @@
autzsearch_var_add(dict, "uid", username);
}
/* build the search filter */
- res = expr_parse(nslcd_cfg->ldc_pam_authz_search[i],
+ res = expr_parse(nslcd_cfg->pam_authz_search[i],
filter, sizeof(filter),
autzsearch_var_get, (void *)dict);
if (res == NULL)
@@ -425,7 +425,7 @@
autzsearch_vars_free(dict);
dict_free(dict);
log_log(LOG_ERR, "invalid pam_authz_search \"%s\"",
- nslcd_cfg->ldc_pam_authz_search[i]);
+ nslcd_cfg->pam_authz_search[i]);
return LDAP_LOCAL_ERROR;
}
log_log(LOG_DEBUG, "trying pam_authz_search \"%s\"", filter);
@@ -433,7 +433,7 @@
attrs[0] = "dn";
attrs[1] = NULL;
/* FIXME: this only searches the first base */
- search = myldap_search(session, nslcd_cfg->ldc_bases[0],
+ search = myldap_search(session, nslcd_cfg->bases[0],
LDAP_SCOPE_SUBTREE, filter, attrs, &rc);
if (search == NULL)
{
@@ -595,8 +595,8 @@
(rc == LDAP_SUCCESS))
{
/* if doing password modification as admin, don't pass old password along
*/
- if ((nslcd_cfg->ldc_rootpwmoddn != NULL) &&
- (strcmp(binddn, nslcd_cfg->ldc_rootpwmoddn) == 0))
+ if ((nslcd_cfg->rootpwmoddn != NULL) &&
+ (strcmp(binddn, nslcd_cfg->rootpwmoddn) == 0))
oldpassword = NULL;
/* perform password modification */
rc = myldap_passwd(session, userdn, oldpassword, newpassword);
@@ -665,17 +665,17 @@
/* check if the the user passed the rootpwmoddn */
if (asroot)
{
- binddn = nslcd_cfg->ldc_rootpwmoddn;
+ binddn = nslcd_cfg->rootpwmoddn;
/* check if rootpwmodpw should be used */
if ((*oldpassword == '\0') && (calleruid == 0) &&
- (nslcd_cfg->ldc_rootpwmodpw != NULL))
+ (nslcd_cfg->rootpwmodpw != NULL))
{
- if (strlen(nslcd_cfg->ldc_rootpwmodpw) >= sizeof(oldpassword))
+ if (strlen(nslcd_cfg->rootpwmodpw) >= sizeof(oldpassword))
{
log_log(LOG_ERR, "nslcd_pam_pwmod(): rootpwmodpw will not fit in
oldpassword");
return -1;
}
- strcpy(oldpassword, nslcd_cfg->ldc_rootpwmodpw);
+ strcpy(oldpassword, nslcd_cfg->rootpwmodpw);
}
}
else
Modified: nss-pam-ldapd/nslcd/passwd.c
==============================================================================
--- nss-pam-ldapd/nslcd/passwd.c Sun Dec 30 14:24:40 2012 (r1886)
+++ nss-pam-ldapd/nslcd/passwd.c Sun Dec 30 15:12:09 2012 (r1887)
@@ -121,10 +121,10 @@
/* set up search bases */
if (passwd_bases[0] == NULL)
for (i = 0; i < NSS_LDAP_CONFIG_MAX_BASES; i++)
- passwd_bases[i] = nslcd_cfg->ldc_bases[i];
+ passwd_bases[i] = nslcd_cfg->bases[i];
/* set up scope */
if (passwd_scope == LDAP_SCOPE_DEFAULT)
- passwd_scope = nslcd_cfg->ldc_scope;
+ passwd_scope = nslcd_cfg->scope;
/* special case when uidNumber or gidNumber reference objectSid */
if (strncasecmp(attmap_passwd_uidNumber, "objectSid:", 10) == 0)
{
@@ -168,7 +168,7 @@
char *tmp;
uid_t uid;
/* if min_uid is not set any entry should do */
- if (nslcd_cfg->ldc_nss_min_uid == 0)
+ if (nslcd_cfg->nss_min_uid == 0)
return 1;
/* get all uidNumber attributes */
values = myldap_get_values_len(entry, attmap_passwd_uidNumber);
@@ -200,7 +200,7 @@
continue;
}
}
- if (uid >= nslcd_cfg->ldc_nss_min_uid)
+ if (uid >= nslcd_cfg->nss_min_uid)
return 1;
}
/* nothing found */
@@ -521,7 +521,7 @@
{
for (j = 0; j < numuids; j++)
{
- if (uids[j] >= nslcd_cfg->ldc_nss_min_uid)
+ if (uids[j] >= nslcd_cfg->nss_min_uid)
{
WRITE_INT32(fp, NSLCD_RESULT_BEGIN);
WRITE_STRING(fp, usernames[i]);
@@ -560,7 +560,7 @@
char filter[4096];
READ_INT32(fp, uid);
log_setrequest("passwd=%lu", (unsigned long int)uid);
- if (uid < nslcd_cfg->ldc_nss_min_uid)
+ if (uid < nslcd_cfg->nss_min_uid)
{
/* return an empty result */
WRITE_INT32(fp, NSLCD_VERSION);
Modified: nss-pam-ldapd/nslcd/protocol.c
==============================================================================
--- nss-pam-ldapd/nslcd/protocol.c Sun Dec 30 14:24:40 2012 (r1886)
+++ nss-pam-ldapd/nslcd/protocol.c Sun Dec 30 15:12:09 2012 (r1887)
@@ -89,10 +89,10 @@
/* set up search bases */
if (protocol_bases[0] == NULL)
for (i = 0; i < NSS_LDAP_CONFIG_MAX_BASES; i++)
- protocol_bases[i] = nslcd_cfg->ldc_bases[i];
+ protocol_bases[i] = nslcd_cfg->bases[i];
/* set up scope */
if (protocol_scope == LDAP_SCOPE_DEFAULT)
- protocol_scope = nslcd_cfg->ldc_scope;
+ protocol_scope = nslcd_cfg->scope;
/* set up attribute list */
protocol_attrs[0] = attmap_protocol_cn;
protocol_attrs[1] = attmap_protocol_ipProtocolNumber;
Modified: nss-pam-ldapd/nslcd/rpc.c
==============================================================================
--- nss-pam-ldapd/nslcd/rpc.c Sun Dec 30 14:24:40 2012 (r1886)
+++ nss-pam-ldapd/nslcd/rpc.c Sun Dec 30 15:12:09 2012 (r1887)
@@ -87,10 +87,10 @@
/* set up search bases */
if (rpc_bases[0] == NULL)
for (i = 0; i < NSS_LDAP_CONFIG_MAX_BASES; i++)
- rpc_bases[i] = nslcd_cfg->ldc_bases[i];
+ rpc_bases[i] = nslcd_cfg->bases[i];
/* set up scope */
if (rpc_scope == LDAP_SCOPE_DEFAULT)
- rpc_scope = nslcd_cfg->ldc_scope;
+ rpc_scope = nslcd_cfg->scope;
/* set up attribute list */
rpc_attrs[0] = attmap_rpc_cn;
rpc_attrs[1] = attmap_rpc_oncRpcNumber;
Modified: nss-pam-ldapd/nslcd/service.c
==============================================================================
--- nss-pam-ldapd/nslcd/service.c Sun Dec 30 14:24:40 2012 (r1886)
+++ nss-pam-ldapd/nslcd/service.c Sun Dec 30 15:12:09 2012 (r1887)
@@ -109,10 +109,10 @@
/* set up search bases */
if (service_bases[0] == NULL)
for (i = 0; i < NSS_LDAP_CONFIG_MAX_BASES; i++)
- service_bases[i] = nslcd_cfg->ldc_bases[i];
+ service_bases[i] = nslcd_cfg->bases[i];
/* set up scope */
if (service_scope == LDAP_SCOPE_DEFAULT)
- service_scope = nslcd_cfg->ldc_scope;
+ service_scope = nslcd_cfg->scope;
/* set up attribute list */
service_attrs[0] = attmap_service_cn;
service_attrs[1] = attmap_service_ipServicePort;
Modified: nss-pam-ldapd/nslcd/shadow.c
==============================================================================
--- nss-pam-ldapd/nslcd/shadow.c Sun Dec 30 14:24:40 2012 (r1886)
+++ nss-pam-ldapd/nslcd/shadow.c Sun Dec 30 15:12:09 2012 (r1887)
@@ -88,10 +88,10 @@
/* set up search bases */
if (shadow_bases[0] == NULL)
for (i = 0; i < NSS_LDAP_CONFIG_MAX_BASES; i++)
- shadow_bases[i] = nslcd_cfg->ldc_bases[i];
+ shadow_bases[i] = nslcd_cfg->bases[i];
/* set up scope */
if (shadow_scope == LDAP_SCOPE_DEFAULT)
- shadow_scope = nslcd_cfg->ldc_scope;
+ shadow_scope = nslcd_cfg->scope;
/* set up attribute list */
set = set_new();
attmap_add_attributes(set, attmap_shadow_uid);
Modified: nss-pam-ldapd/tests/test_cfg.c
==============================================================================
--- nss-pam-ldapd/tests/test_cfg.c Sun Dec 30 14:24:40 2012 (r1886)
+++ nss-pam-ldapd/tests/test_cfg.c Sun Dec 30 15:12:09 2012 (r1887)
@@ -52,22 +52,22 @@
int i;
/* set up config */
cfg_defaults(&cfg);
- assert(cfg.ldc_uris[0].uri == NULL);
+ assert(cfg.uris[0].uri == NULL);
/* add a uri */
add_uri(__FILE__, __LINE__, &cfg, "ldap://localhost");
- assert(cfg.ldc_uris[0].uri != NULL);
- assert(cfg.ldc_uris[1].uri == NULL);
+ assert(cfg.uris[0].uri != NULL);
+ assert(cfg.uris[1].uri == NULL);
/* add some more uris */
for (i = 1; i < NSS_LDAP_CONFIG_URI_MAX; i++)
{
add_uri(__FILE__, __LINE__, &cfg, "ldap://localhost");
- assert(cfg.ldc_uris[i].uri != NULL);
- assert(cfg.ldc_uris[i + 1].uri == NULL);
+ assert(cfg.uris[i].uri != NULL);
+ assert(cfg.uris[i + 1].uri == NULL);
}
/* inserting one more entry should call exit():
add_uri(__FILE__, __LINE__, &cfg, "ldap://localhost");
- assert(cfg.ldc_uris[i] != NULL);
- assert(cfg.ldc_uris[i + 1] == NULL); */
+ assert(cfg.uris[i] != NULL);
+ assert(cfg.uris[i + 1] == NULL); */
/* there is no cfg_free() so we have a memory leak here */
}
@@ -204,14 +204,14 @@
cfg_defaults(&cfg);
cfg_read("temp.cfg", &cfg);
/* check results */
- assert(cfg.ldc_uris[0].uri != NULL);
- assert(cfg.ldc_uris[1].uri != NULL);
- assert(cfg.ldc_uris[2].uri != NULL);
- assertstreq(cfg.ldc_uris[0].uri, "ldap://127.0.0.1/");
- assertstreq(cfg.ldc_uris[1].uri, "ldap:///");
- assertstreq(cfg.ldc_uris[2].uri, "ldaps://127.0.0.1/");
- assert(cfg.ldc_uris[3].uri == NULL);
- assertstreq(cfg.ldc_bases[0], "dc=test, dc=tld");
+ assert(cfg.uris[0].uri != NULL);
+ assert(cfg.uris[1].uri != NULL);
+ assert(cfg.uris[2].uri != NULL);
+ assertstreq(cfg.uris[0].uri, "ldap://127.0.0.1/");
+ assertstreq(cfg.uris[1].uri, "ldap:///");
+ assertstreq(cfg.uris[2].uri, "ldaps://127.0.0.1/");
+ assert(cfg.uris[3].uri == NULL);
+ assertstreq(cfg.bases[0], "dc=test, dc=tld");
assertstreq(passwd_bases[0], "ou=Some People,dc=test,dc=tld");
assertstreq(attmap_passwd_uid, "sAMAccountName");
assertstreq(group_filter, "(&(objeclClass=posixGroup)(gid=1*))");
Modified: nss-pam-ldapd/tests/test_myldap.c
==============================================================================
--- nss-pam-ldapd/tests/test_myldap.c Sun Dec 30 14:24:40 2012 (r1886)
+++ nss-pam-ldapd/tests/test_myldap.c Sun Dec 30 15:12:09 2012 (r1887)
@@ -59,8 +59,7 @@
assert(session != NULL);
/* perform search */
printf("test_myldap: test_search(): doing search...\n");
- search = myldap_search(session, nslcd_cfg->ldc_bases[0],
- LDAP_SCOPE_SUBTREE,
+ search = myldap_search(session, nslcd_cfg->bases[0], LDAP_SCOPE_SUBTREE,
"(objectclass=posixAccount)", attrs, NULL);
assert(search != NULL);
/* go over results */
@@ -78,8 +77,7 @@
assert(rc == LDAP_SUCCESS);
/* perform another search */
printf("test_myldap: test_search(): doing search...\n");
- search = myldap_search(session, nslcd_cfg->ldc_bases[0],
- LDAP_SCOPE_SUBTREE,
+ search = myldap_search(session, nslcd_cfg->bases[0], LDAP_SCOPE_SUBTREE,
"(objectclass=posixGroup)", attrs, NULL);
assert(search != NULL);
/* go over results */
@@ -113,8 +111,7 @@
assert(session != NULL);
/* perform search */
printf("test_myldap: test_get(): doing search...\n");
- search1 = myldap_search(session, nslcd_cfg->ldc_bases[0],
- LDAP_SCOPE_SUBTREE,
+ search1 = myldap_search(session, nslcd_cfg->bases[0], LDAP_SCOPE_SUBTREE,
"(&(|(objectClass=posixGroup)(objectClass=groupOfNames))(cn=testgroup2))",
attrs1, NULL);
assert(search1 != NULL);
@@ -159,8 +156,7 @@
session = myldap_create_session();
assert(session != NULL);
/* perform search */
- search = myldap_search(session, nslcd_cfg->ldc_bases[0],
- LDAP_SCOPE_SUBTREE,
+ search = myldap_search(session, nslcd_cfg->bases[0], LDAP_SCOPE_SUBTREE,
"(&(objectClass=posixAccount)(uid=*))", attrs, NULL);
assert(search != NULL);
/* go over results */
@@ -261,8 +257,7 @@
session = myldap_create_session();
assert(session != NULL);
/* perform search1 */
- search1 = myldap_search(session, nslcd_cfg->ldc_bases[0],
- LDAP_SCOPE_SUBTREE,
+ search1 = myldap_search(session, nslcd_cfg->bases[0], LDAP_SCOPE_SUBTREE,
"(&(objectClass=posixAccount)(uid=*))",
attrs, NULL);
assert(search1 != NULL);
@@ -275,8 +270,7 @@
assert((vals != NULL) && (vals[0] != NULL));
printf("test_myldap: test_two_searches(): [search1] cn=%s\n", vals[0]);
/* start a second search */
- search2 = myldap_search(session, nslcd_cfg->ldc_bases[0],
- LDAP_SCOPE_SUBTREE,
+ search2 = myldap_search(session, nslcd_cfg->bases[0], LDAP_SCOPE_SUBTREE,
"(&(objectclass=posixGroup)(gidNumber=*))",
attrs, NULL);
assert(search2 != NULL);
@@ -324,8 +318,7 @@
session = myldap_create_session();
assert(session != NULL);
/* perform search */
- search = myldap_search(session, nslcd_cfg->ldc_bases[0],
- LDAP_SCOPE_SUBTREE,
+ search = myldap_search(session, nslcd_cfg->bases[0], LDAP_SCOPE_SUBTREE,
"(objectclass=posixAccount)", attrs, NULL);
assert(search != NULL);
/* go over results */
@@ -376,31 +369,30 @@
/* save the old URIs */
for (i = 0; i < (NSS_LDAP_CONFIG_URI_MAX + 1); i++)
{
- old_uris[i] = nslcd_cfg->ldc_uris[i].uri;
- nslcd_cfg->ldc_uris[i].uri = NULL;
+ old_uris[i] = nslcd_cfg->uris[i].uri;
+ nslcd_cfg->uris[i].uri = NULL;
}
/* set new URIs */
i = 0;
- nslcd_cfg->ldc_uris[i++].uri = "ldapi://%2fdev%2fnull/";
- nslcd_cfg->ldc_uris[i++].uri = "ldap://10.10.10.10/";
- nslcd_cfg->ldc_uris[i++].uri = "ldapi://%2fdev%2fnonexistent/";
- nslcd_cfg->ldc_uris[i++].uri = "ldap://nosuchhost/";
- nslcd_cfg->ldc_uris[i++].uri = NULL;
+ nslcd_cfg->uris[i++].uri = "ldapi://%2fdev%2fnull/";
+ nslcd_cfg->uris[i++].uri = "ldap://10.10.10.10/";
+ nslcd_cfg->uris[i++].uri = "ldapi://%2fdev%2fnonexistent/";
+ nslcd_cfg->uris[i++].uri = "ldap://nosuchhost/";
+ nslcd_cfg->uris[i++].uri = NULL;
/* initialize session */
printf("test_myldap: test_connections(): getting session...\n");
session = myldap_create_session();
assert(session != NULL);
/* perform search */
printf("test_myldap: test_connections(): doing search...\n");
- search = myldap_search(session, nslcd_cfg->ldc_bases[0],
- LDAP_SCOPE_SUBTREE,
+ search = myldap_search(session, nslcd_cfg->bases[0], LDAP_SCOPE_SUBTREE,
"(objectclass=posixAccount)", attrs, NULL);
assert(search == NULL);
/* clean up */
myldap_session_close(session);
/* restore the old URIs */
for (i = 0; i < (NSS_LDAP_CONFIG_URI_MAX + 1); i++)
- nslcd_cfg->ldc_uris[i].uri = old_uris[i];
+ nslcd_cfg->uris[i].uri = old_uris[i];
}
/* test whether myldap_escape() handles buffer overlows correctly */
--
To unsubscribe send an email to
nss-pam-ldapd-commits-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/nss-pam-ldapd-commits/
- nss-pam-ldapd commit: r1887 - in nss-pam-ldapd: nslcd tests,
Commits of the nss-pam-ldapd project