summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/netapi/examples/getdc/getdc.c4
-rw-r--r--source3/lib/netapi/getdc.c42
2 files changed, 8 insertions, 38 deletions
diff --git a/source3/lib/netapi/examples/getdc/getdc.c b/source3/lib/netapi/examples/getdc/getdc.c
index cdd4d0b3b4..272ba1088e 100644
--- a/source3/lib/netapi/examples/getdc/getdc.c
+++ b/source3/lib/netapi/examples/getdc/getdc.c
@@ -29,7 +29,7 @@ int main(int argc, char **argv)
{
NET_API_STATUS status;
struct libnetapi_ctx *ctx = NULL;
- uint8_t *buffer;
+ uint8_t *buffer = NULL;
if (argc < 3) {
printf("usage: getdc <hostname> <domain>\n");
@@ -50,7 +50,7 @@ int main(int argc, char **argv)
} else {
printf("%s\n", (char *)buffer);
}
-
+ NetApiBufferFree(buffer);
libnetapi_free(ctx);
return status;
diff --git a/source3/lib/netapi/getdc.c b/source3/lib/netapi/getdc.c
index 85a0ae52ef..484af04a55 100644
--- a/source3/lib/netapi/getdc.c
+++ b/source3/lib/netapi/getdc.c
@@ -22,22 +22,6 @@
#include "lib/netapi/netapi.h"
#include "libnet/libnet.h"
-#if 0
-#include "librpc/gen_ndr/cli_netlogon.h"
-#endif
-
-NTSTATUS rpccli_netr_GetDcName(struct rpc_pipe_client *cli,
- TALLOC_CTX *mem_ctx,
- const char *logon_server,
- const char *domainname,
- const char **dcname);
-NTSTATUS rpccli_netr_GetAnyDCName(struct rpc_pipe_client *cli,
- TALLOC_CTX *mem_ctx,
- const char *logon_server,
- const char *domainname,
- const char **dcname,
- WERROR *werror);
-
static WERROR NetGetDCNameLocal(struct libnetapi_ctx *ctx,
const char *server_name,
const char *domain_name,
@@ -76,17 +60,11 @@ static WERROR NetGetDCNameRemote(struct libnetapi_ctx *ctx,
goto done;
};
-#if 0
- werr = rpccli_netr_GetDcName(pipe_cli, ctx,
- server_name,
- domain_name,
- (const char **)&buffer);
-#else
- werr = rpccli_netlogon_getdcname(pipe_cli, ctx,
- server_name,
- domain_name,
- (char **)buffer);
-#endif
+ status = rpccli_netr_GetDcName(pipe_cli, ctx,
+ server_name,
+ domain_name,
+ (const char **)buffer);
+ werr = ntstatus_to_werror(status);
done:
if (cli) {
cli_shutdown(cli);
@@ -175,22 +153,14 @@ static WERROR NetGetAnyDCNameRemote(struct libnetapi_ctx *ctx,
goto done;
};
-#if 0
status = rpccli_netr_GetAnyDCName(pipe_cli, ctx,
server_name,
domain_name,
- (const char **)&buffer,
+ (const char **)buffer,
&werr);
if (!NT_STATUS_IS_OK(status)) {
- werr = ntstatus_to_werror(status);
goto done;
}
-#else
- werr = rpccli_netlogon_getanydcname(pipe_cli, ctx,
- server_name,
- domain_name,
- (char **)buffer);
-#endif
done:
if (cli) {
cli_shutdown(cli);