Stream::Replace Will Not Work
when CLIENT_ACCEPTED {
STREAM::expression :LOGIN\ .*:
STREAM::enable
}
when STREAM_MATCHED {
STREAM::replace "$logon $username $pass [STREAM::match]"
if {[STREAM::match] starts_with "LOGIN"}{
log local0. "Replace string conditional: true"
STREAM::replace "[string map {L G} [STREAM::match]]"
}
log local0. "Stream filter matched: [STREAM::match]"
}
For whatever reason, it won't replace anything. Once I get the code to do simple replacements, I hope to replace the entire stream with variables that I define. Hopefully someone can point out what I am doing wrong.
Please note that I am testing this by attempting to log in with an email client attaching to IMAP. I am able to cause failures by replacing with STREAM::expression but, again, any replacement attempts with STREAM::replace will not work. The IMAP packet format is LOGIN "username" "password". So logically, if I replace the letter L with anything else it would fail. Again, I can do it with STREAM::expression but not STREAM::replace.