]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:tests: Make winbind_call_depth_trace to use global_inject.conf
authorPavel Filipenský <pfilipensky@samba.org>
Sat, 30 Nov 2024 19:49:05 +0000 (20:49 +0100)
committerPavel Filipensky <pfilipensky@samba.org>
Thu, 5 Dec 2024 14:57:33 +0000 (14:57 +0000)
To get the expected traces we need:

debug syslog format = no
log level = 10

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
source3/script/tests/test_winbind_call_depth_trace.sh

index 6d978beca8f905ba2d5860f56c2161450fc711f4..e3cd441f0a7bae6127a8dd7630aa6fe866cc047c 100755 (executable)
@@ -34,43 +34,22 @@ EOF
        exit 0
 fi
 
-saved_level=1
-
-get_winbind_loglevel()
-{
-       s1=$(${SMBCONTROL} "${CONFIGURATION}" winbind debuglevel)
-       # We need to get the all level from output like this:
-       # "PID 664474: all:1 tdb:1 printdrivers:1  lanman:1 smb:1 rpc_parse:1 rpc_srv:1 rpc_cli:1 passdb:1 sam:1..."
-       # 1. remove PID 664474:
-       s2=${s1#PID*: }
-       # "all:1 tdb:1 printdrivers:1  lanman:1 smb:1 rpc_parse:1 rpc_srv:1 rpc_cli:1 passdb"
-       # 2. remove " tdb:1 printdrivers:1 ..."
-       s3=${s2%% *}
-       # "all:1"
-       # 3. remove "all:"
-       saved_level=${s3#all:}
-}
-
 # Example of trace line
 # [2023/01/25 00:20:33.307038,  5, pid=535581, effective(0, 0), real(0, 0), class=winbind, traceid=78, depth=4] ../../source3/winbindd/wb_group_members.c:310(wb_group_members_send)
 test_winbind_call_depth_trace()
 {
-       get_winbind_loglevel
-
-       # If loglevel < 10, set it to 10.
-       if [ "$saved_level" -lt 10 ]; then
-               ${SMBCONTROL}  "${CONFIGURATION}" winbind debug 10
-       fi
+       global_inject_conf=$(dirname $SMB_CONF_PATH)/global_inject.conf
+       echo "debug syslog format = no" >$global_inject_conf
+       echo "log level = 10" >>$global_inject_conf
+       ${SMBCONTROL} "${CONFIGURATION}" winbind reload-config
 
        COUNT1=$(grep -c wb_group_members_send "$LOGFILE")
 
        id ADDOMAIN/alice
        ret=$?
 
-       # Restore loglevel, if it was changed.
-       if [ "$saved_level" -lt 10 ]; then
-               ${SMBCONTROL} "${CONFIGURATION}" winbind debug "$saved_level"
-       fi
+       echo "" >$global_inject_conf
+       ${SMBCONTROL} "${CONFIGURATION}" winbind reload-config
 
        if [ $ret != 0 ]; then
                echo "Command 'id ADDOMAIN/alice' failed!"