ReactOS 0.4.15-dev-8109-gd7be748
parse.c File Reference
#include <stdarg.h>
#include <stdlib.h>
#include <windef.h>
#include <winbase.h>
#include <winldap.h>
#include "wine/test.h"
Include dependency graph for parse.c:

Go to the source code of this file.

Functions

static void test_ldap_parse_sort_control (LDAP *ld)
 
static void test_ldap_search_extW (LDAP *ld)
 
static void test_ldap_set_optionW (LDAP *ld)
 
static void test_ldap_get_optionW (LDAP *ld)
 
 START_TEST (parse)
 

Function Documentation

◆ START_TEST()

START_TEST ( parse  )

Definition at line 135 of file parse.c.

136{
137 LDAP *ld;
138
139 ld = ldap_initA((char *)"ldap.itd.umich.edu", 389 );
140 ok( ld != NULL, "ldap_init failed\n" );
141
146 ldap_unbind( ld );
147}
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
WLDAP32_LDAP *CDECL ldap_initA(const PCHAR hostname, ULONG portnumber)
Definition: init.c:331
static void test_ldap_search_extW(LDAP *ld)
Definition: parse.c:89
static void test_ldap_set_optionW(LDAP *ld)
Definition: parse.c:108
static void test_ldap_get_optionW(LDAP *ld)
Definition: parse.c:126
static void test_ldap_parse_sort_control(LDAP *ld)
Definition: parse.c:29
WINLDAPAPI ULONG ldap_unbind(LDAP *)

◆ test_ldap_get_optionW()

static void test_ldap_get_optionW ( LDAP ld)
static

Definition at line 126 of file parse.c.

127{
129
131 ok( !ret, "ldap_get_optionW failed 0x%08x\n", ret );
132 ok( version == LDAP_VERSION3, "got %u\n", version );
133}
static const WCHAR version[]
Definition: asmname.c:66
ULONG CDECL ldap_get_optionW(WLDAP32_LDAP *ld, int option, void *value)
Definition: option.c:183
uint32_t ULONG
Definition: typedefs.h:59
int ret
#define LDAP_OPT_PROTOCOL_VERSION
Definition: winldap.h:145
#define LDAP_VERSION3
Definition: winldap.h:49

Referenced by START_TEST().

◆ test_ldap_parse_sort_control()

static void test_ldap_parse_sort_control ( LDAP ld)
static

Definition at line 29 of file parse.c.

30{
32 LDAPSortKeyA *sortkeys[2], key;
33 LDAPControlA *sort, *ctrls[2], **server_ctrls;
35 struct l_timeval timeout;
36
37 key.sk_attrtype = (char *)"ou";
38 key.sk_matchruleoid = NULL;
39 key.sk_reverseorder = FALSE;
40
41 sortkeys[0] = &key;
42 sortkeys[1] = NULL;
43 ret = ldap_create_sort_controlA( ld, sortkeys, 0, &sort );
44 ok( !ret, "ldap_create_sort_controlA failed 0x%x\n", ret );
45
46 ctrls[0] = sort;
47 ctrls[1] = NULL;
48 timeout.tv_sec = 20;
49 timeout.tv_usec = 0;
50 ret = ldap_search_ext_sA( ld, (char *)"", LDAP_SCOPE_ONELEVEL, (char *)"(ou=*)", NULL, 0, ctrls, NULL, &timeout, 10, &res );
52 {
53 skip("test server can't be reached\n");
55 return;
56 }
57 ok( !ret, "ldap_search_ext_sA failed 0x%x\n", ret );
58 ok( res != NULL, "expected res != NULL\n" );
59
60 if (GetProcAddress(GetModuleHandleA("wldap32.dll"), "ber_init"))
61 {
62 ret = ldap_parse_resultA( NULL, res, &result, NULL, NULL, NULL, &server_ctrls, 1 );
63 ok( ret == LDAP_PARAM_ERROR, "ldap_parse_resultA failed 0x%x\n", ret );
64 }
65 else
66 win_skip("Test would crash on older wldap32 versions\n");
67
68 result = ~0u;
69 ret = ldap_parse_resultA( ld, res, &result, NULL, NULL, NULL, &server_ctrls, 1 );
70 ok( !ret, "ldap_parse_resultA failed 0x%x\n", ret );
71 ok( !result, "got 0x%x expected 0\n", result );
72
74 ok( ret == LDAP_PARAM_ERROR, "ldap_parse_sort_controlA failed 0x%d\n", ret );
75
77 ok( ret == LDAP_CONTROL_NOT_FOUND, "ldap_parse_sort_controlA failed 0x%x\n", ret );
78
80 ok( ret == LDAP_CONTROL_NOT_FOUND, "ldap_parse_sort_controlA failed 0x%x\n", ret );
81
82 ret = ldap_parse_sort_controlA( ld, server_ctrls, &result, NULL );
83 ok( ret == LDAP_CONTROL_NOT_FOUND, "ldap_parse_sort_controlA failed 0x%x\n", ret );
84
86 ldap_controls_freeA( server_ctrls );
87}
_STLP_MOVE_TO_STD_NAMESPACE void sort(_RandomAccessIter __first, _RandomAccessIter __last)
Definition: _algo.c:993
#define skip(...)
Definition: atltest.h:64
#define FALSE
Definition: types.h:117
#define GetProcAddress(x, y)
Definition: compat.h:753
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
ULONG CDECL ldap_create_sort_controlA(WLDAP32_LDAP *ld, PLDAPSortKeyA *sortkey, UCHAR critical, PLDAPControlA *control)
Definition: control.c:124
ULONG CDECL ldap_control_freeA(LDAPControlA *control)
Definition: control.c:44
ULONG CDECL ldap_controls_freeA(LDAPControlA **controls)
Definition: control.c:84
ULONG CDECL ldap_parse_sort_controlA(WLDAP32_LDAP *ld, PLDAPControlA *control, ULONG *result, PCHAR *attr)
Definition: parse.c:273
ULONG CDECL ldap_parse_resultA(WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *result, ULONG *retcode, PCHAR *matched, PCHAR *error, PCHAR **referrals, PLDAPControlA **serverctrls, BOOLEAN free)
Definition: parse.c:179
ULONG CDECL ldap_search_ext_sA(WLDAP32_LDAP *ld, PCHAR base, ULONG scope, PCHAR filter, PCHAR attrs[], ULONG attrsonly, PLDAPControlA *serverctrls, PLDAPControlA *clientctrls, struct l_timeval *timeout, ULONG sizelimit, WLDAP32_LDAPMessage **res)
Definition: search.c:301
GLuint res
Definition: glext.h:9613
GLuint64EXT * result
Definition: glext.h:11304
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 win_skip
Definition: test.h:163
Definition: copy.c:22
Definition: dhcpd.h:245
#define LDAP_SERVER_DOWN
Definition: winldap.h:101
#define LDAP_TIMEOUT
Definition: winldap.h:105
#define LDAP_PARAM_ERROR
Definition: winldap.h:109
#define LDAP_CONTROL_NOT_FOUND
Definition: winldap.h:113
#define LDAP_SCOPE_ONELEVEL
Definition: winldap.h:189

Referenced by START_TEST().

◆ test_ldap_search_extW()

static void test_ldap_search_extW ( LDAP ld)
static

Definition at line 89 of file parse.c.

90{
91 ULONG ret, message, timelimit;
92 WCHAR base[] = {0}, filter[] = {'o','u','=','*',0};
93
94 timelimit = 20;
95 ret = ldap_search_extW( ld, base, LDAP_SCOPE_SUBTREE, filter, NULL, 0, NULL, NULL, timelimit, 0, &message );
97 {
98 skip("test server can't be reached\n");
99 return;
100 }
101 ok( !ret, "ldap_search_extW failed 0x%08x\n", ret );
102
103 timelimit = 0;
104 ret = ldap_search_extW( ld, base, LDAP_SCOPE_SUBTREE, filter, NULL, 0, NULL, NULL, timelimit, 0, &message );
105 ok( !ret, "ldap_search_extW failed 0x%08x\n", ret );
106}
ULONG CDECL ldap_search_extW(WLDAP32_LDAP *ld, PWCHAR base, ULONG scope, PWCHAR filter, PWCHAR attrs[], ULONG attrsonly, PLDAPControlW *serverctrls, PLDAPControlW *clientctrls, ULONG timelimit, ULONG sizelimit, ULONG *message)
Definition: search.c:236
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glext.h:7005
Definition: tftpd.h:60
#define LDAP_SCOPE_SUBTREE
Definition: winldap.h:190
#define LDAP_UNAVAILABLE
Definition: winldap.h:89
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by START_TEST().

◆ test_ldap_set_optionW()

static void test_ldap_set_optionW ( LDAP ld)
static

Definition at line 108 of file parse.c.

109{
110 ULONG ret, oldvalue;
111
112 ret = ldap_get_optionW( ld, LDAP_OPT_REFERRALS, &oldvalue );
114 {
115 skip("test server can't be reached\n");
116 return;
117 }
118
120 ok( !ret || broken(ret == LDAP_PARAM_ERROR) /* nt4, win2k */, "ldap_set_optionW failed 0x%08x\n", ret );
121
122 ret = ldap_set_optionW( ld, LDAP_OPT_REFERRALS, (void *)&oldvalue );
123 ok( !ret, "ldap_set_optionW failed 0x%08x\n", ret );
124}
#define broken(x)
Definition: _sntprintf.h:21
ULONG CDECL ldap_set_optionW(WLDAP32_LDAP *ld, int option, void *value)
Definition: option.c:416
#define LDAP_OPT_REFERRALS
Definition: winldap.h:137
#define LDAP_OPT_OFF
Definition: winldap.h:128

Referenced by START_TEST().