Bug 17248 – Multiple wrong function definitions in core.sys.windows.winldap (causing runtime issues)
Status
RESOLVED
Resolution
FIXED
Severity
minor
Priority
P1
Component
druntime
Product
D
Version
D2
Platform
All
OS
Windows
Creation time
2017-03-09T13:30:02Z
Last change time
2019-05-23T06:18:43Z
Keywords
pull
Assigned to
No Owner
Creator
Jan Jurzitza
Comments
Comment #0 by d.bugs — 2017-03-09T13:30:02Z
PCHAR[] and PWCHAR[] have been used in function definitions where they should have been PCHAR* and PWCHAR*. This doesn't cause the linker to fail but the windows api will throw LDAP_PARAM_ERROR on runtime because it is not possible to pass a valid argument there.
For example in ldap_search_s you should be able to pass null to receive all attributes, however it will always crash when the function definition argument uses []. Replacing it with a definition using a pointer will fix the issue and it will properly call it. Passing a list of arguments (null terminated) doesn't work either (same issue).
Functions I have checked that are affected by this and get fixed by replacing the [] with * (always both A and W version):
ldap_search_ext
ldap_search_ext_s
ldap_search
ldap_search_s
ldap_search_st
Functions that are probably affected by this (but untested):
ldap_modify_ext
ldap_modify_ext_s
ldap_modify
ldap_modify_s
ldap_add_ext
ldap_add_ext_s
ldap_add
ldap_add_s
ldap_search_init_page
Comment #1 by dlang-bot — 2019-05-11T12:07:24Z
@WebFreak001 created dlang/druntime pull request #2603 "fix ldap bindings, fix issue 17248" fixing this issue:
- fix ldap bindings, fix issue 17248
Looked up and corrected most LDAP methods:
changed char* (PCHAR) arguments to
const(char)* (PCSTR) where documentation say const
Renamed some types like in the documentation (purely aesthetic)
Fixed a PLDAPControlW actually being PLDAPControlA in an ASCII method
Changed [] arguments to * (fixed the referenced issue)
https://github.com/dlang/druntime/pull/2603
Comment #2 by dlang-bot — 2019-05-23T06:18:43Z
dlang/druntime pull request #2603 "fix ldap bindings, fix issue 17248" was merged into stable:
- c4e2f9fb7de19f5da9b8e6af462eacad39a01b91 by WebFreak001:
fix ldap bindings, fix issue 17248
Looked up and corrected most LDAP methods:
changed char* (PCHAR) arguments to
const(char)* (PCSTR) where documentation say const
Renamed some types like in the documentation (purely aesthetic)
Fixed a PLDAPControlW actually being PLDAPControlA in an ASCII method
Changed [] arguments to * (fixed the referenced issue)
https://github.com/dlang/druntime/pull/2603