[SCM] Samba Shared Repository - branch master updated

Andrew Bartlett abartlet at samba.org
Tue Oct 26 23:25:01 MDT 2010


The branch, master has been updated
       via  51dd83a auth/credentials Give a sensible behaviour for resetting the krb5 context
       via  d9b7123 librpc Make ndrdump use printf() rather than having to mess with DEBUG()
       via  cf310a4 s3-smbd Remove manual override of DEBUGELVEL during exit
      from  4c634a3 talloc: fix waf build for libtalloc-compat1

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 51dd83a50cbfc6d1bf17eb95095bac4d223cc637
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Wed Oct 27 15:22:46 2010 +1100

    auth/credentials Give a sensible behaviour for resetting the krb5 context
    
    This extra code isn't used at the moment, but I noticed the old API
    was rather supprising in it's behaviour, and might catch someone out
    at some later time.
    
    Andrew Bartlett
    
    Autobuild-User: Andrew Bartlett <abartlet at samba.org>
    Autobuild-Date: Wed Oct 27 05:24:22 UTC 2010 on sn-devel-104

commit d9b7123cb7dd4ed04f266aa48c35e70569ae258e
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Wed Oct 27 15:19:05 2010 +1100

    librpc Make ndrdump use printf() rather than having to mess with DEBUG()
    
    This means it no longer needs to force the debug level etc.
    
    (this builds on the fine work by Volker to create dump_data_cb())
    
    Andrew Bartlett

commit cf310a4306b3a4b6b9201d01c5d6dbbe5ff8f09e
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Wed Oct 27 12:58:10 2010 +1100

    s3-smbd Remove manual override of DEBUGELVEL during exit
    
    This code, originally added at the dawn of time (the import into CVS)
    does not seem to be required any more, as all the DEBUG() statements
    in the intermediate functions are at level 0.
    
    Andrew Bartlett

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

Summary of changes:
 librpc/ndr/libndr.h                         |    1 +
 librpc/ndr/ndr.c                            |   19 +++++++++++++++++++
 librpc/tools/ndrdump.c                      |   19 +++++++------------
 source3/smbd/server_exit.c                  |    5 -----
 source4/auth/credentials/credentials_krb5.c |   11 ++++++++---
 5 files changed, 35 insertions(+), 20 deletions(-)


Changeset truncated at 500 lines:

diff --git a/librpc/ndr/libndr.h b/librpc/ndr/libndr.h
index 6bc96ca..06cc93a 100644
--- a/librpc/ndr/libndr.h
+++ b/librpc/ndr/libndr.h
@@ -406,6 +406,7 @@ struct ndr_push *ndr_push_init_ctx(TALLOC_CTX *mem_ctx);
 DATA_BLOB ndr_push_blob(struct ndr_push *ndr);
 enum ndr_err_code ndr_push_expand(struct ndr_push *ndr, uint32_t extra_size);
 void ndr_print_debug_helper(struct ndr_print *ndr, const char *format, ...) PRINTF_ATTRIBUTE(2,3);
+void ndr_print_printf_helper(struct ndr_print *ndr, const char *format, ...) PRINTF_ATTRIBUTE(2,3);
 void ndr_print_string_helper(struct ndr_print *ndr, const char *format, ...) PRINTF_ATTRIBUTE(2,3);
 void ndr_print_debug(ndr_print_fn_t fn, const char *name, void *ptr);
 void ndr_print_union_debug(ndr_print_fn_t fn, const char *name, uint32_t level, void *ptr);
diff --git a/librpc/ndr/ndr.c b/librpc/ndr/ndr.c
index 3f553a7..0e16a43 100644
--- a/librpc/ndr/ndr.c
+++ b/librpc/ndr/ndr.c
@@ -190,6 +190,25 @@ _PUBLIC_ void ndr_print_debug_helper(struct ndr_print *ndr, const char *format,
 	free(s);
 }
 
+_PUBLIC_ void ndr_print_printf_helper(struct ndr_print *ndr, const char *format, ...) 
+{
+	va_list ap;
+	int i;
+
+	if (!ndr->no_newline) {
+		for (i=0;i<ndr->depth;i++) {
+			printf("    ");
+		}
+	}
+
+	va_start(ap, format);
+	vprintf(format, ap);
+	va_end(ap);
+	if (!ndr->no_newline) {
+		printf("\n");
+	}
+}
+
 _PUBLIC_ void ndr_print_string_helper(struct ndr_print *ndr, const char *format, ...)
 {
 	va_list ap;
diff --git a/librpc/tools/ndrdump.c b/librpc/tools/ndrdump.c
index 6fc903f..b9b4bc7 100644
--- a/librpc/tools/ndrdump.c
+++ b/librpc/tools/ndrdump.c
@@ -127,13 +127,14 @@ static const struct ndr_interface_table *load_iface_from_plugin(const char *plug
 	return p;
 }
 
+static void printf_cb(const char *buf, void *private_data)
+{
+	printf("%s", buf);
+}
+
 static void ndrdump_data(uint8_t *d, uint32_t l, bool force)
 {
-	if (force) {
-		dump_data(0, d, l);
-	} else {
-		dump_data_skip_zeros(0, d, l);
-	}
+	dump_data_cb(d, l, !force, printf_cb, NULL);
 }
 
  int main(int argc, const char *argv[])
@@ -172,10 +173,6 @@ static void ndrdump_data(uint8_t *d, uint32_t l, bool force)
 		{ NULL }
 	};
 
-	if (DEBUGLEVEL < 1) {
-		DEBUGLEVEL = 1;
-	}
-
 	ndr_table_init();
 
 	/* Initialise samba stuff */
@@ -183,8 +180,6 @@ static void ndrdump_data(uint8_t *d, uint32_t l, bool force)
 
 	setlinebuf(stdout);
 
-	dbf = x_stderr;
-
 	setup_logging_stdout();
 
 	pc = poptGetContext("ndrdump", argc, argv, long_options, 0);
@@ -354,7 +349,7 @@ static void ndrdump_data(uint8_t *d, uint32_t l, bool force)
 	}
 
 	ndr_print = talloc_zero(mem_ctx, struct ndr_print);
-	ndr_print->print = ndr_print_debug_helper;
+	ndr_print->print = ndr_print_printf_helper;
 	ndr_print->depth = 1;
 	f->ndr_print(ndr_print, function, flags, st);
 
diff --git a/source3/smbd/server_exit.c b/source3/smbd/server_exit.c
index 9f2d6b3..57fec8d 100644
--- a/source3/smbd/server_exit.c
+++ b/source3/smbd/server_exit.c
@@ -127,10 +127,6 @@ static void exit_server_common(enum server_exit_reason how,
 	TALLOC_FREE(smbd_memcache_ctx);
 
 	if (how != SERVER_EXIT_NORMAL) {
-		int oldlevel = DEBUGLEVEL;
-
-		DEBUGLEVEL = 10;
-
 		DEBUGSEP(0);
 		DEBUG(0,("Abnormal server exit: %s\n",
 			reason ? reason : "no explanation provided"));
@@ -138,7 +134,6 @@ static void exit_server_common(enum server_exit_reason how,
 
 		log_stack_trace();
 
-		DEBUGLEVEL = oldlevel;
 		dump_core();
 
 	} else {
diff --git a/source4/auth/credentials/credentials_krb5.c b/source4/auth/credentials/credentials_krb5.c
index fb4b440..97b1814 100644
--- a/source4/auth/credentials/credentials_krb5.c
+++ b/source4/auth/credentials/credentials_krb5.c
@@ -51,13 +51,18 @@ _PUBLIC_ int cli_credentials_get_krb5_context(struct cli_credentials *cred,
 	return 0;
 }
 
-/* This needs to be called directly after the cli_credentials_init(),
- * otherwise we might have problems with the krb5 context already
- * being here.
+/* For most predictable behaviour, this needs to be called directly after the cli_credentials_init(),
+ * otherwise we may still have references to the old smb_krb5_context in a credential cache etc
  */
 _PUBLIC_ NTSTATUS cli_credentials_set_krb5_context(struct cli_credentials *cred, 
 					  struct smb_krb5_context *smb_krb5_context)
 {
+	if (smb_krb5_context == NULL) {
+		talloc_unlink(cred, cred->smb_krb5_context);
+		cred->smb_krb5_context = NULL;
+		return NT_STATUS_OK;
+	}
+
 	if (!talloc_reference(cred, smb_krb5_context)) {
 		return NT_STATUS_NO_MEMORY;
 	}


-- 
Samba Shared Repository


More information about the samba-cvs mailing list