[SCM] Samba Shared Repository - branch v3-5-test updated

Volker Lendecke vlendec at samba.org
Thu Dec 24 07:26:48 MST 2009


The branch, v3-5-test has been updated
       via  413f458... s3: Remove unused delete_negative_conn_cache()
       via  d405100... s3: Remove unused flush_negative_conn_cache()
       via  e599a46... s3: Remove some unnecessary variables from libsmb/conn_cache.c
       via  1090d67... s3: Fix a comment in conn_cache.c
       via  b1effa2... s3: Fix a 64-bit error
       via  1eb6d31... s3: Remove some pointless SMB_ASSERTs
       via  d3855f7... s3: Remove some pointless casts
      from  c5fa822... Attempt to fix one of the last two bugs with the full Windows ACL support.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-5-test


- Log -----------------------------------------------------------------
commit 413f458984241b28e79e7ad127f6104c76374e71
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Dec 24 13:51:50 2009 +0100

    s3: Remove unused delete_negative_conn_cache()

commit d40510055c835d13d6e6b5f6a6e76046d67d7692
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Dec 24 13:50:39 2009 +0100

    s3: Remove unused flush_negative_conn_cache()

commit e599a467b1bcb1f17e9e14bb04460031973d1d4e
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Dec 24 13:47:35 2009 +0100

    s3: Remove some unnecessary variables from libsmb/conn_cache.c

commit 1090d6745678cb21b234aa61ba7c373a786a217e
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Dec 24 13:46:16 2009 +0100

    s3: Fix a comment in conn_cache.c

commit b1effa274513b2b22313e80140601fa444459e79
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Dec 24 13:40:24 2009 +0100

    s3: Fix a 64-bit error

commit 1eb6d313d358774d637471481cf4292554ec9453
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Dec 24 13:36:00 2009 +0100

    s3: Remove some pointless SMB_ASSERTs

commit d3855f78be27b21d1d56bf9ceda3f2b7bbb52d73
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Dec 24 13:14:18 2009 +0100

    s3: Remove some pointless casts

-----------------------------------------------------------------------

Summary of changes:
 source3/include/proto.h    |    2 -
 source3/libsmb/conncache.c |   76 +++++++++++++------------------------------
 2 files changed, 23 insertions(+), 55 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/include/proto.h b/source3/include/proto.h
index 64abad7..d2ebd92 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -3044,8 +3044,6 @@ NTSTATUS cli_trans(TALLOC_CTX *mem_ctx, struct cli_state *cli,
 NTSTATUS check_negative_conn_cache_timeout( const char *domain, const char *server, unsigned int failed_cache_timeout );
 NTSTATUS check_negative_conn_cache( const char *domain, const char *server);
 void add_failed_connection_entry(const char *domain, const char *server, NTSTATUS result) ;
-void delete_negative_conn_cache(const char *domain, const char *server);
-void flush_negative_conn_cache( void );
 void flush_negative_conn_cache_for_domain(const char *domain);
 
 /* The following definitions come from ../librpc/rpc/dcerpc_error.c  */
diff --git a/source3/libsmb/conncache.c b/source3/libsmb/conncache.c
index b440d61..46dc6d6 100644
--- a/source3/libsmb/conncache.c
+++ b/source3/libsmb/conncache.c
@@ -7,7 +7,8 @@
    Copyright (C) Andrew Bartlett 	2002
    Copyright (C) Gerald (Jerry) Carter 	2003
    Copyright (C) Marc VanHeyningen      2008
-   
+   Copyright (C) Volker Lendecke	2009
+
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 3 of the License, or
@@ -37,11 +38,6 @@
 
 
 /**
- * prefix used for all entries put into the general cache
- */
-static const char NEGATIVE_CONN_CACHE_PREFIX[] = "NEG_CONN_CACHE";
-
-/**
  * Marshalls the domain and server name into the key for the gencache
  * record
  *
@@ -53,15 +49,16 @@ static const char NEGATIVE_CONN_CACHE_PREFIX[] = "NEG_CONN_CACHE";
  */
 static char *negative_conn_cache_keystr(const char *domain, const char *server)
 {
-	const char NEGATIVE_CONN_CACHE_KEY_FMT[] = "%s/%s,%s";
 	char *keystr = NULL;
 
-	SMB_ASSERT(domain != NULL);
+	if (domain == NULL) {
+		return NULL;
+	}
 	if (server == NULL)
 		server = "";
 
-	keystr = talloc_asprintf(talloc_tos(),NEGATIVE_CONN_CACHE_KEY_FMT,
-				 NEGATIVE_CONN_CACHE_PREFIX, domain, server);
+	keystr = talloc_asprintf(talloc_tos(), "NEG_CONN_CACHE/%s,%s",
+				 domain, server);
 	if (keystr == NULL) {
 		DEBUG(0, ("negative_conn_cache_keystr: malloc error\n"));
 	}
@@ -100,13 +97,16 @@ static char *negative_conn_cache_valuestr(NTSTATUS status)
  */
 static NTSTATUS negative_conn_cache_valuedecode(const char *value)
 {
-	NTSTATUS result = NT_STATUS_OK;
+	unsigned int v = NT_STATUS_V(NT_STATUS_INTERNAL_ERROR);;
 
-	SMB_ASSERT(value != NULL);
-	if (sscanf(value, "%x", &(NT_STATUS_V(result))) != 1)
-		DEBUG(0, ("negative_conn_cache_valuestr: unable to parse "
+	if (value != NULL) {
+		return NT_STATUS_INTERNAL_ERROR;
+	}
+	if (sscanf(value, "%x", &v) != 1) {
+		DEBUG(0, ("negative_conn_cache_valuedecode: unable to parse "
 			  "value field '%s'\n", value));
-	return result;
+	}
+	return NT_STATUS(v);
 }
 
 /**
@@ -143,7 +143,7 @@ NTSTATUS check_negative_conn_cache( const char *domain, const char *server)
 	if (key == NULL)
 		goto done;
 
-	if (gencache_get(key, &value, (time_t *) NULL))
+	if (gencache_get(key, &value, NULL))
 		result = negative_conn_cache_valuedecode(value);
  done:
 	DEBUG(9,("check_negative_conn_cache returning result %d for domain %s "
@@ -154,29 +154,6 @@ NTSTATUS check_negative_conn_cache( const char *domain, const char *server)
 }
 
 /**
- * Delete any negative cache entry for the given domain/server
- *
- * @param[in] domain
- * @param[in] server may be either a FQDN or an IP address
- */
-void delete_negative_conn_cache(const char *domain, const char *server)
-{
-	char *key = NULL;
-
-	key = negative_conn_cache_keystr(domain, server);
-	if (key == NULL)
-		goto done;
-
-	gencache_del(key);
-	DEBUG(9,("delete_negative_conn_cache removing domain %s server %s\n",
-		  domain, server));
- done:
-	TALLOC_FREE(key);
-	return;
-}
-
-
-/**
  * Add an entry to the failed connection cache
  *
  * @param[in] domain
@@ -189,7 +166,10 @@ void add_failed_connection_entry(const char *domain, const char *server,
 	char *key = NULL;
 	char *value = NULL;
 
-	SMB_ASSERT(!NT_STATUS_IS_OK(result));
+	if (NT_STATUS_IS_OK(result)) {
+		/* Nothing failed here */
+		return;
+	}
 
 	key = negative_conn_cache_keystr(domain, server);
 	if (key == NULL) {
@@ -204,8 +184,7 @@ void add_failed_connection_entry(const char *domain, const char *server,
 	}
 
 	if (gencache_set(key, value,
-			 time((time_t *) NULL)
-			 + FAILED_CONNECTION_CACHE_TIMEOUT))
+			 time(NULL) + FAILED_CONNECTION_CACHE_TIMEOUT))
 		DEBUG(9,("add_failed_connection_entry: added domain %s (%s) "
 			  "to failed conn cache\n", domain, server ));
 	else
@@ -220,15 +199,6 @@ void add_failed_connection_entry(const char *domain, const char *server,
 }
 
 /**
- * Deletes all records from the negative connection cache in all domains
- */
-void flush_negative_conn_cache( void )
-{
-	flush_negative_conn_cache_for_domain("*");
-}
-
-
-/**
  * Deletes all records for a specified domain from the negative connection
  * cache
  *
@@ -246,10 +216,10 @@ void flush_negative_conn_cache_for_domain(const char *domain)
 		goto done;
 	}
 
-	gencache_iterate(delete_matches, (void *) NULL, key_pattern);
+	gencache_iterate(delete_matches, NULL, key_pattern);
 	DEBUG(8, ("flush_negative_conn_cache_for_domain: flushed domain %s\n",
 		  domain));
-	
+
  done:
 	TALLOC_FREE(key_pattern);
 	return;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list