Joe Feise | 3 Aug 2007 07:04
Favicon
Gravatar

smtp plain authentication

I was surprised to find that mailx doesn't support smtp plain authentication.
The mail server I need to connect to only supports plain auth (of course, over a
secure channel.) I tried to find a patch, but a Google search came up empty.
So I wrote a small patch to add it. It is attached.

Cheers,
-Joe
--- mailx-12.3/smtp.c.orig	2007-01-12 09:40:25.000000000 -0800
+++ mailx-12.3/smtp.c	2007-08-02 21:40:42.109150972 -0700
 <at>  <at>  -258,11 +258,13  <at>  <at> 
 	char *b = NULL, o[LINESIZE];
 	size_t blen, bsize = 0, count;
 	char	*b64, *authstr, *cp;
-	enum	{ AUTH_NONE, AUTH_LOGIN, AUTH_CRAM_MD5 } auth;
+	enum	{ AUTH_NONE, AUTH_PLAIN, AUTH_LOGIN, AUTH_CRAM_MD5 } auth;
 	int	inhdr = 1, inbcc = 0;

 	if ((authstr = smtp_auth_var("", skinned)) == NULL)
 		auth = user && password ? AUTH_LOGIN : AUTH_NONE;
+	else if (strcmp(authstr, "plain") == 0)
+		auth = AUTH_PLAIN;
 	else if (strcmp(authstr, "login") == 0)
 		auth = AUTH_LOGIN;
 	else if (strcmp(authstr, "cram-md5") == 0)
 <at>  <at>  -322,6 +324,16  <at>  <at> 
 			SMTP_OUT(o);
 			SMTP_ANSWER(2);
 			break;
(Continue reading)

Gunnar Ritter | 4 Aug 2007 13:42
Picon
Favicon

Re: smime-sign needs from variable set, smime-encrypt and normal send doesn't

Georgi Stanojevski <glisha@...> wrote:

> I was trying to sign and encrypt messages with mailx (nail). After lots
>  of unsuccessful tries I found out that I need to have the "from"
> variable set to send signed messages.
>
> When I set smime-sign-cert, smime-sign and try to send a mail, mailx was
> only exiting with a dead.letter.
>
> "/home/gogo/dead.letter" 9/221
> . . . message not sent.
>
> After trying a bit, a saw that mailx was giving up in smime_sign
> (openssl.c+426):
>     if ((addr = myorigin(headp)) == NULL)
>         return NULL;

I have now changed the code to print an error message if this
happens. Thank you for reporting the problem.

	Gunnar

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
Gunnar Ritter | 4 Aug 2007 13:47
Picon
Favicon

Re: smtp plain authentication

Joe Feise <jfeise@...> wrote:

> The mail server I need to connect to only supports plain auth
> (of course, over a secure channel.) I tried to find a patch,
> but a Google search came up empty. So I wrote a small patch
> to add it. It is attached.

Thank you! I have applied the patch to the CVS repository.

	Gunnar

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
Gunnar Ritter | 4 Aug 2007 14:00
Picon
Favicon

Re: alias expansions in "Reply-To:" fields

Martin Neitzel <neitzel@...> wrote:

> In particular the section states:
>
> 	In mail the user sends, personal aliases will be expanded in
> 	mail sent to others so that they will be able to reply to  the
> 	recipients [...]
>
> This is certainly intended to be understood like this:

I still hold that it says "reply to the _recipients_" of "mail
the user sends", not to the senders of such mail.

Nevertheless, I already said that I can understand why you
like to have a shortcut mechanism. Still, your last message
did not answer my question,

| Do you really think it is useful to have the same name
| space for lists of senders as for lists of recipients?

that is, do you ever use the same alias for "from" as
well as for "to"?

> The POSIX standard doesn't say "expand for recipient
> addresses and only there".  Expanding aliases in sender addresses would
> still be conforming behaviour, even if you don't like to classify the
> Reply-To: address as "recpient" at any point in time.)

I am not so sure. Do you have serious experience in the
formal interpretation of standards?
(Continue reading)

Dr. Gary E. RAFE | 21 Aug 2007 23:57
Picon

Outgoing GMail messages return error SMTP: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number

Sometime in mid-July (2007), I started to see an odd behavior
when sending messages through smtp.gmail.com using the mailx-12.2
on a Mac OS X/10.4 host.

Messages were sent through the smtp.gmail.com service correctly,
but the e-mail client returned the error message:

SMTP: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number

after the message is sent.

When mailx-12.3 became available, I installed that here,
with the same results continuing...

Following a kernel trace, it appears that the smtp.gmail.com server
is sending the plain text (unencrypted) characters "221 2" somewhere
near the end of the SMTP transaction, probably following the "QUIT"
directive from the client.
Since these characters are not encrypted, OpenSSL gets confused,
and issues the error message.

It used to be (prior to this SSL error) that smtp.gmail.com
would simply "drop" the connection rather than try to
acknowledge the "QUIT" directive.

Now it looks like smtp.gmail.com changed the way they respond to "QUIT",
but did they get it right ?
What is *supposed* to happen here -- i.e., how is the acknowledgement
supposed to be sent back to the client ?

(Continue reading)

Gunnar Ritter | 22 Aug 2007 00:11
Picon
Favicon

Re: Outgoing GMail messages return error SMTP: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number

drgerlists@... (Dr. Gary E. RAFE) wrote:

> It used to be (prior to this SSL error) that smtp.gmail.com
> would simply "drop" the connection rather than try to
> acknowledge the "QUIT" directive.

Yes, I remember that.

> Now it looks like smtp.gmail.com changed the way they respond to "QUIT",
> but did they get it right ?
> What is *supposed* to happen here -- i.e., how is the acknowledgement
> supposed to be sent back to the client ?

It is simply an SMTP exchange with TLS in a lower
connection layer. The decrypted session is in no way
different to a standard SMTP session once encryption
has been initialized. What happens on the TLS level
in detail is outside my scope; I am just a user of
the SSL/TLS library here.

Did you ask the GMail technical support about that
problem?

	Gunnar

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
(Continue reading)

Dr. Gary E. RAFE | 23 Aug 2007 06:06
Picon

Re: Outgoing GMail messages return error SMTP: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number

Gunnar Ritter <gunnarr@...> wrote:
!...
!> Now it looks like smtp.gmail.com changed the way they respond to "QUIT",
!> but did they get it right ?
!> What is *supposed* to happen here -- i.e., how is the acknowledgement
!> supposed to be sent back to the client ?
!
!It is simply an SMTP exchange with TLS in a lower
!connection layer. The decrypted session is in no way
!different to a standard SMTP session once encryption
!has been initialized. What happens on the TLS level
!in detail is outside my scope; I am just a user of
!the SSL/TLS library here.

Here's what I'm seeing from a kernel trace/dump:

...
19532 mailx CALL  write(0x3,0x85000,0x25)
19532 mailx GIO   fd 3 wrote 37 bytes
      "\^W\^C\^A\0 Up\^C\M-W\M^Ni4\M-$\M-|\M-`Z=O
       \M^C\M-?5\M-6k*\M^P\M-O\M^^\M-}8\M-iw\M-I\M^C;\M-dj"
19532 mailx RET   write 37/0x25
19532 mailx CALL  read(0x3,0x7c000,0x5)
19532 mailx GIO   fd 3 read 5 bytes
      "221 2"
19532 mailx RET   read 5
19532 mailx CALL  write(0x3,0x85000,0x1d)
19532 mailx GIO   fd 3 wrote 29 bytes
      "\^U21\0\^Xz\M-q\^NS0}S\M-d\M^Xu\M^Q.\M-^\M-,\M-Y6F\M-'\v7\^\2=:"
19532 mailx RET   write 29/0x1d
(Continue reading)

Dr. Gary E. RAFE | 30 Aug 2007 16:41
Picon

Re: Outgoing GMail messages return error SMTP: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number

Gunnar Ritter <gunnarr@...> wrote:

!drgerlists@... (Dr. Gary E. RAFE) wrote:
!
!> It used to be (prior to this SSL error) that smtp.gmail.com
!> would simply "drop" the connection rather than try to
!> acknowledge the "QUIT" directive.
!
!Yes, I remember that.
!
!> Now it looks like smtp.gmail.com changed the way they respond to "QUIT",
!> but did they get it right ?
!> What is *supposed* to happen here -- i.e., how is the acknowledgement
!> supposed to be sent back to the client ?
!
!It is simply an SMTP exchange with TLS in a lower
!connection layer. The decrypted session is in no way
!different to a standard SMTP session once encryption
!has been initialized. What happens on the TLS level
!in detail is outside my scope; I am just a user of
!the SSL/TLS library here.
!
!Did you ask the GMail technical support about that
!problem?

After exchanging several messages with GMail's Mail Support
Team, the "problem" with their response to "QUIT" seems to
be fixed, although they didn't acknowledge any problem in
our e-mail exchange.

(Continue reading)

Gunnar Ritter | 30 Aug 2007 17:40
Picon
Favicon

Re: Outgoing GMail messages return error SMTP: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number

drgerlists@... (Dr. Gary E. RAFE) wrote:

> The work-around we fashioned previously for the "QUIT"
> command may no longer be needed with smtp.gmail.com ...

Yes, but we can keep it, it does not cause any harm.

	Gunnar

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/

Gmane