b3700b074e637f8c6991b70754c88a2cfffb246bGordon Ross * This file and its contents are supplied under the terms of the
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Ross * Common Development and Distribution License ("CDDL"), version 1.0.
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Ross * You may only use this file in accordance with the terms of version
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Ross * 1.0 of the CDDL.
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Ross * A full copy of the text of the CDDL should have accompanied this
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Ross * source. A copy of the CDDL is also available via the Internet at
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Ross * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Ross * MS-compatible Directory Server Discovery API, DsGetDC...()
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Ross * The Windows version of this would return a single allocation,
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Ross * where any strings pointed to in the returned structure would be
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Ross * stored in space following the top-level returned structure.
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Ross * This allows NetApiBufferFree() to be the same as free().
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Ross * However, we don't have an easy way to do that right now, so
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Ross * the dcinfo returned here will be free'd with DsFreeDcInfo().
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Ross const char *DomainName, const struct uuid *DomainGuid,
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Ross * Later check for over constrained optional args here,
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Ross * and return (ERROR_INVALID_PARAMETER);
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Ross * Call the ADS deamon.
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Ross clnt = clnt_door_create(ADSPRIV_PROGRAM, ADSPRIV_V1, ADSPRIV_MAX_XFER);
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Ross (xdrproc_t)xdr_DsGetDcNameRes, (caddr_t)&res, TIMEOUT);
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Ross * We have taken pains to make these two the same.
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Ross * DOMAIN_CONTROLLER_INFO / struct adspriv_dcinfo
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Ross /* LINTED E_TRUE_LOGICAL_EXPR */
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Ross assert(sizeof (**dcinfo) == sizeof (res.DsGetDcNameRes_u.res0));
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Ross (void) memcpy(*dcinfo, &res.DsGetDcNameRes_u.res0, sizeof (**dcinfo));
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Ross * NB: Do NOT xdr_free the result, because we're
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Ross * returning a copy of it to the caller.
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Ross const char *DomainName, const struct uuid *DomainGuid,
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Ross status = _DsGetDcName(ComputerName, DomainName, DomainGuid,
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Ross case NT_STATUS_NO_SUCH_DOMAIN: /* Specified domain unknown */
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Ross case NT_STATUS_CANT_WAIT: /* or gave up waiting. */
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Ross case NT_STATUS_INVALID_SERVER_STATE: /* not in domain mode. */