Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F151350930
D54778.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
5 KB
Referenced Files
None
Subscribers
None
D54778.id.diff
View Options
diff --git a/usr.sbin/syslogd/tests/syslogd_test.sh b/usr.sbin/syslogd/tests/syslogd_test.sh
--- a/usr.sbin/syslogd/tests/syslogd_test.sh
+++ b/usr.sbin/syslogd/tests/syslogd_test.sh
@@ -419,15 +419,16 @@
syslogd_start -j syslogd_allowed_peer -b 169.254.0.1:514 -a '169.254.0.2/32'
# Make sure that a message from 169.254.0.2:514 is logged.
- atf_check jexec syslogd_client \
- logger -p user.debug -t test1 -h 169.254.0.1 -S 169.254.0.2:514 "hello, world"
+ syslogd_log_jail syslogd_client \
+ -p user.debug -t test1 -h 169.254.0.1 -S 169.254.0.2:514 "hello, world"
atf_check -o match:"test1: hello, world" cat "${logfile}"
+
# ... but not a message from port 515.
- atf_check -o ignore jexec syslogd_client \
- logger -p user.debug -t test2 -h 169.254.0.1 -S 169.254.0.2:515 "hello, world"
+ syslogd_log_jail syslogd_client \
+ -p user.debug -t test2 -h 169.254.0.1 -S 169.254.0.2:515 "hello, world"
atf_check -o not-match:"test2: hello, world" cat "${logfile}"
- atf_check -o ignore jexec syslogd_client \
- logger -p user.debug -t test2 -h 169.254.0.1 -S 169.254.0.3:515 "hello, world"
+ syslogd_log_jail syslogd_client \
+ -p user.debug -t test2 -h 169.254.0.1 -S 169.254.0.3:515 "hello, world"
atf_check -o not-match:"test2: hello, world" cat "${logfile}"
syslogd_stop
@@ -435,11 +436,11 @@
# Now make sure that we can filter by port.
syslogd_start -j syslogd_allowed_peer -b 169.254.0.1:514 -a '169.254.0.2/32:515'
- atf_check jexec syslogd_client \
- logger -p user.debug -t test3 -h 169.254.0.1 -S 169.254.0.2:514 "hello, world"
+ syslogd_log_jail syslogd_client \
+ -p user.debug -t test3 -h 169.254.0.1 -S 169.254.0.2:514 "hello, world"
atf_check -o not-match:"test3: hello, world" cat "${logfile}"
- atf_check jexec syslogd_client \
- logger -p user.debug -t test4 -h 169.254.0.1 -S 169.254.0.2:515 "hello, world"
+ syslogd_log_jail syslogd_client \
+ -p user.debug -t test4 -h 169.254.0.1 -S 169.254.0.2:515 "hello, world"
atf_check -o match:"test4: hello, world" cat "${logfile}"
syslogd_stop
@@ -472,10 +473,10 @@
# A message forwarded to 169.254.0.1:514 should be logged, but one
# forwarded to 169.254.0.1:515 should not.
- atf_check jexec syslogd_client \
- logger -h 169.254.0.2 -p user.debug -t test1 "hello, world"
- atf_check jexec syslogd_client \
- logger -h 169.254.0.2 -p mark.debug -t test2 "hello, world"
+ syslogd_log_jail syslogd_client \
+ -h 169.254.0.2 -p user.debug -t test1 "hello, world"
+ syslogd_log_jail syslogd_client \
+ -h 169.254.0.2 -p mark.debug -t test2 "hello, world"
atf_check -o match:"test1: hello, world" cat "${logfile}"
atf_check -o not-match:"test2: hello, world" cat "${logfile}"
@@ -502,19 +503,19 @@
syslogd_start -j syslogd_allowed_peer -b 169.254.0.1:514 -a '169.254.0.2/32:*'
# Make sure that a message from 169.254.0.2:514 is logged.
- atf_check jexec syslogd_client \
- logger -p user.debug -t test1 -h 169.254.0.1 -S 169.254.0.2:514 "hello, world"
+ syslogd_log_jail syslogd_client \
+ -p user.debug -t test1 -h 169.254.0.1 -S 169.254.0.2:514 "hello, world"
atf_check -o match:"test1: hello, world" cat "${logfile}"
# ... as is a message from 169.254.0.2:515, allowed by the wildcard.
- atf_check jexec syslogd_client \
- logger -p user.debug -t test2 -h 169.254.0.1 -S 169.254.0.2:515 "hello, world"
+ syslogd_log_jail syslogd_client \
+ -p user.debug -t test2 -h 169.254.0.1 -S 169.254.0.2:515 "hello, world"
atf_check -o match:"test2: hello, world" cat "${logfile}"
# ... but not a message from 169.254.0.3.
- atf_check -o ignore jexec syslogd_client \
- logger -p user.debug -t test3 -h 169.254.0.1 -S 169.254.0.3:514 "hello, world"
+ syslogd_log_jail syslogd_client \
+ -p user.debug -t test3 -h 169.254.0.1 -S 169.254.0.3:514 "hello, world"
atf_check -o not-match:"test3: hello, world" cat "${logfile}"
- atf_check -o ignore jexec syslogd_client \
- logger -p user.debug -t test3 -h 169.254.0.1 -S 169.254.0.3:515 "hello, world"
+ syslogd_log_jail syslogd_client \
+ -p user.debug -t test3 -h 169.254.0.1 -S 169.254.0.3:515 "hello, world"
atf_check -o not-match:"test3: hello, world" cat "${logfile}"
syslogd_stop
@@ -567,15 +568,16 @@
syslogd_start -j syslogd_server -f ${PWD}/server_config -b 169.254.0.1 -b 169.254.0.2
syslogd_start -j syslogd_client -f ${PWD}/client_config -P ${SYSLOGD_PIDFILE}.2
- atf_check jexec syslogd_client \
- logger -h 169.254.0.3 -P $SYSLOGD_UDP_PORT -p user.debug -t test1 "hello, world"
- atf_check jexec syslogd_client \
- logger -h 169.254.0.3 -P $SYSLOGD_UDP_PORT -p mail.debug -t test2 "you've got mail"
- atf_check jexec syslogd_client \
- logger -h 169.254.0.3 -P $SYSLOGD_UDP_PORT -p ftp.debug -t test3 "transfer complete"
-
+ syslogd_log_jail syslogd_client \
+ -h 169.254.0.3 -P $SYSLOGD_UDP_PORT -p user.debug -t test1 "hello, world"
atf_check -o match:"test1: hello, world" cat "${logfile}"
+
+ syslogd_log_jail syslogd_client \
+ -h 169.254.0.3 -P $SYSLOGD_UDP_PORT -p mail.debug -t test2 "you've got mail"
atf_check -o match:"test2: you've got mail" cat "${logfile}"
+
+ syslogd_log_jail syslogd_client \
+ -h 169.254.0.3 -P $SYSLOGD_UDP_PORT -p ftp.debug -t test3 "transfer complete"
atf_check -o match:"test3: transfer complete" cat "${logfile}"
}
forward_cleanup()
diff --git a/usr.sbin/syslogd/tests/syslogd_test_common.sh b/usr.sbin/syslogd/tests/syslogd_test_common.sh
--- a/usr.sbin/syslogd/tests/syslogd_test_common.sh
+++ b/usr.sbin/syslogd/tests/syslogd_test_common.sh
@@ -96,6 +96,13 @@
atf_check -s exit:0 -o empty -e empty logger $*
}
+syslogd_log_jail()
+{
+ local jailname=$1
+ shift
+ atf_check -s exit:0 -o empty -e empty jexec ${jailname} logger $*
+}
+
# Make syslogd reload its configuration file.
syslogd_reload()
{
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Apr 8, 7:48 PM (16 h, 43 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31109092
Default Alt Text
D54778.id.diff (5 KB)
Attached To
Mode
D54778: syslogd/tests: Use a helper function to log from within a jail
Attached
Detach File
Event Timeline
Log In to Comment