diff options
author | jbeck <none@none> | 2006-09-20 10:16:14 -0700 |
---|---|---|
committer | jbeck <none@none> | 2006-09-20 10:16:14 -0700 |
commit | d25d47ee62f52e470a91221e64abe838a0af786d (patch) | |
tree | ad70bf48d968e7cae154e13b9c789a9d43f3ae2e /usr/src | |
parent | d2ef9fe9425bdaf63cdf808ce90a1ef90c4d9ce8 (diff) | |
download | illumos-gate-d25d47ee62f52e470a91221e64abe838a0af786d.tar.gz |
6467484 sun_compat.c no longer needed
--HG--
rename : usr/src/cmd/sendmail/src/sun_compat.c => deleted_files/usr/src/cmd/sendmail/src/sun_compat.c
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/cmd/sendmail/src/Makefile | 5 | ||||
-rw-r--r-- | usr/src/cmd/sendmail/src/conf.c | 27 | ||||
-rw-r--r-- | usr/src/cmd/sendmail/src/map.c | 71 | ||||
-rw-r--r-- | usr/src/cmd/sendmail/src/sun_compat.c | 92 |
4 files changed, 81 insertions, 114 deletions
diff --git a/usr/src/cmd/sendmail/src/Makefile b/usr/src/cmd/sendmail/src/Makefile index 5d9c54dc28..9a015bb558 100644 --- a/usr/src/cmd/sendmail/src/Makefile +++ b/usr/src/cmd/sendmail/src/Makefile @@ -33,14 +33,11 @@ PROG= sendmail include ../../Makefile.cmd include ../Makefile.cmd -# additional .o files needed -OBJADD=sun_compat.o - OBJS= alias.o arpadate.o bf.o collect.o conf.o control.o convtime.o daemon.o \ deliver.o domain.o envelope.o err.o headers.o macro.o main.o map.o \ mci.o milter.o mime.o parseaddr.o queue.o ratectrl.o readcf.o \ recipient.o savemail.o sfsasl.o sm_resolve.o srvrsmtp.o stab.o stats.o \ - sysexits.o tls.o trace.o udb.o usersmtp.o util.o version.o ${OBJADD} + sysexits.o tls.o trace.o udb.o usersmtp.o util.o version.o SRCS= $(OBJS:%.o=%.c) diff --git a/usr/src/cmd/sendmail/src/conf.c b/usr/src/cmd/sendmail/src/conf.c index 9bbb0031e5..07a3b46805 100644 --- a/usr/src/cmd/sendmail/src/conf.c +++ b/usr/src/cmd/sendmail/src/conf.c @@ -12,7 +12,7 @@ */ /* - * Copyright 1999-2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 1999-2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -829,8 +829,8 @@ inithostmaps() (void) makemapentry(buf); } #endif /* HESIOD */ -#if defined(LDAPMAP) && defined(SUN_EXTENSIONS) && \ - defined(SUN_SIMPLIFIED_LDAP) && defined(HASLDAPGETALIASBYNAME) +#if LDAPMAP && defined(SUN_EXTENSIONS) && \ + defined(SUN_SIMPLIFIED_LDAP) && HASLDAPGETALIASBYNAME else if (strcmp(maptype[i], "ldap") == 0 && stab("aliases.ldap", ST_MAP, ST_FIND) == NULL) { @@ -838,7 +838,7 @@ inithostmaps() sizeof buf); (void) makemapentry(buf); } -#endif +#endif /* LDAPMAP && defined(SUN_EXTENSIONS) && ... */ } if (stab("aliases", ST_MAP, ST_FIND) == NULL) { @@ -1344,6 +1344,25 @@ checkcompat(to, e) #endif /* EXAMPLE_CODE */ return EX_OK; } + +#ifdef SUN_EXTENSIONS +static void +init_md_sun() +{ + struct stat sbuf; + + /* Check for large file descriptor */ + if (fstat(fileno(stdin), &sbuf) < 0) + { + if (errno == EOVERFLOW) + { + perror("stdin"); + exit(EX_NOINPUT); + } + } +} +#endif /* SUN_EXTENSIONS */ + /* ** INIT_MD -- do machine dependent initializations ** diff --git a/usr/src/cmd/sendmail/src/map.c b/usr/src/cmd/sendmail/src/map.c index 3aa3b63150..dfe4c4a49a 100644 --- a/usr/src/cmd/sendmail/src/map.c +++ b/usr/src/cmd/sendmail/src/map.c @@ -12,7 +12,7 @@ */ /* - * Copyright 1996-2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 1996-2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -667,6 +667,50 @@ map_close(s, bogus) } map->map_mflags &= ~(MF_OPEN|MF_WRITABLE|MF_OPENBOGUS|MF_CLOSING); } + +#if defined(SUN_EXTENSIONS) && defined(SUN_INIT_DOMAIN) +extern int getdomainname(); + +/* this is mainly for backward compatibility in Sun environment */ +static char * +sun_init_domain() +{ + /* + ** Get the domain name from the kernel. + ** If it does not start with a leading dot, then remove + ** the first component. Since leading dots are funny Unix + ** files, we treat a leading "+" the same as a leading dot. + ** Finally, force there to be at least one dot in the domain name + ** (i.e. top-level domains are not allowed, like "com", must be + ** something like "sun.com"). + */ + + char buf[MAXNAME]; + char *period, *autodomain; + + if (getdomainname(buf, sizeof buf) < 0) + return NULL; + + if (buf[0] == '\0') + return NULL; + + if (tTd(0, 20)) + printf("domainname = %s\n", buf); + + if (buf[0] == '+') + buf[0] = '.'; + period = strchr(buf, '.'); + if (period == NULL) + autodomain = buf; + else + autodomain = period + 1; + if (strchr(autodomain, '.') == NULL) + return newstr(buf); + else + return newstr(autodomain); +} +#endif /* SUN_EXTENSIONS && SUN_INIT_DOMAIN */ + /* ** GETCANONNAME -- look up name using service switch ** @@ -698,7 +742,6 @@ getcanonname(host, hbsize, trymx, pttl) #if defined(SUN_EXTENSIONS) && defined(SUN_INIT_DOMAIN) bool should_try_nis_domain = false; static char *nis_domain = NULL; - extern char *sun_init_domain(); #endif nmaps = switch_map_find("hosts", maptype, mapreturn); @@ -722,7 +765,7 @@ getcanonname(host, hbsize, trymx, pttl) # if defined(SUN_EXTENSIONS) && defined(SUN_INIT_DOMAIN) if (nis_domain == NULL) nis_domain = sun_init_domain(); -# endif +# endif /* defined(SUN_EXTENSIONS) && defined(SUN_INIT_DOMAIN) */ } #endif /* NIS */ #if NISPLUS @@ -732,7 +775,7 @@ getcanonname(host, hbsize, trymx, pttl) # if defined(SUN_EXTENSIONS) && defined(SUN_INIT_DOMAIN) if (nis_domain == NULL) nis_domain = sun_init_domain(); -# endif +# endif /* defined(SUN_EXTENSIONS) && defined(SUN_INIT_DOMAIN) */ } #endif /* NISPLUS */ #if NAMED_BIND @@ -769,7 +812,7 @@ getcanonname(host, hbsize, trymx, pttl) if (found) should_try_nis_domain = true; /* but don't break, as we need to try all methods first */ -#endif +#endif /* defined(SUN_EXTENSIONS) && defined(SUN_INIT_DOMAIN) */ /* see if we should continue */ if (status == EX_TEMPFAIL) @@ -814,11 +857,11 @@ getcanonname(host, hbsize, trymx, pttl) { #if defined(SUN_EXTENSIONS) && defined(SUN_INIT_DOMAIN) if (VendorCode == VENDOR_SUN && - should_try_nis_domain) + should_try_nis_domain) { goto try_nis_domain; } -#endif +#endif /* defined(SUN_EXTENSIONS) && defined(SUN_INIT_DOMAIN) */ return false; } } @@ -828,15 +871,15 @@ getcanonname(host, hbsize, trymx, pttl) #if defined(SUN_EXTENSIONS) && defined(SUN_INIT_DOMAIN) if (VendorCode == VENDOR_SUN && should_try_nis_domain) { -try_nis_domain: + try_nis_domain: if (nis_domain != NULL && - strlen(nis_domain) + strlen(host) + 1 < hbsize) + strlen(nis_domain) + strlen(host) + 1 < hbsize) { (void) sm_strlcat2(host, ".", nis_domain, hbsize); return true; } } -#endif +#endif /* defined(SUN_EXTENSIONS) && defined(SUN_INIT_DOMAIN) */ if (tTd(38, 20)) sm_dprintf("getcanonname(%s), failed, status=%d\n", host, @@ -3368,13 +3411,13 @@ ldapmap_open(map, mode) sm_dprintf("ldapmap_open(%s, %d): ", map->map_mname, mode); #if defined(SUN_EXTENSIONS) && defined(SUN_SIMPLIFIED_LDAP) && \ - defined(HASLDAPGETALIASBYNAME) + HASLDAPGETALIASBYNAME if (VendorCode == VENDOR_SUN && strcmp(map->map_mname, "aliases.ldap") == 0) { return true; } -#endif +#endif /* defined(SUN_EXTENSIONS) && defined(SUN_SIMPLIFIED_LDAP) && ... */ mode &= O_ACCMODE; @@ -3557,7 +3600,7 @@ ldapmap_lookup(map, name, av, statp) sm_dprintf("ldapmap_lookup(%s, %s)\n", map->map_mname, name); #if defined(SUN_EXTENSIONS) && defined(SUN_SIMPLIFIED_LDAP) && \ - defined(HASLDAPGETALIASBYNAME) + HASLDAPGETALIASBYNAME if (VendorCode == VENDOR_SUN && strcmp(map->map_mname, "aliases.ldap") == 0) { @@ -3583,7 +3626,7 @@ ldapmap_lookup(map, name, av, statp) result = map_rewrite(map, answer, strlen(answer), av); return result; } -#endif +#endif /* defined(SUN_EXTENSIONS) && defined(SUN_SIMPLIFIED_LDAP) && ... */ /* Get ldap struct pointer from map */ lmap = (SM_LDAP_STRUCT *) map->map_db1; diff --git a/usr/src/cmd/sendmail/src/sun_compat.c b/usr/src/cmd/sendmail/src/sun_compat.c deleted file mode 100644 index 18b3e8d9d4..0000000000 --- a/usr/src/cmd/sendmail/src/sun_compat.c +++ /dev/null @@ -1,92 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1994 - 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifndef lint -static char id[] = "%W% (Sun) %G%"; -#endif /* not lint */ - -#include "sendmail.h" - -extern int getdomainname(); - -void -init_md_sun() -{ - struct stat sbuf; - - /* Check for large file descriptor */ - if (fstat(fileno(stdin), &sbuf) < 0) - { - if (errno == EOVERFLOW) - { - perror("stdin"); - exit(EX_NOINPUT); - } - } -} - - -#ifdef SUN_INIT_DOMAIN -/* this is mainly for backward compatibility in Sun environment */ -char * -sun_init_domain() -{ - /* - * Get the domain name from the kernel. - * If it does not start with a leading dot, then remove - * the first component. Since leading dots are funny Unix - * files, we treat a leading "+" the same as a leading dot. - * Finally, force there to be at least one dot in the domain name - * (i.e. top-level domains are not allowed, like "com", must be - * something like "sun.com"). - */ - char buf[MAXNAME]; - char *period, *autodomain; - - if (getdomainname(buf, sizeof buf) < 0) - return NULL; - - if (strlen(buf) == 0) - return NULL; - - if (tTd(0, 20)) - printf("domainname = %s\n", buf); - - if (buf[0] == '+') - buf[0] = '.'; - period = strchr(buf, '.'); - if (period == NULL) - autodomain = buf; - else - autodomain = period+1; - if (strchr(autodomain, '.') == NULL) - return newstr(buf); - else - return newstr(autodomain); -} -#endif /* SUN_INIT_DOMAIN */ |