2 * WLDAP32 - LDAP support for Wine
4 * Copyright 2005 Hans Leidekker
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.
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.
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
27 typedef struct ldapsearch
34 LDAPControlW
**serverctrls
;
35 LDAPControlW
**clientctrls
;
36 struct l_timeval timeout
;
38 struct berval
*cookie
;
41 #define CTX(ld) (*(void **)ld->Reserved3)
42 #define SERVER_CTRLS(ld) (*(void **)(ld->Reserved3 + sizeof(void *)))
43 #define MSG(entry) (entry->Request)
44 #define BER(ber) (ber->opaque)
46 ULONG
map_error( int ) DECLSPEC_HIDDEN
;
48 static inline char *strdupU( const char *src
)
51 if (!src
) return NULL
;
52 if ((dst
= malloc( strlen( src
) + 1 ))) strcpy( dst
, src
);
56 static inline WCHAR
*strdupW( const WCHAR
*src
)
59 if (!src
) return NULL
;
60 if ((dst
= malloc( (lstrlenW( src
) + 1) * sizeof(WCHAR
) ))) lstrcpyW( dst
, src
);
64 static inline char *strWtoU( const WCHAR
*str
)
69 int len
= WideCharToMultiByte( CP_UTF8
, 0, str
, -1, NULL
, 0, NULL
, NULL
);
70 if ((ret
= malloc( len
))) WideCharToMultiByte( CP_UTF8
, 0, str
, -1, ret
, len
, NULL
, NULL
);
75 static inline char *strnWtoU( const WCHAR
*str
, DWORD in_len
, DWORD
*out_len
)
81 DWORD len
= WideCharToMultiByte( CP_UTF8
, 0, str
, in_len
, NULL
, 0, NULL
, NULL
);
82 if ((ret
= malloc( len
+ 1 )))
84 WideCharToMultiByte( CP_UTF8
, 0, str
, in_len
, ret
, len
, NULL
, NULL
);
92 static inline WCHAR
*strAtoW( const char *str
)
97 DWORD len
= MultiByteToWideChar( CP_ACP
, 0, str
, -1, NULL
, 0 );
98 if ((ret
= malloc( len
* sizeof(WCHAR
) ))) MultiByteToWideChar( CP_ACP
, 0, str
, -1, ret
, len
);
103 static inline WCHAR
*strnAtoW( const char *str
, DWORD in_len
, DWORD
*out_len
)
109 DWORD len
= MultiByteToWideChar( CP_ACP
, 0, str
, in_len
, NULL
, 0 );
110 if ((ret
= malloc( (len
+ 1) * sizeof(WCHAR
) )))
112 MultiByteToWideChar( CP_ACP
, 0, str
, in_len
, ret
, len
);
120 static inline DWORD
bvarraylenW( struct berval
**bv
)
122 struct berval
**p
= bv
;
127 static inline DWORD
strarraylenW( WCHAR
**strarray
)
129 WCHAR
**p
= strarray
;
134 static inline char **strarrayWtoU( WCHAR
**strarray
)
136 char **strarrayU
= NULL
;
141 size
= sizeof(char *) * (strarraylenW( strarray
) + 1);
142 if ((strarrayU
= malloc( size
)))
144 WCHAR
**p
= strarray
;
145 char **q
= strarrayU
;
147 while (*p
) *q
++ = strWtoU( *p
++ );
154 static inline WCHAR
**strarraydupW( WCHAR
**strarray
)
156 WCHAR
**strarrayW
= NULL
;
161 size
= sizeof(WCHAR
*) * (strarraylenW( strarray
) + 1);
162 if ((strarrayW
= malloc( size
)))
164 WCHAR
**p
= strarray
;
165 WCHAR
**q
= strarrayW
;
167 while (*p
) *q
++ = strdupW( *p
++ );
174 static inline char *strWtoA( const WCHAR
*str
)
179 DWORD len
= WideCharToMultiByte( CP_ACP
, 0, str
, -1, NULL
, 0, NULL
, NULL
);
180 if ((ret
= malloc( len
))) WideCharToMultiByte( CP_ACP
, 0, str
, -1, ret
, len
, NULL
, NULL
);
185 static inline char **strarrayWtoA( WCHAR
**strarray
)
187 char **strarrayA
= NULL
;
192 size
= sizeof(char *) * (strarraylenW( strarray
) + 1);
193 if ((strarrayA
= malloc( size
)))
195 WCHAR
**p
= strarray
;
196 char **q
= strarrayA
;
198 while (*p
) *q
++ = strWtoA( *p
++ );
205 static inline DWORD
modarraylenW( LDAPModW
**modarray
)
207 LDAPModW
**p
= modarray
;
212 static inline struct bervalU
*bervalWtoU( const struct berval
*bv
)
214 struct bervalU
*berval
;
215 DWORD size
= sizeof(*berval
) + bv
->bv_len
;
217 if ((berval
= malloc( size
)))
219 char *val
= (char *)(berval
+ 1);
221 berval
->bv_len
= bv
->bv_len
;
222 berval
->bv_val
= val
;
223 memcpy( val
, bv
->bv_val
, bv
->bv_len
);
228 static inline DWORD
bvarraylenU( struct bervalU
**bv
)
230 struct bervalU
**p
= bv
;
235 static inline struct berval
*bervalUtoW( const struct bervalU
*bv
)
237 struct berval
*berval
;
238 DWORD size
= sizeof(*berval
) + bv
->bv_len
;
240 assert( bv
->bv_len
<= ~0u );
242 if ((berval
= malloc( size
)))
244 char *val
= (char *)(berval
+ 1);
246 berval
->bv_len
= bv
->bv_len
;
247 berval
->bv_val
= val
;
248 memcpy( val
, bv
->bv_val
, bv
->bv_len
);
253 static inline struct berval
**bvarrayUtoW( struct bervalU
**bv
)
255 struct berval
**berval
= NULL
;
260 size
= sizeof(*berval
) * (bvarraylenU( bv
) + 1);
261 if ((berval
= malloc( size
)))
263 struct bervalU
**p
= bv
;
264 struct berval
**q
= berval
;
266 while (*p
) *q
++ = bervalUtoW( *p
++ );
273 static inline void bvfreeU( struct bervalU
*berval
)
278 static inline struct bervalU
**bvarrayWtoU( struct berval
**bv
)
280 struct bervalU
**berval
= NULL
;
285 size
= sizeof(*berval
) * (bvarraylenW( bv
) + 1);
286 if ((berval
= malloc( size
)))
288 struct berval
**p
= bv
;
289 struct bervalU
**q
= berval
;
291 while (*p
) *q
++ = bervalWtoU( *p
++ );
298 static inline LDAPModU
*modWtoU( const LDAPModW
*mod
)
302 if ((modU
= malloc( sizeof(*modU
) )))
304 modU
->mod_op
= mod
->mod_op
;
305 modU
->mod_type
= strWtoU( mod
->mod_type
);
307 if (mod
->mod_op
& LDAP_MOD_BVALUES
)
308 modU
->mod_vals
.modv_bvals
= bvarrayWtoU( mod
->mod_vals
.modv_bvals
);
310 modU
->mod_vals
.modv_strvals
= strarrayWtoU( mod
->mod_vals
.modv_strvals
);
315 static inline LDAPModU
**modarrayWtoU( LDAPModW
**modarray
)
317 LDAPModU
**modarrayU
= NULL
;
322 size
= sizeof(LDAPModU
*) * (modarraylenW( modarray
) + 1);
323 if ((modarrayU
= malloc( size
)))
325 LDAPModW
**p
= modarray
;
326 LDAPModU
**q
= modarrayU
;
328 while (*p
) *q
++ = modWtoU( *p
++ );
335 static inline void bvarrayfreeU( struct bervalU
**bv
)
337 struct bervalU
**p
= bv
;
338 while (*p
) free( *p
++ );
342 static inline void strarrayfreeU( char **strarray
)
347 while (*p
) free( *p
++ );
352 static inline void modfreeU( LDAPModU
*mod
)
354 if (mod
->mod_op
& LDAP_MOD_BVALUES
)
355 bvarrayfreeU( mod
->mod_vals
.modv_bvals
);
357 strarrayfreeU( mod
->mod_vals
.modv_strvals
);
361 static inline void modarrayfreeU( LDAPModU
**modarray
)
365 LDAPModU
**p
= modarray
;
366 while (*p
) modfreeU( *p
++ );
371 static inline DWORD
modarraylenA( LDAPModA
**modarray
)
373 LDAPModA
**p
= modarray
;
378 static inline struct berval
*bervalWtoW( const struct berval
*bv
)
380 struct berval
*berval
;
381 DWORD size
= sizeof(*berval
) + bv
->bv_len
;
383 if ((berval
= malloc( size
)))
385 char *val
= (char *)(berval
+ 1);
387 berval
->bv_len
= bv
->bv_len
;
388 berval
->bv_val
= val
;
389 memcpy( val
, bv
->bv_val
, bv
->bv_len
);
394 static inline struct berval
**bvarrayWtoW( struct berval
**bv
)
396 struct berval
**berval
= NULL
;
401 size
= sizeof(*berval
) * (bvarraylenW( bv
) + 1);
402 if ((berval
= malloc( size
)))
404 struct berval
**p
= bv
;
405 struct berval
**q
= berval
;
407 while (*p
) *q
++ = bervalWtoW( *p
++ );
414 static inline DWORD
strarraylenA( char **strarray
)
421 static inline WCHAR
**strarrayAtoW( char **strarray
)
423 WCHAR
**strarrayW
= NULL
;
428 size
= sizeof(WCHAR
*) * (strarraylenA( strarray
) + 1);
429 if ((strarrayW
= malloc( size
)))
432 WCHAR
**q
= strarrayW
;
434 while (*p
) *q
++ = strAtoW( *p
++ );
441 static inline LDAPModW
*modAtoW( const LDAPModA
*mod
)
445 if ((modW
= malloc( sizeof(*modW
) )))
447 modW
->mod_op
= mod
->mod_op
;
448 modW
->mod_type
= strAtoW( mod
->mod_type
);
450 if (mod
->mod_op
& LDAP_MOD_BVALUES
)
451 modW
->mod_vals
.modv_bvals
= bvarrayWtoW( mod
->mod_vals
.modv_bvals
);
453 modW
->mod_vals
.modv_strvals
= strarrayAtoW( mod
->mod_vals
.modv_strvals
);
458 static inline LDAPModW
**modarrayAtoW( LDAPModA
**modarray
)
460 LDAPModW
**modarrayW
= NULL
;
465 size
= sizeof(LDAPModW
*) * (modarraylenA( modarray
) + 1);
466 if ((modarrayW
= malloc( size
)))
468 LDAPModA
**p
= modarray
;
469 LDAPModW
**q
= modarrayW
;
471 while (*p
) *q
++ = modAtoW( *p
++ );
478 static inline void bvarrayfreeW( struct berval
**bv
)
480 struct berval
**p
= bv
;
481 while (*p
) free( *p
++ );
485 static inline void strarrayfreeW( WCHAR
**strarray
)
489 WCHAR
**p
= strarray
;
490 while (*p
) free( *p
++ );
495 static inline void modfreeW( LDAPModW
*mod
)
497 if (mod
->mod_op
& LDAP_MOD_BVALUES
)
498 bvarrayfreeW( mod
->mod_vals
.modv_bvals
);
500 strarrayfreeW( mod
->mod_vals
.modv_strvals
);
504 static inline void modarrayfreeW( LDAPModW
**modarray
)
508 LDAPModW
**p
= modarray
;
509 while (*p
) modfreeW( *p
++ );
514 static inline DWORD
controlarraylenA( LDAPControlA
**controlarray
)
516 LDAPControlA
**p
= controlarray
;
518 return p
- controlarray
;
521 static inline LDAPControlW
*controlAtoW( const LDAPControlA
*control
)
523 LDAPControlW
*controlW
;
524 DWORD len
= control
->ldctl_value
.bv_len
;
527 if (control
->ldctl_value
.bv_val
)
529 if (!(val
= malloc( len
))) return NULL
;
530 memcpy( val
, control
->ldctl_value
.bv_val
, len
);
533 if (!(controlW
= malloc( sizeof(*controlW
) )))
539 controlW
->ldctl_oid
= strAtoW( control
->ldctl_oid
);
540 controlW
->ldctl_value
.bv_len
= len
;
541 controlW
->ldctl_value
.bv_val
= val
;
542 controlW
->ldctl_iscritical
= control
->ldctl_iscritical
;
547 static inline LDAPControlW
**controlarrayAtoW( LDAPControlA
**controlarray
)
549 LDAPControlW
**controlarrayW
= NULL
;
554 size
= sizeof(LDAPControlW
*) * (controlarraylenA( controlarray
) + 1);
555 if ((controlarrayW
= malloc( size
)))
557 LDAPControlA
**p
= controlarray
;
558 LDAPControlW
**q
= controlarrayW
;
560 while (*p
) *q
++ = controlAtoW( *p
++ );
564 return controlarrayW
;
567 static inline void controlfreeW( LDAPControlW
*control
)
571 free( control
->ldctl_oid
);
572 free( control
->ldctl_value
.bv_val
);
577 static inline void controlarrayfreeW( LDAPControlW
**controlarray
)
581 LDAPControlW
**p
= controlarray
;
582 while (*p
) controlfreeW( *p
++ );
583 free( controlarray
);
587 static inline DWORD
controlarraylenW( LDAPControlW
**controlarray
)
589 LDAPControlW
**p
= controlarray
;
591 return p
- controlarray
;
594 static inline LDAPControlA
*controlWtoA( const LDAPControlW
*control
)
596 LDAPControlA
*controlA
;
597 DWORD len
= control
->ldctl_value
.bv_len
;
600 if (control
->ldctl_value
.bv_val
)
602 if (!(val
= malloc( len
))) return NULL
;
603 memcpy( val
, control
->ldctl_value
.bv_val
, len
);
606 if (!(controlA
= malloc( sizeof(*controlA
) )))
612 controlA
->ldctl_oid
= strWtoA( control
->ldctl_oid
);
613 controlA
->ldctl_value
.bv_len
= len
;
614 controlA
->ldctl_value
.bv_val
= val
;
615 controlA
->ldctl_iscritical
= control
->ldctl_iscritical
;
620 static inline void strarrayfreeA( char **strarray
)
625 while (*p
) free( *p
++ );
630 static inline void controlfreeA( LDAPControlA
*control
)
634 free( control
->ldctl_oid
);
635 free( control
->ldctl_value
.bv_val
);
640 static inline void controlarrayfreeA( LDAPControlA
**controlarray
)
644 LDAPControlA
**p
= controlarray
;
645 while (*p
) controlfreeA( *p
++ );
646 free( controlarray
);
650 static inline LDAPControlU
*controlWtoU( const LDAPControlW
*control
)
652 LDAPControlU
*controlU
;
653 DWORD len
= control
->ldctl_value
.bv_len
;
656 if (control
->ldctl_value
.bv_val
)
658 if (!(val
= malloc( len
))) return NULL
;
659 memcpy( val
, control
->ldctl_value
.bv_val
, len
);
662 if (!(controlU
= malloc( sizeof(*controlU
) )))
668 controlU
->ldctl_oid
= strWtoU( control
->ldctl_oid
);
669 controlU
->ldctl_value
.bv_len
= len
;
670 controlU
->ldctl_value
.bv_val
= val
;
671 controlU
->ldctl_iscritical
= control
->ldctl_iscritical
;
676 static inline LDAPControlU
**controlarrayWtoU( LDAPControlW
**controlarray
)
678 LDAPControlU
**controlarrayU
= NULL
;
683 size
= sizeof(LDAPControlU
*) * (controlarraylenW( controlarray
) + 1);
684 if ((controlarrayU
= malloc( size
)))
686 LDAPControlW
**p
= controlarray
;
687 LDAPControlU
**q
= controlarrayU
;
689 while (*p
) *q
++ = controlWtoU( *p
++ );
693 return controlarrayU
;
696 static inline void controlfreeU( LDAPControlU
*control
)
700 free( control
->ldctl_oid
);
701 free( control
->ldctl_value
.bv_val
);
706 static inline void controlarrayfreeU( LDAPControlU
**controlarray
)
710 LDAPControlU
**p
= controlarray
;
711 while (*p
) controlfreeU( *p
++ );
712 free( controlarray
);
716 static inline DWORD
controlarraylenU( LDAPControlU
**controlarray
)
718 LDAPControlU
**p
= controlarray
;
720 return p
- controlarray
;
723 static inline LDAPControlW
*controldupW( LDAPControlW
*control
)
725 LDAPControlW
*controlW
;
726 DWORD len
= control
->ldctl_value
.bv_len
;
729 if (control
->ldctl_value
.bv_val
)
731 if (!(val
= malloc( len
))) return NULL
;
732 memcpy( val
, control
->ldctl_value
.bv_val
, len
);
735 if (!(controlW
= malloc( sizeof(*controlW
) )))
741 controlW
->ldctl_oid
= strdupW( control
->ldctl_oid
);
742 controlW
->ldctl_value
.bv_len
= len
;
743 controlW
->ldctl_value
.bv_val
= val
;
744 controlW
->ldctl_iscritical
= control
->ldctl_iscritical
;
749 static inline LDAPControlW
**controlarraydupW( LDAPControlW
**controlarray
)
751 LDAPControlW
**controlarrayW
= NULL
;
756 size
= sizeof(LDAPControlW
*) * (controlarraylenW( controlarray
) + 1);
757 if ((controlarrayW
= malloc( size
)))
759 LDAPControlW
**p
= controlarray
;
760 LDAPControlW
**q
= controlarrayW
;
762 while (*p
) *q
++ = controldupW( *p
++ );
766 return controlarrayW
;
769 static inline LDAPControlA
**controlarrayWtoA( LDAPControlW
**controlarray
)
771 LDAPControlA
**controlarrayA
= NULL
;
776 size
= sizeof(LDAPControlA
*) * (controlarraylenW( controlarray
) + 1);
777 if ((controlarrayA
= malloc( size
)))
779 LDAPControlW
**p
= controlarray
;
780 LDAPControlA
**q
= controlarrayA
;
782 while (*p
) *q
++ = controlWtoA( *p
++ );
786 return controlarrayA
;
789 static inline WCHAR
*strUtoW( const char *str
)
794 DWORD len
= MultiByteToWideChar( CP_UTF8
, 0, str
, -1, NULL
, 0 );
795 if ((ret
= malloc( len
* sizeof(WCHAR
) ))) MultiByteToWideChar( CP_UTF8
, 0, str
, -1, ret
, len
);
800 static inline DWORD
strarraylenU( char **strarray
)
807 static inline WCHAR
**strarrayUtoW( char **strarray
)
809 WCHAR
**strarrayW
= NULL
;
814 size
= sizeof(WCHAR
*) * (strarraylenU( strarray
) + 1);
815 if ((strarrayW
= malloc( size
)))
818 WCHAR
**q
= strarrayW
;
820 while (*p
) *q
++ = strUtoW( *p
++ );
827 static inline char **strarrayUtoU( char **strarray
)
829 char **strarrayU
= NULL
;
834 size
= sizeof(char *) * (strarraylenU( strarray
) + 1);
835 if ((strarrayU
= malloc( size
)))
838 char **q
= strarrayU
;
840 while (*p
) *q
++ = strdupU( *p
++ );
847 static inline LDAPControlW
*controlUtoW( const LDAPControlU
*control
)
849 LDAPControlW
*controlW
;
850 DWORD len
= control
->ldctl_value
.bv_len
;
853 if (control
->ldctl_value
.bv_val
)
855 if (!(val
= malloc( len
))) return NULL
;
856 memcpy( val
, control
->ldctl_value
.bv_val
, len
);
859 if (!(controlW
= malloc( sizeof(*controlW
) )))
865 controlW
->ldctl_oid
= strUtoW( control
->ldctl_oid
);
866 controlW
->ldctl_value
.bv_len
= len
;
867 controlW
->ldctl_value
.bv_val
= val
;
868 controlW
->ldctl_iscritical
= control
->ldctl_iscritical
;
873 static inline LDAPControlW
**controlarrayUtoW( LDAPControlU
**controlarray
)
875 LDAPControlW
**controlarrayW
= NULL
;
880 size
= sizeof(LDAPControlW
*) * (controlarraylenU( controlarray
) + 1);
881 if ((controlarrayW
= malloc( size
)))
883 LDAPControlU
**p
= controlarray
;
884 LDAPControlW
**q
= controlarrayW
;
886 while (*p
) *q
++ = controlUtoW( *p
++ );
890 return controlarrayW
;
893 static inline DWORD
sortkeyarraylenA( LDAPSortKeyA
**sortkeyarray
)
895 LDAPSortKeyA
**p
= sortkeyarray
;
897 return p
- sortkeyarray
;
900 static inline LDAPSortKeyW
*sortkeyAtoW( const LDAPSortKeyA
*sortkey
)
902 LDAPSortKeyW
*sortkeyW
;
904 if ((sortkeyW
= malloc( sizeof(*sortkeyW
) )))
906 sortkeyW
->sk_attrtype
= strAtoW( sortkey
->sk_attrtype
);
907 sortkeyW
->sk_matchruleoid
= strAtoW( sortkey
->sk_matchruleoid
);
908 sortkeyW
->sk_reverseorder
= sortkey
->sk_reverseorder
;
913 static inline LDAPSortKeyW
**sortkeyarrayAtoW( LDAPSortKeyA
**sortkeyarray
)
915 LDAPSortKeyW
**sortkeyarrayW
= NULL
;
920 size
= sizeof(LDAPSortKeyW
*) * (sortkeyarraylenA( sortkeyarray
) + 1);
921 if ((sortkeyarrayW
= malloc( size
)))
923 LDAPSortKeyA
**p
= sortkeyarray
;
924 LDAPSortKeyW
**q
= sortkeyarrayW
;
926 while (*p
) *q
++ = sortkeyAtoW( *p
++ );
930 return sortkeyarrayW
;
933 static inline void sortkeyfreeW( LDAPSortKeyW
*sortkey
)
937 free( sortkey
->sk_attrtype
);
938 free( sortkey
->sk_matchruleoid
);
943 static inline void sortkeyarrayfreeW( LDAPSortKeyW
**sortkeyarray
)
947 LDAPSortKeyW
**p
= sortkeyarray
;
948 while (*p
) sortkeyfreeW( *p
++ );
949 free( sortkeyarray
);
953 static inline DWORD
sortkeyarraylenW( LDAPSortKeyW
**sortkeyarray
)
955 LDAPSortKeyW
**p
= sortkeyarray
;
957 return p
- sortkeyarray
;
960 static inline LDAPSortKeyU
*sortkeyWtoU( const LDAPSortKeyW
*sortkey
)
962 LDAPSortKeyU
*sortkeyU
;
964 if ((sortkeyU
= malloc( sizeof(*sortkeyU
) )))
966 sortkeyU
->attributeType
= strWtoU( sortkey
->sk_attrtype
);
967 sortkeyU
->orderingRule
= strWtoU( sortkey
->sk_matchruleoid
);
968 sortkeyU
->reverseOrder
= sortkey
->sk_reverseorder
;
973 static inline LDAPSortKeyU
**sortkeyarrayWtoU( LDAPSortKeyW
**sortkeyarray
)
975 LDAPSortKeyU
**sortkeyarrayU
= NULL
;
980 size
= sizeof(LDAPSortKeyU
*) * (sortkeyarraylenW( sortkeyarray
) + 1);
981 if ((sortkeyarrayU
= malloc( size
)))
983 LDAPSortKeyW
**p
= sortkeyarray
;
984 LDAPSortKeyU
**q
= sortkeyarrayU
;
986 while (*p
) *q
++ = sortkeyWtoU( *p
++ );
990 return sortkeyarrayU
;
993 static inline void sortkeyfreeU( LDAPSortKeyU
*sortkey
)
997 free( sortkey
->attributeType
);
998 free( sortkey
->orderingRule
);
1003 static inline void sortkeyarrayfreeU( LDAPSortKeyU
**sortkeyarray
)
1007 LDAPSortKeyU
**p
= sortkeyarray
;
1008 while (*p
) sortkeyfreeU( *p
++ );
1009 free( sortkeyarray
);
1013 static inline LDAPVLVInfoU
*vlvinfoWtoU( const LDAPVLVInfo
*info
)
1015 LDAPVLVInfoU
*infoU
;
1017 if ((infoU
= malloc( sizeof(*infoU
) )))
1019 infoU
->ldvlv_version
= info
->ldvlv_version
;
1020 infoU
->ldvlv_before_count
= info
->ldvlv_before_count
;
1021 infoU
->ldvlv_after_count
= info
->ldvlv_after_count
;
1022 infoU
->ldvlv_offset
= info
->ldvlv_offset
;
1023 infoU
->ldvlv_count
= info
->ldvlv_count
;
1024 if (!(infoU
->ldvlv_attrvalue
= bervalWtoU( info
->ldvlv_attrvalue
)))
1029 if (!(infoU
->ldvlv_context
= bervalWtoU( info
->ldvlv_context
)))
1031 free( infoU
->ldvlv_attrvalue
);
1035 infoU
->ldvlv_extradata
= info
->ldvlv_extradata
;
1040 static inline void vlvinfofreeU( LDAPVLVInfoU
*info
)
1042 free( info
->ldvlv_attrvalue
);
1043 free( info
->ldvlv_context
);