--- ../../sendmail/conf.c Wed Jan 9 09:26:28 2002 +++ conf.c Sun Jan 13 13:51:11 2002 @@ -768,6 +768,15 @@ (void) makemapentry(buf); } #endif /* HESIOD */ +#if defined(LDAPMAP) && defined(SUN_EXTENSIONS) && defined(SUN_SIMPLIFIED_LDAP) + else if (strcmp(maptype[i], "ldap") == 0 && + stab("aliases.ldap", ST_MAP, ST_FIND) == NULL) + { + (void) strlcpy(buf, "aliases.ldap ldap -b . -h localhost -k mail=%0 -v mailgroup", + sizeof buf); + (void) makemapentry(buf); + } +#endif } if (stab("aliases", ST_MAP, ST_FIND) == NULL) { --- ../../sendmail/deliver.c Wed Jan 9 19:23:29 2002 +++ deliver.c Sun Jan 13 13:51:11 2002 @@ -2548,6 +2548,25 @@ } } +#if defined(SUN_EXTENSIONS) && defined(SUN_CONTENT_LENGTH) + /* + ** The Vn/Berkeley *file* mailer will have been + ** caught far above, and mailfile() called instead. + */ + + if (VendorCode == VENDOR_SUN && + strcmp(m->m_name, "*file*") == 0) + { + if (bitset(S_ISUID, stb.st_mode)) + new_ruid = stb.st_uid; + else if (ctladdr != NULL && ctladdr->q_uid != 0) + new_ruid = ctladdr->q_uid; + if (setreuid(new_ruid, new_euid) < 0 && suidwarn) + syserr("openmailer: setreuid(%ld, %ld) failed", + (long) new_ruid, (long) new_euid); + } +#endif + if (tTd(11, 2)) sm_dprintf("openmailer: running as r/euid=%d/%d, r/egid=%d/%d\n", (int) getuid(), (int) geteuid(), --- ../../sendmail/map.c Fri Jan 11 14:06:52 2002 +++ map.c Sun Jan 13 13:51:11 2002 @@ -685,6 +685,11 @@ auto int status; char *maptype[MAXMAPSTACK]; short mapreturn[MAXMAPACTIONS]; +#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); if (pttl != 0) @@ -704,6 +709,10 @@ else if (strcmp("nis", maptype[mapno]) == 0) { found = nis_getcanonname(host, hbsize, &status); +# if defined(SUN_EXTENSIONS) && defined(SUN_INIT_DOMAIN) + if (nis_domain == NULL) + nis_domain = sun_init_domain(); +# endif } #endif /* NIS */ #if NISPLUS @@ -710,6 +719,10 @@ else if (strcmp("nisplus", maptype[mapno]) == 0) { found = nisplus_getcanonname(host, hbsize, &status); +# if defined(SUN_EXTENSIONS) && defined(SUN_INIT_DOMAIN) + if (nis_domain == NULL) + nis_domain = sun_init_domain(); +# endif } #endif /* NISPLUS */ #if NAMED_BIND @@ -742,6 +755,12 @@ (macvalue('m', CurEnv) != NULL || strchr(host, '.') != NULL)) break; +#if defined(SUN_EXTENSIONS) && defined(SUN_INIT_DOMAIN) + if (found) + should_try_nis_domain = true; + /* but don't break, as we need to try all methods first */ +#endif + /* see if we should continue */ if (status == EX_TEMPFAIL) { @@ -782,11 +801,36 @@ (void) sm_strlcat(host, d, hbsize); } else + { +#if defined(SUN_EXTENSIONS) && defined(SUN_INIT_DOMAIN) + if (VendorCode == VENDOR_SUN && + should_try_nis_domain) + { + goto try_nis_domain; + } +#endif return false; + } } return true; } +#if defined(SUN_EXTENSIONS) && defined(SUN_INIT_DOMAIN) + if (VendorCode == VENDOR_SUN && should_try_nis_domain) + { +try_nis_domain: + if (nis_domain != NULL && + strlen(nis_domain) + strlen(host) + 1 < hbsize) + { + char *p = &host[strlen(host)]; + + *p++ = '.'; + strcpy(p, nis_domain); + return true; + } + } +#endif + if (tTd(38, 20)) sm_dprintf("getcanonname(%s), failed, status=%d\n", host, status); @@ -3286,6 +3330,14 @@ if (tTd(38, 2)) sm_dprintf("ldapmap_open(%s, %d): ", map->map_mname, mode); +#if defined(SUN_EXTENSIONS) && defined(SUN_SIMPLIFIED_LDAP) + if (VendorCode == VENDOR_SUN && + strcmp(map->map_mname, "aliases.ldap") == 0) + { + return TRUE; + } +#endif + mode &= O_ACCMODE; /* sendmail doesn't have the ability to write to LDAP (yet) */ @@ -3459,6 +3511,34 @@ if (tTd(38, 20)) sm_dprintf("ldapmap_lookup(%s, %s)\n", map->map_mname, name); +#if defined(SUN_EXTENSIONS) && defined(SUN_SIMPLIFIED_LDAP) + if (VendorCode == VENDOR_SUN && + strcmp(map->map_mname, "aliases.ldap") == 0) + { + char answer[MAXNAME + 1]; + int rc; + + rc = __getldapaliasbyname(name, answer, sizeof(answer)); + if (rc != 0) + { + if (tTd(38, 20)) + sm_dprintf("getldapaliasbyname(%.100s) failed, errno=%d\n", + name, errno); + *statp = EX_NOTFOUND; + return NULL; + } + *statp = EX_OK; + if (tTd(38, 20)) + sm_dprintf("getldapaliasbyname(%.100s) => %s\n", name, + answer); + if (bitset(MF_MATCHONLY, map->map_mflags)) + result = map_rewrite(map, name, strlen(name), NULL); + else + result = map_rewrite(map, answer, strlen(answer), av); + return result; + } +#endif + /* Get ldap struct pointer from map */ lmap = (SM_LDAP_STRUCT *) map->map_db1; sm_ldap_setopts(lmap->ldap_ld, lmap); --- ../../sendmail/version.c Sun Jan 13 10:23:00 2002 +++ version.c Sun Jan 13 13:51:20 2002 @@ -15,4 +15,4 @@ SM_RCSID("@(#)$Id: Patch.txt,v 1.1.1.1 2006/10/11 20:45:19 eric Exp $") -char Version[] = "8.12.2"; +char Version[] = "8.12.2+Sun";