Exemplo n.º 1
0
INT CDECL ldap_parse_vlv_controlW( WLDAP32_LDAP *ld, PLDAPControlW *control,
    PULONG targetpos, PULONG listcount,
    struct WLDAP32_berval **context, PINT errcode )
{
    int ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
    LDAPControl **controlU = NULL;

    TRACE( "(%p, %p, %p, %p, %p, %p)\n", ld, control, targetpos,
           listcount, context, errcode );

    if (!ld) return ~0UL;

    if (control) {
        controlU = controlarrayWtoU( control );
        if (!controlU) return WLDAP32_LDAP_NO_MEMORY;
    }

    ret = ldap_parse_vlv_control( ld, controlU, targetpos, listcount,
                                  (struct berval **)context, errcode );

    controlarrayfreeU( controlU );

#endif
    return ret;
}
Exemplo n.º 2
0
/***********************************************************************
 *      ldap_parse_vlv_controlW     (WLDAP32.@)
 *
 * Parse a virtual list view control.
 *
 * PARAMS
 *  ld         [I] Pointer to an LDAP context.
 *  control    [I] Controls obtained from a result message.
 *  targetpos  [O] Position of the target in the result list.
 *  listcount  [O] Estimate of the number of results in the list.
 *  context    [O] Server side context.
 *  errcode    [O] Error code from the listview operation.
 *
 * RETURNS
 *  Success: LDAP_SUCCESS
 *  Failure: An LDAP error code.
 *
 * NOTES
 *  Free the server context with ber_bvfree.
 */
INT CDECL ldap_parse_vlv_controlW( WLDAP32_LDAP *ld, PLDAPControlW *control,
    PULONG targetpos, PULONG listcount,
    struct WLDAP32_berval **context, PINT errcode )
{
    int ret = WLDAP32_LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
    LDAPControl **controlU = NULL;
#ifdef HAVE_LDAP_PARSE_VLV_CONTROL
    unsigned long pos, count;
#elif defined(HAVE_LDAP_PARSE_VLVRESPONSE_CONTROL)
    ber_int_t pos, count;
    LDAPControl *vlvcontrol = NULL;
    unsigned int i;
#endif

    TRACE( "(%p, %p, %p, %p, %p, %p)\n", ld, control, targetpos,
           listcount, context, errcode );

    if (!ld || !control) return ~0u;

    controlU = controlarrayWtoU( control );
    if (!controlU) return WLDAP32_LDAP_NO_MEMORY;

#ifdef HAVE_LDAP_PARSE_VLV_CONTROL
    if (!(ret = ldap_parse_vlv_control( ld, controlU, &pos, &count,
                                        (struct berval **)context, errcode )))
    {
        *targetpos = pos;
        *listcount = count;
    }
#elif defined(HAVE_LDAP_PARSE_VLVRESPONSE_CONTROL)
    for (i = 0; controlU[i]; i++)
    {
        if (!strcmp( LDAP_CONTROL_VLVRESPONSE, controlU[i]->ldctl_oid ))
            vlvcontrol = controlU[i];
    }
    if (!vlvcontrol)
    {
        controlarrayfreeU( controlU );
        return WLDAP32_LDAP_CONTROL_NOT_FOUND;
    }
    if (!(ret = ldap_parse_vlvresponse_control( ld, vlvcontrol, &pos, &count,
                                                (struct berval **)context, errcode )))
    {
        *targetpos = pos;
        *listcount = count;
    }
#endif
    controlarrayfreeU( controlU );

#endif
    return map_error( ret );
}