Skip to content

ldap: Stop using wide char version of ldapp_err2string#4272

Closed
jay wants to merge 1 commit intocurl:masterfrom
jay:fix_winldap_errstring
Closed

ldap: Stop using wide char version of ldapp_err2string#4272
jay wants to merge 1 commit intocurl:masterfrom
jay:fix_winldap_errstring

Conversation

@jay
Copy link
Member

@jay jay commented Aug 27, 2019

Despite ldapp_err2string being documented by MS as returning a
PCHAR (char *), when UNICODE it is mapped to ldap_err2stringW and
returns PWCHAR (wchar_t *).

We have lots of code like that expects ldap_err2string to return char *,
most of it failf used like this:

failf(data, "LDAP local: Some error: %s", ldap_err2string(rc));

Closes #xxxx


This from
Winldap.h in 7.0A:

#ifndef LDAP_UNICODE
#ifdef UNICODE
#define LDAP_UNICODE 1
#else
#define LDAP_UNICODE 0
#endif
#endif

...

#if LDAP_UNICODE

#define ldap_err2string ldap_err2stringW

...

https://docs.microsoft.com/en-us/windows/win32/api/winldap/nf-winldap-ldap_err2string

@jay jay requested a review from captain-caveman2k August 27, 2019 18:22
Despite ldapp_err2string being documented by MS as returning a
PCHAR (char *), when UNICODE it is mapped to ldap_err2stringW and
returns PWCHAR (wchar_t *).

We have lots of code like that expects ldap_err2string to return char *,
most of it failf used like this:

failf(data, "LDAP local: Some error: %s", ldap_err2string(rc));

Closes #xxxx
@jay jay force-pushed the fix_winldap_errstring branch from 0d33fbd to 853822f Compare September 9, 2019 06:36
@jay jay requested a review from MarcelRaad September 9, 2019 06:38
@jay jay added the LDAP label Sep 9, 2019
@jay jay closed this in 08f9698 Sep 11, 2019
@jay jay deleted the fix_winldap_errstring branch September 11, 2019 07:05
@lock lock bot locked as resolved and limited conversation to collaborators Dec 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Development

Successfully merging this pull request may close these issues.

2 participants