summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2010-02-08 18:38:03 +0100
committerStefan Metzmacher <metze@samba.org>2010-02-08 18:47:41 +0100
commit9b5198dd443a00fdad4faa1f9cdabedd81012d93 (patch)
treed26ab63d11034f220a018722dd48a2105626f10a /source3/libsmb
parent30eec0656c926d3d85a438dc28f17649b53318f8 (diff)
downloadsamba-9b5198dd443a00fdad4faa1f9cdabedd81012d93.tar.gz
samba-9b5198dd443a00fdad4faa1f9cdabedd81012d93.tar.bz2
samba-9b5198dd443a00fdad4faa1f9cdabedd81012d93.zip
s3:libsmb: fix NetServerEnum3 rap calls.
metze
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/clirap.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/source3/libsmb/clirap.c b/source3/libsmb/clirap.c
index a9a13f7b96..7f6dbf5bbb 100644
--- a/source3/libsmb/clirap.c
+++ b/source3/libsmb/clirap.c
@@ -248,11 +248,9 @@ bool cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32 stype,
p = param;
SIVAL(p,0,func); /* api number */
p += 2;
- /* Next time through we need to use the continue api */
- func = RAP_NetServerEnum3;
- if (last_entry) {
- strlcpy(p,"WrLehDOz", sizeof(param)-PTR_DIFF(p,param));
+ if (func == RAP_NetServerEnum3) {
+ strlcpy(p,"WrLehDzz", sizeof(param)-PTR_DIFF(p,param));
} else {
strlcpy(p,"WrLehDz", sizeof(param)-PTR_DIFF(p,param));
}
@@ -271,7 +269,7 @@ bool cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32 stype,
* to continue from.
*/
len = push_ascii(p,
- last_entry ? last_entry : workgroup,
+ workgroup,
sizeof(param) - PTR_DIFF(p,param) - 1,
STR_TERMINATE|STR_UPPER);
@@ -281,6 +279,22 @@ bool cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32 stype,
}
p += len;
+ if (func == RAP_NetServerEnum3) {
+ len = push_ascii(p,
+ last_entry ? last_entry : "",
+ sizeof(param) - PTR_DIFF(p,param) - 1,
+ STR_TERMINATE);
+
+ if (len == (size_t)-1) {
+ SAFE_FREE(last_entry);
+ return false;
+ }
+ p += len;
+ }
+
+ /* Next time through we need to use the continue api */
+ func = RAP_NetServerEnum3;
+
if (!cli_api(cli,
param, PTR_DIFF(p,param), 8, /* params, length, max */
NULL, 0, CLI_BUFFER_SIZE, /* data, length, max */