procmail
[Top] [All Lists]

Re: | vs. ? And another basic question

2003-01-09 12:44:48
On Thu, 09 Jan 2003 06:49:25 -0500 (EST), dman(_at_)nomotek(_dot_)com wrote:
=> So this is some stuff from genvars:
=>  OCTET         = "([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])"
=>  DOTQUAD       = "$OCTET\.$OCTET\.$OCTET\.$OCTET"
=>  # Private IP space
=>  SLASH_EIGHT   = "0?10\.$OCTET"                      # 10.0. - 10.255
=>  SLASH_TWELVE  = "172\.(0?1[6-9]|0?2[0-9]|0?3[01])"  # 172.16. - 172.31
=>  SLASH_SIXTEEN = "192\.168"                          # 192.168
=>  RESERVED_IPs  = "($SLASH_EIGHT|$SLASH_TWELVE|$SLASH_SIXTEEN)"

        Thanks! I think many folks learn a great deal from seeing
posts such as this [your] real life stuff. It may not be always
perfect or pretty like yours, but it works for someone who's
spent a lot of time developing it and *thats* worth a lot.

        Personally I think $variables are a great leap forward
for folks learning about procmail, equivalent to understanding
weighted scoring, and especially the ability to set semaphores
with variables and test later for state.

        I must be dumb but it took me almost forever to
understand that, in procmail, I could set a variable at one point
and then if/then test it later in the code to control processing.
I've been writing code professionally since 1966 (what a long
strange trip it's been) and it wasn't at all evident to me when I
first started trying to use procmail and read all the various
web-based stuff about it.
 
=> Okay, so now, back in the main rc, if I want to have a condition such
=> as Hammond/Peterson are discussing, I do:
=>      * $  ^Received:.*[[(]209\.163\.100\.$OCTET

        Any reason why you're not including the closing
paren/bracket at the end?

        One thing I started using was my own variable $OR
(defined in my equiv of genvars) so I could do the following
scoring by adding in IP ranges as needed, cleanly and easily:

# IP ranges are for example only
OR="2147483647^0"       # defined in initialization
:0
* $ $OR ^Received:.*[[(]209\.163\.100\.$OCTET[])]
* $ $OR ^Received:.*[[(]000\.000\.000\.$OCTET[])]
* $ $OR ^Received:.*[[(]000\.000\.000\.$OCTET[])]
 { some spam variable or action set here }

=> I use the other string-vars in various places to good avail.

        What an understatement!

        Thanks again,

        - Don

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail