]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:tests: Improve debugging for test_wbinfo_lookuprids_cache.sh
authorAndreas Schneider <asn@samba.org>
Fri, 10 Apr 2026 13:45:08 +0000 (15:45 +0200)
committerGünther Deschner <gd@samba.org>
Wed, 22 Apr 2026 16:35:58 +0000 (16:35 +0000)
Note that if this test fails, it is like something else creating keys.
The last time it was a crashing smbd which left a key in the database
and this test failed as a result.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Wed Apr 22 16:35:58 UTC 2026 on atb-devel-224

source3/script/tests/test_wbinfo_lookuprids_cache.sh

index 31dad5c3f14da9514f97205d63d689b4f7eb2b04..7a5d0f7279ab5d44ce211d377be9fb2572148628 100755 (executable)
@@ -28,9 +28,29 @@ testit "flush" "$NET" "cache" "flush" || failed=$(expr $failed + 1)
 testit "lookuprids1" "$WBINFO" "-R" "512,12345" || failed=$(expr $failed + 1)
 
 opnum=$($PYTHON -c'from samba.dcerpc.winbind import wbint_LookupRids; print(wbint_LookupRids.opnum())')
-key=$("$TDBDUMP" "$cache" | awk -F'"' -v opnum="${opnum}" '/key.*NDR/ { regex = "NDR/[^/]+/" opnum "/.*$"; if (match($2, regex)) print substr($2, RSTART, RLENGTH) }')
 
-testit "delete key" "$TDBTOOL" "$cache" delete "$key" || failed=$((failed + 1))
+ndr_keys=$("$TDBDUMP" "$cache" | awk -F'"' -v opnum="${opnum}" '/key.*NDR/ { regex = "NDR/[^/]+/" opnum "/.*$"; if (match($2, regex)) print substr($2, RSTART, RLENGTH) }')
+ndr_key_count=$(echo "$ndr_keys" | grep -c .)
+echo "DEBUG: Found ${ndr_key_count} NDR key(s) for opnum ${opnum}:"
+echo "$ndr_keys" | while IFS= read -r k; do
+       echo "  key='${k}' (length=${#k})"
+done
+
+key=$(echo "$ndr_keys" | head -1)
+echo "DEBUG: Using key='${key}' (length=${#key})"
+
+if [ -n "$key" ]; then
+       echo "DEBUG: Verifying key exists with tdbtool show..."
+       "$TDBTOOL" "$cache" show "$key" 2>&1 \
+               && echo "DEBUG: Key found in TDB" \
+               || echo "DEBUG: Key NOT found in TDB (show failed)"
+fi
+
+testit "delete key" "$TDBTOOL" "$cache" delete "$key" || {
+       failed=$((failed + 1))
+       echo "DEBUG: Post-failure TDB dump of NDR keys:"
+       "$TDBDUMP" "$cache" | grep -A1 "key.*NDR"
+}
 testit "lookuprids2" "$WBINFO" "-R" "512,12345" || failed=$(expr $failed + 1)
 
 testok $0 $failed