s3:libsmb: don't reuse the callers stype variable in cli_NetServerEnum()
authorStefan Metzmacher <metze@samba.org>
Thu, 4 Feb 2010 13:03:20 +0000 (14:03 +0100)
committerKarolin Seeger <kseeger@samba.org>
Fri, 5 Feb 2010 10:32:15 +0000 (11:32 +0100)
When we need to do more than one network operation to get the
browse list we need to use the same 'stype' value each time.

metze

Signed-off-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit c2e4746fa9d68e7601e8e90cc0144d2e65a695b6)

Fix bug #7098 (smbclient -L gives wrong results with a large browse list).

source3/libsmb/clirap.c

index 3f95e77aeec31a0ff227f15321de17ddb9945241..9705cac7d758288f45720070734182cdef4d8aa6 100644 (file)
@@ -341,6 +341,7 @@ bool cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32 stype,
                                const char *p1;
                                char *s1, *s2;
                                TALLOC_CTX *frame = talloc_stackframe();
+                               uint32_t entry_stype;
 
                                if (p + 26 > rdata_end) {
                                        TALLOC_FREE(frame);
@@ -364,7 +365,7 @@ bool cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32 stype,
                                        len++;
                                }
 
-                               stype = IVAL(p,18) & ~SV_TYPE_LOCAL_LIST_ONLY;
+                               entry_stype = IVAL(p,18) & ~SV_TYPE_LOCAL_LIST_ONLY;
 
                                pull_string_talloc(frame,rdata,0,
                                        &s1,sname,16,STR_ASCII);
@@ -376,7 +377,7 @@ bool cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32 stype,
                                        continue;
                                }
 
-                               fn(s1, stype, s2, state);
+                               fn(s1, entry_stype, s2, state);
                                TALLOC_FREE(frame);
                        }