[SCM] Samba Shared Repository - branch v4-6-test updated

Karolin Seeger kseeger at samba.org
Fri May 12 10:58:03 UTC 2017


The branch, v4-6-test has been updated
       via  10b04d7 s3:smbcacls add prompt for password
       via  db9553e idmap_rfc2307: Test unix-ids-to-sids with 35 groups
       via  ea5dd00 selftest: Avoid idmap caching when testing idmap_rfc2307
       via  e0060df idmap_rfc2307: "ldap_next_entry" needs the previous entry, not the start
       via  0160f27 idmap_rfc2307: Don't stop after 30 entries
       via  c66a8b0 test_idmap_rfc2307: Test wbinfo -r for 35 supplementary group memberships
       via  cbf96d9 test_idmap_rfc2307: Do a recursive delete in ou=idmap
       via  bdea676 test_idmap_rfc2307: Correct usage
       via  301abae test_idmap_rfc2307: Avoid a tmpfile
       via  c2d7a72 test_idmap_rfc2307: Remove the correct file
       via  c73b49e idmap_rfc2307: "ldap_next_entry" needs the previous entry, not the start
       via  117547d idmap_rfc2307: Don't stop after 30 entries
       via  c7bead7 samba-tool: let 'samba-tool user syncpasswords' report deletions immediately
       via  ade0e8f4 s3/smbd: update exclusive oplock optimisation to the lease area
       via  6b3ebfb s3/smbd: update exclusive oplock optimisation to the lease area
       via  11a866e s3/locking: helper functions for lease types
       via  c82072f s3/locking: add const to fsp_lease_type
      from  82317ad systemd: fix detection of libsystemd

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-6-test


- Log -----------------------------------------------------------------
commit 10b04d77a8369112fb88fe83500918e5aa01b6f7
Author: Christian Ambach <ambi at samba.org>
Date:   Thu May 4 12:21:45 2017 +0200

    s3:smbcacls add prompt for password
    
    if no password was given, ask for one
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12765
    Signed-off-by: Christian Ambach <ambi at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    
    Autobuild-User(master): Christian Ambach <ambi at samba.org>
    Autobuild-Date(master): Thu May  4 20:36:50 CEST 2017 on sn-devel-144
    
    (cherry picked from commit 770edb6aab2a1c2cbd85b975511b33b5fc580f13)
    
    Autobuild-User(v4-6-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-6-test): Fri May 12 12:57:38 CEST 2017 on sn-devel-144

commit db9553e89b22caab556018bc66193f58f1c5d2b4
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Apr 6 12:50:08 2017 +0200

    idmap_rfc2307: Test unix-ids-to-sids with 35 groups
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12757
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Christof Schmitt <cs at samba.org>
    (cherry picked from commit ee3b17ba4674a17a411c9ec4271e087c8cd7dad1)

commit ea5dd00ddc7964aeb3a39f1dbff10078b9166f65
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Apr 4 17:15:10 2017 +0200

    selftest: Avoid idmap caching when testing idmap_rfc2307
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12757
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Christof Schmitt <cs at samba.org>
    (cherry picked from commit da7481f835ddc1fab16d11ccbaf7f33c213af23a)

commit e0060dfe96e18410f56d806edd399b4b1f37e3db
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Mar 31 15:23:39 2017 +0000

    idmap_rfc2307: "ldap_next_entry" needs the previous entry, not the start
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12757
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Christof Schmitt <cs at samba.org>
    (cherry picked from commit 803ea2d2b7820939d03f7eb381c3cf719a00ff4a)

commit 0160f27a8b3a094686c8d56742eab97fea3aedb7
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Mar 31 15:20:07 2017 +0000

    idmap_rfc2307: Don't stop after 30 entries
    
    We start over again and again, so we need to search in the whole list.
    This is a quick hack generating a bad O(n^2). The real fix is to
    call idmap_rfc2307_find_map with "maps" starting at the right offset,
    but that's an optimization for later when it's restructured
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12757
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Christof Schmitt <cs at samba.org>
    (cherry picked from commit c0f12170e8b9fb3ab75f53bba637c72f6465192e)

commit c66a8b0e5e878135f889168808c16ef179df99f5
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Apr 4 15:28:36 2017 +0200

    test_idmap_rfc2307: Test wbinfo -r for 35 supplementary group memberships
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12757
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Christof Schmitt <cs at samba.org>
    (cherry picked from commit e663357b4d7d5cb0c4d8a0ebc97cfcb58429b894)

commit cbf96d9b6850602a00e6a92bf65736f5feec694e
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Apr 4 15:12:02 2017 +0200

    test_idmap_rfc2307: Do a recursive delete in ou=idmap
    
    We'll create more posix objects soon
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12757
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Christof Schmitt <cs at samba.org>
    (cherry picked from commit 1f5097e3fbf9931c830880637622bb0b05863466)

commit bdea6761db377b75b4f18f5ca945347e9afdc192
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Apr 4 14:59:45 2017 +0200

    test_idmap_rfc2307: Correct usage
    
    We already have 13 args at this point, and growing
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12757
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Christof Schmitt <cs at samba.org>
    (cherry picked from commit f34ff621edbfd8b7c99cdadec166a80ae9c5646c)

commit 301abae4998b236c9f2cd1e4f3c6c381b21c6c3c
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Apr 4 14:15:26 2017 +0200

    test_idmap_rfc2307: Avoid a tmpfile
    
    We can << directly into ldbadd
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12757
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Christof Schmitt <cs at samba.org>
    (cherry picked from commit 1893bb9bc48d9251820a185c95c65562f2878074)

commit c2d7a726c43158d49422cc2965426bc6b1355c3c
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Apr 4 14:15:26 2017 +0200

    test_idmap_rfc2307: Remove the correct file
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12757
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Christof Schmitt <cs at samba.org>
    (cherry picked from commit 9e816ea2f8d21d392b4e9050e443ef936629202e)

commit c73b49e16f2a7d27886d9914d49bb1462cc7b76a
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Mar 31 15:23:39 2017 +0000

    idmap_rfc2307: "ldap_next_entry" needs the previous entry, not the start
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12757
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Christof Schmitt <cs at samba.org>
    (cherry picked from commit 17563f295ffa7379daa5bf7cc89540df4ae4f7b3)

commit 117547dd52a2cddd1adf46d23e450d1198c049bb
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Mar 31 15:20:07 2017 +0000

    idmap_rfc2307: Don't stop after 30 entries
    
    We start over again and again, so we need to search in the whole list.
    This is a quick hack generating a bad O(n^2). The real fix is to
    call idmap_rfc2307_find_map with "maps" starting at the right offset,
    but that's an optimization for later when it's restructured
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12757
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Christof Schmitt <cs at samba.org>
    (cherry picked from commit 54a0e7e3d7332f420f36a3a20dd62156e6adea46)

commit c7bead74bf782b2c8190c9c246d00aecbdadca73
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Apr 25 13:25:57 2017 +0200

    samba-tool: let 'samba-tool user syncpasswords' report deletions immediately
    
    We need to use the show-recycled control in addition to the
    notification control in order to get notifications about deletions.
    
    There's no real problem as the next modification will report the deletion.
    But it might be delayed a few minutes.
    
    Note that show-recycled is a superset of show-deleted, so we only need one.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12767
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    (cherry picked from commit afa15e6128473d3e4006f7cdc3762ab4c1cba05a)

commit ade0e8f473acd4c02537ab1177c114e035351014
Author: Ralph Boehme <slow at samba.org>
Date:   Thu May 4 11:52:16 2017 +0200

    s3/smbd: update exclusive oplock optimisation to the lease area
    
    Update an optimisation in update_num_read_oplocks() that checks for
    exclusive oplocks to the lease area.
    
    The idea of the optimisation is to avoid expensive db queries in
    brlock.tdb if we *know* we're the only open.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=12766
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Signed-off-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Ralph Böhme <slow at samba.org>
    Autobuild-Date(master): Sat May  6 22:58:47 CEST 2017 on sn-devel-144
    
    (cherry picked from commit a50343779a8a92d6f53095b36506b1d47ef68513)

commit 6b3ebfb7a507e7a3472da1bac01e47b2dcceaf61
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Apr 20 21:37:37 2017 +0200

    s3/smbd: update exclusive oplock optimisation to the lease area
    
    This is similar to 9533a55ee5ffe430589dcea845851b84876ef656 but this
    time in the contend_level2_oplocks_begin_default() function.
    
    The idea of the optimisation is to avoid expensive db queries in
    locking.tdb if we *know* we're the only open.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=12766
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 0a4a08ad1cef3b7d6fd47df3a93c2c89dd287ee8)

commit 11a866eef1ff12eebf9a56bc9db0b82b7e2c2aa3
Author: Ralph Boehme <slow at samba.org>
Date:   Thu May 4 11:50:56 2017 +0200

    s3/locking: helper functions for lease types
    
    Add some helper functions that will be used to update a bunch of checks
    for exclusive oplocks to the lease area.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=12766
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit f631e95e2de857ea98204609a71e6db00993994b)

commit c82072f9c5a20890a2402215bee5aea4f6901669
Author: Ralph Boehme <slow at samba.org>
Date:   Thu May 4 11:50:01 2017 +0200

    s3/locking: add const to fsp_lease_type
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=12766
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 952701dce09b1ee89a0f6a450ac244fd6451955b)

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

Summary of changes:
 nsswitch/tests/test_idmap_rfc2307.sh | 130 ++++++++++++++++++++++++++---------
 python/samba/netcmd/user.py          |   2 +-
 selftest/target/Samba3.pm            |   2 +
 source3/locking/leases_util.c        |  19 ++++-
 source3/locking/proto.h              |   4 +-
 source3/selftest/tests.py            |  12 +++-
 source3/smbd/oplock.c                |  15 ++--
 source3/utils/smbcacls.c             |   1 +
 source3/winbindd/idmap_rfc2307.c     |   9 +--
 source3/winbindd/idmap_util.c        |   5 +-
 10 files changed, 149 insertions(+), 50 deletions(-)


Changeset truncated at 500 lines:

diff --git a/nsswitch/tests/test_idmap_rfc2307.sh b/nsswitch/tests/test_idmap_rfc2307.sh
index 90e32a7..c62da5d 100755
--- a/nsswitch/tests/test_idmap_rfc2307.sh
+++ b/nsswitch/tests/test_idmap_rfc2307.sh
@@ -1,7 +1,9 @@
 #!/bin/sh
 # Test id mapping through idmap_rfc2307 module
-if [ $# -lt 9 ]; then
-	echo Usage: $0 DOMAIN USERNAME UID USERNAME2 UID2 GROUPNAME GID GROUPNAME2 GID2 LDAPPREFIX DC_SERVER DC_USERNAME DC_PASSWORD
+if [ $# -lt 15 ]; then
+    echo Usage: $0 DOMAIN USERNAME UID USERNAME2 UID2 \
+	 GROUPNAME GID GROUPNAME2 GID2 GID_START NUMGROUPS \
+	 LDAPPREFIX DC_SERVER DC_USERNAME DC_PASSWORD
 	exit 1
 fi
 
@@ -15,12 +17,20 @@ GROUPGID="$7"
 GROUPNAME2="$8"
 GROUPGID2="$9"
 shift 9
-LDAPPREFIX="$1"
-DC_SERVER="$2"
-DC_USERNAME="$3"
-DC_PASSWORD="$4"
+GID_START="$1"
+NUMGROUPS="$2"
+LDAPPREFIX="$3"
+DC_SERVER="$4"
+DC_USERNAME="$5"
+DC_PASSWORD="$6"
 
 wbinfo="$VALGRIND $BINDIR/wbinfo"
+net="$VALGRIND $BINDIR/net"
+
+ldbsearch="ldbsearch"
+if [ -x "$BINDIR/ldbsearch" ]; then
+	ldbsearch="$BINDIR/ldbsearch"
+fi
 
 ldbadd="ldbadd"
 if [ -x "$BINDIR/ldbadd" ]; then
@@ -37,22 +47,23 @@ failed=0
 . `dirname $0`/../../testprogs/blackbox/subunit.sh
 
 # Delete LDAP records
-$VALGRIND $ldbdel -H ldap://$DC_SERVER -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD "cn=$USERNAME,$LDAPPREFIX"
-$VALGRIND $ldbdel -H ldap://$DC_SERVER -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD "cn=$USERNAME2,$LDAPPREFIX"
-$VALGRIND $ldbdel -H ldap://$DC_SERVER -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD "cn=$GROUPNAME,$LDAPPREFIX"
-$VALGRIND $ldbdel -H ldap://$DC_SERVER -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD "cn=$GROUPNAME2,$LDAPPREFIX"
+$VALGRIND $ldbsearch -H ldap://$DC_SERVER -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD \
+	  -s one -b "$LDAPPREFIX" | grep '^dn:' | cut -d ' ' -f 2- |
+    xargs -d '\n' -n 1 -IDEL_DN \
+	  $ldbdel -H ldap://$DC_SERVER -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD \
+	  "DEL_DN"
 $VALGRIND $ldbdel -H ldap://$DC_SERVER -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD "$LDAPPREFIX"
 
 # Add id mapping information to LDAP
 
-cat > $PREFIX/tmpldb <<EOF
+testit "add ldap prefix" $VALGRIND $ldbadd -H ldap://$DC_SERVER \
+        -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD <<EOF
 dn: $LDAPPREFIX
 objectclass: organizationalUnit
 EOF
 
-testit "add ldap prefix" $VALGRIND $ldbadd -H ldap://$DC_SERVER -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD $PREFIX/tmpldb
-
-cat > $PREFIX/tmpldb <<EOF
+testit "add ldap user mapping record" $VALGRIND $ldbadd -H ldap://$DC_SERVER \
+        -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD <<EOF
 dn: cn=$USERNAME,$LDAPPREFIX
 objectClass: organizationalPerson
 objectClass: posixAccount
@@ -64,9 +75,8 @@ gidNumber: 1
 homeDirectory: /home/admin
 EOF
 
-testit "add ldap user mapping record" $VALGRIND $ldbadd -H ldap://$DC_SERVER -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD $PREFIX/tmpldb
-
-cat > $PREFIX/tmpldb <<EOF
+testit "add second ldap user mapping record" $VALGRIND $ldbadd \
+       -H ldap://$DC_SERVER -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD <<EOF
 dn: cn=$USERNAME2,$LDAPPREFIX
 objectClass: organizationalPerson
 objectClass: posixAccount
@@ -78,9 +88,8 @@ gidNumber: 2
 homeDirectory: /home/admin
 EOF
 
-testit "add second ldap user mapping record" $VALGRIND $ldbadd -H ldap://$DC_SERVER -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD $PREFIX/tmpldb
-
-cat > $PREFIX/tmpldb <<EOF
+testit "add ldap group mapping record" $VALGRIND $ldbadd \
+       -H ldap://$DC_SERVER -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD <<EOF
 dn: cn=$GROUPNAME,$LDAPPREFIX
 objectClass: posixGroup
 objectClass: groupOfNames
@@ -89,9 +98,8 @@ gidNumber: $GROUPGID
 member: cn=$USERNAME,$LDAPPREFIX
 EOF
 
-testit "add ldap group mapping record" $VALGRIND $ldbadd -H ldap://$DC_SERVER -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD $PREFIX/tmpldb
-
-cat > $PREFIX/tmpldb <<EOF
+testit "add second ldap group mapping record" $VALGRIND $ldbadd \
+       -H ldap://$DC_SERVER -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD <<EOF
 dn: cn=$GROUPNAME2,$LDAPPREFIX
 objectClass: posixGroup
 objectClass: groupOfNames
@@ -100,10 +108,6 @@ gidNumber: $GROUPGID2
 member: cn=$USERNAME,$LDAPPREFIX
 EOF
 
-testit "add second ldap group mapping record" $VALGRIND $ldbadd -H ldap://$DC_SERVER -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD $PREFIX/tmpldb
-
-rm -f $PREFIX/tmpldbmodify
-
 testit "wbinfo --name-to-sid" $wbinfo --name-to-sid "$DOMAIN/$USERNAME" || failed=$(expr $failed + 1)
 user_sid=$($wbinfo -n "$DOMAIN/$USERNAME" | cut -d " " -f1)
 echo "$DOMAIN/$USERNAME resolved to $user_sid"
@@ -147,11 +151,75 @@ echo "SID $group_sid2 resolved to $group_name2"
 
 testit "test $group_name2 = $DOMAIN/$GROUPNAME2" test "$(echo $group_name2 | tr A-Z a-z)" = "$(echo $DOMAIN/$GROUPNAME2 | tr A-Z a-z)" || failed=$(expr $failed + 1)
 
+i=0
+while [ ${i} -lt ${NUMGROUPS} ] ; do
+    GRP=$(printf "test_rfc2307_group_%3.3d" "$i")
+    GRP_GID=$(expr "$GID_START" + "$i")
+    testit "Add group $GRP" $net rpc group add "$GRP" -S "$DC_SERVER" \
+	   -U"${DOMAIN}\\${DC_USERNAME}"%"${DC_PASSWORD}" ||
+	failed=$(expr $failed + 1)
+    testit "Add groupmem $GRP $USERNAME" \
+	   $net rpc group addmem "$GRP" "$USERNAME" \
+	   -S "$DC_SERVER" \
+	   -U"${DOMAIN}\\${DC_USERNAME}"%"${DC_PASSWORD}" ||
+	failed=$(expr $failed + 1)
+    testit "Add group object for $GRP $GRP_GID" \
+	   $VALGRIND $ldbadd \
+       -H ldap://$DC_SERVER -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD <<EOF
+dn: cn=$GRP,$LDAPPREFIX
+objectClass: posixGroup
+objectClass: groupOfNames
+cn: $GRP
+gidNumber: $GRP_GID
+member: cn=$USERNAME,$LDAPPREFIX
+EOF
+    i=$(expr "$i" + 1)
+done
+
+# Test whether wbinfo --xids-to-sids finds everything
+
+GIDS=""
+i=0
+while [ ${i} -lt ${NUMGROUPS} ] ; do
+    GIDS="$GIDS g$(expr ${i} + ${GID_START})"
+    i=$(expr "$i" + 1)
+done
+NUM_VALID_SIDS=$($wbinfo --unix-ids-to-sids="$GIDS" | grep -v ^S-0-0 | wc -l)
+
+testit "Count number of valid sids found" \
+       test ${NUM_VALID_SIDS} = ${NUMGROUPS} ||
+       failed=$(expr $failed + 1)
+
+# Test whether wbinfo -r shows all groups
+
+EXPECTED_USERGROUPS="1000000/1000001/2000002/"
+i=0
+while [ ${i} -lt ${NUMGROUPS} ] ; do
+    EXPECTED_USERGROUPS="$EXPECTED_USERGROUPS$(expr ${i} + ${GID_START})/"
+    i=$(expr "$i" + 1)
+done
+
+USERGROUPS=$($wbinfo -r $DOMAIN/$USERNAME | sort -n | tr '\n' '/')
+
+testit "Testing for expected group memberships" \
+       test "$USERGROUPS" = "$EXPECTED_USERGROUPS" ||
+       failed=$(expr $failed + 1)
+
+i=0
+while [ ${i} -lt ${NUMGROUPS} ] ; do
+    GRP=$(printf "test_rfc2307_group_%3.3d" ${i})
+    testit "Del group $GRP" $net rpc group delete "$GRP" -S "$DC_SERVER" \
+	   -U"${DOMAIN}\\${DC_USERNAME}"%"${DC_PASSWORD}" ||
+	failed=$(expr $failed + 1)
+    i=$(expr "$i" + 1)
+done
+
 # Delete LDAP records
-$VALGRIND $ldbdel -H ldap://$DC_SERVER -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD "cn=$USERNAME,$LDAPPREFIX"
-$VALGRIND $ldbdel -H ldap://$DC_SERVER -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD "cn=$USERNAME2,$LDAPPREFIX"
-$VALGRIND $ldbdel -H ldap://$DC_SERVER -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD "cn=$GROUPNAME,$LDAPPREFIX"
-$VALGRIND $ldbdel -H ldap://$DC_SERVER -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD "cn=$GROUPNAME2,$LDAPPREFIX"
+$VALGRIND $ldbsearch -H ldap://$DC_SERVER -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD \
+	  -s one -b "$LDAPPREFIX" | grep '^dn:' | cut -d ' ' -f 2- |
+    xargs -d '\n' -n 1 -IDEL_DN \
+	  $ldbdel -H ldap://$DC_SERVER -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD \
+	  "DEL_DN"
 $VALGRIND $ldbdel -H ldap://$DC_SERVER -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD "$LDAPPREFIX"
 
 exit $failed
diff --git a/python/samba/netcmd/user.py b/python/samba/netcmd/user.py
index f007ee5..858ade4 100644
--- a/python/samba/netcmd/user.py
+++ b/python/samba/netcmd/user.py
@@ -1861,7 +1861,7 @@ samba-tool user syncpasswords --terminate \\
 
         def sync_loop(wait):
             notify_attrs = ["name", "uSNCreated", "uSNChanged", "objectClass"]
-            notify_controls = ["notification:1"]
+            notify_controls = ["notification:1", "show_recycled:1"]
             notify_handle = self.samdb.search_iterator(expression="objectClass=*",
                                                        scope=ldb.SCOPE_SUBTREE,
                                                        attrs=notify_attrs,
diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index d81e4a4..fb6d0f4 100755
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -507,6 +507,8 @@ sub setup_admember_rfc2307($$$$)
 	security = ads
         workgroup = $dcvars->{DOMAIN}
         realm = $dcvars->{REALM}
+        idmap cache time = 0
+        idmap negative cache time = 0
         idmap config * : backend = autorid
         idmap config * : range = 1000000-1999999
         idmap config * : rangesize = 100000
diff --git a/source3/locking/leases_util.c b/source3/locking/leases_util.c
index cb307c8..af1e837 100644
--- a/source3/locking/leases_util.c
+++ b/source3/locking/leases_util.c
@@ -46,10 +46,27 @@ uint32_t map_oplock_to_lease_type(uint16_t op_type)
 	return ret;
 }
 
-uint32_t fsp_lease_type(struct files_struct *fsp)
+uint32_t fsp_lease_type(const struct files_struct *fsp)
 {
 	if (fsp->oplock_type == LEASE_OPLOCK) {
 		return fsp->lease->lease.lease_state;
 	}
 	return map_oplock_to_lease_type(fsp->oplock_type);
 }
+
+uint32_t lease_type_is_exclusive(uint32_t lease_type)
+{
+	if ((lease_type & (SMB2_LEASE_READ | SMB2_LEASE_WRITE)) ==
+	    (SMB2_LEASE_READ | SMB2_LEASE_WRITE)) {
+		return true;
+	}
+
+	return false;
+}
+
+bool fsp_lease_type_is_exclusive(const struct files_struct *fsp)
+{
+	uint32_t lease_type = fsp_lease_type(fsp);
+
+	return lease_type_is_exclusive(lease_type);
+}
diff --git a/source3/locking/proto.h b/source3/locking/proto.h
index 17cb1cd..461f89a 100644
--- a/source3/locking/proto.h
+++ b/source3/locking/proto.h
@@ -250,6 +250,8 @@ bool release_posix_lock_posix_flavour(files_struct *fsp,
 
 /* The following definitions come from locking/leases_util.c */
 uint32_t map_oplock_to_lease_type(uint16_t op_type);
-uint32_t fsp_lease_type(struct files_struct *fsp);
+uint32_t fsp_lease_type(const struct files_struct *fsp);
+uint32_t lease_type_is_exclusive(uint32_t lease_type);
+bool fsp_lease_type_is_exclusive(const struct files_struct *fsp);
 
 #endif /* _LOCKING_PROTO_H_ */
diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py
index 5bc37cd..dfe7866 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -393,7 +393,17 @@ for t in tests:
         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/write-list-tmp -U$USERNAME%$PASSWORD')
         plansmbtorture4testsuite(t, "ad_dc", '//$SERVER/tmp -U$USERNAME%$PASSWORD')
     elif t == "idmap.rfc2307":
-        plantestsuite(t, "ad_member_rfc2307", [os.path.join(samba3srcdir, "../nsswitch/tests/test_idmap_rfc2307.sh"), '$DOMAIN', 'Administrator', '2000000', 'Guest', '2000001', '"Domain Users"', '2000002', 'DnsAdmins', '2000003', 'ou=idmap,dc=samba,dc=example,dc=com', '$DC_SERVER', '$DC_USERNAME', '$DC_PASSWORD'])
+        plantestsuite(t, "ad_member_rfc2307",
+                      [os.path.join(samba3srcdir,
+                                    "../nsswitch/tests/test_idmap_rfc2307.sh"),
+                       '$DOMAIN',
+                       'Administrator', '2000000',
+                       'Guest', '2000001',
+                       '"Domain Users"', '2000002',
+                       'DnsAdmins', '2000003',
+                       '2000005', '35',
+                       'ou=idmap,dc=samba,dc=example,dc=com',
+                       '$DC_SERVER', '$DC_USERNAME', '$DC_PASSWORD'])
     elif t == "idmap.alloc":
         plantestsuite(t, "ad_member_rfc2307", [os.path.join(samba3srcdir, "../nsswitch/tests/test_idmap_nss.sh"), '$DOMAIN'])
     elif t == "idmap.rid":
diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c
index 57b53f8..ff7c037 100644
--- a/source3/smbd/oplock.c
+++ b/source3/smbd/oplock.c
@@ -165,13 +165,18 @@ bool update_num_read_oplocks(files_struct *fsp, struct share_mode_lock *lck)
 	uint32_t num_read_oplocks = 0;
 	uint32_t i;
 
-	if (EXCLUSIVE_OPLOCK_TYPE(fsp->oplock_type)) {
+	if (fsp_lease_type_is_exclusive(fsp)) {
 		/*
-		 * If we're the only one, we don't need a brlock entry
+		 * If we're fully exclusive, we don't need a brlock entry
 		 */
 		remove_stale_share_mode_entries(d);
-		SMB_ASSERT(d->num_share_modes == 1);
-		SMB_ASSERT(EXCLUSIVE_OPLOCK_TYPE(d->share_modes[0].op_type));
+
+		for (i=0; i<d->num_share_modes; i++) {
+			struct share_mode_entry *e = &d->share_modes[i];
+			uint32_t e_lease_type = get_lease_type(d, e);
+
+			SMB_ASSERT(lease_type_is_exclusive(e_lease_type));
+		}
 		return true;
 	}
 
@@ -1043,7 +1048,7 @@ static void contend_level2_oplocks_begin_default(files_struct *fsp,
 	 * the shared memory area whilst doing this.
 	 */
 
-	if (EXCLUSIVE_OPLOCK_TYPE(fsp->oplock_type)) {
+	if (fsp_lease_type_is_exclusive(fsp)) {
 		/*
 		 * There can't be any level2 oplocks, we're alone.
 		 */
diff --git a/source3/utils/smbcacls.c b/source3/utils/smbcacls.c
index 255ff97..18fb8b0 100644
--- a/source3/utils/smbcacls.c
+++ b/source3/utils/smbcacls.c
@@ -903,6 +903,7 @@ int main(int argc, char *argv[])
 
 	poptFreeContext(pc);
 	popt_burn_cmdline_password(argc, argv);
+	popt_common_credentials_post();
 
 	string_replace(path,'/','\\');
 
diff --git a/source3/winbindd/idmap_rfc2307.c b/source3/winbindd/idmap_rfc2307.c
index 34cc5cd..0e0311a 100644
--- a/source3/winbindd/idmap_rfc2307.c
+++ b/source3/winbindd/idmap_rfc2307.c
@@ -236,7 +236,7 @@ static void idmap_rfc2307_map_sid_results(struct idmap_rfc2307_context *ctx,
 		if (i == 0) {
 			entry = ldap_first_entry(ctx->ldap, result);
 		} else {
-			entry = ldap_next_entry(ctx->ldap, result);
+			entry = ldap_next_entry(ctx->ldap, entry);
 		}
 		if (!entry) {
 			DEBUG(2, ("Unable to fetch entry.\n"));
@@ -521,10 +521,7 @@ static struct id_map* idmap_rfc2307_find_map(struct idmap_rfc2307_map *maps,
 
 	DEBUG(10, ("Looking for name %s, type %d\n", name, type));
 
-	for (i = 0; i < IDMAP_LDAP_MAX_IDS; i++) {
-		if (maps[i].map == NULL) { /* end of the run */
-			return NULL;
-		}
+	for (i = 0; maps[i].map != NULL; i++) {
 		DEBUG(10, ("Entry %d: name %s, type %d\n",
 			   i, maps[i].name, maps[i].type));
 		if (type == maps[i].type && strcmp(name, maps[i].name) == 0) {
@@ -556,7 +553,7 @@ static void idmap_rfc2307_map_xid_results(struct idmap_rfc2307_context *ctx,
 		if (i == 0) {
 			entry = ldap_first_entry(ctx->ldap, result);
 		} else {
-			entry = ldap_next_entry(ctx->ldap, result);
+			entry = ldap_next_entry(ctx->ldap, entry);
 		}
 		if (!entry) {
 			DEBUG(2, ("Unable to fetch entry.\n"));
diff --git a/source3/winbindd/idmap_util.c b/source3/winbindd/idmap_util.c
index 196b4ad..fd2ae4a 100644
--- a/source3/winbindd/idmap_util.c
+++ b/source3/winbindd/idmap_util.c
@@ -52,10 +52,7 @@ struct id_map *idmap_find_map_by_id(struct id_map **maps, enum id_type type,
 {
 	int i;
 
-	for (i = 0; i < IDMAP_LDAP_MAX_IDS; i++) {
-		if (maps[i] == NULL) { /* end of the run */
-			return NULL;
-		}
+	for (i = 0; maps[i] != NULL; i++) {
 		if ((maps[i]->xid.type == type) && (maps[i]->xid.id == id)) {
 			return maps[i];
 		}


-- 
Samba Shared Repository



More information about the samba-cvs mailing list