- /* look for the appropriate ctrl structure */
- for ( c = op->o_ctrls; c[0] != NULL; c++ ) {
- if ( strcmp( c[0]->ldctl_oid, LDAP_CONTROL_PAGEDRESULTS ) == 0 )
- {
- break;
- }
- }
-
- if ( c[0] == NULL ) {
- rs->sr_text = "missing pagedResults control";
- return LDAP_PROTOCOL_ERROR;
- }
-
- /* Tested by frontend */
- assert( c[0]->ldctl_value.bv_len > 0 );
-
- /* Parse the control value
- * realSearchControlValue ::= SEQUENCE {
- * size INTEGER (0..maxInt),
- * -- requested page size from client
- * -- result set size estimate from server
- * cookie OCTET STRING
- * }
- */
- ber = ber_init( &c[0]->ldctl_value );
- if ( ber == NULL ) {
- rs->sr_text = "internal error";
- return LDAP_OTHER;
- }
-
- tag = ber_scanf( ber, "{im}", &size, &cookie );
-
- /* Tested by frontend */
- assert( tag != LBER_ERROR );
- assert( size >= 0 );
-