Cygwin: ldap: Fix overwriting domain when creating naming context
cyg_ldap::fetch_ad_account creates a naming context from the incoming domain, if it's not NULL. The algorithm overwrites dots with \0 in domain while creating the naming context, but neglects to restore the dots. Fix that by never overwriting the incoming domain name. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
parent
40958b0d86
commit
6c86b85f4e
|
@ -7,6 +7,10 @@ Cygwin license. Please consult the file "CYGWIN_LICENSE" for
|
||||||
details. */
|
details. */
|
||||||
|
|
||||||
#include "winsup.h"
|
#include "winsup.h"
|
||||||
|
#include <lm.h>
|
||||||
|
#include <dsgetdc.h>
|
||||||
|
#include <iptypes.h>
|
||||||
|
#include <sys/param.h>
|
||||||
#include "ldap.h"
|
#include "ldap.h"
|
||||||
#include "cygerrno.h"
|
#include "cygerrno.h"
|
||||||
#include "security.h"
|
#include "security.h"
|
||||||
|
@ -16,10 +20,7 @@ details. */
|
||||||
#include "cygheap.h"
|
#include "cygheap.h"
|
||||||
#include "registry.h"
|
#include "registry.h"
|
||||||
#include "pinfo.h"
|
#include "pinfo.h"
|
||||||
#include "lm.h"
|
|
||||||
#include "dsgetdc.h"
|
|
||||||
#include "tls_pbuf.h"
|
#include "tls_pbuf.h"
|
||||||
#include <sys/param.h>
|
|
||||||
|
|
||||||
#define CYG_LDAP_ENUM_PAGESIZE 100 /* entries per page */
|
#define CYG_LDAP_ENUM_PAGESIZE 100 /* entries per page */
|
||||||
|
|
||||||
|
@ -452,16 +453,15 @@ cyg_ldap::fetch_ad_account (PSID sid, bool group, PCWSTR domain)
|
||||||
problems, we know what to do. */
|
problems, we know what to do. */
|
||||||
base = tp.w_get ();
|
base = tp.w_get ();
|
||||||
PWCHAR b = base;
|
PWCHAR b = base;
|
||||||
for (PWCHAR dotp = (PWCHAR) domain; dotp && *dotp; domain = dotp)
|
for (PCWSTR dotp = domain; dotp && *dotp; domain = dotp)
|
||||||
{
|
{
|
||||||
dotp = wcschr (domain, L'.');
|
dotp = wcschr (domain, L'.');
|
||||||
if (dotp)
|
|
||||||
*dotp++ = L'\0';
|
|
||||||
if (b > base)
|
if (b > base)
|
||||||
*b++ = L',';
|
*b++ = L',';
|
||||||
b = wcpcpy (b, L"DC=");
|
b = wcpcpy (b, L"DC=");
|
||||||
b = wcpcpy (b, domain);
|
b = dotp ? wcpncpy (b, domain, dotp++ - domain) : wcpcpy (b, domain);
|
||||||
}
|
}
|
||||||
|
debug_printf ("naming context <%W>", base);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue