
                     Store values at runtime: map_storage
                                       
   Look for changes in the file CHANGES.
   
   The map-storage is included in the check_local distribution.
   
How to install

    1. Move map_storage.c to sendmail-8.9.?/src.
    2. Apply the conf.c.patch
    3. Add the following lines to your site.config.m4

APPENDDEF(`confMAPDEF', `-DMAP_STORAGE')dnl
APPENDDEF(`confSMOBJADD', `map_storage.o')dnl
    4. If you want to use md5-support, change the secret in map_storage.c
       and add the following line to your site.config.m4

APPENDDEF(`confMAPDEF', `-DMAP_STORAGE_MD5')dnl
    5. If you want to enable option M,

APPENDDEF(`confMAPDEF', `-DMAP_STORAGE_MD5_M')dnl
    6. Rebuild sendmail (ie ./Build -c -f site.config.m4)
    7. With compiled in secret you should install sendmail without read
       permissions for group and others (-r-s--x--x).
    8. Send bug-reports to: Jan.Krueger+map@stud.uni-hannover.de
       
How does it work

   It knows the following options in K-Line:
     * -sSIZE size in characters (default 100)
     * -eEQUAL string returned, if strcmp or strcasecmp returns 0. Also
       used for matching md5-magic-key with option m (default @EQUAL).
     * -hHEADER add a header-field named HEADER with the content of the
       storage. This is logged to syslog. If the storage is empty, no
       field is added.
       
   It knows the following options in lookup ($@), the options rewrite the
   key before the assingement to the storage:
     * b convert IP to binary "number" (@ = 1, . = 0)
     * c clear the storage
     * 5 substitute the key with its md5-hash.
     * m test a given md5-magic-key (localpart+key).
     * M calculate the md5-magic-key for the given localpart.
     * s strcmp key with content of the storage
     * S strcasecmp key with content of the storage
       
Examples

   _Define a map_storage:_
Kfriend storage STARTUP_VALUE

   _Store a value:_
...
R$*             $: $(spam_friends $1 $)
R$*@SPAMFRIEND  $: $(friend YES $)
...

   _Lookup a value:_
...
R$*     $: $(friend $)
RYES    $@ is_friend
...

   _Clear the storage_
...
R$*     $: $(friend $@ c $)
...

   _Match local subnets:_
# file containing IPs in "binary" format @ = 1, . = 0
# e.g. 130.75.128.0/255.255.128.0 = @.....@..@..@.@@@
F{localsubnets}/etc/mail/localsubnets

Kip2bin storage

...
R$*                     $: $(ip2bin $&{client_addr} $@ b $)
R$={localsubnets}$*     $@ ok_is_local
...

   _Add a header-field_
Kspam_head -hX-Spam-Header

...
R@JUNK          $: $(spam_head is_junk $)
...

   _Add no header-field, if it's no spam_
Kspam_head -hX-Spam-Header is_junk

...
R$*             $@ $(spam_head $@ c $)

     _________________________________________________________________
                                      
   
    Jan Krger, Jan.Krueger+map@stud.uni-hannover.de
