From: Benoit DOLEZ <bdolez@ant-computing.com>
To: mlmmj@mlmmj.org
Subject: SIGSEGV in resolving hostname
Date: Sun, 22 Oct 2006 17:44:34 +0000 [thread overview]
Message-ID: <453BAE02.7030501@ant-computing.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 638 bytes --]
Hi,
When there is not reverse for the hostname, the gethostbyname return
NULL. There is no check of the return value in the function
hostnamestr() (strgen:144). Because of the SIGSEGV generated, the normal
might not working.
Here you can find a patch, the hostname is used in the HELO part. It
might be interesting to specify the hostname in the config, for the
moment, I had a patch that use the non reversed hostname if the
hostnamestr return NULL.
Under Slakware, the hostname command return the first part of the FQDN
hostname.
Benoit
--
Benoit DOLEZ
GSM: +33 6 21 05 91 69 mailto:bdolez@ant-computing.com
[-- Attachment #2: mlmmj-hostname-no-reverse.patch --]
[-- Type: text/x-patch, Size: 1321 bytes --]
diff -r -u mlmmj-1.2.12-RC4/src/mlmmj-send.c mlmmj-1.2.12-RC4-flx0.1/src/mlmmj-send.c
--- mlmmj-1.2.12-RC4/src/mlmmj-send.c 2006-06-21 23:50:48.000000000 +0200
+++ mlmmj-1.2.12-RC4-flx0.1/src/mlmmj-send.c 2006-10-22 19:23:19.000000000 +0200
@@ -326,7 +326,19 @@
int retval = 0;
char *reply = NULL;
char *myhostname = hostnamestr();
-
+
+ if (!myhostname) {
+ char tmp[256];
+ if (gethostname(tmp, 256) != 0) {
+ perror("FATAL: gethostname()");
+ exit(1);
+ }
+ if (!(myhostname = mystrdup(tmp))) {
+ perror("FATAL: mystrdup()");
+ exit(1);
+ }
+ }
+
init_sockfd(sockfd, relayhost, port);
if((reply = checkwait_smtpreply(*sockfd, MLMMJ_CONNECT)) != NULL) {
diff -r -u mlmmj-1.2.12-RC4/src/strgen.c mlmmj-1.2.12-RC4-flx0.1/src/strgen.c
--- mlmmj-1.2.12-RC4/src/strgen.c 2006-09-03 14:11:14.000000000 +0200
+++ mlmmj-1.2.12-RC4-flx0.1/src/strgen.c 2006-10-22 19:16:08.000000000 +0200
@@ -144,7 +144,7 @@
hostname[sizeof(hostname)-1] = '\0';
hostlookup = gethostbyname(hostname);
- return mystrdup(hostlookup->h_name);
+ return (hostlookup ? mystrdup(hostlookup->h_name) : NULL);
}
char *mydirname(const char *path)
next reply other threads:[~2006-10-22 17:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-22 17:44 Benoit DOLEZ [this message]
-- strict thread matches above, loose matches on Subject: below --
2006-11-06 20:08 SIGSEGV in resolving hostname Morten K. Poulsen
2006-12-06 13:41 Morten K. Poulsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=453BAE02.7030501@ant-computing.com \
--to=bdolez@ant-computing.com \
--cc=mlmmj@mlmmj.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.