Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 258018 - mail-mta/ssmtp-2.62-r8: blank password sent if ssmtp.conf defines password containing '#'
Summary: mail-mta/ssmtp-2.62-r8: blank password sent if ssmtp.conf defines password co...
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High major with 2 votes (vote)
Assignee: No maintainer - Look at https://wiki.gentoo.org/wiki/Project:Proxy_Maintainers if you want to take care of it
URL: http://bugs.debian.org/cgi-bin/bugrep...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-07 13:15 UTC by davidshen
Modified: 2021-07-23 15:21 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
fix values in ssmtp.conf file cannot contain '#' (ssmtp-2.62-comments.patch,1.69 KB, patch)
2010-08-14 06:58 UTC, davidshen
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description davidshen 2009-02-07 13:15:13 UTC
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.





Reproducible: Always

Steps to Reproduce:
1. Prepare an email account, which password contain '#'
2. emerge and configure ssmtp correctly. (DEBUG=YES)
3. use ssmtp/sendmail withou -ap option to send an email
4. observe the debug information on tty12, and verify if the email can be sent out.
Actual Results:  
the password is sent in blank, or did not send at all;
the email could not be send

Expected Results:  
the password should be pass to the server in base64 encoding;
the email should be send correctly.

Portage 2.2_rc18 (default/linux/x86/2008.0/desktop, gcc-4.1.2, glibc-2.6.1-r0, 2.6.27-gentoo-r8 i686)
=================================================================
System uname: Linux-2.6.27-gentoo-r8-i686-Intel-R-_Core-TM-2_Duo_CPU_T9300_@_2.50GHz-with-glibc2.0
Timestamp of tree: Tue, 27 Jan 2009 08:10:02 +0000
app-shells/bash:     3.2_p39
dev-lang/python:     2.5.2-r7
dev-python/pycrypto: 2.0.1-r6
dev-util/cmake:      2.6.2
sys-apps/baselayout: 1.12.11.1
sys-apps/sandbox:    1.2.18.1-r2
sys-devel/autoconf:  2.13, 2.63
sys-devel/automake:  1.5, 1.7.9-r1, 1.9.6-r2, 1.10.2
sys-devel/binutils:  2.18-r3
sys-devel/gcc-config: 1.4.0-r4
sys-devel/libtool:   1.5.26
virtual/os-headers:  2.6.27-r2
ACCEPT_KEYWORDS="x86"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=prescott -msse2 -fomit-frame-pointer -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/revdep-rebuild /etc/splash /etc/terminfo /etc/udev/rules.d"
CXXFLAGS="-O2 -march=prescott -msse2 -fomit-frame-pointer -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="distlocks fixpackages parallel-fetch preserve-libs protect-owned sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="http://ftp.ucsb.edu/pub/mirrors/linux/gentoo ftp://ftp.ecc.u-tokyo.ac.jp/gentoo/ http://mirror.usu.edu/mirrors/gentoo/ http://mirror.csclub.uwaterloo.ca/gentoo-distfiles/"
LDFLAGS="-Wl,-O1"
PKGDIR="/usr/pkg"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X acl acpi alsa berkdb bluetooth branding bzip2 cairo cdr cli cracklib crypt dbus dri dvd dvdr dvdread eds emboss encode esd evo fam firefox fortran gdbm gif gpm gstreamer gtk hal iconv isdnlog jpeg ldap libnotify mad midi mikmod mp3 mpeg mudflap ncurses nls nptl nptlonly ogg opengl openmp pam pcre pdf perl png ppds pppd python qt3support qt4 quicktime readline reflection sdl session spell spl ssl startup-notification svg sysfs tcpd tiff truetype unicode usb vim-syntax vorbis win32codecs x86 xcb xml xorg xulrunner xv zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU" VIDEO_CARDS="fbdev glint i810 intel mach64 mga neomagic nv r128 radeon savage sis tdfx trident vesa vga via vmware voodoo"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LANG, LC_ALL, LINGUAS, MAKEOPTS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY
Comment 1 Rodrigo Cortés 2010-04-15 21:44:57 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.
Comment 2 Rodrigo Cortés 2010-04-16 19:11:35 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.

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.
Comment 3 davidshen 2010-08-14 06:58:05 UTC
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 '#'
Comment 4 davidshen 2010-08-14 07:01:53 UTC
i am sorry it took me almost one and half a year to fix this. hope some one could help me review this patch.
Comment 5 kfm 2010-12-04 12:17:55 UTC
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.
Comment 6 Diego Elio Pettenò (RETIRED) gentoo-dev 2011-01-19 13:51:16 UTC
Please try with version 2.64 and re-open if it's still a problem.
Comment 7 Fab 2012-12-17 22:50:54 UTC
(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.
Comment 8 Eray Aslan gentoo-dev 2012-12-21 12:48:02 UTC
Reopening so it doesn't fall off the radar.
Comment 9 MickKi 2014-05-26 10:40:21 UTC
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
Comment 10 Fernando Rodriguez 2015-08-20 22:51:33 UTC
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.