From: Stefan Metzmacher Date: Thu, 3 Apr 2025 14:55:19 +0000 (+0200) Subject: ctdb:events: let 50.samba.script normalize the transports to tcp ports X-Git-Tag: tevent-0.17.0~287 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cbcc94be5430fee6661c48e5e67df8862cca2cd6;p=thirdparty%2Fsamba.git ctdb:events: let 50.samba.script normalize the transports to tcp ports Signed-off-by: Stefan Metzmacher Reviewed-by: Volker Lendecke --- diff --git a/ctdb/config/events/legacy/50.samba.script b/ctdb/config/events/legacy/50.samba.script index 41864d59e80..195c9259ee8 100755 --- a/ctdb/config/events/legacy/50.samba.script +++ b/ctdb/config/events/legacy/50.samba.script @@ -152,6 +152,17 @@ list_samba_ports() testparm_get "smb ports" } +normalize_transports_to_tcp_ports() +{ + echo "$1" | sed \ + -e 's!,! !g' \ + -e 's!\:!!g' \ + -e 's!\!445!g' \ + -e 's!\:!!g' \ + -e 's!\!139!g' \ + -e 's!\<[a-zA-Z][^ ]*!!g' +} + ########################### case "$1" in @@ -172,9 +183,11 @@ monitor) smb_ports=$(list_samba_ports) [ -n "$smb_ports" ] || die "Failed to set smb ports" fi + smb_tcp_ports=$(normalize_transports_to_tcp_ports "$smb_ports") + [ -n "$smb_tcp_ports" ] || die "Failed to set smb tcp ports" # Intentionally unquoted multi-word value here # shellcheck disable=SC2086 - ctdb_check_tcp_ports $smb_ports || exit $? + ctdb_check_tcp_ports $smb_tcp_ports || exit $? if [ "$CTDB_SAMBA_SKIP_SHARE_CHECK" != "yes" ]; then list_samba_shares | ctdb_check_directories || exit $?