WebLdapControlGet Function

Action

Retrieves the control returned from the server after a WebLdapAdd, WebLdapCompare, WebLdapDelete, WebLdapModify, WebLdapRename, WebLdapSearch or WebLdapExtendedOperation function call. If the server has returned multiple controls, this function must be called repeatedly.

Include file

WebAPI.bdh

Syntax

WebLdapControlGet( in    hLdap       : number, 
                   out   sOid        : string, 
                   in    nOidLen     : number, 
                   out   sData       : string, 
                   inout nLength     : number,
                   out   bIsCritical : boolean): boolean;

Return value

  • true if successful

  • false otherwise

Parameter Description
hLdap Handle to a Web connection that was created with WebLdapConnect.
sOid The object identifier of the control.
nOidLen Specifies the maximal length of sOid.
sData The data associated with the control.
nLength Specifies the maximal length of sData. After the function call, this parameter contains the actual length.
bIsCritical Specifies whether the control is critical to the operation.

Example

const
  LDAP_SIZELIMIT := 100;
  LDAP_TIMELIMIT := 10000;
 
transaction TWebLdap 
  var
    hLdap, nDataLen : number;
    sOid, sData     : string;
    bIsCritic       : boolean;
  const 
    // this is a representation of a server-side sorting control 
    // which specifies that results shall be sorted by cn in 
    // ascending order
    cControlData:="\h300630040402636E"; 
  begin
    WebLdapConnect(hLdap, "standardhost", WEB_PORT_LDAP,
                   WEB_LDAP_FLAG_VERSION3);
    WebLdapBind(hLdap, "cn=adminname", "password");
    WebLdapControlAdd(hLdap,"1.2.840.113556.1.4.473", cControlData, 
                      sizeof(cControlData), true,
                      WEB_LDAP_SERVER_CONTROL); 

     if (not WebLdapSearch(hLdap, "o=MyCompany", NULL, "cn=*",
      LDAP_SIZELIMIT, LDAP_TIMELIMIT, 0)) then 
      write("LDAP Search failed"); writeln; 
    else
      TWebLdapPrintSearchResults(hLdap); 
        write("Search ok"); writeln; 
    end;

    nDataLen := 100; //returned sData size is max 100
    nLenOid := sizeof(sOid); 

    WebLdapControlGet(hLdap, sOid, nLenOid, sData, nDataLen, bIsCritic);
    write("result control - "); 
    write("oid:"); write(sOid); 
    write(", data:"); write(sData); 
    writeln;

     WebLdapDisconnect(hLdap); 
  end TWebLdap;