diff options
author | Günther Deschner <gd@samba.org> | 2007-12-06 19:04:49 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2007-12-21 15:29:09 +0100 |
commit | 72ffac399077ad7777f1282c94d9b661e7fa53fb (patch) | |
tree | 8b88f2bd4efbd4715ecb73d85fd7cc4188e185d0 | |
parent | c000a166459468e0cfd5277fa717f8fc9ed8311f (diff) | |
download | samba-72ffac399077ad7777f1282c94d9b661e7fa53fb.tar.gz samba-72ffac399077ad7777f1282c94d9b661e7fa53fb.tar.bz2 samba-72ffac399077ad7777f1282c94d9b661e7fa53fb.zip |
Add NetGetJoinInformation().
Guenther
(This used to be commit d341d251d6e22e9cc1c4596038fd5fe5c7c6c174)
-rw-r--r-- | source3/lib/netapi/joindomain.c | 53 | ||||
-rw-r--r-- | source3/lib/netapi/joindomain.h | 3 |
2 files changed, 56 insertions, 0 deletions
diff --git a/source3/lib/netapi/joindomain.c b/source3/lib/netapi/joindomain.c index 10f7e94835..6da4548f05 100644 --- a/source3/lib/netapi/joindomain.c +++ b/source3/lib/netapi/joindomain.c @@ -181,3 +181,56 @@ WERROR NetUnjoinDomain(const char *server_name, return werr; } + +WERROR NetGetJoinInformation(const char *server_name, + const char **name_buffer, + uint16_t *name_type) +{ + TALLOC_CTX *mem_ctx = NULL; + struct cli_state *cli = NULL; + struct rpc_pipe_client *pipe_cli = NULL; + NTSTATUS status; + WERROR werr; + + mem_ctx = talloc_init("NetGetJoinInformation"); + if (!mem_ctx) { + werr = WERR_NOMEM; + goto done; + } + + status = cli_full_connection(&cli, NULL, server_name, + NULL, 0, + "IPC$", "IPC", + opt_user_name, opt_workgroup, + opt_password, 0, Undefined, NULL); + + if (!NT_STATUS_IS_OK(status)) { + werr = ntstatus_to_werror(status); + goto done; + } + + pipe_cli = cli_rpc_pipe_open_noauth(cli, PI_WKSSVC, + &status); + if (!pipe_cli) { + werr = ntstatus_to_werror(status); + goto done; + }; + + status = rpccli_wkssvc_NetrGetJoinInformation(pipe_cli, mem_ctx, + server_name, + name_buffer, + (enum wkssvc_NetJoinStatus *)name_type, + &werr); + if (!NT_STATUS_IS_OK(status)) { + werr = ntstatus_to_werror(status); + goto done; + } + + done: + if (cli) { + cli_shutdown(cli); + } + TALLOC_FREE(mem_ctx); + + return werr; +} diff --git a/source3/lib/netapi/joindomain.h b/source3/lib/netapi/joindomain.h index 2c71702db7..d0badd979d 100644 --- a/source3/lib/netapi/joindomain.h +++ b/source3/lib/netapi/joindomain.h @@ -27,3 +27,6 @@ WERROR NetUnjoinDomain(const char *server_name, const char *account, const char *password, uint32_t unjoin_flags); +WERROR NetGetJoinInformation(const char *server_name, + const char **name_buffer, + uint16_t *name_type); |