LDAPS_OPEN

Opens a connection to an LDAP server

Syntax

CALL LDAPS_OPEN(lHandle, ldapServerName, port, base, bindDN, password, rc<, options> );

Required Arguments

lHandle
returns a connection handle that is used in subsequent CALL routines to access the LDAP server session.
Type:Numeric, Output
ldapServerName
identifies the LDAP server that is to be connected to. If blank, the value defaults to the host that issued the CALL routine. Otherwise, the value must be the DNS name or IP address of a host on which an LDAP server is running.
Type:Character, Input
port
specifies the TCP port of the LDAP server. If the value is zero, then the standard port of 389 is used.
Type:Numeric, Input
base
specifies a distinguished name that establishes the base object for the search. The base object is the point in the LDAP tree at which you want to start searching. If this value is blank, then the default value is the macro variable or environment variable LDAP_BASE.
Type:Character, Input
bindDN
specifies the distinguished name that is used to bind to the server. If this value is blank, then the macro variable or environment variable LDAP_BINDDN is used as the bind-distinguished name. If the value "" is specified and the LDAP_BINDDN variable has not been set, then an unauthenticated bind is performed.
Type:Character, Input
password
specifies the password that is associated with the bindDN value. If this value is blank, then the macro variable or environment variable LDAP_BINDPW is used as the bind-distinguished name. If the value "" is specified and the LDAP_BINDPW variable has not been set, then an unauthenticated bind is performed. Passwords that have been encoded by using the PWENCODE procedure can be used to bind to the server. For more information, see the PWENCODE Procedure in Base SAS Procedures Guide.
Type:Character, Input
rc
receives a return code that identifies success or failure.
Type:Numeric, Output

Optional Argument

options
specifies one or more session options to use with this bind. The following session options are valid:
OPT_REFERRALS_OFF instructs the server to not chase referrals. Specifying this option overrides the default value of OPT_REFERRALS_ON.
SUBTREE_SEARCH_SCOPE sets the scope of the search to include all subtrees. This is the default value.
BASE_SEARCH_SCOPE sets the scope of the search to include only the base. This value overrides the default value of SUBTREE_SEARCH_SCOPE.
ONELEVEL_SEARCH_SCOPE sets the scope of the search to include the base and one additional level. This value overrides the default value of SUBTREE_SEARCH_SCOPE.
Note that you can specify only one search scope option. If multiple search scope options are specified, then the one that appears last is used. If none of the search scope options are specified, then the default value of SUBTREE_SEARCH_SCOPE is used.
Type:Character, Input

Details

The options that are specified in the LDAPS_OPEN CALL routine include only those that must be specified when the server connection is first opened. Additional options can be specified after the connection is opened by using the LDAPS_SETOPTIONS CALL routine.
Note: The LDAP_TLSMODE environment variable enables the SAS LDAP interfaces to use an SSL-enabled port. In order to activate SSL mode, set LDAP_TLSMODE=1 at or prior to SAS session invocation.

Examples

Example 1

The following example opens a connection to an LDAP server by using an anonymous bind and default session options.
server="alpair01.unx.com";port=8010;
base="sasComponent=sasPublishSubscribe,cn=SAS,o=Alphalite Airways,c=US";
bindDN="";
Pw="";
call LDAPS_OPEN(lHandle, server, port, base, bindDN, Pw, rc);

Example 2

The following example opens a connection to an LDAP server, binds to the server, and passes in a session option of OPT_REFERRALS_OFF. This instructs the LDAP server not to chase referrals.
server = "alpair02.unx.com";
base = "o=Alphalite Airways,c=US";
bindDN ="cn=John Doe,o=Alphalite Airways,c=us";
bindPW ="myPass1";
option= "OPT_REFERRALS_OFF";
call LDAPS_OPEN(lHandle, server,8001,base,bindDN,bindPW,rc, option);