The branch, master has been updated
       via  7a4d937fd9e80e27d58584bc1a4d3dddc88ba74d (commit)
       via  6bc9fb887fa685a595b019c5ad6fc77f2fa3e914 (commit)
      from  2b29b7186459d945ec448694164bfe4239b30d72 (commit)

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


- Log -----------------------------------------------------------------
commit 7a4d937fd9e80e27d58584bc1a4d3dddc88ba74d
Author: Stefan Metzmacher <[EMAIL PROTECTED]>
Date:   Tue Oct 28 12:21:44 2008 +0100

    s4: lsa-server: fix crash bugs related to [out,ref] ** changes
    
    metze

commit 6bc9fb887fa685a595b019c5ad6fc77f2fa3e914
Author: Stefan Metzmacher <[EMAIL PROTECTED]>
Date:   Tue Oct 28 12:20:59 2008 +0100

    selftest: move gdb_* and valgrind_* scripts to selftest/
    
    metze

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

Summary of changes:
 selftest/gdb_backtrace              |   87 +++++++++++++++++++++++++++++++++++
 selftest/gdb_backtrace_test.c       |   42 +++++++++++++++++
 selftest/gdb_run                    |   20 ++++++++
 selftest/selftest.pl                |    2 +-
 selftest/target/Samba4.pm           |    2 +-
 selftest/valgrind_run               |    9 ++++
 source4/rpc_server/lsa/dcesrv_lsa.c |    8 ++--
 source4/script/gdb_backtrace        |   87 -----------------------------------
 source4/script/gdb_backtrace_test.c |   42 -----------------
 source4/script/gdb_run              |   20 --------
 source4/script/valgrind_run         |    9 ----
 source4/selftest/config.mk          |   13 +++--
 12 files changed, 171 insertions(+), 170 deletions(-)
 create mode 100755 selftest/gdb_backtrace
 create mode 100644 selftest/gdb_backtrace_test.c
 create mode 100755 selftest/gdb_run
 create mode 100755 selftest/valgrind_run
 delete mode 100755 source4/script/gdb_backtrace
 delete mode 100644 source4/script/gdb_backtrace_test.c
 delete mode 100755 source4/script/gdb_run
 delete mode 100755 source4/script/valgrind_run


Changeset truncated at 500 lines:

diff --git a/selftest/gdb_backtrace b/selftest/gdb_backtrace
new file mode 100755
index 0000000..826381e
--- /dev/null
+++ b/selftest/gdb_backtrace
@@ -0,0 +1,87 @@
+#!/bin/sh
+
+BASENAME=`basename $0`
+
+if [ -n "$VALGRIND" -o -n "$SMBD_VALGRIND" ]; then
+       echo "${BASENAME}: Not running debugger under valgrind"
+       exit 1
+fi
+
+# we want everything on stderr, so the program is not disturbed
+exec 1>&2
+
+BASENAME=`basename $0`
+UNAME=`uname`
+
+PID=$1
+BINARY=$2
+
+test x"${PID}" = x"" && {
+       echo "Usage: ${BASENAME} <pid> [<binary>]"
+       exit 1
+}
+
+DB_LIST="gdb"
+case "${UNAME}" in
+       #
+       # on Tru64 we need to try ladebug first
+       # because gdb crashes itself...
+       #
+       OSF1)
+               DB_LIST="ladebug ${DB_LIST}"
+       ;;
+esac
+
+for DB in ${DB_LIST}; do
+       DB_BIN=`which ${DB} 2>/dev/null | grep '^/'`
+       test x"${DB_BIN}" != x"" && {
+               break
+       }
+done
+
+test x"${DB_BIN}" = x"" && {
+       echo "${BASENAME}: ERROR: No debugger found."
+       exit 1
+}
+
+#
+# we first try to use /proc/${PID}/exe
+# then fallback to the binary from the commandline
+# then we search for the commandline argument with
+# 'which'
+#
+test -f "/proc/${PID}/exe" && BINARY="/proc/${PID}/exe"
+test x"${BINARY}" = x"" && BINARY="/proc/${PID}/exe"
+test -f "${BINARY}" || BINARY=`which ${BINARY}`
+
+test -f "${BINARY}" || {
+       echo "${BASENAME}: ERROR: Cannot find binary '${BINARY}'."
+       exit 1
+}
+
+echo "${BASENAME}: Trying to use ${DB_BIN} on ${BINARY} on PID ${PID}"
+
+BATCHFILE_PRE=/tmp/gdb_backtrace_pre.$$
+BATCHFILE_MAIN=/tmp/gdb_backtrace_main.$$
+case "${DB}" in
+       ladebug)
+cat << EOF  > ${BATCHFILE_PRE}
+set \$stoponattach
+EOF
+
+cat << EOF  > ${BATCHFILE_MAIN}
+where
+quit
+EOF
+       ${DB_BIN} -c "${BATCHFILE_MAIN}" -i "${BATCHFILE_PRE}" -pid "${PID}" 
"${BINARY}"
+       ;;
+       gdb)
+cat << EOF  > ${BATCHFILE_MAIN}
+set height 1000
+bt full
+quit
+EOF
+       ${DB_BIN} -x "${BATCHFILE_MAIN}" "${BINARY}" "${PID}"
+       ;;
+esac
+/bin/rm -f ${BATCHFILE_PRE} ${BATCHFILE_MAIN}
diff --git a/selftest/gdb_backtrace_test.c b/selftest/gdb_backtrace_test.c
new file mode 100644
index 0000000..506784f
--- /dev/null
+++ b/selftest/gdb_backtrace_test.c
@@ -0,0 +1,42 @@
+/*
+
+add a usefull tool to test the gdb_backtrace script
+
+just compile it with
+cc -g -o gdb_backtrace_test gdb_backtrace_test.c
+
+and run it in the same directory where your gdb_backtrace script is.
+
+2006 - Stefan Metzmacher <[EMAIL PROTECTED]>
+
+*/
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <signal.h>
+
+static const char *prog;
+
+static void sig_fault(int sig)
+{
+       int ret;
+       char cmdstr[200];
+
+       snprintf(cmdstr, sizeof(cmdstr),
+                "./gdb_backtrace %u %s",
+                getpid(), prog);
+       printf("sig_fault start: %s\n", cmdstr);
+       ret = system(cmdstr);
+       printf("sig_fault end: %d\n", ret);
+}
+
+int main(int argc, const char **argv)
+{
+       prog = argv[0];
+
+       signal(SIGABRT, sig_fault);
+
+       abort();
+       return 0;
+}
diff --git a/selftest/gdb_run b/selftest/gdb_run
new file mode 100755
index 0000000..8ad101e
--- /dev/null
+++ b/selftest/gdb_run
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+ENV="$1"
+
+shift 1
+
+if test -z "$TMPDIR"; then
+       TMPDIR="/tmp"
+fi
+
+TMPFILE=$TMPDIR/gdb_run.$$
+cat << EOF  > $TMPFILE
+run
+bt
+EOF
+
+trap "/bin/rm -f $TMPFILE" EXIT
+CMD="gdb -x $TMPFILE --args $@"
+echo $CMD
+eval $ENV "$CMD"
diff --git a/selftest/selftest.pl b/selftest/selftest.pl
index 2484bd0..aa99b2e 100755
--- a/selftest/selftest.pl
+++ b/selftest/selftest.pl
@@ -573,7 +573,7 @@ sub write_clientconf($$)
        print CF "
        private dir = $prefix_abs/client/private
        name resolve order = bcast
-       panic action = $srcdir_abs/script/gdb_backtrace \%PID\% \%PROG\%
+       panic action = $RealBin/gdb_backtrace \%PID\% \%PROG\%
        max xmit = 32K
        notify:inotify = false
        ldb:nosync = true
diff --git a/selftest/target/Samba4.pm b/selftest/target/Samba4.pm
index 9364008..8c79a31 100644
--- a/selftest/target/Samba4.pm
+++ b/selftest/target/Samba4.pm
@@ -562,7 +562,7 @@ sub provision($$$$$$)
        name resolve order = bcast
        interfaces = $interfaces
        tls dh params file = $tlsdir/dhparms.pem
-       panic action = $srcdir/script/gdb_backtrace \%PID% \%PROG%
+       panic action = $RealBin/gdb_backtrace \%PID% \%PROG%
        wins support = yes
        server role = $server_role
        max xmit = 32K
diff --git a/selftest/valgrind_run b/selftest/valgrind_run
new file mode 100755
index 0000000..5171d17
--- /dev/null
+++ b/selftest/valgrind_run
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+ENV="$1"
+
+shift 1
+
+CMD="$ENV valgrind -q --db-attach=yes --num-callers=30 $@"
+echo $CMD
+eval $CMD
diff --git a/source4/rpc_server/lsa/dcesrv_lsa.c 
b/source4/rpc_server/lsa/dcesrv_lsa.c
index 0041c5f..6507c75 100644
--- a/source4/rpc_server/lsa/dcesrv_lsa.c
+++ b/source4/rpc_server/lsa/dcesrv_lsa.c
@@ -1387,12 +1387,12 @@ static NTSTATUS 
dcesrv_lsa_QueryTrustedDomainInfo(struct dcesrv_call_state *dce_
        case LSA_TRUSTED_DOMAIN_INFO_INFO_EX2_INTERNAL:
                /* oops, we don't want to return the info after all */
                talloc_free(info);
-               r->out.info = NULL;
+               *r->out.info = NULL;
                return NT_STATUS_INVALID_PARAMETER;
        default:
                /* oops, we don't want to return the info after all */
                talloc_free(info);
-               r->out.info = NULL;
+               *r->out.info = NULL;
                return NT_STATUS_INVALID_INFO_CLASS;
        }
 
@@ -2981,8 +2981,8 @@ static NTSTATUS 
dcesrv_lsa_QueryDomainInformationPolicy(struct dcesrv_call_state
                                                        
dce_call->conn->dce_ctx->lp_ctx,
                                                        &smb_krb5_context);
                if (ret != 0) {
-                       talloc_free(r->out.info);
-                       r->out.info = NULL;
+                       talloc_free(info);
+                       *r->out.info = NULL;
                        return NT_STATUS_INTERNAL_ERROR;
                }
                k->enforce_restrictions = 0; /* FIXME, details missing from 
MS-LSAD 2.2.53 */
diff --git a/source4/script/gdb_backtrace b/source4/script/gdb_backtrace
deleted file mode 100755
index 826381e..0000000
--- a/source4/script/gdb_backtrace
+++ /dev/null
@@ -1,87 +0,0 @@
-#!/bin/sh
-
-BASENAME=`basename $0`
-
-if [ -n "$VALGRIND" -o -n "$SMBD_VALGRIND" ]; then
-       echo "${BASENAME}: Not running debugger under valgrind"
-       exit 1
-fi
-
-# we want everything on stderr, so the program is not disturbed
-exec 1>&2
-
-BASENAME=`basename $0`
-UNAME=`uname`
-
-PID=$1
-BINARY=$2
-
-test x"${PID}" = x"" && {
-       echo "Usage: ${BASENAME} <pid> [<binary>]"
-       exit 1
-}
-
-DB_LIST="gdb"
-case "${UNAME}" in
-       #
-       # on Tru64 we need to try ladebug first
-       # because gdb crashes itself...
-       #
-       OSF1)
-               DB_LIST="ladebug ${DB_LIST}"
-       ;;
-esac
-
-for DB in ${DB_LIST}; do
-       DB_BIN=`which ${DB} 2>/dev/null | grep '^/'`
-       test x"${DB_BIN}" != x"" && {
-               break
-       }
-done
-
-test x"${DB_BIN}" = x"" && {
-       echo "${BASENAME}: ERROR: No debugger found."
-       exit 1
-}
-
-#
-# we first try to use /proc/${PID}/exe
-# then fallback to the binary from the commandline
-# then we search for the commandline argument with
-# 'which'
-#
-test -f "/proc/${PID}/exe" && BINARY="/proc/${PID}/exe"
-test x"${BINARY}" = x"" && BINARY="/proc/${PID}/exe"
-test -f "${BINARY}" || BINARY=`which ${BINARY}`
-
-test -f "${BINARY}" || {
-       echo "${BASENAME}: ERROR: Cannot find binary '${BINARY}'."
-       exit 1
-}
-
-echo "${BASENAME}: Trying to use ${DB_BIN} on ${BINARY} on PID ${PID}"
-
-BATCHFILE_PRE=/tmp/gdb_backtrace_pre.$$
-BATCHFILE_MAIN=/tmp/gdb_backtrace_main.$$
-case "${DB}" in
-       ladebug)
-cat << EOF  > ${BATCHFILE_PRE}
-set \$stoponattach
-EOF
-
-cat << EOF  > ${BATCHFILE_MAIN}
-where
-quit
-EOF
-       ${DB_BIN} -c "${BATCHFILE_MAIN}" -i "${BATCHFILE_PRE}" -pid "${PID}" 
"${BINARY}"
-       ;;
-       gdb)
-cat << EOF  > ${BATCHFILE_MAIN}
-set height 1000
-bt full
-quit
-EOF
-       ${DB_BIN} -x "${BATCHFILE_MAIN}" "${BINARY}" "${PID}"
-       ;;
-esac
-/bin/rm -f ${BATCHFILE_PRE} ${BATCHFILE_MAIN}
diff --git a/source4/script/gdb_backtrace_test.c 
b/source4/script/gdb_backtrace_test.c
deleted file mode 100644
index 506784f..0000000
--- a/source4/script/gdb_backtrace_test.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
-
-add a usefull tool to test the gdb_backtrace script
-
-just compile it with
-cc -g -o gdb_backtrace_test gdb_backtrace_test.c
-
-and run it in the same directory where your gdb_backtrace script is.
-
-2006 - Stefan Metzmacher <[EMAIL PROTECTED]>
-
-*/
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <signal.h>
-
-static const char *prog;
-
-static void sig_fault(int sig)
-{
-       int ret;
-       char cmdstr[200];
-
-       snprintf(cmdstr, sizeof(cmdstr),
-                "./gdb_backtrace %u %s",
-                getpid(), prog);
-       printf("sig_fault start: %s\n", cmdstr);
-       ret = system(cmdstr);
-       printf("sig_fault end: %d\n", ret);
-}
-
-int main(int argc, const char **argv)
-{
-       prog = argv[0];
-
-       signal(SIGABRT, sig_fault);
-
-       abort();
-       return 0;
-}
diff --git a/source4/script/gdb_run b/source4/script/gdb_run
deleted file mode 100755
index 8ad101e..0000000
--- a/source4/script/gdb_run
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/sh
-
-ENV="$1"
-
-shift 1
-
-if test -z "$TMPDIR"; then
-       TMPDIR="/tmp"
-fi
-
-TMPFILE=$TMPDIR/gdb_run.$$
-cat << EOF  > $TMPFILE
-run
-bt
-EOF
-
-trap "/bin/rm -f $TMPFILE" EXIT
-CMD="gdb -x $TMPFILE --args $@"
-echo $CMD
-eval $ENV "$CMD"
diff --git a/source4/script/valgrind_run b/source4/script/valgrind_run
deleted file mode 100755
index 5171d17..0000000
--- a/source4/script/valgrind_run
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/sh
-
-ENV="$1"
-
-shift 1
-
-CMD="$ENV valgrind -q --db-attach=yes --num-callers=30 $@"
-echo $CMD
-eval $CMD
diff --git a/source4/selftest/config.mk b/source4/selftest/config.mk
index 43c5855..c5f7c5a 100644
--- a/source4/selftest/config.mk
+++ b/source4/selftest/config.mk
@@ -58,30 +58,31 @@ test-%::
 valgrindtest:: valgrindtest-all
 
 valgrindtest-quick:: all
-       SMBD_VALGRIND="xterm -n server -e $(srcdir)/script/valgrind_run 
$(LD_LIBPATH_OVERRIDE)" \
+       SMBD_VALGRIND="xterm -n server -e $(selftestdir)/valgrind_run 
$(LD_LIBPATH_OVERRIDE)" \
        VALGRIND="valgrind -q --num-callers=30 
--log-file=${selftest_prefix}/valgrind.log" \
        $(SELFTEST) $(SELFTEST_QUICK_OPTS) --immediate --socket-wrapper $(TESTS)
 
 valgrindtest-all:: everything
-       SMBD_VALGRIND="xterm -n server -e $(srcdir)/script/valgrind_run 
$(LD_LIBPATH_OVERRIDE)" \
+       SMBD_VALGRIND="xterm -n server -e $(selftestdir)/valgrind_run 
$(LD_LIBPATH_OVERRIDE)" \
        VALGRIND="valgrind -q --num-callers=30 
--log-file=${selftest_prefix}/valgrind.log" \
        $(SELFTEST) $(SELFTEST_NOSLOW_OPTS) --immediate --socket-wrapper 
$(TESTS)
 
 valgrindtest-env:: everything
-       SMBD_VALGRIND="xterm -n server -e $(srcdir)/script/valgrind_run 
$(LD_LIBPATH_OVERRIDE)" \
+       SMBD_VALGRIND="xterm -n server -e $(selftestdir)/valgrind_run 
$(LD_LIBPATH_OVERRIDE)" \
        VALGRIND="valgrind -q --num-callers=30 
--log-file=${selftest_prefix}/valgrind.log" \
        $(SELFTEST) $(SELFTEST_NOSLOW_OPTS) --socket-wrapper --testenv
 
 gdbtest:: gdbtest-all
 
 gdbtest-quick:: all
-       SMBD_VALGRIND="xterm -n server -e $(srcdir)/script/gdb_run 
$(LD_LIBPATH_OVERRIDE)" \
+       SMBD_VALGRIND="xterm -n server -e $(selftestdir)/gdb_run 
$(LD_LIBPATH_OVERRIDE)" \
        $(SELFTEST) $(SELFTEST_QUICK_OPTS) --immediate --socket-wrapper $(TESTS)
 
 gdbtest-all:: everything
-       SMBD_VALGRIND="xterm -n server -e $(srcdir)/script/gdb_run 
$(LD_LIBPATH_OVERRIDE)" \
+       SMBD_VALGRIND="xterm -n server -e $(selftestdir)/gdb_run 
$(LD_LIBPATH_OVERRIDE)" \
        $(SELFTEST) $(SELFTEST_NOSLOW_OPTS) --immediate --socket-wrapper 
$(TESTS)
 
 gdbtest-env:: everything
-       SMBD_VALGRIND="xterm -n server -e $(srcdir)/script/gdb_run 
$(LD_LIBPATH_OVERRIDE)" \
+       SMBD_VALGRIND="xterm -n server -e $(selftestdir)/gdb_run 
$(LD_LIBPATH_OVERRIDE)" \
        $(SELFTEST) $(SELFTEST_NOSLOW_OPTS) --socket-wrapper --testenv
+


-- 
Samba Shared Repository

Reply via email to