Enda | 4 May 2009 12:29

Help with maildrop syntax

Hi Guys,

My first attempt at handcrafting a maildrop filter.... and its not that it 
doesn't work, its that I'm getting stuck trying to fix it!

The purpose of the filter is to manipulate the delivered to header for 
messages delivered using  <at> domain aliases to a mailbox using .courier-default 
to implement a catchall... the delivered to header shows the local mailbox 
name, and I want to rewrite it to give the username that the message was 
addressed to, which isn't always apparent eg in a bcc scenario. The script 
is below. I'm curious if its a type issue, and if I can typecast to get 
around, eg, that its trying to subtract a string from an int etc.

Any help appreciated!

 -Enda.

# First I declare some once off hard coded variables.
DTLD="domain.com"
USTART="32"
EXCESS="55"

# Extract the current Delivered-to: header from the mail
DELTO=/Delivered-To:/:h

#    **** this is where I'm getting the syntax error *******
# Calculate the length of the uid plus the already appended  <at>  character
# My first attempt - ULENGTH=((length(DELTO))-$EXCESS) - bracket error
# My next attempt - ULENGTH=(length(DELTO))-$EXCESS - syntax error
# My next attempt - ULENGTH=(length($DELTO))-$EXCESS - syntax error
(Continue reading)

Enda | 4 May 2009 12:43

Re: Help with maildrop syntax

Just a quick followup:

> # First I declare some once off hard coded variables.
> DTLD="domain.com"
> USTART="32"
> EXCESS="55"

I've redeclared these as:

DTLD="domain.com"
USTART=32
EXCESS=55

But still no joy....

 -Enda.

------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance & Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
Enda | 4 May 2009 16:32

Re: Help with maildrop syntax

Hi Guys,

In the end, I deleted the buggy line and tried to test the rest of the 
script, and have eventually got it working. My mistakes are highlighted 
below in case anyone is interested.

> # Extract the current Delivered-to: header from the mail
> DELTO=/Delivered-To:/:h

Two mistakes here, first you can't assign directly into a varibale from a 
pattern search, you run the search and then load the value of the MATCH 
variable, and second, pattern doesn't mean the pattern you are looking for, 
its actually an expression with its own syntax which must be got correct.

> ULENGTH=length($DELTO)-$EXCESS

Arithmetic operations must have a space on either side of an operator, 
otherwise they are interpreted as strings.

All working now with those basic hurdles crossed.

 -Enda. 

------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance & Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
(Continue reading)

Sam Varshavchik | 11 May 2009 05:02
Gravatar

maildrop 2.1.0 released

Download: http://www.courier-mta.org/download.php#maildrop

Changes:

• maildrop's license formally changed to GPL 3.

• reformail: generate larger Message-ID: headers on 64 bit platforms. If 
standard input is seekable, don't bother wasting time discarding stdin.

• maildrop: ignore SIGPIPE if child process did not fully consume stdin.

------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
Courier-maildrop mailing list
Courier-maildrop <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/courier-maildrop
mr.maX | 12 May 2009 18:56
Favicon

Dovecot Authentication extension updated for maildrop 2.1.0 (PATCH)

Hi,

an updated version of my patch for maildrop that extends it with the ability 
to perform user lookups against Dovecot's database made against the latest 
version of maildrop 2.1.0 can be downloaded from the following location: 
http://www.max.rs/ozone/maildrop-2.1.0-dovecotauth.patch.txt

The patch has just been redone in order to apply cleanly without fuzz and to 
apply properly against one file that was changed in the latest version of 
maildrop. There have been no other changes compared to the initial version 
of the patch.

For more information, take a look at my previous post to the maildrop's 
mailing list at: http://markmail.org/message/gakg67p6gsqcawwa

--
Best Regards,
Marko Njezic - mr.maX  <at>  MAX Interactive corp.
Personal: http://www.markonjezic.com/
MAX's Empire: http://www.maxempire.com/
MAX's HTML Beauty++ 2004: http://www.htmlbeauty.com/ 

------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
Richard | 15 May 2009 16:19

Problem compiling Maildrop 2.1.0 on Mac OS X 10.5.7

Hi,

I've tried to compile and install an updated version of Maildrop on my  
intel mac mini but I get an error when trying to compile the new  
version of maildrop. I've checked with version 2.0.4 if this was  
caused by some changes on my machine but 2.0.4 still compiles without  
any error.

I use configure with the following parameters:
./configure --enable-maildirquota --enable-maildrop-uid=102 --enable- 
maildrop-gid=102

I get the following error:
makedatprog.c:19: warning: 'struct dbobj' declared inside parameter list
makedatprog.c:19: warning: its scope is only this definition or  
declaration, which is probably not what you want
makedatprog.c: In function 'addgdbm':
makedatprog.c:33: warning: implicit declaration of function  
'dbobj_store'
makedatprog.c: At top level:
makedatprog.c:42: warning: 'struct dbobj' declared inside parameter list
makedatprog.c: In function 'buildgdbm':
makedatprog.c:76: warning: passing argument 2 of 'addgdbm' from  
incompatible pointer type
makedatprog.c: In function 'main':
makedatprog.c:83: error: storage size of 'obj' isn't known
makedatprog.c:102: warning: implicit declaration of function  
'dbobj_init'
makedatprog.c:104: warning: implicit declaration of function  
'dbobj_open'
(Continue reading)

Tiago Gomes | 22 May 2009 15:47
Picon

Re: maildrop + Ldap , maildirsize don't update

Hi Sam, can you help me  to adjust  the permissions about maildrop ? can i show my schema of permission and may configuration files ? it 's works very well but don 't update the maildirsize file. Thank's 

2009/4/27 Sam Varshavchik <mrsam <at> courier-mta.com>
algodas writes:


Hi, sam . I'm configuring maildrop with thats options, the delivery it's ok, the permission for maildrop is:  -rwsrwxrwx  1 maildrop www  745102 Apr 21 00:37 maildrop

the owner for Maildirs is user maildrop and the permission for maildir is
600 .

any Idea ?

For starters, group+world writable is a bad idea. Terrible idea.

Furthermore, the above does not really indicate which option you have selected. In fact, none of the three options mentioned in the INSTALL file would result in something like this.

This is not complicated. This is standard UNIX file permission configuration issue. UNIX permissions have worked the same way for forty years now. If you do not understand how process/file permissions work, then there are plenty of tutorials and FAQs on the web that explain how they work.

maildrop's INSTALL file says:

       NOTE:

       When using the standalone maildrop build with courier-authlib, one
       of the following configurations must be used:

          * Your mail server must invoke maildrop as the root user (the -d
            flag reads the mail account's uid and gid, then drops root) .
          * Manually change the permissions on the maildrop binary to be
            setuid root.
          * Manually change the permissions on the courier-authlib's socket
            directory (/usr/local/var/spool/authdaemon by default) to be
            globally readable or executable.

This does not mean that you get to randomly pick one of these three options. The correct option depends on how you have your system accounts and your mail server configured. maildrop must be able to contact courier-authlib's socket, and, after obtaining the account details, be able to change its uid and gid to the account's uid and gid, then change to the account's home directory and maildir. Therefore, either you must arrange for maildrop to have root privileges, or all all your mail accounts must use the same virtual uid and gid, maildrop must get invoked by your mail server using the global uid and gid, and courier-authlib's socket directory must similarly be searchable by this uid and gid.

If you still do not understand this, you should not just randomly change the permissions on maildrop binary, to see what works, or what does not. Mail system security is very important, and you must understand exactly how process and file permissions work, on UNIX, before proceeding any further.


------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations
Conference from O'Reilly Media. Velocity features a full day of
expert-led, hands-on workshops and two days of sessions from industry
leaders in dedicated Performance & Operations tracks. Use code vel09scf
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
_______________________________________________
Courier-maildrop mailing list
Courier-maildrop <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/courier-maildrop




--
----------------------------------------------------------------
Tiago Gomes Pereira http://www.tiagogomes.eti.br
LPI Certified
LPI ID - LPI000129445
IT Service Management - ITIL FOUNDATION V2
ID - SR341901
algodas <at> gmail.com
------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com 
_______________________________________________
Courier-maildrop mailing list
Courier-maildrop <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/courier-maildrop
algodas | 22 May 2009 22:29
Picon

Re: maildrop + Ldap , maildirsize don't update


The  maildrop's permission

# ls   -la    /usr/local/bin/maildrop 
-rwsrwxrwx 1 maildrop www 763422 Apr 28 18:25 /usr/local/bin/maildrop

// Permission to user maildrop and group www , respectly : 1003 and 8

# ls -la /mailbox/domain.com.br/tiago.pereira/Maildir

drwxrwxr-x 13 maildrop www 4096 Apr 24 18:06 .
drwxrwxrwx  4 maildrop www 4096 Apr 27 19:40 ..
drwxrwxr-x  6 maildrop www 4096 Jan 29 11:00 .Drafts
drwxrwxr-x  6 maildrop www 4096 Jan 29 11:00 .Junk
drwxrwxr-x  6 maildrop www 4096 Jan 29 11:00 .Sent
drwxrwxr-x  6 maildrop www 4096 Dec 30 15:59 .Spam
drwxrwxr-x  6 maildrop www 4096 Dec 15 15:13 .Trash
drwxrwxr-x  6 maildrop www 4096 Nov 19  2008 .sent-mail
drwxrwxr-x  2 maildrop www 4096 Dec 30 13:41 courierimaphieracl
drwxrwxr-x  2 maildrop www 4096 May 19 19:41 courierimapkeywords
-rwxrwxr-x  1 maildrop www   74 Jan 29 11:00 courierimapsubscribed
-rw-r--r--  1 maildrop www   17 May 19 19:41 courierimapuiddb
-rw-r--r--  1 maildrop www  108 May 22 15:16 courierpop3dsizelist
drwxrwxr-x  2 maildrop www 4096 May 22 15:16 cur
-rw-r--r--  1 maildrop www 1129 Apr 24 15:58 mmaildirsize
drwxrwxr-x  2 maildrop www 4096 May 22 15:16 new
drwxrwxr-x  2 maildrop www 4096 May 22 15:16 tmp

algodas wrote:
> 
> Hi Sam, can you help me  to adjust  the permissions about maildrop ? can i
> show my schema of permission and may configuration files ? it 's works
> very
> well but don 't update the maildirsize file. Thank's
> 
> 2009/4/27 Sam Varshavchik <mrsam <at> courier-mta.com>
> 
>> algodas writes:
>>
>>
>>> Hi, sam . I'm configuring maildrop with thats options, the delivery it's
>>> ok, the permission for maildrop is:  -rwsrwxrwx  1 maildrop www  745102
>>> Apr
>>> 21 00:37 maildrop
>>>
>>> the owner for Maildirs is user maildrop and the permission for maildir
>>> is
>>> 600 .
>>>
>>> any Idea ?
>>>
>>
>> For starters, group+world writable is a bad idea. Terrible idea.
>>
>> Furthermore, the above does not really indicate which option you have
>> selected. In fact, none of the three options mentioned in the INSTALL
>> file
>> would result in something like this.
>>
>> This is not complicated. This is standard UNIX file permission
>> configuration issue. UNIX permissions have worked the same way for forty
>> years now. If you do not understand how process/file permissions work,
>> then
>> there are plenty of tutorials and FAQs on the web that explain how they
>> work.
>>
>> maildrop's INSTALL file says:
>>
>>        NOTE:
>>
>>        When using the standalone maildrop build with courier-authlib, one
>>        of the following configurations must be used:
>>
>>           * Your mail server must invoke maildrop as the root user (the
>> -d
>>             flag reads the mail account's uid and gid, then drops root) .
>>           * Manually change the permissions on the maildrop binary to be
>>             setuid root.
>>           * Manually change the permissions on the courier-authlib's
>> socket
>>             directory (/usr/local/var/spool/authdaemon by default) to be
>>             globally readable or executable.
>>
>> This does not mean that you get to randomly pick one of these three
>> options. The correct option depends on how you have your system accounts
>> and
>> your mail server configured. maildrop must be able to contact
>> courier-authlib's socket, and, after obtaining the account details, be
>> able
>> to change its uid and gid to the account's uid and gid, then change to
>> the
>> account's home directory and maildir. Therefore, either you must arrange
>> for
>> maildrop to have root privileges, or all all your mail accounts must use
>> the
>> same virtual uid and gid, maildrop must get invoked by your mail server
>> using the global uid and gid, and courier-authlib's socket directory must
>> similarly be searchable by this uid and gid.
>>
>> If you still do not understand this, you should not just randomly change
>> the permissions on maildrop binary, to see what works, or what does not.
>> Mail system security is very important, and you must understand exactly
>> how
>> process and file permissions work, on UNIX, before proceeding any
>> further.
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Register Now & Save for Velocity, the Web Performance & Operations
>> Conference from O'Reilly Media. Velocity features a full day of
>> expert-led, hands-on workshops and two days of sessions from industry
>> leaders in dedicated Performance & Operations tracks. Use code vel09scf
>> and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
>> _______________________________________________
>> Courier-maildrop mailing list
>> Courier-maildrop <at> lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/courier-maildrop
>>
>>
> 
> 
> -- 
> ----------------------------------------------------------------
> Tiago Gomes Pereira http://www.tiagogomes.eti.br
> LPI Certified
> LPI ID - LPI000129445
> IT Service Management - ITIL FOUNDATION V2
> ID - SR341901
> algodas <at> gmail.com
> 
> ------------------------------------------------------------------------------
> Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
> is a gathering of tech-side developers & brand creativity professionals.
> Meet
> the minds behind Google Creative Lab, Visual Complexity, Processing, & 
> iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
> Group, R/GA, & Big Spaceship. http://www.creativitycat.com 
> _______________________________________________
> Courier-maildrop mailing list
> Courier-maildrop <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/courier-maildrop
> 
> 

--

-- 
View this message in context: http://www.nabble.com/maildrop-%2B-Ldap-%2C-maildirsize-don%27t-update-tp23143213p23676665.html
Sent from the courier-maildrop mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com 
Sam Varshavchik | 23 May 2009 01:00
Gravatar

Re: maildrop + Ldap , maildirsize don't update

algodas writes:

> 
> The  maildrop's permission
> 
> # ls   -la    /usr/local/bin/maildrop 
> -rwsrwxrwx 1 maildrop www 763422 Apr 28 18:25 /usr/local/bin/maildrop

Again, world-writable permissions are always wrong, no matter what you're 
trying to do.

> // Permission to user maildrop and group www , respectly : 1003 and 8
> 
> # ls -la /mailbox/domain.com.br/tiago.pereira/Maildir

I didn't ask you about mailbox permissions, but rather which option you have 
selected, based on the instructions in maildrop's INSTALL file:

         NOTE:

         When using the standalone maildrop build with courier-authlib, one
         of the following configurations must be used:

            * Your mail server must invoke maildrop as the root user (the -d
              flag reads the mail account's uid and gid, then drops root) .
            * Manually change the permissions on the maildrop binary to be
              setuid root.
            * Manually change the permissions on the courier-authlib's socket
              directory (/usr/local/var/spool/authdaemon by default) to be
              globally readable or executable.

         The default permissions on courier-authlib's socket directory blocks
         world-access to the filesystem socket connected to courier-authlib's
         authentication daemon process. In order for maildrop to connect to
         the authentication library, maildrop must either have root
         privileges (which will be temporary, as soon as maildrop determines
         the account's userid and groupid, it will drop root, before reading
         the maildroprc file), or courier-authlib's socket directory must
         have world read and execute permission.

Again, which option, from the list above, did you choose when you configured 
maildrop to use courier-authlib. The permissions and the ownership of your 
maildrop binary is not sufficient information to determine that.

Furthermore, you can easily do some additional debugging yourself. For 
example, take a look to what value MAILDIRQUOTA gets set, when delivering 
mail. Put some echo statements in your maildrop recipe, to check the value 
of MAILDIRQUOTA.

------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com 
_______________________________________________
Courier-maildrop mailing list
Courier-maildrop <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/courier-maildrop

Gmane