Package: mailto
Version: 1.2.6
Version: 1.3.2
Hi there
Mailto uses gethostbyname() to get the hostname;
/* Get the local hostname for later insertion */
gethostname(localhost, sizeof(localhost));
if ( index(localhost, '.')) {
snprintf(hostname, sizeof(hostname), "%s", localhost);
} else {
hent = gethostbyname(localhost);
if ( hent )
snprintf(hostname, sizeof(hostname), "%s",
hent->h_name);
else
snprintf(hostname, sizeof(hostname), "%s", localhost);
}
This OK as long as you don't add www-data to the trusted users in your
SMTPD conf. Otherwise you may get an invalid sender address which may be
blocked by spam filters.
Adding a 'FILE' var to main;
int main(int argc, char *argv[])
{
int c;
char *ptr,*nptr;
char *address,*fulladdress,*from,*subject,*location;
char *tag,*val;
int cl,cnt,copyself;
char localhost[100];
struct hostent *hent;
/* RvdP, /etc/mailname */
FILE *f1;
And then getting the name from '/etc/mailname';
/* RvdP, get the hostname from /etc/mailname */
if ((f1 = fopen("/etc/mailname", "r")) != NULL) {
fscanf(f1, "%254s", hostname);
fclose(f1);
}
Will get you a more reliable result.
See;
http://www.sput.nl/software/homebrew/mailto.c
for more info (this version is 1.2.6 based).
Of course, it would be better to use a config statement for this.
There is also something wrong with the 1.3.2 source. It says;
#define ENC_8859_1 "??????"
This probaly should have been something like;
#define ENC_8859_1
"\0xC4\0xE4\0xD6\0xF6\0xDC\0xFC\0xDF\0xC5\0xE5\0xC6\0xE6\0xF8"
Regards,
Rob
--
+----------------------------------------------------------------------+
| Rob van der Putten, [EMAIL PROTECTED] |
| http://www.sput.nl/spam/spam-policy.html |
+----------------------------------------------------------------------+
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]