Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygencontrol.c
Go to the documentation of this file.
00001 /* 00002 * WLDAP32 - LDAP support for Wine 00003 * 00004 * Copyright 2005 Hans Leidekker 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2.1 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with this library; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 00019 */ 00020 00021 #include "config.h" 00022 00023 #include "wine/port.h" 00024 #include "wine/debug.h" 00025 00026 #include <stdarg.h> 00027 00028 #include "windef.h" 00029 #include "winbase.h" 00030 #include "winnls.h" 00031 00032 #ifdef HAVE_LDAP_H 00033 #include <ldap.h> 00034 #endif 00035 00036 #include "winldap_private.h" 00037 #include "wldap32.h" 00038 00039 WINE_DEFAULT_DEBUG_CHANNEL(wldap32); 00040 00041 /*********************************************************************** 00042 * ldap_control_freeA (WLDAP32.@) 00043 * 00044 * See ldap_control_freeW. 00045 */ 00046 ULONG CDECL ldap_control_freeA( LDAPControlA *control ) 00047 { 00048 ULONG ret = WLDAP32_LDAP_SUCCESS; 00049 #ifdef HAVE_LDAP 00050 00051 TRACE( "(%p)\n", control ); 00052 controlfreeA( control ); 00053 00054 #endif 00055 return ret; 00056 } 00057 00058 /*********************************************************************** 00059 * ldap_control_freeW (WLDAP32.@) 00060 * 00061 * Free an LDAPControl structure. 00062 * 00063 * PARAMS 00064 * control [I] LDAPControl structure to free. 00065 * 00066 * RETURNS 00067 * LDAP_SUCCESS 00068 */ 00069 ULONG CDECL ldap_control_freeW( LDAPControlW *control ) 00070 { 00071 ULONG ret = WLDAP32_LDAP_SUCCESS; 00072 #ifdef HAVE_LDAP 00073 00074 TRACE( "(%p)\n", control ); 00075 controlfreeW( control ); 00076 00077 #endif 00078 return ret; 00079 } 00080 00081 /*********************************************************************** 00082 * ldap_controls_freeA (WLDAP32.@) 00083 * 00084 * See ldap_controls_freeW. 00085 */ 00086 ULONG CDECL ldap_controls_freeA( LDAPControlA **controls ) 00087 { 00088 ULONG ret = WLDAP32_LDAP_SUCCESS; 00089 #ifdef HAVE_LDAP 00090 00091 TRACE( "(%p)\n", controls ); 00092 controlarrayfreeA( controls ); 00093 00094 #endif 00095 return ret; 00096 } 00097 00098 /*********************************************************************** 00099 * ldap_controls_freeW (WLDAP32.@) 00100 * 00101 * Free an array of LDAPControl structures. 00102 * 00103 * PARAMS 00104 * controls [I] Array of LDAPControl structures to free. 00105 * 00106 * RETURNS 00107 * LDAP_SUCCESS 00108 */ 00109 ULONG CDECL ldap_controls_freeW( LDAPControlW **controls ) 00110 { 00111 ULONG ret = WLDAP32_LDAP_SUCCESS; 00112 #ifdef HAVE_LDAP 00113 00114 TRACE( "(%p)\n", controls ); 00115 controlarrayfreeW( controls ); 00116 00117 #endif 00118 return ret; 00119 } 00120 00121 /*********************************************************************** 00122 * ldap_create_sort_controlA (WLDAP32.@) 00123 * 00124 * See ldap_create_sort_controlW. 00125 */ 00126 ULONG CDECL ldap_create_sort_controlA( WLDAP32_LDAP *ld, PLDAPSortKeyA *sortkey, 00127 UCHAR critical, PLDAPControlA *control ) 00128 { 00129 ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED; 00130 #ifdef HAVE_LDAP 00131 LDAPSortKeyW **sortkeyW = NULL; 00132 LDAPControlW *controlW = NULL; 00133 00134 TRACE( "(%p, %p, 0x%02x, %p)\n", ld, sortkey, critical, control ); 00135 00136 if (!ld || !sortkey || !control) 00137 return WLDAP32_LDAP_PARAM_ERROR; 00138 00139 sortkeyW = sortkeyarrayAtoW( sortkey ); 00140 if (!sortkeyW) return WLDAP32_LDAP_NO_MEMORY; 00141 00142 ret = ldap_create_sort_controlW( ld, sortkeyW, critical, &controlW ); 00143 00144 *control = controlWtoA( controlW ); 00145 if (!*control) ret = WLDAP32_LDAP_NO_MEMORY; 00146 00147 ldap_control_freeW( controlW ); 00148 sortkeyarrayfreeW( sortkeyW ); 00149 00150 #endif 00151 return ret; 00152 } 00153 00154 /*********************************************************************** 00155 * ldap_create_sort_controlW (WLDAP32.@) 00156 * 00157 * Create a control for server sorted search results. 00158 * 00159 * PARAMS 00160 * ld [I] Pointer to an LDAP context. 00161 * sortkey [I] Array of LDAPSortKey structures, each specifying an 00162 * attribute to use as a sort key, a matching rule and 00163 * the sort order (ascending or descending). 00164 * critical [I] Tells the server this control is critical to the 00165 * search operation. 00166 * control [O] LDAPControl created. 00167 * 00168 * RETURNS 00169 * Success: LDAP_SUCCESS 00170 * Failure: An LDAP error code. 00171 * 00172 * NOTES 00173 * Pass the created control as a server control in subsequent calls 00174 * to ldap_search_ext(_s) to obtain sorted search results. 00175 */ 00176 ULONG CDECL ldap_create_sort_controlW( WLDAP32_LDAP *ld, PLDAPSortKeyW *sortkey, 00177 UCHAR critical, PLDAPControlW *control ) 00178 { 00179 ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED; 00180 #ifdef HAVE_LDAP 00181 LDAPSortKey **sortkeyU = NULL; 00182 LDAPControl *controlU = NULL; 00183 00184 TRACE( "(%p, %p, 0x%02x, %p)\n", ld, sortkey, critical, control ); 00185 00186 if (!ld || !sortkey || !control) 00187 return WLDAP32_LDAP_PARAM_ERROR; 00188 00189 sortkeyU = sortkeyarrayWtoU( sortkey ); 00190 if (!sortkeyU) return WLDAP32_LDAP_NO_MEMORY; 00191 00192 ret = map_error( ldap_create_sort_control( ld, sortkeyU, critical, &controlU )); 00193 00194 *control = controlUtoW( controlU ); 00195 if (!*control) ret = WLDAP32_LDAP_NO_MEMORY; 00196 00197 ldap_control_free( controlU ); 00198 sortkeyarrayfreeU( sortkeyU ); 00199 00200 #endif 00201 return ret; 00202 } 00203 00204 /*********************************************************************** 00205 * ldap_create_vlv_controlA (WLDAP32.@) 00206 * 00207 * See ldap_create_vlv_controlW. 00208 */ 00209 INT CDECL ldap_create_vlv_controlA( WLDAP32_LDAP *ld, WLDAP32_LDAPVLVInfo *info, 00210 UCHAR critical, LDAPControlA **control ) 00211 { 00212 INT ret = WLDAP32_LDAP_NOT_SUPPORTED; 00213 #ifdef HAVE_LDAP 00214 LDAPControlW *controlW = NULL; 00215 00216 TRACE( "(%p, %p, 0x%02x, %p)\n", ld, info, critical, control ); 00217 00218 if (!ld || !control) return ~0u; 00219 00220 ret = ldap_create_vlv_controlW( ld, info, critical, &controlW ); 00221 00222 if (ret == WLDAP32_LDAP_SUCCESS) 00223 { 00224 *control = controlWtoA( controlW ); 00225 if (!*control) ret = WLDAP32_LDAP_NO_MEMORY; 00226 ldap_control_freeW( controlW ); 00227 } 00228 00229 #endif 00230 return ret; 00231 } 00232 00233 /*********************************************************************** 00234 * ldap_create_vlv_controlW (WLDAP32.@) 00235 * 00236 * Create a virtual list view control. 00237 * 00238 * PARAMS 00239 * ld [I] Pointer to an LDAP context. 00240 * info [I] LDAPVLVInfo structure specifying a list view window. 00241 * critical [I] Tells the server this control is critical to the 00242 * search operation. 00243 * control [O] LDAPControl created. 00244 * 00245 * RETURNS 00246 * Success: LDAP_SUCCESS 00247 * Failure: An LDAP error code. 00248 * 00249 * NOTES 00250 * Pass the created control in conjunction with a sort control as 00251 * server controls in subsequent calls to ldap_search_ext(_s). The 00252 * server will then return a sorted, contiguous subset of results 00253 * that meets the criteria specified in the LDAPVLVInfo structure. 00254 */ 00255 INT CDECL ldap_create_vlv_controlW( WLDAP32_LDAP *ld, WLDAP32_LDAPVLVInfo *info, 00256 UCHAR critical, LDAPControlW **control ) 00257 { 00258 INT ret = WLDAP32_LDAP_NOT_SUPPORTED; 00259 #ifdef HAVE_LDAP 00260 LDAPControl *controlU = NULL; 00261 00262 TRACE( "(%p, %p, 0x%02x, %p)\n", ld, info, critical, control ); 00263 00264 if (!ld || !control) return ~0u; 00265 00266 ret = map_error( ldap_create_vlv_control( ld, (LDAPVLVInfo *)info, &controlU )); 00267 00268 if (ret == WLDAP32_LDAP_SUCCESS) 00269 { 00270 *control = controlUtoW( controlU ); 00271 if (!*control) ret = WLDAP32_LDAP_NO_MEMORY; 00272 ldap_control_free( controlU ); 00273 } 00274 00275 #endif 00276 return ret; 00277 } 00278 00279 /*********************************************************************** 00280 * ldap_encode_sort_controlA (WLDAP32.@) 00281 * 00282 * See ldap_encode_sort_controlW. 00283 */ 00284 ULONG CDECL ldap_encode_sort_controlA( WLDAP32_LDAP *ld, PLDAPSortKeyA *sortkeys, 00285 PLDAPControlA control, BOOLEAN critical ) 00286 { 00287 return ldap_create_sort_controlA( ld, sortkeys, critical, &control ); 00288 } 00289 00290 /*********************************************************************** 00291 * ldap_encode_sort_controlW (WLDAP32.@) 00292 * 00293 * Create a control for server sorted search results. 00294 * 00295 * PARAMS 00296 * ld [I] Pointer to an LDAP context. 00297 * sortkey [I] Array of LDAPSortKey structures, each specifying an 00298 * attribute to use as a sort key, a matching rule and 00299 * the sort order (ascending or descending). 00300 * critical [I] Tells the server this control is critical to the 00301 * search operation. 00302 * control [O] LDAPControl created. 00303 * 00304 * RETURNS 00305 * Success: LDAP_SUCCESS 00306 * Failure: An LDAP error code. 00307 * 00308 * NOTES 00309 * This function is obsolete. Use its equivalent 00310 * ldap_create_sort_control instead. 00311 */ 00312 ULONG CDECL ldap_encode_sort_controlW( WLDAP32_LDAP *ld, PLDAPSortKeyW *sortkeys, 00313 PLDAPControlW control, BOOLEAN critical ) 00314 { 00315 return ldap_create_sort_controlW( ld, sortkeys, critical, &control ); 00316 } 00317 00318 /*********************************************************************** 00319 * ldap_free_controlsA (WLDAP32.@) 00320 * 00321 * See ldap_free_controlsW. 00322 */ 00323 ULONG CDECL ldap_free_controlsA( LDAPControlA **controls ) 00324 { 00325 return ldap_controls_freeA( controls ); 00326 } 00327 00328 /*********************************************************************** 00329 * ldap_free_controlsW (WLDAP32.@) 00330 * 00331 * Free an array of LDAPControl structures. 00332 * 00333 * PARAMS 00334 * controls [I] Array of LDAPControl structures to free. 00335 * 00336 * RETURNS 00337 * LDAP_SUCCESS 00338 * 00339 * NOTES 00340 * Obsolete, use ldap_controls_freeW. 00341 */ 00342 ULONG CDECL ldap_free_controlsW( LDAPControlW **controls ) 00343 { 00344 return ldap_controls_freeW( controls ); 00345 } Generated on Wed May 23 2012 04:14:55 for ReactOS by
1.7.6.1
|