From: Unknown <> Date: Tue, 13 May 2008 01:17:54 +0000 (+0000) Subject: add files for 2008-05-13T01:17:54Z X-Git-Tag: imap-2007b~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e9b05d3fe15921260e5f8fe05b2ff13866070777;p=uw-imap add files for 2008-05-13T01:17:54Z --- diff --git a/src/osdep/unix/env_unix.c b/src/osdep/unix/env_unix.c index 4d6049e..5ddade1 100644 --- a/src/osdep/unix/env_unix.c +++ b/src/osdep/unix/env_unix.c @@ -21,7 +21,7 @@ * Internet: MRC@Washington.EDU * * Date: 1 August 1988 - * Last Edited: 15 February 2008 + * Last Edited: 15 May 2008 */ #include @@ -931,10 +931,16 @@ char *myusername_full (unsigned long *flags) char *mylocalhost () { - char tmp[MAILTMPLEN]; if (!myLocalHost) { - gethostname(tmp,MAILTMPLEN);/* get local host name */ - myLocalHost = cpystr (tcp_canonical (tmp)); + char *s,tmp[MAILTMPLEN]; + char *t = "unknown"; + tmp[0] = tmp[MAILTMPLEN-1] = '\0'; + if (!gethostname (tmp,MAILTMPLEN-1) && tmp[0]) { + /* sanity check of name */ + for (s = tmp; (*s > 0x20) && (*s < 0x7f); ++s); + if (!*s) t = tcp_canonical (tmp); + } + myLocalHost = cpystr (t); } return myLocalHost; }