summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1996-07-22 12:00:39 +0000
committerAndrew Tridgell <tridge@samba.org>1996-07-22 12:00:39 +0000
commit6fa3468c9ba50a4de39e3bdc1c976f363fb6a412 (patch)
tree9f18a70eafa5f675fb5270ec394be21354dadcdd /source
parentfd6c3dfffdb204ef75c1f235174da8e65b68f472 (diff)
downloadsamba-6fa3468c9ba50a4de39e3bdc1c976f363fb6a412.tar.gz
samba-6fa3468c9ba50a4de39e3bdc1c976f363fb6a412.tar.xz
samba-6fa3468c9ba50a4de39e3bdc1c976f363fb6a412.zip
fix up problems with "smbclient -L". It now uses a generic
NetServerEnum with no workgroup attached if the workgroup is "WORKGROUP" (the default in the Makefile) and uses the specific NetServerEnum (with workgroup attached) otherwise.
Diffstat (limited to 'source')
-rw-r--r--source/client/client.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/source/client/client.c b/source/client/client.c
index 27837d08dcb..1bd91d3d7ae 100644
--- a/source/client/client.c
+++ b/source/client/client.c
@@ -3590,35 +3590,44 @@ static BOOL list_servers(char *wk_grp)
char *rparam = NULL;
char *rdata = NULL;
int rdrcnt,rprcnt;
- char *p;
+ char *p,*svtype_p;
pstring param;
int uLevel = 1;
int count = 0;
BOOL ok = False;
+ BOOL generic_request = False;
+
+
+ if (strequal(wk_grp,"WORKGROUP")) {
+ /* we won't specify a workgroup */
+ generic_request = True;
+ }
/* now send a SMBtrans command with api ServerEnum? */
p = param;
SSVAL(p,0,0x68); /* api number */
p += 2;
- strcpy(p,"WrLehDz");
+
+ strcpy(p,generic_request?"WrLehDO":"WrLehDz");
p = skip_string(p,1);
strcpy(p,"B16BBDz");
-#if 0
- strcpy(p,getenv("XX_STR2"));
-#endif
p = skip_string(p,1);
SSVAL(p,0,uLevel);
SSVAL(p,2,0x2000); /* buf length */
p += 4;
- SIVAL(p,0,SV_TYPE_ALL);
-
+ svtype_p = p;
p += 4;
- strcpy(p, wk_grp);
- p = skip_string(p,1);
+ if (!generic_request) {
+ strcpy(p, wk_grp);
+ p = skip_string(p,1);
+ }
+
+ /* first ask for a list of servers in this workgroup */
+ SIVAL(svtype_p,0,SV_TYPE_ALL);
if (call_api(PTR_DIFF(p+4,param),0,
8,10000,
@@ -3656,7 +3665,8 @@ static BOOL list_servers(char *wk_grp)
if (rparam) {free(rparam); rparam = NULL;}
if (rdata) {free(rdata); rdata = NULL;}
- SIVAL(p,0,0x7fffffff);
+ /* now ask for a list of workgroups */
+ SIVAL(svtype_p,0,SV_TYPE_DOMAIN_ENUM);
if (call_api(PTR_DIFF(p+4,param),0,
8,10000,