summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/libsmb/clirap.c68
1 files changed, 12 insertions, 56 deletions
diff --git a/source3/libsmb/clirap.c b/source3/libsmb/clirap.c
index d1ce4d712e..bf0940d1d6 100644
--- a/source3/libsmb/clirap.c
+++ b/source3/libsmb/clirap.c
@@ -218,36 +218,14 @@ BOOL cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32 stype,
int uLevel = 1;
int count = -1;
- /*
- * First, check that the stype is reasonable ...
- */
-
- if (stype&0x80000000 && stype&0x7FFFFFFF) {
-
- /* Set an error here ... */
-
- return False;
-
- }
-
/* send a SMBtrans command with api NetServerEnum */
p = param;
SSVAL(p,0,0x68); /* api number */
p += 2;
- if (!(stype&0x80000000))
- pstrcpy(p,"WrLehDz");
- else
- pstrcpy(p,"WrLehDO");
+ pstrcpy(p,"WrLehDz");
p = skip_string(p,1);
- if (!(stype&0x80000000)) {
- pstrcpy(p,"B16BBDz");
- uLevel = 1;
- }
- else {
- pstrcpy(p,"B16");
- uLevel = 0;
- }
+ pstrcpy(p,"B16BBDz");
p = skip_string(p,1);
SSVAL(p,0,uLevel);
@@ -257,7 +235,7 @@ BOOL cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32 stype,
p += 4;
p += clistr_push(cli, p, workgroup, -1,
- CLISTR_TERMINATE | CLISTR_CONVERT);
+ CLISTR_TERMINATE | CLISTR_CONVERT | CLISTR_ASCII);
if (cli_api(cli,
param, PTR_DIFF(p,param), 8, /* params, length, max */
@@ -274,39 +252,17 @@ BOOL cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32 stype,
count=SVAL(rparam,4);
p = rdata;
- if (!(stype&0x80000000)) {
- for (i = 0;i < count;i++, p += 26) {
- fstring sname, cmnt;
- int comment_offset = (IVAL(p,22) & 0xFFFF)-converter;
- char *cptr = comment_offset?(rdata+comment_offset):NULL;
- if (comment_offset < 0 || comment_offset > rdrcnt) continue;
-
- stype = IVAL(p,18) & ~SV_TYPE_LOCAL_LIST_ONLY;
- clistr_pull(cli, sname, p,
- sizeof(fstring), -1,
- CLISTR_TERMINATE |
- CLISTR_CONVERT);
- fstrcpy(cmnt, "");
- if (cptr) {
- clistr_pull(cli, cmnt, cptr,
- sizeof(fstring), -1,
- CLISTR_TERMINATE |
- CLISTR_CONVERT);
- }
- fn(sname, stype, cmnt, state);
- }
- }
- else {
- for (i = 0; i < count; i++, p+= 16) {
- fstring sname;
+ for (i = 0;i < count;i++, p += 26) {
+ char *sname = p;
+ int comment_offset = (IVAL(p,22) & 0xFFFF)-converter;
+ char *cmnt = comment_offset?(rdata+comment_offset):"";
+ if (comment_offset < 0 || comment_offset > rdrcnt) continue;
- clistr_pull(cli, sname, p,
- sizeof(fstring), -1,
- CLISTR_TERMINATE |
- CLISTR_CONVERT);
+ stype = IVAL(p,18) & ~SV_TYPE_LOCAL_LIST_ONLY;
- fn(sname, stype, NULL, state);
- }
+ dos_to_unix(sname, True);
+ dos_to_unix(cmnt, True);
+ fn(sname, stype, cmnt, state);
}
}
}