Author: jerry Date: 2006-03-28 13:34:13 +0000 (Tue, 28 Mar 2006) New Revision: 14748
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=14748 Log: store the name/ip address combination when we doa reverse look up in case future forward lookups would fail Modified: branches/SAMBA_3_0/source/nsswitch/winbindd_cm.c trunk/source/nsswitch/winbindd_cm.c Changeset: Modified: branches/SAMBA_3_0/source/nsswitch/winbindd_cm.c =================================================================== --- branches/SAMBA_3_0/source/nsswitch/winbindd_cm.c 2006-03-27 19:50:46 UTC (rev 14747) +++ branches/SAMBA_3_0/source/nsswitch/winbindd_cm.c 2006-03-28 13:34:13 UTC (rev 14748) @@ -581,23 +581,31 @@ static void dcip_to_name( const char *domainname, const char *realm, const DOM_SID *sid, struct in_addr ip, fstring name ) { + struct ip_service ip_list; + ip_list.ip = ip; + ip_list.port = 0; + /* try GETDC requests first */ if (send_getdc_request(ip, domainname, sid)) { int i; smb_msleep(100); for (i=0; i<5; i++) { - if (receive_getdc_response(ip, domainname, name)) + if (receive_getdc_response(ip, domainname, name)) { + namecache_store(name, 0x20, 1, &ip_list); return; + } smb_msleep(500); } } /* try node status request */ - if ( name_status_find(domainname, 0x1c, 0x20, ip, name) ) + if ( name_status_find(domainname, 0x1c, 0x20, ip, name) ) { + namecache_store(name, 0x20, 1, &ip_list); return; + } /* backup in case the netbios stuff fails */ @@ -627,6 +635,7 @@ } fstrcpy(name, ads->config.ldap_server_name); + namecache_store(name, 0x20, 1, &ip_list); ads_destroy( &ads ); } Modified: trunk/source/nsswitch/winbindd_cm.c =================================================================== --- trunk/source/nsswitch/winbindd_cm.c 2006-03-27 19:50:46 UTC (rev 14747) +++ trunk/source/nsswitch/winbindd_cm.c 2006-03-28 13:34:13 UTC (rev 14748) @@ -581,23 +581,31 @@ static void dcip_to_name( const char *domainname, const char *realm, const DOM_SID *sid, struct in_addr ip, fstring name ) { + struct ip_service ip_list; + ip_list.ip = ip; + ip_list.port = 0; + /* try GETDC requests first */ if (send_getdc_request(ip, domainname, sid)) { int i; smb_msleep(100); for (i=0; i<5; i++) { - if (receive_getdc_response(ip, domainname, name)) + if (receive_getdc_response(ip, domainname, name)) { + namecache_store(name, 0x20, 1, &ip_list); return; + } smb_msleep(500); } } /* try node status request */ - if ( name_status_find(domainname, 0x1c, 0x20, ip, name) ) + if ( name_status_find(domainname, 0x1c, 0x20, ip, name) ) { + namecache_store(name, 0x20, 1, &ip_list); return; + } /* backup in case the netbios stuff fails */ @@ -627,6 +635,7 @@ } fstrcpy(name, ads->config.ldap_server_name); + namecache_store(name, 0x20, 1, &ip_list); ads_destroy( &ads ); }
