diff options
author | Stefan Metzmacher <metze@samba.org> | 2010-02-08 18:38:03 +0100 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2010-02-24 16:25:10 +0100 |
commit | 0d86cb0fd92fc30541bc586cbb9098eb39dbfee6 (patch) | |
tree | eb5e5c8b9423081928db6809bc72900fd554c628 | |
parent | 5657bfc7c85827969933c57d5193b214215c279c (diff) | |
download | samba-0d86cb0fd92fc30541bc586cbb9098eb39dbfee6.tar.gz samba-0d86cb0fd92fc30541bc586cbb9098eb39dbfee6.tar.xz samba-0d86cb0fd92fc30541bc586cbb9098eb39dbfee6.zip |
s3:libsmb: fix NetServerEnum3 rap calls.
metze
(cherry picked from commit 9b5198dd443a00fdad4faa1f9cdabedd81012d93)
(cherry picked from commit 98399a69d6fc3d30c899588c8846ce19ef974fa3)
-rw-r--r-- | source/libsmb/clirap.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/source/libsmb/clirap.c b/source/libsmb/clirap.c index d248d0cdd1b..116e0a91759 100644 --- a/source/libsmb/clirap.c +++ b/source/libsmb/clirap.c @@ -270,11 +270,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)); } @@ -293,7 +291,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); @@ -303,6 +301,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 */ |