]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
netapi: fix returned name buffer in NetGetJoinInformation_r().
authorGünther Deschner <gd@samba.org>
Tue, 29 Apr 2008 18:11:02 +0000 (20:11 +0200)
committerGünther Deschner <gd@samba.org>
Wed, 21 May 2008 10:39:48 +0000 (12:39 +0200)
Guenther
(cherry picked from commit 0e8e05d556a7f84e500cca3fa858f9b4a9522a5f)

source/lib/netapi/joindomain.c

index 8e0a62e820b392f4a3b5006640afcf8ef3336d65..74ed8f2302f1e66fbd83922d3eeefaece659091c 100644 (file)
@@ -282,6 +282,7 @@ WERROR NetGetJoinInformation_r(struct libnetapi_ctx *ctx,
        struct rpc_pipe_client *pipe_cli = NULL;
        NTSTATUS status;
        WERROR werr;
+       const char *buffer = NULL;
 
        werr = libnetapi_open_ipc_connection(ctx, r->in.server_name, &cli);
        if (!W_ERROR_IS_OK(werr)) {
@@ -295,7 +296,7 @@ WERROR NetGetJoinInformation_r(struct libnetapi_ctx *ctx,
 
        status = rpccli_wkssvc_NetrGetJoinInformation(pipe_cli, ctx,
                                                      r->in.server_name,
-                                                     r->out.name_buffer,
+                                                     &buffer,
                                                      (enum wkssvc_NetJoinStatus *)r->out.name_type,
                                                      &werr);
        if (!NT_STATUS_IS_OK(status)) {
@@ -303,6 +304,9 @@ WERROR NetGetJoinInformation_r(struct libnetapi_ctx *ctx,
                goto done;
        }
 
+       *r->out.name_buffer = talloc_strdup(ctx, buffer);
+       W_ERROR_HAVE_NO_MEMORY(*r->out.name_buffer);
+
  done:
        return werr;
 }