r18199: Allow winbindd to delete a saf_ entry if it knows
authorJeremy Allison <jra@samba.org>
Thu, 7 Sep 2006 03:44:05 +0000 (03:44 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 16:51:15 +0000 (11:51 -0500)
it can't talk to it.
Jeremy.

source/libsmb/namequery.c
source/nsswitch/winbindd_cm.c

index 5cd09fd04f1a23608e4d88649eb67a6dbe22ea1c..aeeeb3372cbc57e67c40a1bcc210ca77b541b766 100644 (file)
@@ -77,6 +77,30 @@ BOOL saf_store( const char *domain, const char *servername )
        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;
+}
+
 /****************************************************************************
 ****************************************************************************/
 
index 3072ca2a39bf835c10379e7aaeca175f070c7547..1aab918f69b01013eb9b5b4029598cb4111fc9d1 100644 (file)
@@ -167,8 +167,12 @@ void winbind_add_failed_connection_entry(const struct winbindd_domain *domain,
                                        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);
        }
 }