patch for filtering browsing and for dns resolving

Dmitry Melekhov dm at belkam.com
Sat Apr 3 06:21:48 GMT 2004


Hello!

Here are diffs for
lib/util_str.c
param/loadparam.c
nmbd/asyncdns.c
nmbd/nmbd_workgroupdb.c

against 3.0.2a

This patch adds two parameters:


1. browse workgroups=BELKAM,UPN-CHR

Only listed workgroups will be browsed.
This is very helpfull in our enviroment, where we had about 100 
workgroups, but really need 2 :-)
It is impossible to stop our technicians and people from other companies 
with notebooks ;-)))

If parameter doesn't present, all works as usual.


2.  dns domains = .npu1.belkam.com

resolv.conf allows only 6 domains in search.
This is, certanly, not enough for distributed enviroment, with many 
subnets, especially because wins replication is still not implemented.
Without this parameter all works as usual, with this parameter nmbd 
tries to resolve name in listed domains too.
btw, I think that DDNS is better than WINS replication :-)

And, thanks to Valery Zhechenko.
He wrote prototypes of C code, which I then used with cut&puste 
technique :-) ,
just because I'm not programmer.



-------------- next part --------------
84a85,86
>         char **p;
> 
95a98,117
> 		if (!r.result.s_addr) {
> 		
> 		/*name wasn't resloved without adding domain name, we'll try domains from list*/
> 		
> 			    p=lp_dns_domains_list();
> 			    
> 			    while (*p)
> 		           {
> 		                fstrcpy(qname, r.name.name);
>                 		fstrcat(qname,*p);
> 
> 		                if (r.result.s_addr = interpret_addr(qname)) {
>                 			  break;
> 		                }
>                 		*p++;
> 
>          		  }
> 		}
> 
> 
-------------- next part --------------
135a136
>         char **szBrowseWorkgroups; /*list of workgroups for browinsg, if empty-all */
237a239
>         char **szDNSDomains;
1031c1033
< 
---
> 	{"browse workgroups", P_LIST, P_GLOBAL, &Globals.szBrowseWorkgroups, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD},
1034a1037
> 	{"dns domains", P_LIST, P_GLOBAL, &Globals.szDNSDomains, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD},
1645a1649,1650
> FN_GLOBAL_LIST(lp_browse_workgroups_list, &Globals.szBrowseWorkgroups)
> FN_GLOBAL_LIST(lp_dns_domains_list, &Globals.szDNSDomains)
-------------- next part --------------
35d34
< 
172a172
> 
177a178,180
>  if ( lp_browse_workgroups_list()==NULL || str_list_find(lp_browse_workgroups_list(),name)!=-1 ) 
>     {
> 
185a189
>     }
-------------- next part --------------
1570a1571,1590
> unsigned int str_list_find(const char **p,const char *fs)
> {
>     unsigned int ps=0;
>     unsigned char fnd=0;
>     while (*p) {
>             if (0==strcmp(*p,fs)) {
>             fnd=1;
>             break;
>             }
>         ps++;
>         *p++;
>      }
>    if (fnd) {
>         return ps;
>     } else {
>       return -1;
>    }
> }
> 
> 
1572,1574c1592,1593
<  version of standard_sub_basic() for string lists; uses alloc_sub_basic() 
<  for the work
<  *****************************************************************************/
---
>  version of standard_sub_basic() for string lists; uses alloc_sub_basic()  for the work
> *****************************************************************************/


More information about the samba-technical mailing list