From f3a509e5a745038a74c9bd9784e79837a21a03ff Mon Sep 17 00:00:00 2001 From: eknauel Date: Wed, 11 Feb 2004 16:16:03 +0000 Subject: [PATCH] * scheme/ldap.scm (ldap-init): make port optional argument, accept list of hosts as argument. (ldap-simple-bind-as-nobody): new function --- scheme/ldap.scm | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/scheme/ldap.scm b/scheme/ldap.scm index 7f29da5..76a929c 100644 --- a/scheme/ldap.scm +++ b/scheme/ldap.scm @@ -14,17 +14,21 @@ (host port) "scsh_ldap_init") -(define (ldap-init host-name port . args) +(define (ldap-init host-name-or-list . args) (let-optionals args - ((implicit-unbind-ok? #f) + ((port 0) ; use default port + (implicit-unbind-ok? #f) (unbind-automatically? #t)) - (let ((session (ldap-init-internal host-name port)) - (options (make-session-options implicit-unbind-ok? - unbind-automatically?))) - (add-finalizer! ldap-session-finalizer session) - (set-ldap-session-bound?! session #f) - (set-ldap-session-options! session options) - session))) + (let ((hosts (if (list? host-name-or-list) + (string-join host-name-or-list) + host-name-or-list))) + (let ((session (ldap-init-internal hosts port)) + (options (make-session-options implicit-unbind-ok? + unbind-automatically?))) + (add-finalizer! session ldap-session-finalizer) + (set-ldap-session-bound?! session #f) + (set-ldap-session-options! session options) + session)))) ;;; SIMPLE_BIND_S @@ -40,6 +44,9 @@ (set-ldap-session-bound?! session #t) (raise-ldap-condition ret-obj session)))) +(define (ldap-simple-bind-as-nobody session) + (ldap-simple-bind session #f #f)) + ;;; SASL_BIND_S (import-lambda-definition ldap-sasl-bind-internal