summaryrefslogtreecommitdiff
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
commit124beb45f857a83a4b7fca0480a56beae2753be7 (patch)
treeb63a577699cd63223c5999ad2f759b70082ec0d0
parent413db88cc7103c44e0be2310d37739c98ab2ed39 (diff)
downloadsamba-124beb45f857a83a4b7fca0480a56beae2753be7.tar.gz
samba-124beb45f857a83a4b7fca0480a56beae2753be7.tar.bz2
samba-124beb45f857a83a4b7fca0480a56beae2753be7.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. (This used to be commit 6fa3468c9ba50a4de39e3bdc1c976f363fb6a412)
-rw-r--r--source3/client/client.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/source3/client/client.c b/source3/client/client.c
index 27837d08dc..1bd91d3d7a 100644
--- a/source3/client/client.c
+++ b/source3/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,