Author: jra
Date: 2006-09-07 03:44:05 +0000 (Thu, 07 Sep 2006)
New Revision: 18199

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=18199

Log:
Allow winbindd to delete a saf_ entry if it knows
it can't talk to it.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/libsmb/namequery.c
   branches/SAMBA_3_0/source/nsswitch/winbindd_cm.c


Changeset:
Modified: branches/SAMBA_3_0/source/libsmb/namequery.c
===================================================================
--- branches/SAMBA_3_0/source/libsmb/namequery.c        2006-09-07 03:24:08 UTC 
(rev 18198)
+++ branches/SAMBA_3_0/source/libsmb/namequery.c        2006-09-07 03:44:05 UTC 
(rev 18199)
@@ -77,6 +77,30 @@
        return ret;
 }
 
+BOOL saf_delete( const char *domain, const char *servername )
+{
+       char *key;
+       BOOL ret = False;
+       
+       if ( !domain || !servername ) {
+               DEBUG(2,("saf_delete: Refusing to store empty domain or 
servername!\n"));
+               return False;
+       }
+       
+       if ( !gencache_init() ) 
+               return False;
+       
+       key = saf_key(domain);
+       ret = gencache_del(key);
+       
+       if (ret) {
+               DEBUG(10,("saf_delete: domain = [%s], server = [%s]\n",
+                       domain, servername));
+       }
+       SAFE_FREE( key );
+       return ret;
+}
+
 /****************************************************************************
 ****************************************************************************/
 

Modified: branches/SAMBA_3_0/source/nsswitch/winbindd_cm.c
===================================================================
--- branches/SAMBA_3_0/source/nsswitch/winbindd_cm.c    2006-09-07 03:24:08 UTC 
(rev 18198)
+++ branches/SAMBA_3_0/source/nsswitch/winbindd_cm.c    2006-09-07 03:44:05 UTC 
(rev 18199)
@@ -167,8 +167,12 @@
                                        NTSTATUS result)
 {
        add_failed_connection_entry(domain->name, server, result);
+       /* If this was the saf name for the last thing we talked to,
+          remove it. */
+       saf_delete(domain->name, server);
        if (*domain->alt_name) {
                add_failed_connection_entry(domain->alt_name, server, result);
+               saf_delete(domain->alt_name, server);
        }
 }
 

Reply via email to