Unnecessary NetBIOS domain lookups - fix to ads_init

Gerald (Jerry) Carter jerry at plainjoe.org
Mon Jan 20 18:04:01 GMT 2003


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tue, 14 Jan 2003, Ken Cross wrote:

> Here's the actual patch to fix the problem below (same patch for
> SAMBA_3_0 and HEAD):
> 
> # cvs diff -r SAMBA_3_0 -pu ads_struct.c
> Index: ads_struct.c
> ===================================================================
> RCS file: /cvsroot/samba/source/libads/ads_struct.c,v
> retrieving revision 1.13.2.3
> diff -p -u -r1.13.2.3 ads_struct.c
> --- ads_struct.c        1 Oct 2002 18:26:00 -0000       1.13.2.3
> +++ ads_struct.c        14 Jan 2003 10:23:24 -0000
> @@ -94,10 +94,10 @@ ADS_STRUCT *ads_init(const char *realm, 
>  
>         /* we need to know if this is a foreign realm to know if we can
>            use lp_ads_server() */
> -       if (realm && strcasecmp(lp_realm(), realm) != 0) {
> +       if (realm && *realm && strcasecmp(lp_realm(), realm) != 0) {
>                 ads->server.foreign = 1;
>         }
> -       if (workgroup && strcasecmp(lp_workgroup(), workgroup) != 0) {
> +       if (workgroup && *workgroup && strcasecmp(lp_workgroup(),
> workgroup) != 0) {
>                 ads->server.foreign = 1;
>         }

Looks good to me.   I'll apply it to HEAD/SAMBA_3_0.

> If those tests set ads->server.foreign to 1, then it will use NetBIOS to
> try to find the domain.  But there are places in the code where realm
> and/or workgroup are not null, but are empty strings.  In this case, I
> don't think the test should succeed.  I changed ads_init to the
> following:

For my own edification, do you remember what places the realm/workgroup 
was being set to "" ?




cheers, jerry
 ----------------------------------------------------------------------
 Hewlett-Packard            ------------------------- http://www.hp.com
 SAMBA Team                 ---------------------- http://www.samba.org
 GnuPG Key                  ---- http://www.plainjoe.org/gpg_public.asc
 ISBN 0-672-32269-2         "SAMS Teach Yourself Samba in 24 Hours" 2ed
 "You can never go home again, Oatman, but I guess you can shop there."  
                            --John Cusack - "Grosse Point Blank" (1997)


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.0 (GNU/Linux)
Comment: For info see http://quantumlab.net/pine_privacy_guard/

iD8DBQE+LDoVIR7qMdg1EfYRAuDMAJ98Tn0u3ARfC9dxXeqmdNjVH/ajGACfXH4+
TH5N6SZ08E+S3pyIFtrCcoo=
=PQ53
-----END PGP SIGNATURE-----




More information about the samba-technical mailing list