[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Wed Apr 11 02:04:02 UTC 2018


The branch, master has been updated
       via  462eb4a lib/util: Call log_stack_trace() in smb_panic_default()
       via  bf95519 lib/util: Move log_stack_trace() to common code
       via  3acc00b lib/util: Log PANIC before calling pacic action just like s3
       via  85dc9ee s3-lib: Remove support for libexc for IRIX backtraces
       via  07532f6 libsmb: Pass "account_name/flags" through nb_getdc
       via  d34014c libsmb: Pass "account_name/flags" through prep_getdc_request
       via  295c534 libsmb: Introduce a helper variable
       via  1643c33 libsmb: Give dsgetdcname.c its own header
       via  39bdd17 libsmb: Give namequery.c its own header
       via  6c1e75f libsmb: Remove unused trustdom_cache.c
       via  59961f9 nmbd: Fix a typo
       via  5cdc583 nmbd: Fix a typo
       via  10dbd51 tdbtool: Use tdb_wipe_all in "erase" command
       via  ee560fa s4:ldb/password_hash.c: improve krb5 context error message
      from  3227b11 s3: smbd: Unix extensions attempts to change wrong field in fchown call.

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


- Log -----------------------------------------------------------------
commit 462eb4a44cc51dc17aebbcd5c609c9ff7f088554
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Tue Apr 10 16:37:45 2018 +1200

    lib/util: Call log_stack_trace() in smb_panic_default()
    
    This matches the AD DC with the behaviour in smbd.
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Wed Apr 11 04:03:07 CEST 2018 on sn-devel-144

commit bf9551902afdb32310db4a3381964c435dd08bf0
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Tue Apr 10 16:35:07 2018 +1200

    lib/util: Move log_stack_trace() to common code
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 3acc00b6808d5d5ad035d9d43526204db1608c8a
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Tue Apr 10 16:06:12 2018 +1200

    lib/util: Log PANIC before calling pacic action just like s3
    
    This is like the changes made in s3 by
    4fa555980070d78b39711ef21d77628d26055bc2
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 85dc9ee14023a8fb84b5c74555d43008bb6bb0c0
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Tue Apr 10 15:54:10 2018 +1200

    s3-lib: Remove support for libexc for IRIX backtraces
    
    IRIX is long dead, and this code needs become_root() which is not in
    the top level code.
    
    Additionally, the check for libexc never made it into waf, so this
    has been dead code since Samba 4.1.
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 07532f6a5953e5900d5350e12e13a76e37a9ec6a
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Mar 10 18:06:03 2018 +0100

    libsmb: Pass "account_name/flags" through nb_getdc
    
    Don't hardcode values that we might want to change later
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit d34014c9358c49a3407b0c726e85a21e3848d981
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Mar 10 18:06:03 2018 +0100

    libsmb: Pass "account_name/flags" through prep_getdc_request
    
    Don't hardcode values that we might want to change later
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 295c53405ab5f12b79e62d54e288a7c9bafc857f
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Mar 10 18:01:08 2018 +0100

    libsmb: Introduce a helper variable
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 1643c334db7f49a9c5ededf3422e4cc9ff17f253
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Jan 5 14:21:05 2018 +0100

    libsmb: Give dsgetdcname.c its own header
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 39bdd175e94584504edeb9f1ccf11890185bfdbf
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Mar 10 15:31:11 2018 +0100

    libsmb: Give namequery.c its own header
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 6c1e75f6b9284c9b2dd73ea0ea65fe54ebd3e272
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Mar 10 15:35:43 2018 +0100

    libsmb: Remove unused trustdom_cache.c
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 59961f9cc90bd237ff39f9a03b74d032ccf6efd4
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Jan 25 14:21:22 2018 +0100

    nmbd: Fix a typo
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 5cdc5834809e2ab7a84fcac7c4563805f7b7173b
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Jan 25 14:07:53 2018 +0100

    nmbd: Fix a typo
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 10dbd51e2d54c45de103de10c400d7f323c7223e
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Apr 10 16:58:46 2018 +0200

    tdbtool: Use tdb_wipe_all in "erase" command
    
    This is a lot quicker on large, fragmented databases. tdb_delete can
    leave the freelist in a fragmented mess.
    
    Also, it's a lot more robust: I've got a 4GB tdb file that was affected
    by the problem fixed with c7211882a79. These databases have large space
    at the end that is not part of any record or freelist
    entry. tdb_wipe_all converts this space into a freelist entry. One
    downside is that with those broken databases (which should not happen
    after c7211882a79) have unallocated blocks in their file range after
    this operation.
    
    I think the speed advantage outweighs this disadvantage.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit ee560fa3a67797deef86b3aea763389488790ef0
Author: William Brown <william at blackhats.net.au>
Date:   Tue Apr 10 14:51:06 2018 +1000

    s4:ldb/password_hash.c: improve krb5 context error message
    
    When heimdal encounters a MIT krb5.conf that it does not understand,
    it would emit an "ldb operations error". Sadly this does not help
    or communicate to the administrator the root cause of the issue.
    
    Improve the error message for when krb init fails during password_hash.c
    
    Signed-off-by: William Brown <william at blackhats.net.au>
    Reviewed-by: Alexander Bokovoy <ab at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

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

Summary of changes:
 lib/tdb/tools/tdbtool.c                            |   8 +-
 lib/util/fault.c                                   | 107 +++++-
 lib/util/fault.h                                   |   1 +
 lib/util/wscript_configure                         |   1 +
 source3/include/local.h                            |   3 -
 source3/include/proto.h                            | 110 -------
 source3/lib/netapi/getdc.c                         |   1 +
 source3/lib/netapi/joindomain.c                    |   1 +
 source3/lib/netapi/serverinfo.c                    |   1 +
 source3/lib/util.c                                 | 139 --------
 source3/libads/kerberos.c                          |   1 +
 source3/libads/ldap.c                              |   1 +
 source3/libnet/libnet_join.c                       |   2 +
 source3/libsmb/cliconnect.c                        |   1 +
 source3/libsmb/clidgram.c                          |  26 +-
 source3/libsmb/clidgram.h                          |   4 +
 source3/libsmb/dsgetdcname.c                       |  11 +-
 .../server_id_watch.h => libsmb/dsgetdcname.h}     |  25 +-
 source3/libsmb/libsmb_dir.c                        |   1 +
 source3/libsmb/namequery.c                         |   1 +
 source3/libsmb/namequery.h                         | 115 +++++++
 source3/libsmb/namequery_dc.c                      |   1 +
 source3/libsmb/trustdom_cache.c                    | 360 ---------------------
 source3/nmbd/nmbd.c                                |   4 +-
 source3/rpc_client/cli_pipe.c                      |   1 +
 source3/rpc_server/netlogon/srv_netlog_nt.c        |   1 +
 source3/rpc_server/spoolss/srv_spoolss_nt.c        |   1 +
 source3/smbd/reply.c                               |   1 +
 source3/torture/torture.c                          |   1 +
 source3/utils/net_ads.c                            |   1 +
 source3/utils/net_lookup.c                         |   2 +
 source3/utils/net_rpc.c                            |   2 +
 source3/utils/net_time.c                           |   1 +
 source3/utils/net_util.c                           |   1 +
 source3/utils/nmblookup.c                          |   1 +
 source3/utils/smbfilter.c                          |   1 +
 source3/utils/smbtree.c                            |   1 +
 source3/winbindd/idmap_ad.c                        |   1 +
 source3/winbindd/winbindd_ads.c                    |   1 +
 source3/winbindd/winbindd_cm.c                     |  19 +-
 source3/winbindd/winbindd_dual_srv.c               |   1 +
 source3/winbindd/winbindd_pam.c                    |   1 +
 source3/winbindd/winbindd_wins_byip.c              |   1 +
 source3/winbindd/winbindd_wins_byname.c            |   1 +
 source3/wscript                                    |   2 +-
 source3/wscript_build                              |   1 -
 source4/dsdb/samdb/ldb_modules/password_hash.c     |  23 +-
 47 files changed, 337 insertions(+), 654 deletions(-)
 copy source3/{lib/server_id_watch.h => libsmb/dsgetdcname.h} (58%)
 create mode 100644 source3/libsmb/namequery.h
 delete mode 100644 source3/libsmb/trustdom_cache.c


Changeset truncated at 500 lines:

diff --git a/lib/tdb/tools/tdbtool.c b/lib/tdb/tools/tdbtool.c
index d8bacdb..3e9d154 100644
--- a/lib/tdb/tools/tdbtool.c
+++ b/lib/tdb/tools/tdbtool.c
@@ -647,12 +647,6 @@ static char *tdb_getline(const char *prompt)
 	return p?thisline:NULL;
 }
 
-static int do_delete_fn(TDB_CONTEXT *the_tdb, TDB_DATA key, TDB_DATA dbuf,
-                     void *state)
-{
-    return tdb_delete(the_tdb, key);
-}
-
 static void first_record(TDB_CONTEXT *the_tdb, TDB_DATA *pkey)
 {
 	TDB_DATA dbuf;
@@ -758,7 +752,7 @@ static int do_command(void)
 			return 0;
 		case CMD_ERASE:
 			bIterate = 0;
-			tdb_traverse(tdb, do_delete_fn, NULL);
+			tdb_wipe_all(tdb);
 			return 0;
 		case CMD_DUMP:
 			bIterate = 0;
diff --git a/lib/util/fault.c b/lib/util/fault.c
index 54d8471..1b56361 100644
--- a/lib/util/fault.c
+++ b/lib/util/fault.c
@@ -3,6 +3,7 @@
    Critical Fault handling
    Copyright (C) Andrew Tridgell 1992-1998
    Copyright (C) Tim Prouty 2009
+   Copyright (C) James Peach 2006
 
    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
@@ -123,6 +124,10 @@ _PUBLIC_ const char *panic_action = NULL;
 static void smb_panic_default(const char *why) _NORETURN_;
 static void smb_panic_default(const char *why)
 {
+	DBG_ERR("PANIC (pid %llu): %s\n",
+		    (unsigned long long)getpid(), why);
+	log_stack_trace();
+
 #if defined(HAVE_PRCTL) && defined(PR_SET_PTRACER)
 	/*
 	 * Make sure all children can attach a debugger.
@@ -148,7 +153,6 @@ static void smb_panic_default(const char *why)
 					  WEXITSTATUS(result)));
 		}
 	}
-	DEBUG(0,("PANIC: %s\n", why));
 
 #ifdef SIGABRT
 	CatchSignal(SIGABRT, SIG_DFL);
@@ -168,3 +172,104 @@ _PUBLIC_ void smb_panic(const char *why)
 	}
 	smb_panic_default(why);
 }
+
+/*******************************************************************
+ Print a backtrace of the stack to the debug log. This function
+ DELIBERATELY LEAKS MEMORY. The expectation is that you should
+ exit shortly after calling it.
+********************************************************************/
+
+/* Buffer size to use when printing backtraces */
+#define BACKTRACE_STACK_SIZE 64
+
+
+#ifdef HAVE_LIBUNWIND_H
+#include <libunwind.h>
+#endif
+
+#ifdef HAVE_EXECINFO_H
+#include <execinfo.h>
+#endif
+
+void log_stack_trace(void)
+{
+#ifdef HAVE_LIBUNWIND
+	/* Try to use libunwind before any other technique since on ia64
+	 * libunwind correctly walks the stack in more circumstances than
+	 * backtrace.
+	 */
+	unw_cursor_t cursor;
+	unw_context_t uc;
+	unsigned i = 0;
+
+	char procname[256];
+	unw_word_t ip, sp, off;
+
+	procname[sizeof(procname) - 1] = '\0';
+
+	if (unw_getcontext(&uc) != 0) {
+		goto libunwind_failed;
+	}
+
+	if (unw_init_local(&cursor, &uc) != 0) {
+		goto libunwind_failed;
+	}
+
+	DEBUG(0, ("BACKTRACE:\n"));
+
+	do {
+	    ip = sp = 0;
+	    unw_get_reg(&cursor, UNW_REG_IP, &ip);
+	    unw_get_reg(&cursor, UNW_REG_SP, &sp);
+
+	    switch (unw_get_proc_name(&cursor,
+			procname, sizeof(procname) - 1, &off) ) {
+	    case 0:
+		    /* Name found. */
+	    case -UNW_ENOMEM:
+		    /* Name truncated. */
+		    DEBUGADD(0, (" #%u %s + %#llx [ip=%#llx] [sp=%#llx]\n",
+			    i, procname, (long long)off,
+			    (long long)ip, (long long) sp));
+		    break;
+	    default:
+	    /* case -UNW_ENOINFO: */
+	    /* case -UNW_EUNSPEC: */
+		    /* No symbol name found. */
+		    DEBUGADD(0, (" #%u %s [ip=%#llx] [sp=%#llx]\n",
+			    i, "<unknown symbol>",
+			    (long long)ip, (long long) sp));
+	    }
+	    ++i;
+	} while (unw_step(&cursor) > 0);
+
+	return;
+
+libunwind_failed:
+	DEBUG(0, ("unable to produce a stack trace with libunwind\n"));
+
+#elif HAVE_BACKTRACE_SYMBOLS
+	void *backtrace_stack[BACKTRACE_STACK_SIZE];
+	size_t backtrace_size;
+	char **backtrace_strings;
+
+	/* get the backtrace (stack frames) */
+	backtrace_size = backtrace(backtrace_stack,BACKTRACE_STACK_SIZE);
+	backtrace_strings = backtrace_symbols(backtrace_stack, backtrace_size);
+
+	DEBUG(0, ("BACKTRACE: %lu stack frames:\n",
+		  (unsigned long)backtrace_size));
+
+	if (backtrace_strings) {
+		int i;
+
+		for (i = 0; i < backtrace_size; i++)
+			DEBUGADD(0, (" #%u %s\n", i, backtrace_strings[i]));
+
+		/* Leak the backtrace_strings, rather than risk what free() might do */
+	}
+
+#else
+	DEBUG(0, ("unable to produce a stack trace on this platform\n"));
+#endif
+}
diff --git a/lib/util/fault.h b/lib/util/fault.h
index 0ac6cb9..dfa339b 100644
--- a/lib/util/fault.h
+++ b/lib/util/fault.h
@@ -53,5 +53,6 @@ void fault_setup(void);
 void fault_setup_disable(void);
 _NORETURN_ void smb_panic(const char *reason);
 
+void log_stack_trace(void);
 
 #endif /* _SAMBA_FAULT_H_ */
diff --git a/lib/util/wscript_configure b/lib/util/wscript_configure
index 8e5a59c..2a8dbef 100644
--- a/lib/util/wscript_configure
+++ b/lib/util/wscript_configure
@@ -6,6 +6,7 @@ if Options.options.disable_fault_handling:
 
 # backtrace could be in libexecinfo or in libc
 conf.CHECK_FUNCS_IN('backtrace backtrace_symbols', 'execinfo', checklibc=True, headers='execinfo.h')
+conf.CHECK_HEADERS('execinfo.h libunwind.h')
 
 conf.CHECK_STRUCTURE_MEMBER('struct statvfs', 'f_frsize', define='HAVE_FRSIZE', headers='sys/statvfs.h')
 
diff --git a/source3/include/local.h b/source3/include/local.h
index 7f97d4e..c2be1ff 100644
--- a/source3/include/local.h
+++ b/source3/include/local.h
@@ -172,9 +172,6 @@
 /* Number in seconds for winbindd to wait for the mutex. Make this 2 * smbd wait time. */
 #define WINBIND_SERVER_MUTEX_WAIT_TIME (( ((NUM_CLI_AUTH_CONNECT_RETRIES) * ((CLI_AUTH_TIMEOUT)/1000)) + 5)*2)
 
-/* Buffer size to use when printing backtraces */
-#define BACKTRACE_STACK_SIZE 64
-
 /* size of listen() backlog in smbd */
 #define SMBD_LISTEN_BACKLOG 50
 
diff --git a/source3/include/proto.h b/source3/include/proto.h
index fa87407..fea4ba5 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -356,7 +356,6 @@ char *gidtoname(gid_t gid);
 uid_t nametouid(const char *name);
 gid_t nametogid(const char *name);
 void smb_panic_s3(const char *why);
-void log_stack_trace(void);
 const char *readdirname(DIR *p);
 bool is_in_path(const char *name, name_compare_entry *namelist, bool case_sensitive);
 void set_namearray(name_compare_entry **ppname_array, const char *namelist);
@@ -676,18 +675,6 @@ 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 flush_negative_conn_cache_for_domain(const char *domain);
 
-/* The following definitions come from libsmb/dsgetdcname.c  */
-
-struct netr_DsRGetDCNameInfo;
-
-NTSTATUS dsgetdcname(TALLOC_CTX *mem_ctx,
-		     struct messaging_context *msg_ctx,
-		     const char *domain_name,
-		     const struct GUID *domain_guid,
-		     const char *site_name,
-		     uint32_t flags,
-		     struct netr_DsRGetDCNameInfo **info);
-
 /* The following definitions come from libsmb/errormap.c  */
 
 NTSTATUS dos_to_ntstatus(uint8_t eclass, uint32_t ecode);
@@ -713,96 +700,6 @@ bool namecache_status_fetch(const char *keyname,
 				const struct sockaddr_storage *keyip,
 				char *srvname_out);
 
-/* The following definitions come from libsmb/namequery.c  */
-
-bool saf_store( const char *domain, const char *servername );
-bool saf_join_store( const char *domain, const char *servername );
-bool saf_delete( const char *domain );
-char *saf_fetch(TALLOC_CTX *mem_ctx, const char *domain );
-struct tevent_req *node_status_query_send(TALLOC_CTX *mem_ctx,
-					  struct tevent_context *ev,
-					  struct nmb_name *name,
-					  const struct sockaddr_storage *addr);
-NTSTATUS node_status_query_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
-				struct node_status **pnode_status,
-				int *pnum_names,
-				struct node_status_extra *extra);
-NTSTATUS node_status_query(TALLOC_CTX *mem_ctx, struct nmb_name *name,
-			   const struct sockaddr_storage *addr,
-			   struct node_status **pnode_status,
-			   int *pnum_names,
-			   struct node_status_extra *extra);
-bool name_status_find(const char *q_name,
-			int q_type,
-			int type,
-			const struct sockaddr_storage *to_ss,
-			fstring name);
-int remove_duplicate_addrs2(struct ip_service *iplist, int count );
-struct tevent_req *name_query_send(TALLOC_CTX *mem_ctx,
-				   struct tevent_context *ev,
-				   const char *name, int name_type,
-				   bool bcast, bool recurse,
-				   const struct sockaddr_storage *addr);
-NTSTATUS name_query_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
-			 struct sockaddr_storage **addrs, int *num_addrs,
-			 uint8_t *flags);
-NTSTATUS name_query(const char *name, int name_type,
-		    bool bcast, bool recurse,
-		    const struct sockaddr_storage *to_ss,
-		    TALLOC_CTX *mem_ctx,
-		    struct sockaddr_storage **addrs,
-		    int *num_addrs, uint8_t *flags);
-struct tevent_req *name_resolve_bcast_send(TALLOC_CTX *mem_ctx,
-					   struct tevent_context *ev,
-					   const char *name,
-					   int name_type);
-NTSTATUS name_resolve_bcast_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
-				 struct sockaddr_storage **addrs,
-				 int *num_addrs);
-NTSTATUS name_resolve_bcast(const char *name,
-			int name_type,
-			TALLOC_CTX *mem_ctx,
-			struct sockaddr_storage **return_iplist,
-			int *return_count);
-struct tevent_req *resolve_wins_send(TALLOC_CTX *mem_ctx,
-				     struct tevent_context *ev,
-				     const char *name,
-				     int name_type);
-NTSTATUS resolve_wins_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
-			   struct sockaddr_storage **addrs,
-			   int *num_addrs, uint8_t *flags);
-NTSTATUS resolve_wins(const char *name,
-		int name_type,
-		TALLOC_CTX *mem_ctx,
-		struct sockaddr_storage **return_iplist,
-		int *return_count);
-NTSTATUS internal_resolve_name(const char *name,
-			        int name_type,
-				const char *sitename,
-				struct ip_service **return_iplist,
-				int *return_count,
-				const char **resolve_order);
-bool resolve_name(const char *name,
-		struct sockaddr_storage *return_ss,
-		int name_type,
-		bool prefer_ipv4);
-NTSTATUS resolve_name_list(TALLOC_CTX *ctx,
-		const char *name,
-		int name_type,
-		struct sockaddr_storage **return_ss_arr,
-		unsigned int *p_num_entries);
-bool find_master_ip(const char *group, struct sockaddr_storage *master_ss);
-bool get_pdc_ip(const char *domain, struct sockaddr_storage *pss);
-NTSTATUS get_sorted_dc_list( const char *domain,
-			const char *sitename,
-			struct ip_service **ip_list,
-			int *count,
-			bool ads_only );
-NTSTATUS get_kdc_list( const char *realm,
-			const char *sitename,
-			struct ip_service **ip_list,
-			int *count);
-
 /* The following definitions come from libsmb/namequery_dc.c  */
 
 bool get_dc_name(const char *domain,
@@ -817,13 +714,6 @@ const char *get_dos_error_msg(WERROR result);
 const char *smb_dos_err_class(uint8_t e_class);
 WERROR map_werror_from_unix(int error);
 
-/* The following definitions come from libsmb/trustdom_cache.c  */
-
-bool trustdom_cache_store(const char *name, const struct dom_sid *sid);
-bool trustdom_cache_fetch(const char* name, struct dom_sid* sid);
-void trustdom_cache_flush(void);
-void update_trustdom_cache( void );
-
 /* The following definitions come from libsmb/trusts_util.c  */
 
 struct netlogon_creds_cli_context;
diff --git a/source3/lib/netapi/getdc.c b/source3/lib/netapi/getdc.c
index 2d47ee4..d463375 100644
--- a/source3/lib/netapi/getdc.c
+++ b/source3/lib/netapi/getdc.c
@@ -24,6 +24,7 @@
 #include "lib/netapi/netapi.h"
 #include "lib/netapi/netapi_private.h"
 #include "lib/netapi/libnetapi.h"
+#include "libsmb/dsgetdcname.h"
 
 /********************************************************************
 ********************************************************************/
diff --git a/source3/lib/netapi/joindomain.c b/source3/lib/netapi/joindomain.c
index 7d27bd9..ff2154b 100644
--- a/source3/lib/netapi/joindomain.c
+++ b/source3/lib/netapi/joindomain.c
@@ -29,6 +29,7 @@
 #include "../librpc/gen_ndr/ndr_wkssvc_c.h"
 #include "rpc_client/cli_pipe.h"
 #include "secrets.h"
+#include "libsmb/dsgetdcname.h"
 
 /****************************************************************
 ****************************************************************/
diff --git a/source3/lib/netapi/serverinfo.c b/source3/lib/netapi/serverinfo.c
index 2fd7668..7d9cc48 100644
--- a/source3/lib/netapi/serverinfo.c
+++ b/source3/lib/netapi/serverinfo.c
@@ -26,6 +26,7 @@
 #include "../librpc/gen_ndr/ndr_srvsvc_c.h"
 #include "lib/smbconf/smbconf.h"
 #include "lib/smbconf/smbconf_reg.h"
+#include "libsmb/dsgetdcname.h"
 
 /****************************************************************
 ****************************************************************/
diff --git a/source3/lib/util.c b/source3/lib/util.c
index ae9fe71..5f786f9 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -839,145 +839,6 @@ void smb_panic_s3(const char *why)
 }
 
 /*******************************************************************
- Print a backtrace of the stack to the debug log. This function
- DELIBERATELY LEAKS MEMORY. The expectation is that you should
- exit shortly after calling it.
-********************************************************************/
-
-#ifdef HAVE_LIBUNWIND_H
-#include <libunwind.h>
-#endif
-
-#ifdef HAVE_EXECINFO_H
-#include <execinfo.h>
-#endif
-
-#ifdef HAVE_LIBEXC_H
-#include <libexc.h>
-#endif
-
-void log_stack_trace(void)
-{
-#ifdef HAVE_LIBUNWIND
-	/* Try to use libunwind before any other technique since on ia64
-	 * libunwind correctly walks the stack in more circumstances than
-	 * backtrace.
-	 */ 
-	unw_cursor_t cursor;
-	unw_context_t uc;
-	unsigned i = 0;
-
-	char procname[256];
-	unw_word_t ip, sp, off;
-
-	procname[sizeof(procname) - 1] = '\0';
-
-	if (unw_getcontext(&uc) != 0) {
-		goto libunwind_failed;
-	}
-
-	if (unw_init_local(&cursor, &uc) != 0) {
-		goto libunwind_failed;
-	}
-
-	DEBUG(0, ("BACKTRACE:\n"));
-
-	do {
-	    ip = sp = 0;
-	    unw_get_reg(&cursor, UNW_REG_IP, &ip);
-	    unw_get_reg(&cursor, UNW_REG_SP, &sp);
-
-	    switch (unw_get_proc_name(&cursor,
-			procname, sizeof(procname) - 1, &off) ) {
-	    case 0:
-		    /* Name found. */
-	    case -UNW_ENOMEM:
-		    /* Name truncated. */
-		    DEBUGADD(0, (" #%u %s + %#llx [ip=%#llx] [sp=%#llx]\n",
-			    i, procname, (long long)off,
-			    (long long)ip, (long long) sp));
-		    break;
-	    default:
-	    /* case -UNW_ENOINFO: */
-	    /* case -UNW_EUNSPEC: */
-		    /* No symbol name found. */
-		    DEBUGADD(0, (" #%u %s [ip=%#llx] [sp=%#llx]\n",
-			    i, "<unknown symbol>",
-			    (long long)ip, (long long) sp));
-	    }
-	    ++i;
-	} while (unw_step(&cursor) > 0);
-
-	return;
-
-libunwind_failed:
-	DEBUG(0, ("unable to produce a stack trace with libunwind\n"));
-
-#elif HAVE_BACKTRACE_SYMBOLS
-	void *backtrace_stack[BACKTRACE_STACK_SIZE];
-	size_t backtrace_size;
-	char **backtrace_strings;
-
-	/* get the backtrace (stack frames) */
-	backtrace_size = backtrace(backtrace_stack,BACKTRACE_STACK_SIZE);
-	backtrace_strings = backtrace_symbols(backtrace_stack, backtrace_size);
-
-	DEBUG(0, ("BACKTRACE: %lu stack frames:\n", 
-		  (unsigned long)backtrace_size));
-
-	if (backtrace_strings) {
-		int i;
-
-		for (i = 0; i < backtrace_size; i++)
-			DEBUGADD(0, (" #%u %s\n", i, backtrace_strings[i]));
-
-		/* Leak the backtrace_strings, rather than risk what free() might do */
-	}
-
-#elif HAVE_LIBEXC
-
-	/* The IRIX libexc library provides an API for unwinding the stack. See
-	 * libexc(3) for details. Apparantly trace_back_stack leaks memory, but
-	 * since we are about to abort anyway, it hardly matters.
-	 */
-
-#define NAMESIZE 32 /* Arbitrary */
-
-	__uint64_t	addrs[BACKTRACE_STACK_SIZE];
-	char *      	names[BACKTRACE_STACK_SIZE];
-	char		namebuf[BACKTRACE_STACK_SIZE * NAMESIZE];
-
-	int		i;
-	int		levels;
-
-	ZERO_ARRAY(addrs);
-	ZERO_ARRAY(names);
-	ZERO_ARRAY(namebuf);
-


-- 
Samba Shared Repository



More information about the samba-cvs mailing list