The branch, master has been updated
       via  caff670 libcli: Remove code clone
       via  b89de21 ctdb-tests: Add a missing assert()
       via  5e4381d ctdb-tests: Use bash locals for readability
       via  b832049 ctdb-scripts: Drop backward compatibility from 
ctdbd_is_running()
       via  56d526c ctdb-scripts: ctdbd_wrapper should never remove the PID file
      from  d7214a8 spoolss: Fix caching of printername->sharename

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


- Log -----------------------------------------------------------------
commit caff67082a22b4b5250eb73b09e57bb9ab99c346
Author: Moritz Beller <moritzbel...@gmx.de>
Date:   Tue Oct 11 15:39:55 2016 +0200

    libcli: Remove code clone
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12373
    Signed-off-by: Moritz Beller <moritzbel...@gmx.de>
    Reviewed-by: Jeremy Allison <j...@samba.org>
    Reviewed-by: Simo <s...@samba.org>
    
    Autobuild-User(master): Volker Lendecke <v...@samba.org>
    Autobuild-Date(master): Thu Oct 13 18:13:45 CEST 2016 on sn-devel-144

commit b89de21ac365100cd8ea0ff466fcb6aa352df4df
Author: Martin Schwenke <mar...@meltin.net>
Date:   Wed Oct 12 18:36:51 2016 +1100

    ctdb-tests: Add a missing assert()
    
    Signed-off-by: Martin Schwenke <mar...@meltin.net>
    Reviewed-by: Volker Lendecke <v...@samba.org>

commit 5e4381d32302830695f7fb0384d2e433eaf0d6a3
Author: Martin Schwenke <mar...@meltin.net>
Date:   Tue Oct 11 13:32:31 2016 +1100

    ctdb-tests: Use bash locals for readability
    
    This is a bash script so use bash feature instead of using the leading
    underscore convention for locals.
    
    Signed-off-by: Martin Schwenke <mar...@meltin.net>
    Reviewed-by: Volker Lendecke <v...@samba.org>

commit b832049116e1446e44571d63cde9d88a56f017fa
Author: Martin Schwenke <mar...@meltin.net>
Date:   Mon Oct 10 14:48:28 2016 +1100

    ctdb-scripts: Drop backward compatibility from ctdbd_is_running()
    
    The PID file has been used since CTDB 2.3.  Assume that anyone
    upgrading from an older version does a clean shutdown, upgrades CTDB
    and then does a clean start (as opposed to upgrade CTDB and then
    restart).
    
    Signed-off-by: Martin Schwenke <mar...@meltin.net>
    Reviewed-by: Volker Lendecke <v...@samba.org>

commit 56d526c6ea3150a19dd0762b45d23a7c5f96d260
Author: Martin Schwenke <mar...@meltin.net>
Date:   Mon Oct 10 13:16:01 2016 +1100

    ctdb-scripts: ctdbd_wrapper should never remove the PID file
    
    kill_ctdbd() kills the daemon and then removes the PID file.  This is
    racy because a new daemon could write a new PID file in between the
    kill and the removal.  Reversing these steps would be an improvement.
    
    However, none of the places where kill_ctdbd() is called is a safe
    place to remove the PID file.  There is always a chance that a new
    daemon could start, write a new PID file and then kill_ctdbd() could
    remove the new PID file.
    
    ctdbd is able to overwrite a stale PID file by checking to see if it
    is locked.
    
    Therefore, entirely drop removal of the PID file from ctdbd_wrapper.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12287
    
    Signed-off-by: Martin Schwenke <mar...@meltin.net>
    Reviewed-by: Volker Lendecke <v...@samba.org>

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

Summary of changes:
 ctdb/config/ctdbd_wrapper     | 50 ++++++++-----------------------------------
 ctdb/tests/run_tests.sh       | 46 ++++++++++++++++++++-------------------
 ctdb/tests/src/pidfile_test.c |  1 +
 libcli/security/sddl.c        |  2 +-
 4 files changed, 35 insertions(+), 64 deletions(-)


Changeset truncated at 500 lines:

diff --git a/ctdb/config/ctdbd_wrapper b/ctdb/config/ctdbd_wrapper
index cdf0304..11ea59a 100755
--- a/ctdb/config/ctdbd_wrapper
+++ b/ctdb/config/ctdbd_wrapper
@@ -30,53 +30,22 @@ ctdbd="${CTDBD:-/usr/local/sbin/ctdbd}"
 
 # ctdbd_is_running()
 
-# 1. Check if ctdbd is running.
-#    - If the PID file is being used then, if the PID file is present,
-#      ctdbd is only considered to running if the PID in the file is
-#      active.
-#    - If the PID file is not being used (i.e. we're upgrading from a
-#      version that doesn't support it) then the presence of any ctdbd
-#      processes is enough proof.
-
-# 2. Print a comma-separated list of PIDs that can be
-#    used with "pkill -s".
-#    - If the PID file is being used then this is just the PID in that
-#      file.  This also happens to be the session ID, so can be used
-#      to kill all CTDB processes.
-#    - If the PID file is not being used (i.e. upgrading) then this is
-#      just any ctdbd processes that are running.  Hopefully one of
-#      them is the session ID so that it can be used to kill all CTDB
-#      processes.
-
-# Combining these 2 checks is an optimisation to avoid potentially
-# running too many pgrep/pkill processes on an already loaded system.
-# Trawling through /proc/ can be very expensive.
+# Check if ctdbd is running.  ctdbd is only considered to running if
+# the PID in the PID file is active.  Return true if this is the case.
+# Print the PID regardless, since it can be used to kill stale
+# processes in the session.
 
 ctdbd_is_running ()
 {
-    # If the directory for the PID file exists then respect the
-    # existence of a PID file.
-    _pidfile_dir=$(dirname "$pidfile")
-    if [ -d "$_pidfile_dir" ] ; then
        if read _pid 2>/dev/null <"$pidfile" ; then
-           echo "$_pid"
+               echo "$_pid"
 
-           # Return value of kill is used
-           kill -0 "$_pid" 2>/dev/null
+               # Return value of kill is used
+               kill -0 "$_pid" 2>/dev/null
        else
-           # Missing/empty PID file
-           return 1
-       fi
-    else
-       if _pid=$(pgrep -f "${ctdbd}\>") ; then
-               # Use word splitting to squash whitespace
-               # shellcheck disable=SC2086
-           echo $_pid | sed -e 's@ @,@g'
-           return 0
-       else
-           return 1
+               # Missing/empty PID file
+               return 1
        fi
-    fi
 }
 
 ############################################################
@@ -185,7 +154,6 @@ kill_ctdbd ()
 
     if [ -n "$_session" ] ; then
        pkill -9 -s "$_session" 2>/dev/null
-       rm -f "$pidfile"
     fi
 }
 
diff --git a/ctdb/tests/run_tests.sh b/ctdb/tests/run_tests.sh
index a7823dc..fcb4688 100755
--- a/ctdb/tests/run_tests.sh
+++ b/ctdb/tests/run_tests.sh
@@ -155,20 +155,20 @@ if ! which mktemp >/dev/null 2>&1 ; then
     # Not perfect, but it will do...
     mktemp ()
     {
-       _dir=false
+       local dir=false
        if [ "$1" = "-d" ] ; then
-           _dir=true
+           dir=true
        fi
-       _t="${TMPDIR:-/tmp}/tmp.$$.$RANDOM"
+       local t="${TMPDIR:-/tmp}/tmp.$$.$RANDOM"
        (
            umask 077
-           if $_dir ; then
-               mkdir "$_t"
+           if $dir ; then
+               mkdir "$t"
            else
-               >"$_t"
+               >"$t"
            fi
        )
-       echo "$_t"
+       echo "$t"
     }
 fi
 
@@ -179,12 +179,12 @@ set -o pipefail
 
 run_one_test ()
 {
-    _f="$1"
+    local f="$1"
 
-    [ -x "$_f" ] || die "test \"$_f\" is not executable"
+    [ -x "$f" ] || die "test \"$f\" is not executable"
     tests_total=$(($tests_total + 1))
 
-    ctdb_test_run "$_f" | tee "$tf" | show_progress
+    ctdb_test_run "$f" | tee "$tf" | show_progress
     status=$?
     if [ $status -eq 0 ] ; then
        tests_passed=$(($tests_passed + 1))
@@ -192,37 +192,39 @@ run_one_test ()
        tests_failed=$(($tests_failed + 1))
     fi
     if $with_summary ; then
+       local t
        if [ $status -eq 0 ] ; then
-           _t=" PASSED "
+           t=" PASSED "
        else
-           _t="*FAILED*"
+           t="*FAILED*"
        fi
        if $with_desc ; then
            desc=$(tail -n +4 $tf | head -n 1)
-           _f="$desc"
+           f="$desc"
        fi
-       echo "$_t $_f" >>"$sf"
+       echo "$t $f" >>"$sf"
     fi
 }
 
 find_and_run_one_test ()
 {
-    _t="$1"
-    _dir="$2"
+    local t="$1"
+    local dir="$2"
 
-    _f="${_dir}${_dir:+/}${_t}"
+    local f="${dir}${dir:+/}${t}"
 
-    if [ -d "$_f" ] ; then
-       for _i in $(ls "${_f%/}/"*".sh" 2>/dev/null) ; do
-           run_one_test "$_i"
+    if [ -d "$f" ] ; then
+       local i
+       for i in $(ls "${f%/}/"*".sh" 2>/dev/null) ; do
+           run_one_test "$i"
            if $exit_on_fail && [ $status -ne 0 ] ; then
                break
            fi
        done
        # No tests found?  Not a tests directory!  Not found...
        [ -n "$status" ] || status=127
-    elif [ -f "$_f" ] ; then
-       run_one_test "$_f"
+    elif [ -f "$f" ] ; then
+       run_one_test "$f"
     else
        status=127
     fi
diff --git a/ctdb/tests/src/pidfile_test.c b/ctdb/tests/src/pidfile_test.c
index ad8bf14..00b64ca 100644
--- a/ctdb/tests/src/pidfile_test.c
+++ b/ctdb/tests/src/pidfile_test.c
@@ -43,6 +43,7 @@ static void test1(const char *pidfile)
        assert(S_ISREG(st.st_mode));
 
        fp = fopen(pidfile, "r");
+       assert(fp != NULL);
        ret = fscanf(fp, "%d", &pid);
        assert(ret == 1);
        assert(pid == getpid());
diff --git a/libcli/security/sddl.c b/libcli/security/sddl.c
index 47e5934..9a5a250 100644
--- a/libcli/security/sddl.c
+++ b/libcli/security/sddl.c
@@ -529,7 +529,7 @@ static char *sddl_encode_ace(TALLOC_CTX *mem_ctx, const 
struct security_ace *ace
        if (ace->type == SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT ||
            ace->type == SEC_ACE_TYPE_ACCESS_DENIED_OBJECT ||
            ace->type == SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT ||
-           ace->type == SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT) {
+           ace->type == SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT) {
                if (ace->object.object.flags & SEC_ACE_OBJECT_TYPE_PRESENT) {
                        sddl_object = GUID_string(
                                tmp_ctx, &ace->object.object.type.type);


-- 
Samba Shared Repository

Reply via email to