ReactOS  0.4.15-dev-1197-g8081ba9
control.c File Reference
#include "config.h"
#include "wine/port.h"
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "winldap_private.h"
#include "wldap32.h"
#include "wine/debug.h"
Include dependency graph for control.c:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (wldap32)
 
ULONG CDECL ldap_control_freeA (LDAPControlA *control)
 
ULONG CDECL ldap_control_freeW (LDAPControlW *control)
 
ULONG CDECL ldap_controls_freeA (LDAPControlA **controls)
 
ULONG CDECL ldap_controls_freeW (LDAPControlW **controls)
 
ULONG CDECL ldap_create_sort_controlA (WLDAP32_LDAP *ld, PLDAPSortKeyA *sortkey, UCHAR critical, PLDAPControlA *control)
 
ULONG CDECL ldap_create_sort_controlW (WLDAP32_LDAP *ld, PLDAPSortKeyW *sortkey, UCHAR critical, PLDAPControlW *control)
 
INT CDECL ldap_create_vlv_controlA (WLDAP32_LDAP *ld, WLDAP32_LDAPVLVInfo *info, UCHAR critical, LDAPControlA **control)
 
INT CDECL ldap_create_vlv_controlW (WLDAP32_LDAP *ld, WLDAP32_LDAPVLVInfo *info, UCHAR critical, LDAPControlW **control)
 
static void bv_val_dup (const struct WLDAP32_berval *src, struct WLDAP32_berval *dst)
 
ULONG CDECL ldap_encode_sort_controlA (WLDAP32_LDAP *ld, PLDAPSortKeyA *sortkeys, PLDAPControlA ret, BOOLEAN critical)
 
ULONG CDECL ldap_encode_sort_controlW (WLDAP32_LDAP *ld, PLDAPSortKeyW *sortkeys, PLDAPControlW ret, BOOLEAN critical)
 
ULONG CDECL ldap_free_controlsA (LDAPControlA **controls)
 
ULONG CDECL ldap_free_controlsW (LDAPControlW **controls)
 

Function Documentation

◆ bv_val_dup()

static void bv_val_dup ( const struct WLDAP32_berval src,
struct WLDAP32_berval dst 
)
inlinestatic

Definition at line 277 of file control.c.

278 {
279  if ((dst->bv_val = heap_alloc( src->bv_len )))
280  {
281  memcpy( dst->bv_val, src->bv_val, src->bv_len );
282  dst->bv_len = src->bv_len;
283  }
284  else
285  dst->bv_len = 0;
286 }
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340

Referenced by ldap_encode_sort_controlA(), and ldap_encode_sort_controlW().

◆ ldap_control_freeA()

ULONG CDECL ldap_control_freeA ( LDAPControlA control)

Definition at line 44 of file control.c.

45 {
47 #ifdef HAVE_LDAP
48 
49  TRACE( "(%p)\n", control );
50  controlfreeA( control );
51 
52 #endif
53  return ret;
54 }
#define TRACE(s)
Definition: solgame.cpp:4
int ret
unsigned int ULONG
Definition: retypes.h:1

Referenced by ldap_encode_sort_controlA(), and test_ldap_parse_sort_control().

◆ ldap_control_freeW()

ULONG CDECL ldap_control_freeW ( LDAPControlW control)

Definition at line 67 of file control.c.

68 {
70 #ifdef HAVE_LDAP
71 
72  TRACE( "(%p)\n", control );
73  controlfreeW( control );
74 
75 #endif
76  return ret;
77 }
#define TRACE(s)
Definition: solgame.cpp:4
int ret
unsigned int ULONG
Definition: retypes.h:1

Referenced by ldap_create_page_controlA(), ldap_create_sort_controlA(), ldap_create_vlv_controlA(), and ldap_encode_sort_controlW().

◆ ldap_controls_freeA()

ULONG CDECL ldap_controls_freeA ( LDAPControlA **  controls)

Definition at line 84 of file control.c.

85 {
87 #ifdef HAVE_LDAP
88 
89  TRACE( "(%p)\n", controls );
90  controlarrayfreeA( controls );
91 
92 #endif
93  return ret;
94 }
#define TRACE(s)
Definition: solgame.cpp:4
int ret
unsigned int ULONG
Definition: retypes.h:1

Referenced by ldap_free_controlsA(), and test_ldap_parse_sort_control().

◆ ldap_controls_freeW()

ULONG CDECL ldap_controls_freeW ( LDAPControlW **  controls)

Definition at line 107 of file control.c.

108 {
110 #ifdef HAVE_LDAP
111 
112  TRACE( "(%p)\n", controls );
113  controlarrayfreeW( controls );
114 
115 #endif
116  return ret;
117 }
#define TRACE(s)
Definition: solgame.cpp:4
int ret
unsigned int ULONG
Definition: retypes.h:1

Referenced by ldap_free_controlsW(), and ldap_parse_resultA().

◆ ldap_create_sort_controlA()

ULONG CDECL ldap_create_sort_controlA ( WLDAP32_LDAP ld,
PLDAPSortKeyA sortkey,
UCHAR  critical,
PLDAPControlA control 
)

Definition at line 124 of file control.c.

126 {
128 #ifdef HAVE_LDAP
129  LDAPSortKeyW **sortkeyW = NULL;
131 
132  TRACE( "(%p, %p, 0x%02x, %p)\n", ld, sortkey, critical, control );
133 
134  if (!ld || !sortkey || !control)
136 
137  sortkeyW = sortkeyarrayAtoW( sortkey );
138  if (!sortkeyW) return WLDAP32_LDAP_NO_MEMORY;
139 
140  ret = ldap_create_sort_controlW( ld, sortkeyW, critical, &controlW );
141 
142  *control = controlWtoA( controlW );
143  if (!*control) ret = WLDAP32_LDAP_NO_MEMORY;
144 
146  sortkeyarrayfreeW( sortkeyW );
147 
148 #endif
149  return ret;
150 }
static const WCHAR controlW[]
Definition: actctx.c:658
ULONG CDECL ldap_create_sort_controlW(WLDAP32_LDAP *ld, PLDAPSortKeyW *sortkey, UCHAR critical, PLDAPControlW *control)
Definition: control.c:174
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
int ret
ULONG CDECL ldap_control_freeW(LDAPControlW *control)
Definition: control.c:67
unsigned int ULONG
Definition: retypes.h:1

Referenced by ldap_encode_sort_controlA(), and test_ldap_parse_sort_control().

◆ ldap_create_sort_controlW()

ULONG CDECL ldap_create_sort_controlW ( WLDAP32_LDAP ld,
PLDAPSortKeyW sortkey,
UCHAR  critical,
PLDAPControlW control 
)

Definition at line 174 of file control.c.

176 {
178 #ifdef HAVE_LDAP
179  LDAPSortKey **sortkeyU = NULL;
180  LDAPControl *controlU = NULL;
181 
182  TRACE( "(%p, %p, 0x%02x, %p)\n", ld, sortkey, critical, control );
183 
184  if (!ld || !sortkey || !control)
186 
187  sortkeyU = sortkeyarrayWtoU( sortkey );
188  if (!sortkeyU) return WLDAP32_LDAP_NO_MEMORY;
189 
190  ret = map_error( ldap_create_sort_control( ld, sortkeyU, critical, &controlU ));
191 
192  *control = controlUtoW( controlU );
193  if (!*control) ret = WLDAP32_LDAP_NO_MEMORY;
194 
195  ldap_control_free( controlU );
196  sortkeyarrayfreeU( sortkeyU );
197 
198 #endif
199  return ret;
200 }
#define LDAPControl
Definition: winldap.h:620
#define ldap_create_sort_control
Definition: winldap.h:664
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
int ret
#define LDAPSortKey
Definition: winldap.h:624
unsigned int ULONG
Definition: retypes.h:1
static UINT map_error(DWORD error)
Definition: service.c:35
#define ldap_control_free
Definition: winldap.h:685

Referenced by ldap_create_sort_controlA(), and ldap_encode_sort_controlW().

◆ ldap_create_vlv_controlA()

INT CDECL ldap_create_vlv_controlA ( WLDAP32_LDAP ld,
WLDAP32_LDAPVLVInfo info,
UCHAR  critical,
LDAPControlA **  control 
)

Definition at line 207 of file control.c.

209 {
211 #ifdef HAVE_LDAP
213 
214  TRACE( "(%p, %p, 0x%02x, %p)\n", ld, info, critical, control );
215 
216  if (!ld || !control) return ~0u;
217 
218  ret = ldap_create_vlv_controlW( ld, info, critical, &controlW );
219 
220  if (ret == WLDAP32_LDAP_SUCCESS)
221  {
222  *control = controlWtoA( controlW );
223  if (!*control) ret = WLDAP32_LDAP_NO_MEMORY;
225  }
226 
227 #endif
228  return ret;
229 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
static const WCHAR controlW[]
Definition: actctx.c:658
int32_t INT
Definition: typedefs.h:58
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
int ret
ULONG CDECL ldap_control_freeW(LDAPControlW *control)
Definition: control.c:67
INT CDECL ldap_create_vlv_controlW(WLDAP32_LDAP *ld, WLDAP32_LDAPVLVInfo *info, UCHAR critical, LDAPControlW **control)
Definition: control.c:253

◆ ldap_create_vlv_controlW()

INT CDECL ldap_create_vlv_controlW ( WLDAP32_LDAP ld,
WLDAP32_LDAPVLVInfo info,
UCHAR  critical,
LDAPControlW **  control 
)

Definition at line 253 of file control.c.

255 {
257 #ifdef HAVE_LDAP
258  LDAPControl *controlU = NULL;
259 
260  TRACE( "(%p, %p, 0x%02x, %p)\n", ld, info, critical, control );
261 
262  if (!ld || !control) return ~0u;
263 
264  ret = map_error( ldap_create_vlv_control( ld, (LDAPVLVInfo *)info, &controlU ));
265 
266  if (ret == WLDAP32_LDAP_SUCCESS)
267  {
268  *control = controlUtoW( controlU );
269  if (!*control) ret = WLDAP32_LDAP_NO_MEMORY;
270  ldap_control_free( controlU );
271  }
272 
273 #endif
274  return ret;
275 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
#define LDAPControl
Definition: winldap.h:620
#define ldap_create_vlv_control
Definition: winldap.h:665
int32_t INT
Definition: typedefs.h:58
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
int ret
static UINT map_error(DWORD error)
Definition: service.c:35
#define ldap_control_free
Definition: winldap.h:685

Referenced by ldap_create_vlv_controlA().

◆ ldap_encode_sort_controlA()

ULONG CDECL ldap_encode_sort_controlA ( WLDAP32_LDAP ld,
PLDAPSortKeyA sortkeys,
PLDAPControlA  ret,
BOOLEAN  critical 
)

Definition at line 293 of file control.c.

295 {
296  LDAPControlA *control = NULL;
297  ULONG result;
298 
299  if ((result = ldap_create_sort_controlA( ld, sortkeys, critical, &control )) == WLDAP32_LDAP_SUCCESS)
300  {
301  ret->ldctl_oid = strdupU(control->ldctl_oid);
302  bv_val_dup( &control->ldctl_value, &ret->ldctl_value );
303  ret->ldctl_iscritical = control->ldctl_iscritical;
304  ldap_control_freeA( control );
305  }
306  return result;
307 }
static char * strdupU(const char *src)
Definition: wldap32.h:34
ULONG CDECL ldap_create_sort_controlA(WLDAP32_LDAP *ld, PLDAPSortKeyA *sortkey, UCHAR critical, PLDAPControlA *control)
Definition: control.c:124
smooth NULL
Definition: ftsmooth.c:416
BOOLEAN ldctl_iscritical
ULONG CDECL ldap_control_freeA(LDAPControlA *control)
Definition: control.c:44
int ret
static void bv_val_dup(const struct WLDAP32_berval *src, struct WLDAP32_berval *dst)
Definition: control.c:277
struct WLDAP32_berval ldctl_value
unsigned int ULONG
Definition: retypes.h:1
GLuint64EXT * result
Definition: glext.h:11304

◆ ldap_encode_sort_controlW()

ULONG CDECL ldap_encode_sort_controlW ( WLDAP32_LDAP ld,
PLDAPSortKeyW sortkeys,
PLDAPControlW  ret,
BOOLEAN  critical 
)

Definition at line 331 of file control.c.

333 {
334  LDAPControlW *control = NULL;
335  ULONG result;
336 
337  if ((result = ldap_create_sort_controlW( ld, sortkeys, critical, &control )) == WLDAP32_LDAP_SUCCESS)
338  {
339  ret->ldctl_oid = strdupW(control->ldctl_oid);
340  bv_val_dup( &control->ldctl_value, &ret->ldctl_value );
341  ret->ldctl_iscritical = control->ldctl_iscritical;
342  ldap_control_freeW( control );
343  }
344  return result;
345 }
static WCHAR * strdupW(const WCHAR *src)
Definition: main.c:92
ULONG CDECL ldap_create_sort_controlW(WLDAP32_LDAP *ld, PLDAPSortKeyW *sortkey, UCHAR critical, PLDAPControlW *control)
Definition: control.c:174
struct WLDAP32_berval ldctl_value
smooth NULL
Definition: ftsmooth.c:416
int ret
ULONG CDECL ldap_control_freeW(LDAPControlW *control)
Definition: control.c:67
BOOLEAN ldctl_iscritical
static void bv_val_dup(const struct WLDAP32_berval *src, struct WLDAP32_berval *dst)
Definition: control.c:277
unsigned int ULONG
Definition: retypes.h:1
GLuint64EXT * result
Definition: glext.h:11304

◆ ldap_free_controlsA()

ULONG CDECL ldap_free_controlsA ( LDAPControlA **  controls)

Definition at line 352 of file control.c.

353 {
354  return ldap_controls_freeA( controls );
355 }
ULONG CDECL ldap_controls_freeA(LDAPControlA **controls)
Definition: control.c:84

◆ ldap_free_controlsW()

ULONG CDECL ldap_free_controlsW ( LDAPControlW **  controls)

Definition at line 371 of file control.c.

372 {
373  return ldap_controls_freeW( controls );
374 }
ULONG CDECL ldap_controls_freeW(LDAPControlW **controls)
Definition: control.c:107

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( wldap32  )