*** auth.c Mon May 13 09:59:43 2002 --- auth-patched.c Mon May 13 10:03:08 2002 *************** *** 50,76 **** char buf[512]; static char *my_hostname=0; FILE *f; if (my_hostname == 0) { ! buf[0]=0; ! if ((f=fopen(HOSTNAMEFILE, "r")) != 0) { ! char *p; ! fgets(buf, sizeof(buf), f); ! fclose(f); ! if ((p=strchr(buf, '\n')) != 0) ! *p=0; ! } ! ! if (buf[0] == 0 && gethostname(buf, sizeof(buf)-1)) ! strcpy(buf, "localhost"); ! if ((my_hostname=malloc(strlen(buf)+1)) == 0) ! enomem(); ! strcpy(my_hostname, buf); } return (my_hostname); } --- 50,84 ---- char buf[512]; static char *my_hostname=0; FILE *f; + char *vhostname; if (my_hostname == 0) { ! if ((vhostname=getenv("VHOST_MAILDOMAIN")) !=NULL) { ! if ((my_hostname=malloc(strlen(vhostname)+1))==0) ! enomem(); ! strcpy(my_hostname, vhostname); ! } else { ! buf[0]=0; ! if ((f=fopen(HOSTNAMEFILE, "r")) != 0) ! { ! char *p; ! ! fgets(buf, sizeof(buf), f); ! fclose(f); ! if ((p=strchr(buf, '\n')) != 0) ! *p=0; ! } ! if (buf[0] == 0 && gethostname(buf, sizeof(buf)-1)) ! strcpy(buf, "localhost"); ! if ((my_hostname=malloc(strlen(buf)+1)) == 0) ! enomem(); ! strcpy(my_hostname, buf); ! } } return (my_hostname); }