ReactOS  0.4.15-dev-439-g292f67a
dn.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 dn.c:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (wldap32)
 
PCHAR CDECL ldap_dn2ufnA (PCHAR dn)
 
PWCHAR CDECL ldap_dn2ufnW (PWCHAR dn)
 
PCHAR *CDECL ldap_explode_dnA (PCHAR dn, ULONG notypes)
 
PWCHAR *CDECL ldap_explode_dnW (PWCHAR dn, ULONG notypes)
 
PCHAR CDECL ldap_get_dnA (WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *entry)
 
PWCHAR CDECL ldap_get_dnW (WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *entry)
 
ULONG CDECL ldap_ufn2dnA (PCHAR ufn, PCHAR *dn)
 
ULONG CDECL ldap_ufn2dnW (PWCHAR ufn, PWCHAR *dn)
 

Function Documentation

◆ ldap_dn2ufnA()

PCHAR CDECL ldap_dn2ufnA ( PCHAR  dn)

Definition at line 44 of file dn.c.

45 {
46  PCHAR ret = NULL;
47 #ifdef HAVE_LDAP
48  WCHAR *dnW, *retW;
49 
50  TRACE( "(%s)\n", debugstr_a(dn) );
51 
52  dnW = strAtoW( dn );
53  if (!dnW) return NULL;
54 
55  retW = ldap_dn2ufnW( dnW );
56  ret = strWtoA( retW );
57 
58  strfreeW( dnW );
59  ldap_memfreeW( retW );
60 
61 #endif
62  return ret;
63 }
signed char * PCHAR
Definition: retypes.h:7
static void strfreeW(LPWSTR str)
Definition: wldap32.h:103
static LPSTR strWtoA(LPCWSTR str)
Definition: wldap32.h:62
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
int ret
static LPWSTR strAtoW(const char *str)
void CDECL ldap_memfreeW(PWCHAR block)
Definition: misc.c:421
PWCHAR CDECL ldap_dn2ufnW(PWCHAR dn)
Definition: dn.c:80

◆ ldap_dn2ufnW()

PWCHAR CDECL ldap_dn2ufnW ( PWCHAR  dn)

Definition at line 80 of file dn.c.

81 {
82  PWCHAR ret = NULL;
83 #ifdef HAVE_LDAP
84  char *dnU, *retU;
85 
86  TRACE( "(%s)\n", debugstr_w(dn) );
87 
88  dnU = strWtoU( dn );
89  if (!dnU) return NULL;
90 
91  retU = ldap_dn2ufn( dnU );
92  ret = strUtoW( retU );
93 
94  strfreeU( dnU );
95  ldap_memfree( retU );
96 
97 #endif
98  return ret;
99 }
static char * strWtoU(LPCWSTR str)
Definition: wldap32.h:74
static void strfreeU(char *str)
Definition: wldap32.h:108
#define ldap_memfree
Definition: winldap.h:688
uint16_t * PWCHAR
Definition: typedefs.h:55
static LPWSTR strUtoW(char *str)
Definition: wldap32.h:86
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
int ret
#define ldap_dn2ufn
Definition: winldap.h:690

Referenced by ldap_dn2ufnA().

◆ ldap_explode_dnA()

PCHAR* CDECL ldap_explode_dnA ( PCHAR  dn,
ULONG  notypes 
)

Definition at line 106 of file dn.c.

107 {
108  PCHAR *ret = NULL;
109 #ifdef HAVE_LDAP
110  WCHAR *dnW, **retW;
111 
112  TRACE( "(%s, 0x%08x)\n", debugstr_a(dn), notypes );
113 
114  dnW = strAtoW( dn );
115  if (!dnW) return NULL;
116 
117  retW = ldap_explode_dnW( dnW, notypes );
118  ret = strarrayWtoA( retW );
119 
120  strfreeW( dnW );
121  ldap_value_freeW( retW );
122 
123 #endif
124  return ret;
125 }
signed char * PCHAR
Definition: retypes.h:7
static LPSTR * strarrayWtoA(LPWSTR *strarray)
Definition: wldap32.h:154
ULONG CDECL ldap_value_freeW(PWCHAR *vals)
Definition: value.c:364
static void strfreeW(LPWSTR str)
Definition: wldap32.h:103
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
int ret
static LPWSTR strAtoW(const char *str)
PWCHAR *CDECL ldap_explode_dnW(PWCHAR dn, ULONG notypes)
Definition: dn.c:144

◆ ldap_explode_dnW()

PWCHAR* CDECL ldap_explode_dnW ( PWCHAR  dn,
ULONG  notypes 
)

Definition at line 144 of file dn.c.

145 {
146  PWCHAR *ret = NULL;
147 #ifdef HAVE_LDAP
148  char *dnU, **retU;
149 
150  TRACE( "(%s, 0x%08x)\n", debugstr_w(dn), notypes );
151 
152  dnU = strWtoU( dn );
153  if (!dnU) return NULL;
154 
155  retU = ldap_explode_dn( dnU, notypes );
156  ret = strarrayUtoW( retU );
157 
158  strfreeU( dnU );
159  ldap_memvfree( (void **)retU );
160 
161 #endif
162  return ret;
163 }
static char * strWtoU(LPCWSTR str)
Definition: wldap32.h:74
static void strfreeU(char *str)
Definition: wldap32.h:108
uint16_t * PWCHAR
Definition: typedefs.h:55
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
int ret
static LPWSTR * strarrayUtoW(char **strarray)
Definition: wldap32.h:194
#define ldap_explode_dn
Definition: winldap.h:692

Referenced by ldap_explode_dnA().

◆ ldap_get_dnA()

PCHAR CDECL ldap_get_dnA ( WLDAP32_LDAP ld,
WLDAP32_LDAPMessage entry 
)

Definition at line 170 of file dn.c.

171 {
172  PCHAR ret = NULL;
173 #ifdef HAVE_LDAP
174  PWCHAR retW;
175 
176  TRACE( "(%p, %p)\n", ld, entry );
177 
178  if (!ld || !entry) return NULL;
179 
180  retW = ldap_get_dnW( ld, entry );
181 
182  ret = strWtoA( retW );
183  ldap_memfreeW( retW );
184 
185 #endif
186  return ret;
187 }
signed char * PCHAR
Definition: retypes.h:7
uint16_t * PWCHAR
Definition: typedefs.h:55
PWCHAR CDECL ldap_get_dnW(WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *entry)
Definition: dn.c:205
static LPSTR strWtoA(LPCWSTR str)
Definition: wldap32.h:62
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
int ret
uint32_t entry
Definition: isohybrid.c:63
void CDECL ldap_memfreeW(PWCHAR block)
Definition: misc.c:421

◆ ldap_get_dnW()

PWCHAR CDECL ldap_get_dnW ( WLDAP32_LDAP ld,
WLDAP32_LDAPMessage entry 
)

Definition at line 205 of file dn.c.

206 {
207  PWCHAR ret = NULL;
208 #ifdef HAVE_LDAP
209  char *retU;
210 
211  TRACE( "(%p, %p)\n", ld, entry );
212 
213  if (!ld || !entry) return NULL;
214 
215  retU = ldap_get_dn( ld, entry );
216 
217  ret = strUtoW( retU );
218  ldap_memfree( retU );
219 
220 #endif
221  return ret;
222 }
#define ldap_memfree
Definition: winldap.h:688
uint16_t * PWCHAR
Definition: typedefs.h:55
static LPWSTR strUtoW(char *str)
Definition: wldap32.h:86
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
int ret
uint32_t entry
Definition: isohybrid.c:63
#define ldap_get_dn
Definition: winldap.h:693

Referenced by ldap_get_dnA().

◆ ldap_ufn2dnA()

ULONG CDECL ldap_ufn2dnA ( PCHAR  ufn,
PCHAR dn 
)

Definition at line 229 of file dn.c.

230 {
232 #ifdef HAVE_LDAP
233  PWCHAR ufnW = NULL, dnW = NULL;
234 
235  TRACE( "(%s, %p)\n", debugstr_a(ufn), dn );
236 
237  if (!dn) return WLDAP32_LDAP_PARAM_ERROR;
238 
239  *dn = NULL;
240 
241  if (ufn) {
242  ufnW = strAtoW( ufn );
243  if (!ufnW) return WLDAP32_LDAP_NO_MEMORY;
244  }
245 
246  ret = ldap_ufn2dnW( ufnW, &dnW );
247 
248  if (dnW) {
249  *dn = strWtoA( dnW );
250  if (!*dn) ret = WLDAP32_LDAP_NO_MEMORY;
251  }
252 
253  strfreeW( ufnW );
254  ldap_memfreeW( dnW );
255 
256 #endif
257  return ret;
258 }
static void strfreeW(LPWSTR str)
Definition: wldap32.h:103
uint16_t * PWCHAR
Definition: typedefs.h:55
static LPSTR strWtoA(LPCWSTR str)
Definition: wldap32.h:62
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
int ret
static LPWSTR strAtoW(const char *str)
unsigned int ULONG
Definition: retypes.h:1
void CDECL ldap_memfreeW(PWCHAR block)
Definition: misc.c:421
ULONG CDECL ldap_ufn2dnW(PWCHAR ufn, PWCHAR *dn)
Definition: dn.c:276

◆ ldap_ufn2dnW()

ULONG CDECL ldap_ufn2dnW ( PWCHAR  ufn,
PWCHAR dn 
)

Definition at line 276 of file dn.c.

277 {
279 #ifdef HAVE_LDAP
280  char *ufnU = NULL;
281 
282  TRACE( "(%s, %p)\n", debugstr_w(ufn), dn );
283 
284  if (!dn) return WLDAP32_LDAP_PARAM_ERROR;
285 
286  *dn = NULL;
287 
288  if (ufn) {
289  ufnU = strWtoU( ufn );
290  if (!ufnU) return WLDAP32_LDAP_NO_MEMORY;
291 
292  /* FIXME: do more than just a copy */
293  *dn = strUtoW( ufnU );
294  if (!*dn) ret = WLDAP32_LDAP_NO_MEMORY;
295  }
296 
297  strfreeU( ufnU );
298 
299 #endif
300  return ret;
301 }
static char * strWtoU(LPCWSTR str)
Definition: wldap32.h:74
static void strfreeU(char *str)
Definition: wldap32.h:108
static LPWSTR strUtoW(char *str)
Definition: wldap32.h:86
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
int ret
unsigned int ULONG
Definition: retypes.h:1

Referenced by ldap_ufn2dnA().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( wldap32  )