Add NetGetJoinInformation().
authorGünther Deschner <gd@samba.org>
Thu, 6 Dec 2007 18:04:49 +0000 (19:04 +0100)
committerGünther Deschner <gd@samba.org>
Fri, 21 Dec 2007 14:29:09 +0000 (15:29 +0100)
Guenther
(This used to be commit d341d251d6e22e9cc1c4596038fd5fe5c7c6c174)

source3/lib/netapi/joindomain.c
source3/lib/netapi/joindomain.h

index 10f7e948358c7990d95879a39f3d8121211f0e10..6da4548f054a3a22f221231657e050b6448d5dd2 100644 (file)
@@ -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;
+}
index 2c71702db7cbc81069897b8aa5355b5ada0ee132..d0badd979d8ee404e0447a50aa2b7d73bcd6f518 100644 (file)
@@ -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);