Garming Sam via samba-technical
2018-03-29 02:29:25 UTC
Hi,
While looking at automatic site coverage (which has already went
upstream), I noticed that our DC location calls in NETLOGON are
particularly bad. GetDCNameEx only returned WERR_NO_SUCH_DOMAIN when you
asked for a site that the DC did not exist in. Furthermore, it did not
bother checking the domain, which meant that as long as you supplied a
valid site name in both domains, you could get a DC in the wrong domain
returned.
In order to remedy a large amount of the behaviour, I've implemented a
winbind forward call which triggers the dsgetdcname calls (using CLDAP
and DNS) in the winbind DC locator process. This allows arbitrary sites
to be queried for, and by doing so, the trusted domain case also works too.
There are a number of other errors in the RPC call which I have had to
fix, including:
- Failing to forward the error code from GetDCNameEx2 to GetDCNameEx
when it is called internally.
- Returning a more appropriate client site name (and avoid a fallback
that would be wrong in trusted domains)
- Handling of NULL and empty string parameters
There appears to still be issues with querying using a NETBIOS domain
name (including trusted domains), due to winbind sometimes falling back
to NETBIOS queries which have no site-awareness. I've noticed this
against Windows and seen it once in testenv, but the particular test I
expected to fail seems to consistently pass in make test. I've marked
the questionable test in flapping, which may warrant more inspection
later on.
Please review and push.
Cheers,
Garming
While looking at automatic site coverage (which has already went
upstream), I noticed that our DC location calls in NETLOGON are
particularly bad. GetDCNameEx only returned WERR_NO_SUCH_DOMAIN when you
asked for a site that the DC did not exist in. Furthermore, it did not
bother checking the domain, which meant that as long as you supplied a
valid site name in both domains, you could get a DC in the wrong domain
returned.
In order to remedy a large amount of the behaviour, I've implemented a
winbind forward call which triggers the dsgetdcname calls (using CLDAP
and DNS) in the winbind DC locator process. This allows arbitrary sites
to be queried for, and by doing so, the trusted domain case also works too.
There are a number of other errors in the RPC call which I have had to
fix, including:
- Failing to forward the error code from GetDCNameEx2 to GetDCNameEx
when it is called internally.
- Returning a more appropriate client site name (and avoid a fallback
that would be wrong in trusted domains)
- Handling of NULL and empty string parameters
There appears to still be issues with querying using a NETBIOS domain
name (including trusted domains), due to winbind sometimes falling back
to NETBIOS queries which have no site-awareness. I've noticed this
against Windows and seen it once in testenv, but the particular test I
expected to fail seems to consistently pass in make test. I've marked
the questionable test in flapping, which may warrant more inspection
later on.
Please review and push.
Cheers,
Garming