]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3-net: Fix Bug #6102. NetQueryDisplayInformation could return wrong information.
authorGünther Deschner <gd@samba.org>
Thu, 26 Mar 2009 09:41:11 +0000 (10:41 +0100)
committerGünther Deschner <gd@samba.org>
Thu, 26 Mar 2009 09:41:11 +0000 (10:41 +0100)
Guenther

source/lib/netapi/user.c

index 05a051067adcce5e47de71e857071d8a8da286b4..b31d8384be2baaf325f85c8e27aa50e3bd120039 100644 (file)
@@ -899,6 +899,9 @@ WERROR NetQueryDisplayInformation_r(struct libnetapi_ctx *ctx,
 
        NTSTATUS status;
        WERROR werr;
+       WERROR werr_tmp;
+
+       *r->out.entries_read = 0;
 
        ZERO_STRUCT(connect_handle);
        ZERO_STRUCT(domain_handle);
@@ -992,15 +995,18 @@ WERROR NetQueryDisplayInformation_r(struct libnetapi_ctx *ctx,
                                               &total_size,
                                               &returned_size,
                                               &info);
-       if (!NT_STATUS_IS_OK(status)) {
-               werr = ntstatus_to_werror(status);
+       werr = ntstatus_to_werror(status);
+       if (NT_STATUS_IS_ERR(status)) {
                goto done;
        }
 
-       werr = convert_samr_dispinfo_to_NET_DISPLAY(ctx, &info,
-                                                   r->in.level,
-                                                   r->out.entries_read,
-                                                   r->out.buffer);
+       werr_tmp = convert_samr_dispinfo_to_NET_DISPLAY(ctx, &info,
+                                                       r->in.level,
+                                                       r->out.entries_read,
+                                                       r->out.buffer);
+       if (!W_ERROR_IS_OK(werr_tmp)) {
+               werr = werr_tmp;
+       }
  done:
        if (!cli) {
                return werr;