Summary: | mail-mta/ssmtp-2.62-r8: blank password sent if ssmtp.conf defines password containing '#' | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | davidshen <davidshen84> |
Component: | Current packages | Assignee: | No maintainer - Look at https://wiki.gentoo.org/wiki/Project:Proxy_Maintainers if you want to take care of it <maintainer-needed> |
Status: | UNCONFIRMED --- | ||
Severity: | major | CC: | mgorny, net-mail+disabled, netbox253, roco3d, samuel.cuella |
Priority: | High | ||
Version: | 10.1 | ||
Hardware: | All | ||
OS: | Linux | ||
URL: | http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=544018 | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Attachments: | fix values in ssmtp.conf file cannot contain '#' |
Description
davidshen
2009-02-07 13:15:13 UTC
(In reply to comment #0) > my email password contains '#'. I set DEBUG=YES in /etc/ssmtp/ssmtp.conf and > observe the debug information in tty12. The username is passed correctly, but > the line for password is blank. > > I tried to use ssmtp/sendmail with -ap option, and my password is pass to the > server correctly, and my email is send correctly. > > And I also tried to modify my password not to contain '#', and use sendmail > without -ap option, and the email is send correctly. My password contains a ' '(space), and ssmtp can not handle it well either. In logs i can see that the variable AuthPass only takes the first characters (before the space), and can't login to my gmail account to send mail. (In reply to comment #0) > my email password contains '#'. I set DEBUG=YES in /etc/ssmtp/ssmtp.conf and > observe the debug information in tty12. The username is passed correctly, but > the line for password is blank. > > I tried to use ssmtp/sendmail with -ap option, and my password is pass to the > server correctly, and my email is send correctly. > > And I also tried to modify my password not to contain '#', and use sendmail > without -ap option, and the email is send correctly. I'm not a programmer but i have studied several languages and got a clue for you problem: There is a function in ssmtp code to parse the config file defined like this: /* read_config() -- Open and parse config file and extract values of variables */ bool_t read_config() { char buf[(BUF_SZ + 1)], *p, *q, *r; FILE *fp; if(config_file == (char *)NULL) { config_file = strdup(CONFIGURATION_FILE); if(config_file == (char *)NULL) { die("parse_config() -- strdup() failed"); } } if((fp = fopen(config_file, "r")) == NULL) { return(False); } while(fgets(buf, sizeof(buf), fp)) { char *begin=buf; char *rightside; /* Make comments invisible */ if((p = strchr(buf, '#'))) { *p = (char)NULL; } /* Ignore malformed lines and comments */ if(strchr(buf, '=') == (char *)NULL) continue; /* Parse out keywords */ p=firsttok(&begin, "= \t\n"); if(p){ rightside=begin; q = firsttok(&begin, "= \t\n:"); } If we look, will see the comment "/* Make comments invisible */", in the few lines below this comment the sentence: if((p = strchr(buf, '#'))) { *p = (char)NULL; } make that every line readed from config file that has "#" character becomes NULL, so your password with that character is not parsed. I think that it's a "peace of cake" code programming, but i dont have the skills yet. Created attachment 242899 [details, diff]
fix values in ssmtp.conf file cannot contain '#'
in the original ssmpt-2.62 source code. a comment is recognized by checking if a '#' is contained in the line. this logic is not correct. some of the values may also contain the '#', e.g. the AuthPass.
this patch trims the spaces on the left before processing the line, and ignore comment lines only if that line is started with '#', instead of contain '#'
i am sorry it took me almost one and half a year to fix this. hope some one could help me review this patch. This has also been reported independently upstream, albeit without any resolution thus far: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=544018 I've commented on the above bug in order to make them aware of David's patch and inviting them to review it. Please try with version 2.64 and re-open if it's still a problem. (In reply to comment #6) > Please try with version 2.64 and re-open if it's still a problem. Still a bug in 2.64-r2. I tried to connect to gmail's smtp with a pass#word, it failed. I replaced the # by a ! and it worked. Please reopen and please see the debian bug above comment#25, someone has posted a patch to fix the parsing. Thanks. Reopening so it doesn't fall off the radar. Close to two years have passed since the last post and this is still a problem. Is it a matter of upstream no longer developing their code, or could Gentoo have their own patch/fork? As currently stands only alphanumeric characters will work. -- Regards, Mick I've forked ssmtp and fixed this and other bugs (I didn't fixed the space problem cause I didn't noticed it but will fix it tonight), plus added a number of new features. The fork is at: https://github.com/fernando-rodriguez/ssmtp-reloaded And there's an ebuild here: https://github.com/fernando-rodriguez/portage-overlay/tree/master/mail-mta/ssmtp-reloaded I opened bug #558320 to see if we can get it in the tree. |