Package: ssmtp Severity: wishlist
Anibal Monsalve Salazar -- .''`. Debian GNU/Linux : :' : Free Operating System `. `' http://debian.org/ `- http://v7w.com/anibal
--- Begin Message ---Hi Anibal, > >If I code a "Use alternate configuration file" (i.e. the -C flag) > >patch and offer it, what are the odds that it makes it into the > >mainstream codebase? > > If it's a good patch, it will be accepted. > > I'll prepare a new package this weekend but I could wait for the > patch. When will you send it? The patch took a lot less time than expected. Here it is, along with the corrected manpage patch, which should apply cleanly to 2.61. Note that I tried to keep the behaviour exactly like sendmail, so the alternate config file knows nothing about the sSMTP conf dir (i.e. you need to specify a full path like -C/etc/ssmtp/ssmtp.conf). As with sendmail, relative paths like -Cssmtp.conf refer to the current working directory. Let me know if this is acceptable. Cheers! rudy--- ssmtp.c.orig 2005-02-03 15:48:35.468370300 -0500 +++ ssmtp.c 2005-02-03 23:26:39.705353600 -0500 @@ -68,6 +68,7 @@ char *root = NULL; char *tls_cert = "/etc/ssl/certs/ssmtp.pem"; /* Default Certificate */ char *uad = (char)NULL; +char *config_file = (char)NULL; /* alternate configuration file */ headers_t headers, *ht; @@ -789,7 +790,14 @@ char buf[(BUF_SZ + 1)], *p, *q, *r; FILE *fp; - if((fp = fopen(CONFIGURATION_FILE, "r")) == NULL) { + 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); } @@ -1289,7 +1297,7 @@ get_arpadate(arpadate); if(read_config() == False) { - log_event(LOG_INFO, "%s/ssmtp.conf not found", SSMTPCONFDIR); + log_event(LOG_INFO, "%s not found", config_file); } if((p = strtok(pw->pw_gecos, ";,"))) { @@ -1640,6 +1648,19 @@ /* Configfile name */ case 'C': + if((!argv[i][(j + 1)]) && argv[(i + 1)]) { + config_file = strdup(argv[(i + 1)]); + if(config_file == (char *)NULL) { + die("parse_options() -- strdup() failed"); + } + add++; + } + else { + config_file = strdup(argv[i]+j+1); + if(config_file == (char *)NULL) { + die("parse_options() -- strdup() failed"); + } + } goto exit; /* Debug */ --- ssmtp.8.orig 2005-02-04 10:41:22.609810000 -0500 +++ ssmtp.8 2005-02-04 10:43:12.003655000 -0500 @@ -1,4 +1,4 @@ -.TH SSMTP 8 "Last change: 5 February 2000" +.TH SSMTP 8 "Last change: 4 February 2005" .SH NAME ssmtp, sendmail \- send a message using smtp .SH SYNOPSIS @@ -103,7 +103,7 @@ .TP \fB\-C\fP\fIfile\fP -(ignored) Use alternate configuration file. +Use alternate configuration file. .TP \fB\-d\fP\fIX\fP
--- End Message ---
signature.asc
Description: Digital signature