From 518f2fc391266c2f9b9cfc8b485a8e57ce359be8 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 21 Feb 2001 02:52:41 +0000 Subject: reverted richards cli_NetServerEnum changes - they broke lots of things (This used to be commit 86adbb0caf26a8c2fc4d3748b965c0ce79360c1a) --- source3/libsmb/clirap.c | 68 +++++++++---------------------------------------- 1 file changed, 12 insertions(+), 56 deletions(-) (limited to 'source3/libsmb') 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); } } } -- cgit