From 05202a5d4ef3326db3d43feff2bef5271850296b Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 8 Apr 2008 18:43:51 +0200 Subject: Add DsGetDcName call to libnetapi library. Guenther (This used to be commit 27780e984152e38c8f80e1c67ddf13b73a2b220d) --- source3/lib/netapi/libnetapi.c | 50 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) (limited to 'source3/lib/netapi/libnetapi.c') diff --git a/source3/lib/netapi/libnetapi.c b/source3/lib/netapi/libnetapi.c index 9d42b7e97c..ed97df2143 100644 --- a/source3/lib/netapi/libnetapi.c +++ b/source3/lib/netapi/libnetapi.c @@ -391,3 +391,53 @@ NET_API_STATUS NetGetAnyDCName(const char * server_name /* [in] [unique] */, return r.out.result; } +/**************************************************************** + DsGetDcName +****************************************************************/ + +NET_API_STATUS DsGetDcName(const char * server_name /* [in] [unique] */, + const char * domain_name /* [in] [ref] */, + struct GUID *domain_guid /* [in] [unique] */, + const char * site_name /* [in] [unique] */, + uint32_t flags /* [in] */, + struct DOMAIN_CONTROLLER_INFO **dc_info /* [out] [ref] */) +{ + struct DsGetDcName r; + struct libnetapi_ctx *ctx = NULL; + NET_API_STATUS status; + WERROR werr; + + status = libnetapi_getctx(&ctx); + if (status != 0) { + return status; + } + + /* In parameters */ + r.in.server_name = server_name; + r.in.domain_name = domain_name; + r.in.domain_guid = domain_guid; + r.in.site_name = site_name; + r.in.flags = flags; + + /* Out parameters */ + r.out.dc_info = dc_info; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(DsGetDcName, &r); + } + + if (LIBNETAPI_LOCAL_SERVER(server_name)) { + werr = DsGetDcName_l(ctx, &r); + } else { + werr = DsGetDcName_r(ctx, &r); + } + + r.out.result = W_ERROR_V(werr); + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(DsGetDcName, &r); + } + + return r.out.result; +} + -- cgit