Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ldap: Stop using wide char version of ldapp_err2string #4272

Closed
wants to merge 1 commit into from

Conversation

@jay
Copy link
Member

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 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
@jay jay force-pushed the jay:fix_winldap_errstring branch from 0d33fbd to 853822f Sep 9, 2019
@jay jay requested a review from MarcelRaad Sep 9, 2019
@jay jay added the LDAP label Sep 9, 2019
@jay jay closed this in 08f9698 Sep 11, 2019
@jay jay deleted the jay:fix_winldap_errstring branch Sep 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.