diff options
-rw-r--r-- | include/libbb.h | 1 | ||||
-rw-r--r-- | libbb/safe_gethostname.c | 22 | ||||
-rw-r--r-- | mailutils/sendmail.c | 7 |
3 files changed, 4 insertions, 26 deletions
diff --git a/include/libbb.h b/include/libbb.h index 2cc1466..f12800f 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -795,7 +795,6 @@ void qsort_string_vector(char **sv, unsigned count) FAST_FUNC; int safe_poll(struct pollfd *ufds, nfds_t nfds, int timeout_ms) FAST_FUNC; char *safe_gethostname(void) FAST_FUNC; -char *safe_getdomainname(void) FAST_FUNC; /* Convert each alpha char in str to lower-case */ char* str_tolower(char *str) FAST_FUNC; diff --git a/libbb/safe_gethostname.c b/libbb/safe_gethostname.c index bdb9896..cac99ae 100644 --- a/libbb/safe_gethostname.c +++ b/libbb/safe_gethostname.c @@ -50,25 +50,3 @@ char* FAST_FUNC safe_gethostname(void) uname(&uts); return xstrndup(!uts.nodename[0] ? "?" : uts.nodename, sizeof(uts.nodename)); } - -/* - * On success return the current malloced and NUL terminated domainname. - * On error return malloced and NUL terminated string "?". - * This is an illegal first character for a domainname. - * The returned malloced string must be freed by the caller. - */ -char* FAST_FUNC safe_getdomainname(void) -{ -#if defined(__linux__) -/* The field domainname of struct utsname is Linux specific. */ - struct utsname uts; - uname(&uts); - return xstrndup(!uts.domainname[0] ? "?" : uts.domainname, sizeof(uts.domainname)); -#else - /* We really don't care about people with domain names wider than most screens */ - char buf[256]; - int r = getdomainname(buf, sizeof(buf)); - buf[sizeof(buf)-1] = '\0'; - return xstrdup(r < 0 ? "?" : buf); -#endif -} diff --git a/mailutils/sendmail.c b/mailutils/sendmail.c index aa381c6..c426e9d 100644 --- a/mailutils/sendmail.c +++ b/mailutils/sendmail.c @@ -118,7 +118,7 @@ int sendmail_main(int argc UNUSED_PARAM, char **argv) char *opt_from; char *s; llist_t *list = NULL; - char *domain = sane_address(safe_getdomainname()); + char *host = sane_address(safe_gethostname()); unsigned nheaders = 0; int code; @@ -222,8 +222,9 @@ int sendmail_main(int argc UNUSED_PARAM, char **argv) } // we should start with modern EHLO - if (250 != smtp_checkp("EHLO %s", domain, -1)) - smtp_checkp("HELO %s", domain, 250); + if (250 != smtp_checkp("EHLO %s", host, -1)) + smtp_checkp("HELO %s", host, 250); + free(host); // perform authentication if (opts & OPT_a) { |