summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorSamba Release Account <samba-bugs@samba.org>1996-07-01 18:54:02 +0000
committerSamba Release Account <samba-bugs@samba.org>1996-07-01 18:54:02 +0000
commit601281a43bb84f62485929a974c44b69f5c19884 (patch)
tree0c6c5b0e8d5d45d1ba728f7d0c14b08b540447d5 /source3
parent7a804a2e838846715f036e5e93630a4436a4ec4b (diff)
downloadsamba-601281a43bb84f62485929a974c44b69f5c19884.tar.gz
samba-601281a43bb84f62485929a974c44b69f5c19884.tar.bz2
samba-601281a43bb84f62485929a974c44b69f5c19884.zip
patch to fix NetServerEnum with multiple workgroup lists kindly supplied.
it works for him. needs testing. (This used to be commit 546c49080707c0cbaa6bfc928102d52826867592)
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/ipc.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/source3/smbd/ipc.c b/source3/smbd/ipc.c
index 415c939bf3..c5c87ea07f 100644
--- a/source3/smbd/ipc.c
+++ b/source3/smbd/ipc.c
@@ -747,32 +747,45 @@ struct srv_info_struct
/*******************************************************************
filter out unwanted server info
+ This function returns True if the entry is wanted.
******************************************************************/
static BOOL filter_server_info(struct srv_info_struct *server,
BOOL domains,
char *domain, uint32 request)
{
+ /* If no domain was specified, */
if (*domain == 0)
{
+ /* If entry's domain matches this server's domain,
+ accept this entry. */
if (strequal(lp_workgroup(), server->domain)) {
return True;
}
+
+ /* If specific domain requested, reject this entry. */
else if (domains)
{
DEBUG(4,("primary domain:reject %8x %s %s\n",request,server->name,server->domain));
return False;
}
+
+ /* If the request was for a list of domain enumerators,
+ we don't care what domain this entry is in as long
+ as it is a domain enumerator. */
else if ((request & SV_TYPE_DOMAIN_ENUM) &&
(server->type & SV_TYPE_DOMAIN_ENUM))
{
- DEBUG(4,("rej:DOM %8x: %s %s\n",server->type,server->name,server->domain));
- return False;
+ return True;
}
- return True;
+ DEBUG(4,("wrong domain: %8x: %s %s\n",server->type,server->name,server->domain));
+ return False;
}
+
+ /* If a domain name was specified, */
else
{
+ /* If this entry is in the requested domain, */
if (strequal(domain, server->domain))
{
/*
@@ -792,11 +805,15 @@ static BOOL filter_server_info(struct srv_info_struct *server,
return True;
}
+
+ /* If the user didn't pick a domain,
+ (I don't think this can happen.) */
else if (!domains)
{
DEBUG(4,("domain:%s %s %s\n",domain,server->name,server->domain));
return False;
}
+
return True;
}
}
@@ -871,6 +888,7 @@ static int get_server_info(uint32 servertype,
ok = False;
}
+ /* If all server, reject DOMIAN_ENUM entries? */
if ((servertype == ~SV_TYPE_DOMAIN_ENUM) &&
(s->type & SV_TYPE_DOMAIN_ENUM))
{
@@ -878,6 +896,8 @@ static int get_server_info(uint32 servertype,
ok = False;
}
+ /* If a domain is specified, reject all except the
+ domain enumerators for the specified domain. */
if (domains && !(domain && *domain && strequal(domain, s->domain)))
{
if (!(s->type & SV_TYPE_DOMAIN_ENUM))
@@ -1035,11 +1055,13 @@ static BOOL api_RNetServerEnum(int cnum, int uid, char *param, char *data,
if (strcmp(str1, "WrLehDO") == 0)
{
domains = False;
+ DEBUG(4, ("all domains\n"));
}
else if (strcmp(str1, "WrLehDz") == 0)
{
domains = True;
StrnCpy(domain, p, sizeof(fstring)-1);
+ DEBUG(4, ("domains must match \"%s\"\n", domains));
}
if (lp_browse_list())
@@ -1051,6 +1073,7 @@ static BOOL api_RNetServerEnum(int cnum, int uid, char *param, char *data,
qsort(servers,total,sizeof(servers[0]),QSORT_CAST srv_comp);
+ /* A dry run */
{
char *lastname=NULL;
@@ -1085,6 +1108,7 @@ static BOOL api_RNetServerEnum(int cnum, int uid, char *param, char *data,
f_len = fixed_len;
s_len = string_len;
+ /* the real thing */
{
char *lastname=NULL;
int count2 = counted;