Still changes for libreadline checks output

Clear environment before calling ldap_init, as suggested by Olaf


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@391 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
aet 2002-03-25 11:54:10 +00:00
parent 262b1d79d9
commit bfe2df2341
3 changed files with 17 additions and 12 deletions

View File

@ -269,7 +269,8 @@ saved_LIBS="$LIBS"
# libreadline will also need libtermcap on some OSes
for add in "" "-ltermcap"; do
if test "x$add" != x; then
AC_MSG_CHECKING([whether -lreadline requires $add])
AC_MSG_CHECKING([for readline with])
AC_MSG_RESULT($add)
fi
LIBS="$saved_LIBS $add"
unset ac_cv_lib_readline_readline
@ -277,16 +278,7 @@ for add in "" "-ltermcap"; do
LIBREADLINE="-lreadline $add"
ac_cv_func_readline_lreadline=yes
], ac_cv_func_readline_lreadline=no)
if test "x$ac_cv_func_readline_lreadline" = xyes; then
if test "x$add" != x; then
AC_MSG_RESULT(yes)
fi
break;
else
if test "x$add" != x; then
AC_MSG_RESULT(no)
fi
fi
test "x$ac_cv_func_readline_lreadline" = xyes && break
done
LIBS="$LIBS $LIBREADLINE"
AC_CHECK_FUNCS(readline)

View File

@ -5,7 +5,7 @@ ldap example {
# Hostname for LDAP server (required)
ldaphost = "ldap.foobar.tld";
# Port for LDAP server
ldapport = 0;
ldapport = 389;
# Scope for ldap search
# 0 = LDAP_SCOPE_BASE
# 1 = LDAP_SCOPE_ONELEVEL
@ -30,6 +30,7 @@ ldap example {
card "FINEID S4-1-1", "VRK-FINSIGN" {
ldap "auth certificate" {
ldaphost = ldap.example.com;
ldapport = 389;
scope = 2;
base = "dc=example,dc=com";
attributes = userCertificate;
@ -39,11 +40,13 @@ card "FINEID S4-1-1", "VRK-FINSIGN" {
# unnecessary, data for crl is usually generated from
# auth cert's crlDistributionPoints
ldaphost = ldap.example.com;
ldapport = 389;
scope = 2;
base = "dc=example,dc=com";
}
ldap "ca certificate" {
ldaphost = ldap.example.com;
ldapport = 389;
scope = 2;
base = "dc=example,dc=com";
attributes = cACertificate;
@ -51,6 +54,7 @@ card "FINEID S4-1-1", "VRK-FINSIGN" {
}
ldap "approx base" {
ldaphost = ldap.example.com;
ldapport = 389;
scope = 2;
base = "dc=example,dc=com";
}
@ -59,6 +63,7 @@ card "FINEID S4-1-1", "VRK-FINSIGN" {
card "FINEID S4-1", "VRK-FINSIGN" {
ldap "auth certificate" {
ldaphost = ldap.example.com;
ldapport = 389;
scope = 2;
base = "dc=example,dc=com";
attributes = userCertificate;
@ -68,11 +73,13 @@ card "FINEID S4-1", "VRK-FINSIGN" {
# unnecessary, data for crl is usually generated from
# auth cert's crlDistributionPoints
ldaphost = ldap.example.com;
ldapport = 389;
scope = 2;
base = "dc=example,dc=com";
}
ldap "ca certificate" {
ldaphost = ldap.example.com;
ldapport = 389;
scope = 2;
base = "dc=example,dc=com";
attributes = cACertificate;
@ -80,6 +87,7 @@ card "FINEID S4-1", "VRK-FINSIGN" {
}
ldap "approx base" {
ldaphost = ldap.example.com;
ldapport = 389;
scope = 2;
base = "dc=example,dc=com";
}

View File

@ -769,6 +769,7 @@ int scldap_search(scldap_context * ctx, const char *entry,
scldap_result *_result = *result;
int rc, entrynum = -1;
char *pattern = NULL;
char **env = NULL;
if (_result || !ctx) {
return -1;
@ -780,10 +781,14 @@ int scldap_search(scldap_context * ctx, const char *entry,
if (!ctx->entry[entrynum].ldaphost) {
return -1;
}
env = __environ;
__environ = NULL;
if ((ld = ldap_init(ctx->entry[entrynum].ldaphost, ctx->entry[entrynum].ldapport)) == NULL) {
__environ = env;
perror("ldap_init");
return -1;
}
__environ = env;
if (ldap_bind_s(ld, ctx->entry[entrynum].binddn, ctx->entry[entrynum].passwd, LDAP_AUTH_SIMPLE) != LDAP_SUCCESS) {
ldap_perror(ld, "ldap_bind");
ldap_unbind(ld);