Lines 716-733
do_connect(char *server, bind_options *bind_options,
Link Here
|
716 |
server = url; |
716 |
server = url; |
717 |
} |
717 |
} |
718 |
|
718 |
|
719 |
if (ldap_set_option(0, LDAP_OPT_X_TLS_REQUIRE_CERT, (void *) &tls)) |
|
|
720 |
ldaperr(0, "ldap_set_option(LDAP_OPT_X_TLS)"); |
721 |
if ( rc = ldap_initialize(&ld, server)) { |
719 |
if ( rc = ldap_initialize(&ld, server)) { |
722 |
fprintf(stderr, "ldap_initialize: %s\n", ldap_err2string(rc)); |
720 |
fprintf(stderr, "ldap_initialize: %s\n", ldap_err2string(rc)); |
723 |
exit(1); |
721 |
exit(1); |
724 |
} |
722 |
} |
|
|
723 |
if (LDAP_OPT_SUCCESS != ldap_set_option(ld, LDAP_OPT_X_TLS_REQUIRE_CERT, (void *) &tls)) |
724 |
ldaperr(ld, "ldap_set_option(LDAP_OPT_X_TLS)"); |
725 |
if (!profileonlyp) |
725 |
if (!profileonlyp) |
726 |
init_sasl_arguments(ld, bind_options); |
726 |
init_sasl_arguments(ld, bind_options); |
727 |
if (ldap_set_option(ld, LDAP_OPT_PROTOCOL_VERSION, &drei)) |
727 |
if (LDAP_OPT_SUCCESS != ldap_set_option(ld, LDAP_OPT_PROTOCOL_VERSION, &drei)) |
728 |
ldaperr(ld, "ldap_set_option(LDAP_OPT_PROTOCOL_VERSION)"); |
728 |
ldaperr(ld, "ldap_set_option(LDAP_OPT_PROTOCOL_VERSION)"); |
729 |
if (starttls) |
729 |
if (starttls) |
730 |
if (ldap_start_tls_s(ld, 0, 0)) |
730 |
if (LDAP_SUCCESS != ldap_start_tls_s(ld, 0, 0)) |
731 |
ldaperr(ld, "ldap_start_tls_s"); |
731 |
ldaperr(ld, "ldap_start_tls_s"); |
732 |
if (rebind(ld, bind_options, 1, dir, 0) == -1) { |
732 |
if (rebind(ld, bind_options, 1, dir, 0) == -1) { |
733 |
ldap_unbind_s(ld); |
733 |
ldap_unbind_s(ld); |
Lines 736-745
do_connect(char *server, bind_options *bind_options,
Link Here
|
736 |
/* after initial bind, always ask interactively (except in '!' rebinds, |
736 |
/* after initial bind, always ask interactively (except in '!' rebinds, |
737 |
* which are special-cased): */ |
737 |
* which are special-cased): */ |
738 |
bind_options->dialog = BD_ALWAYS; |
738 |
bind_options->dialog = BD_ALWAYS; |
739 |
if (ldap_set_option(ld, LDAP_OPT_REFERRALS, |
739 |
if (LDAP_OPT_SUCCESS != ldap_set_option(ld, LDAP_OPT_REFERRALS, |
740 |
referrals ? LDAP_OPT_ON : LDAP_OPT_OFF)) |
740 |
referrals ? LDAP_OPT_ON : LDAP_OPT_OFF)) |
741 |
ldaperr(ld, "ldap_set_option(LDAP_OPT_REFERRALS)"); |
741 |
ldaperr(ld, "ldap_set_option(LDAP_OPT_REFERRALS)"); |
742 |
if (ldap_set_option(ld, LDAP_OPT_DEREF, (void *) &deref)) |
742 |
if (LDAP_OPT_SUCCESS != ldap_set_option(ld, LDAP_OPT_DEREF, (void *) &deref)) |
743 |
ldaperr(ld, "ldap_set_option(LDAP_OPT_DEREF)"); |
743 |
ldaperr(ld, "ldap_set_option(LDAP_OPT_DEREF)"); |
744 |
|
744 |
|
745 |
return ld; |
745 |
return ld; |