[Raw Msg Headers][Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problems with quoted email addresses.



> If incoming mail is addressed to <" username"@localdomain.net>,
> and username (without the leading space) is a valid ID, the
> message passes through and ends up in a file
> called '/var/mail/ username'.
> 
> It ends up that we have about 10-15 files in our /var/mail
> that all begin with space characters. Any quick ideas on how
> to prevent this?

	I think this depends of your systems  getpwnam()  behaviour.
	I get:  User ' mea' unknown

	Try this small program, and tell what happens.
	(But do change the USER value at first..)

  ------- pwtest.c ---------
#include <stdio.h>
#include <pwd.h>
#define USER " mea"
main()
{
  struct passwd *pw = getpwnam(USER);
  printf ("getpwnam(\"%s\") -> ",USER);
  if (pw == NULL)
    printf("USER UNKNOWN\n");
  else
    printf("user='%s', uid=%d\n", pw->pw_name, pw->pw_uid);
  return 0;
}
  -------------------------

> With the quotes, <" username"@localdomain.net> should not be
> a valid mailbox.
> 
> example follows. I'm running a very stock version of .cf files.
> Also note the errors after the RCPT TO: line in the example.

	Oops..  This is more or less cut&paste from the xterm,
	so TABs are broken, but it should not matter..

	Ok, I will collect that, and the SM message truncation,
	and whatnot else into "patch2" package today.

--- ~/src/zmailer-2.99.48/proto/cf/fqdnalias.cf	Mon Feb 17 23:09:16 1997
+++ $MAILSHARE/cf/fqdnalias.cf	Fri May  2 11:32:54 1997
@@ -94,7 +94,7 @@
       a="$MAILVAR/fqlists/$lcaddress"
       l="$preowner$user$postowner@$host"
       nattr=()
-      [ -f $a ] &&
+      [ -f "$a" ] &&
         db add expansions "$lcaddress" fqlist &&
           priv=$(getpriv "644" $priv "$a" maillist) &&
             nattr=$(newattribute $A privilege $priv sender "$l") &&


> /var/mail> telnet localhost smtp
> Trying 127.0.0.1...
> Connected to localhost.
> Escape character is '^]'.
> 220 localhost.domain.net ZMailer Server 2.99.48 #1 ESMTP ready at Thu, 1
> May 1997 17:01:43 -0600
> HELO localhost.domain.net
> 250 localhost.domain.net Hello localhost.domain.net
> MAIL FROM: <>
> 250 2.1.0 Sender syntax Ok
> RCPT TO: <" dmichael"@domain.net>
> 250-[: argument expected
> 250-[: syntax error at:
> 250 Ok (verified) Ok
> DATA
> 354 Start mail input; end with <CRLF>.<CRLF>
> Subject: test
> 
> asdf
> asdf
> .
> 250 2.6.0 S.nOG2I20638 message accepted
> QUIT
> 221 2.0.0 localhost.domain.net Out
> Connection closed by foreign host.
> /var/mail> ls -l *michael
> -rw-------   1 dmichael staff        807 May  1 17:02  dmichael
> -rw-------   1 dmichael staff        417 May  1 14:03 dmichael
> /var/mail> 
>                                                       ^^^
>                                             note the extra space
> Anyone have a quick fix?
> 
> Dean.

	/Matti Aarnio <mea@nic.funet.fi>