wldap32: Always return WLDAP32 error values instead of redefining the ldap.h ones.
[wine] / dlls / wldap32 / search.c
1 /*
2  * WLDAP32 - LDAP support for Wine
3  *
4  * Copyright 2005 Hans Leidekker
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20
21 #include "config.h"
22
23 #include "wine/port.h"
24 #include "wine/debug.h"
25
26 #include <stdarg.h>
27
28 #include "windef.h"
29 #include "winbase.h"
30 #include "winnls.h"
31
32 #ifdef HAVE_LDAP_H
33 #include <ldap.h>
34 #endif
35
36 #include "winldap_private.h"
37 #include "wldap32.h"
38
39 WINE_DEFAULT_DEBUG_CHANNEL(wldap32);
40
41 /***********************************************************************
42  *      ldap_searchA     (WLDAP32.@)
43  *
44  * See ldap_searchW.
45  */
46 ULONG CDECL ldap_searchA( WLDAP32_LDAP *ld, PCHAR base, ULONG scope, PCHAR filter,
47     PCHAR attrs[], ULONG attrsonly )
48 {
49     ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
50 #ifdef HAVE_LDAP
51     WCHAR *baseW = NULL, *filterW = NULL, **attrsW = NULL;
52
53     ret = WLDAP32_LDAP_NO_MEMORY;
54
55     TRACE( "(%p, %s, 0x%08x, %s, %p, 0x%08x)\n", ld, debugstr_a(base),
56            scope, debugstr_a(filter), attrs, attrsonly );
57
58     if (!ld) return ~0UL;
59
60     if (base) {
61         baseW = strAtoW( base );
62         if (!baseW) goto exit;
63     }
64     if (filter) {
65         filterW = strAtoW( filter );
66         if (!filterW) goto exit;
67     }
68     if (attrs) {
69         attrsW = strarrayAtoW( attrs );
70         if (!attrsW) goto exit;
71     }
72
73     ret = ldap_searchW( ld, baseW, scope, filterW, attrsW, attrsonly );
74
75 exit:
76     strfreeW( baseW );
77     strfreeW( filterW );
78     strarrayfreeW( attrsW );
79
80 #endif
81     return ret;
82 }
83
84 /***********************************************************************
85  *      ldap_searchW     (WLDAP32.@)
86  *
87  * Search a directory tree (asynchronous operation).
88  *
89  * PARAMS
90  *  ld        [I] Pointer to an LDAP context.
91  *  base      [I] Starting point for the search.
92  *  scope     [I] Search scope. One of LDAP_SCOPE_BASE,
93  *                LDAP_SCOPE_ONELEVEL and LDAP_SCOPE_SUBTREE.
94  *  filter    [I] Search filter.
95  *  attrs     [I] Attributes to return.
96  *  attrsonly [I] Return no values, only attributes.
97  *
98  * RETURNS
99  *  Success: Message ID of the search operation.
100  *  Failure: ~0UL
101  *
102  * NOTES
103  *  Call ldap_result with the message ID to get the result of
104  *  the operation. Cancel the operation by calling ldap_abandon
105  *  with the message ID.
106  */
107 ULONG CDECL ldap_searchW( WLDAP32_LDAP *ld, PWCHAR base, ULONG scope, PWCHAR filter,
108     PWCHAR attrs[], ULONG attrsonly )
109 {
110     ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
111 #ifdef HAVE_LDAP
112     char *baseU = NULL, *filterU = NULL, **attrsU = NULL;
113     int msg;
114
115     ret = WLDAP32_LDAP_NO_MEMORY;
116
117     TRACE( "(%p, %s, 0x%08x, %s, %p, 0x%08x)\n", ld, debugstr_w(base),
118            scope, debugstr_w(filter), attrs, attrsonly );
119
120     if (!ld) return ~0UL;
121
122     if (base) {
123         baseU = strWtoU( base );
124         if (!baseU) goto exit;
125     }
126     if (filter) {
127         filterU = strWtoU( filter );
128         if (!filterU) goto exit;
129     }
130     if (attrs) {
131         attrsU = strarrayWtoU( attrs );
132         if (!attrsU) goto exit;
133     }
134
135     ret = ldap_search_ext( ld, baseU, scope, filterU, attrsU, attrsonly,
136                            NULL, NULL, NULL, 0, &msg );
137
138     if (ret == LDAP_SUCCESS)
139         ret = msg;
140     else
141         ret = ~0UL;
142
143 exit:
144     strfreeU( baseU );
145     strfreeU( filterU );
146     strarrayfreeU( attrsU );
147
148 #endif
149     return ret;
150 }
151
152 /***********************************************************************
153  *      ldap_search_extA     (WLDAP32.@)
154  *
155  * See ldap_search_extW.
156  */
157 ULONG CDECL ldap_search_extA( WLDAP32_LDAP *ld, PCHAR base, ULONG scope,
158     PCHAR filter, PCHAR attrs[], ULONG attrsonly, PLDAPControlA *serverctrls,
159     PLDAPControlA *clientctrls, ULONG timelimit, ULONG sizelimit, ULONG *message )
160 {
161     ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
162 #ifdef HAVE_LDAP
163     WCHAR *baseW = NULL, *filterW = NULL, **attrsW = NULL;
164     LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL;
165
166     ret = WLDAP32_LDAP_NO_MEMORY;
167
168     TRACE( "(%p, %s, 0x%08x, %s, %p, 0x%08x, %p, %p, 0x%08x, 0x%08x, %p)\n",
169            ld, debugstr_a(base), scope, debugstr_a(filter), attrs, attrsonly,
170            serverctrls, clientctrls, timelimit, sizelimit, message );
171
172     if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
173
174     if (base) {
175         baseW = strAtoW( base );
176         if (!baseW) goto exit;
177     }
178     if (filter)
179     {
180         filterW = strAtoW( filter );
181         if (!filterW) goto exit;
182     }
183     if (attrs) {
184         attrsW = strarrayAtoW( attrs );
185         if (!attrsW) goto exit;
186     }
187     if (serverctrls) {
188         serverctrlsW = controlarrayAtoW( serverctrls );
189         if (!serverctrlsW) goto exit;
190     }
191     if (clientctrls) {
192         clientctrlsW = controlarrayAtoW( clientctrls );
193         if (!clientctrlsW) goto exit;
194     }
195
196     ret = ldap_search_extW( ld, baseW, scope, filterW, attrsW, attrsonly,
197                             serverctrlsW, clientctrlsW, timelimit, sizelimit, message );
198
199 exit:
200     strfreeW( baseW );
201     strfreeW( filterW );
202     strarrayfreeW( attrsW );
203     controlarrayfreeW( serverctrlsW );
204     controlarrayfreeW( clientctrlsW );
205
206 #endif
207     return ret;
208 }
209
210 /***********************************************************************
211  *      ldap_search_extW     (WLDAP32.@)
212  *
213  * Search a directory tree (asynchronous operation).
214  *
215  * PARAMS
216  *  ld          [I] Pointer to an LDAP context.
217  *  base        [I] Starting point for the search.
218  *  scope       [I] Search scope. One of LDAP_SCOPE_BASE,
219  *                  LDAP_SCOPE_ONELEVEL and LDAP_SCOPE_SUBTREE.
220  *  filter      [I] Search filter.
221  *  attrs       [I] Attributes to return.
222  *  attrsonly   [I] Return no values, only attributes.
223  *  serverctrls [I] Array of LDAP server controls.
224  *  clientctrls [I] Array of LDAP client controls.
225  *  timelimit   [I] Timeout in seconds.
226  *  sizelimit   [I] Maximum number of entries to return. Zero means unlimited.
227  *  message     [O] Message ID of the search operation.
228  *
229  * RETURNS
230  *  Success: LDAP_SUCCESS
231  *  Failure: An LDAP error code.
232  *
233  * NOTES
234  *  Call ldap_result with the message ID to get the result of
235  *  the operation. Cancel the operation by calling ldap_abandon
236  *  with the message ID.
237  */
238 ULONG CDECL ldap_search_extW( WLDAP32_LDAP *ld, PWCHAR base, ULONG scope,
239     PWCHAR filter, PWCHAR attrs[], ULONG attrsonly, PLDAPControlW *serverctrls,
240     PLDAPControlW *clientctrls, ULONG timelimit, ULONG sizelimit, ULONG *message )
241 {
242     ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
243 #ifdef HAVE_LDAP
244     char *baseU = NULL, *filterU = NULL, **attrsU = NULL;
245     LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL;
246     struct timeval tv;
247
248     ret = WLDAP32_LDAP_NO_MEMORY;
249
250     TRACE( "(%p, %s, 0x%08x, %s, %p, 0x%08x, %p, %p, 0x%08x, 0x%08x, %p)\n",
251            ld, debugstr_w(base), scope, debugstr_w(filter), attrs, attrsonly,
252            serverctrls, clientctrls, timelimit, sizelimit, message );
253
254     if (!ld) return ~0UL;
255
256     if (base) {
257         baseU = strWtoU( base );
258         if (!baseU) goto exit;
259     }
260     if (filter) {
261         filterU = strWtoU( filter );
262         if (!filterU) goto exit;
263     }
264     if (attrs) {
265         attrsU = strarrayWtoU( attrs );
266         if (!attrsU) goto exit;
267     }
268     if (serverctrls) {
269         serverctrlsU = controlarrayWtoU( serverctrls );
270         if (!serverctrlsU) goto exit;
271     }
272     if (clientctrls) {
273         clientctrlsU = controlarrayWtoU( clientctrls );
274         if (!clientctrlsU) goto exit;
275     }
276
277     tv.tv_sec = timelimit;
278     tv.tv_usec = 0;
279
280     ret = ldap_search_ext( ld, baseU, scope, filterU, attrsU, attrsonly,
281                            serverctrlsU, clientctrlsU, &tv, sizelimit, (int *)message );
282
283 exit:
284     strfreeU( baseU );
285     strfreeU( filterU );
286     strarrayfreeU( attrsU );
287     controlarrayfreeU( serverctrlsU );
288     controlarrayfreeU( clientctrlsU );
289
290 #endif
291     return ret;
292 }
293
294 /***********************************************************************
295  *      ldap_search_ext_sA     (WLDAP32.@)
296  *
297  * See ldap_search_ext_sW.
298  */
299 ULONG CDECL ldap_search_ext_sA( WLDAP32_LDAP *ld, PCHAR base, ULONG scope,
300     PCHAR filter, PCHAR attrs[], ULONG attrsonly, PLDAPControlA *serverctrls,
301     PLDAPControlA *clientctrls, struct l_timeval* timeout, ULONG sizelimit, WLDAP32_LDAPMessage **res )
302 {
303     ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
304 #ifdef HAVE_LDAP
305     WCHAR *baseW = NULL, *filterW = NULL, **attrsW = NULL;
306     LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL;
307
308     ret = WLDAP32_LDAP_NO_MEMORY;
309
310     TRACE( "(%p, %s, 0x%08x, %s, %p, 0x%08x, %p, %p, %p, 0x%08x, %p)\n",
311            ld, debugstr_a(base), scope, debugstr_a(filter), attrs, attrsonly,
312            serverctrls, clientctrls, timeout, sizelimit, res );
313
314     if (!ld || !res) return WLDAP32_LDAP_PARAM_ERROR;
315
316     if (base) {
317         baseW = strAtoW( base );
318         if (!baseW) goto exit;
319     }
320     if (filter) {
321         filterW = strAtoW( filter );
322         if (!filterW) goto exit;
323     }
324     if (attrs) {
325         attrsW = strarrayAtoW( attrs );
326         if (!attrsW) goto exit;
327     }
328     if (serverctrls) {
329         serverctrlsW = controlarrayAtoW( serverctrls );
330         if (!serverctrlsW) goto exit;
331     }
332     if (clientctrls) {
333         clientctrlsW = controlarrayAtoW( clientctrls );
334         if (!clientctrlsW) goto exit;
335     }
336
337     ret = ldap_search_ext_sW( ld, baseW, scope, filterW, attrsW, attrsonly,
338                               serverctrlsW, clientctrlsW, timeout, sizelimit, res );
339
340 exit:
341     strfreeW( baseW );
342     strfreeW( filterW );
343     strarrayfreeW( attrsW );
344     controlarrayfreeW( serverctrlsW );
345     controlarrayfreeW( clientctrlsW );
346
347 #endif
348     return ret;
349 }
350
351 /***********************************************************************
352  *      ldap_search_ext_sW     (WLDAP32.@)
353  *
354  * Search a directory tree (synchronous operation).
355  *
356  * PARAMS
357  *  ld          [I] Pointer to an LDAP context.
358  *  base        [I] Starting point for the search.
359  *  scope       [I] Search scope. One of LDAP_SCOPE_BASE,
360  *                  LDAP_SCOPE_ONELEVEL and LDAP_SCOPE_SUBTREE.
361  *  filter      [I] Search filter.
362  *  attrs       [I] Attributes to return.
363  *  attrsonly   [I] Return no values, only attributes.
364  *  serverctrls [I] Array of LDAP server controls.
365  *  clientctrls [I] Array of LDAP client controls.
366  *  timeout     [I] Timeout in seconds.
367  *  sizelimit   [I] Maximum number of entries to return. Zero means unlimited.
368  *  res         [O] Results of the search operation.
369  *
370  * RETURNS
371  *  Success: LDAP_SUCCESS
372  *  Failure: An LDAP error code.
373  *
374  * NOTES
375  *  Call ldap_msgfree to free the results.
376  */
377 ULONG CDECL ldap_search_ext_sW( WLDAP32_LDAP *ld, PWCHAR base, ULONG scope,
378     PWCHAR filter, PWCHAR attrs[], ULONG attrsonly, PLDAPControlW *serverctrls,
379     PLDAPControlW *clientctrls, struct l_timeval* timeout, ULONG sizelimit, WLDAP32_LDAPMessage **res )
380 {
381     ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
382 #ifdef HAVE_LDAP
383     char *baseU = NULL, *filterU = NULL, **attrsU = NULL;
384     LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL;
385
386     ret = WLDAP32_LDAP_NO_MEMORY;
387
388     TRACE( "(%p, %s, 0x%08x, %s, %p, 0x%08x, %p, %p, %p, 0x%08x, %p)\n",
389            ld, debugstr_w(base), scope, debugstr_w(filter), attrs, attrsonly,
390            serverctrls, clientctrls, timeout, sizelimit, res );
391
392     if (!ld || !res) return WLDAP32_LDAP_PARAM_ERROR;
393
394     if (base) {
395         baseU = strWtoU( base );
396         if (!baseU) goto exit;
397     }
398     if (filter) {
399         filterU = strWtoU( filter );
400         if (!filterU) goto exit;
401     }
402     if (attrs) {
403         attrsU = strarrayWtoU( attrs );
404         if (!attrsU) goto exit;
405     }
406     if (serverctrls) {
407         serverctrlsU = controlarrayWtoU( serverctrls );
408         if (!serverctrlsU) goto exit;
409     }
410     if (clientctrls) {
411         clientctrlsU = controlarrayWtoU( clientctrls );
412         if (!clientctrlsU) goto exit;
413     }
414
415     ret = ldap_search_ext_s( ld, baseU, scope, filterU, attrsU, attrsonly,
416                              serverctrlsU, clientctrlsU, (struct timeval *)timeout, sizelimit, res );
417
418 exit:
419     strfreeU( baseU );
420     strfreeU( filterU );
421     strarrayfreeU( attrsU );
422     controlarrayfreeU( serverctrlsU );
423     controlarrayfreeU( clientctrlsU );
424
425 #endif
426     return ret;
427 }
428
429 /***********************************************************************
430  *      ldap_search_sA     (WLDAP32.@)
431  *
432  * See ldap_search_sW.
433  */
434 ULONG CDECL ldap_search_sA( WLDAP32_LDAP *ld, PCHAR base, ULONG scope, PCHAR filter,
435     PCHAR attrs[], ULONG attrsonly, WLDAP32_LDAPMessage **res )
436 {
437     ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
438 #ifdef HAVE_LDAP
439     WCHAR *baseW = NULL, *filterW = NULL, **attrsW = NULL;
440
441     ret = WLDAP32_LDAP_NO_MEMORY;
442
443     TRACE( "(%p, %s, 0x%08x, %s, %p, 0x%08x, %p)\n", ld, debugstr_a(base),
444            scope, debugstr_a(filter), attrs, attrsonly, res );
445
446     if (!ld || !res) return WLDAP32_LDAP_PARAM_ERROR;
447
448     if (base) {
449         baseW = strAtoW( base );
450         if (!baseW) goto exit;
451     }
452     if (filter) {
453         filterW = strAtoW( filter );
454         if (!filterW) goto exit;
455     }
456     if (attrs) {
457         attrsW = strarrayAtoW( attrs );
458         if (!attrsW) goto exit;
459     }
460
461     ret = ldap_search_sW( ld, baseW, scope, filterW, attrsW, attrsonly, res );
462
463 exit:
464     strfreeW( baseW );
465     strfreeW( filterW );
466     strarrayfreeW( attrsW );
467
468 #endif
469     return ret;
470 }
471
472 /***********************************************************************
473  *      ldap_search_sW     (WLDAP32.@)
474  *
475  * Search a directory tree (synchronous operation).
476  *
477  * PARAMS
478  *  ld        [I] Pointer to an LDAP context.
479  *  base      [I] Starting point for the search.
480  *  scope     [I] Search scope. One of LDAP_SCOPE_BASE,
481  *                LDAP_SCOPE_ONELEVEL and LDAP_SCOPE_SUBTREE.
482  *  filter    [I] Search filter.
483  *  attrs     [I] Attributes to return.
484  *  attrsonly [I] Return no values, only attributes.
485  *  res       [O] Results of the search operation.
486  *
487  * RETURNS
488  *  Success: LDAP_SUCCESS
489  *  Failure: An LDAP error code.
490  *
491  * NOTES
492  *  Call ldap_msgfree to free the results.
493  */
494 ULONG CDECL ldap_search_sW( WLDAP32_LDAP *ld, PWCHAR base, ULONG scope, PWCHAR filter,
495     PWCHAR attrs[], ULONG attrsonly, WLDAP32_LDAPMessage **res )
496 {
497     ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
498 #ifdef HAVE_LDAP
499     char *baseU = NULL, *filterU = NULL, **attrsU = NULL;
500
501     ret = WLDAP32_LDAP_NO_MEMORY;
502
503     TRACE( "(%p, %s, 0x%08x, %s, %p, 0x%08x, %p)\n", ld, debugstr_w(base),
504            scope, debugstr_w(filter), attrs, attrsonly, res );
505
506     if (!ld || !res) return WLDAP32_LDAP_PARAM_ERROR;
507
508     if (base) {
509         baseU = strWtoU( base );
510         if (!baseU) goto exit;
511     }
512     if (filter) {
513         filterU = strWtoU( filter );
514         if (!filterU) goto exit;
515     }
516     if (attrs) {
517         attrsU = strarrayWtoU( attrs );
518         if (!attrsU) goto exit;
519     }
520
521     ret = ldap_search_ext_s( ld, baseU, scope, filterU, attrsU, attrsonly,
522                              NULL, NULL, NULL, 0, res );
523
524 exit:
525     strfreeU( baseU );
526     strfreeU( filterU );
527     strarrayfreeU( attrsU );
528
529 #endif
530     return ret;
531 }
532
533 /***********************************************************************
534  *      ldap_search_stA     (WLDAP32.@)
535  *
536  * See ldap_search_stW.
537  */
538 ULONG CDECL ldap_search_stA( WLDAP32_LDAP *ld, const PCHAR base, ULONG scope,
539     const PCHAR filter, PCHAR attrs[], ULONG attrsonly,
540     struct l_timeval *timeout, WLDAP32_LDAPMessage **res )
541 {
542     ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
543 #ifdef HAVE_LDAP
544     WCHAR *baseW = NULL, *filterW = NULL, **attrsW = NULL;
545
546     ret = WLDAP32_LDAP_NO_MEMORY;
547
548     TRACE( "(%p, %s, 0x%08x, %s, %p, 0x%08x, %p, %p)\n", ld,
549            debugstr_a(base), scope, debugstr_a(filter), attrs,
550            attrsonly, timeout, res );
551
552     if (!ld || !res) return WLDAP32_LDAP_PARAM_ERROR;
553
554     if (base) {
555         baseW = strAtoW( base );
556         if (!baseW) goto exit;
557     }
558     if (filter) {
559         filterW = strAtoW( filter );
560         if (!filterW) goto exit;
561     }
562     if (attrs) {
563         attrsW = strarrayAtoW( attrs );
564         if (!attrsW) goto exit;
565     }
566
567     ret = ldap_search_stW( ld, baseW, scope, filterW, attrsW, attrsonly,
568                            timeout, res );
569
570 exit:
571     strfreeW( baseW );
572     strfreeW( filterW );
573     strarrayfreeW( attrsW );
574
575 #endif
576     return ret;
577 }
578
579 /***********************************************************************
580  *      ldap_search_stW     (WLDAP32.@)
581  *
582  * Search a directory tree (synchronous operation).
583  *
584  * PARAMS
585  *  ld        [I] Pointer to an LDAP context.
586  *  base      [I] Starting point for the search.
587  *  scope     [I] Search scope. One of LDAP_SCOPE_BASE,
588  *                LDAP_SCOPE_ONELEVEL and LDAP_SCOPE_SUBTREE.
589  *  filter    [I] Search filter.
590  *  attrs     [I] Attributes to return.
591  *  attrsonly [I] Return no values, only attributes.
592  *  timeout   [I] Timeout in seconds.
593  *  res       [O] Results of the search operation.
594  *
595  * RETURNS
596  *  Success: LDAP_SUCCESS
597  *  Failure: An LDAP error code.
598  *
599  * NOTES
600  *  Call ldap_msgfree to free the results.
601  */
602 ULONG CDECL ldap_search_stW( WLDAP32_LDAP *ld, const PWCHAR base, ULONG scope,
603     const PWCHAR filter, PWCHAR attrs[], ULONG attrsonly,
604     struct l_timeval *timeout, WLDAP32_LDAPMessage **res )
605 {
606     ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
607 #ifdef HAVE_LDAP
608     char *baseU = NULL, *filterU = NULL, **attrsU = NULL;
609
610     ret = WLDAP32_LDAP_NO_MEMORY;
611
612     TRACE( "(%p, %s, 0x%08x, %s, %p, 0x%08x, %p, %p)\n", ld,
613            debugstr_w(base), scope, debugstr_w(filter), attrs,
614            attrsonly, timeout, res );
615
616     if (!ld || !res) return WLDAP32_LDAP_PARAM_ERROR;
617
618     if (base) {
619         baseU = strWtoU( base );
620         if (!baseU) goto exit;
621     }
622     if (filter) {
623         filterU = strWtoU( filter );
624         if (!filterU) goto exit;
625     }
626     if (attrs) {
627         attrsU = strarrayWtoU( attrs );
628         if (!attrsU) goto exit;
629     }
630
631     ret = ldap_search_ext_s( ld, baseU, scope, filterU, attrsU, attrsonly,
632                              NULL, NULL, (struct timeval *)timeout, 0, res );
633
634 exit:
635     strfreeU( baseU );
636     strfreeU( filterU );
637     strarrayfreeU( attrsU );
638
639 #endif
640     return ret;
641 }