2 * Unix SMB/CIFS implementation.
4 * Copyright (C) Guenther Deschner 2007
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, see <http://www.gnu.org/licenses/>.
22 #include "librpc/gen_ndr/libnetapi.h"
23 #include "lib/netapi/netapi.h"
24 #include "lib/netapi/libnetapi.h"
25 #include "libnet/libnet.h"
27 /********************************************************************
28 ********************************************************************/
30 WERROR NetGetDCName_l(struct libnetapi_ctx *ctx,
31 struct NetGetDCName *r)
33 return WERR_NOT_SUPPORTED;
36 /********************************************************************
37 ********************************************************************/
39 WERROR NetGetDCName_r(struct libnetapi_ctx *ctx,
40 struct NetGetDCName *r)
42 struct cli_state *cli = NULL;
43 struct rpc_pipe_client *pipe_cli = NULL;
47 status = cli_full_connection(&cli, NULL, r->in.server_name,
55 if (!NT_STATUS_IS_OK(status)) {
56 werr = ntstatus_to_werror(status);
60 pipe_cli = cli_rpc_pipe_open_noauth(cli, PI_NETLOGON,
63 werr = ntstatus_to_werror(status);
67 status = rpccli_netr_GetDcName(pipe_cli, ctx,
70 (const char **)r->out.buffer,
80 /********************************************************************
81 ********************************************************************/
83 WERROR NetGetAnyDCName_l(struct libnetapi_ctx *ctx,
84 struct NetGetAnyDCName *r)
86 return WERR_NOT_SUPPORTED;
89 /********************************************************************
90 ********************************************************************/
92 WERROR NetGetAnyDCName_r(struct libnetapi_ctx *ctx,
93 struct NetGetAnyDCName *r)
95 struct cli_state *cli = NULL;
96 struct rpc_pipe_client *pipe_cli = NULL;
100 status = cli_full_connection(&cli, NULL, r->in.server_name,
108 if (!NT_STATUS_IS_OK(status)) {
109 werr = ntstatus_to_werror(status);
113 pipe_cli = cli_rpc_pipe_open_noauth(cli, PI_NETLOGON,
116 werr = ntstatus_to_werror(status);
120 status = rpccli_netr_GetAnyDCName(pipe_cli, ctx,
123 (const char **)r->out.buffer,
125 if (!NT_STATUS_IS_OK(status)) {