and correct the filter_password policy so that it works
# This policy filters them out.
#
filter_password {
- if (&User-Password && \
- (&User-Password != "%string(User-Password)")) {
- string tmp
- &tmp := %string(User-Password)
- &request.User-Password := %string(tmp)
- }
+ if &User-Password {
+ group tmp
+ octets delim
+
+ #
+ # Because "\000" yields "zero length delimiter is not allowed"
+ #
+ &delim = 0x00
+ &tmp.User-Password := %explode(%{User-Password}, "%{delim}")
+
+ &User-Password := &tmp.User-Password[0]
+ }
}
filter_inner_identity {
--- /dev/null
+#
+# Tests for NUL in the middle of a string
+#
+
+&Reply-Message := "bob\000hello"
+
+#
+# Commented out because it fails
+#
+#if %length("\000") != 1 {
+# test_fail
+#}
+
+if &Reply-Message {
+ group tmp
+ octets delim
+
+ #
+ # Because "\000" yields "zero length delimiter is not allowed"
+ #
+ &delim = 0x00
+ &tmp.Reply-Message := %explode(%{Reply-Message}, "%{delim}")
+
+ &Reply-Message := &tmp.Reply-Message[0]
+}
+
+if &Reply-Message != "bob" {
+ test_fail
+}
+
+success