共用方式為


LDAP_SERVER_QUOTA_CONTROL_OID control code

The LDAP_SERVER_QUOTA_CONTROL_OID control is used to pass the SID of a security principal, whose quota is being queried, to the server in a LDAP search operation. The LDAP search operation queries the constructed attributes ms-DS-Quota-Effective and ms-DS-Quota-Used specified below. The SID is passed as the "value" of the control as a binary value. The absence of this control in a search means that the SID of the user performing the search operation is to be used; that is, self-quota is queried.

PWCHAR ldctl_oid = LDAP_SERVER_QUOTA_CONTROL_OID;
struct berval ldctl_value;
BOOLEAN ldctl_iscritical;

Members

ldctl_oid

LDAP_SERVER_QUOTA_CONTROL_OID, which is defined as "1.2.840.113556.1.4.1852".

ldctl_value

Specifies a querySID OCTET string whose value is a BER-encoded sequence of parameters that specify the SID of the security principal whose quota is to be queried. In the berval structure, set bv_val to a pointer to the sequence that contains the SID of a security principal, and set bv_len to the length of the sequence. For more information, see the Remarks section.

ldctl_iscritical

Can be TRUE or FALSE depending on whether the SID results is critical to the application.

Remarks

If the value of the ldctl_value sequence argument is required to be created manually, the sequence data is formatted as follows:

Sequence {
  querySID     OCTET STRING
}

The following table lists the sequence fields.

Sequence data Description
querySID
An Octet String that specifies the SID of the security principal whose quota is to be queried.

The following code example shows how to manually format the sequence data for the first call to an extended LDAP search function.

LDAPControl lControl;
BerElement *pber = NULL;
PBERVAL pldctrl_value = NULL;
int success = -1;

// Format and encode the SEQUENCE data in a BerElement.
pber = ber_alloc_t(LBER_USE_DER);
if(pber==NULL) return BER_ALLOC_FAILURE_CODE;
ber_printf(pber,"{o}",NULL,0);

// Transfer the encoded data into a BERVAL.
success = ber_flatten(pber,&pldctrl_value);
if(success == 0)
    ber_free(pber,1);
else
{
    printf("ber_flatten failed");
    // Call an error routine.
}

// Copy the BERVAL data to the LDAPControl structure.
lControl.ldctl_oid = LDAP_SERVER_QUOTA_CONTROL_OID;
lControl.ldctl_iscritical = TRUE;
lControl.ldctl_value.bv_val = new char[pldctrl_value->bv_len];
memcpy(lControl.ldctl_value.bv_val, 
       pldctrl_value->bv_val, pldctrl_value->bv_len);
lControl.ldctl_value.bv_len = pldctrl_value->bv_len;

// Cleanup temporary berval.
ber_bvfree(pldctrl_value);

// The LDAPControl data is ready for use in ldap_search_ext()
// or another call.

Requirements

Minimum supported client
Windows Vista
Minimum supported server
Windows Server 2008
Header
Ntldap.h

See also

Data Structures

LDAPSearch

Using Controls