static char	*aliaslookup __P((char *, int *, char *));    void alias(a, sendq, aliaslevel, e) register ADDRESS *a; ADDRESS **sendq; int aliaslevel; register ENVELOPE *e; { register char *p; char *owner; auto int status = EX_OK; char obuf[MAXNAME + 7];  if (tTd(27, 1)) sm_dprintf("alias(%s)\n", a->q_user);   if (!QS_IS_OK(a->q_state)) return;  if (NoAlias) return;  e->e_to = a->q_paddr;    #if _FFR_REDIRECTEMPTY   if (e->e_sender != NULL && *e->e_sender == '\0') {  (void) sm_strlcpyn(obuf, sizeof obuf, 2, "owner-", a->q_user); if (aliaslookup(obuf, &status, a->q_host) != NULL) { if (LogLevel > 8) sm_syslog(LOG_WARNING, e->e_id, "possible spam from <> to list: %s, redirected to %s\n", a->q_user, obuf); a->q_user = sm_rpool_strdup_x(e->e_rpool, obuf); } } #endif   p = aliaslookup(a->q_user, &status, a->q_host); if (status == EX_TEMPFAIL || status == EX_UNAVAILABLE) { a->q_state = QS_QUEUEUP; if (e->e_message == NULL) e->e_message = "alias database unavailable";   if (a->q_message == NULL) a->q_message = "alias database unavailable"; return; } if (p == NULL) return;    if (tTd(27, 1)) sm_dprintf("%s (%s, %s) aliased to %s\n", a->q_paddr, a->q_host, a->q_user, p); if (bitset(EF_VRFYONLY, e->e_flags)) { a->q_state = QS_VERIFIED; return; } message("aliased to %s", shortenstring(p, MAXSHORTSTR)); if (LogLevel > 10) sm_syslog(LOG_INFO, e->e_id, "alias %.100s => %s", a->q_paddr, shortenstring(p, MAXSHORTSTR)); a->q_flags &= ~QSELFREF; if (tTd(27, 5)) { sm_dprintf("alias: QS_EXPANDED "); printaddr(a, false); } a->q_state = QS_EXPANDED;    a->q_uid = DefUid; a->q_gid = 0; a->q_fullname = NULL; a->q_flags |= QGOODUID|QALIAS;  (void) sendtolist(p, a, sendq, aliaslevel + 1, e);  if (bitset(QSELFREF, a->q_flags) && QS_IS_EXPANDED(a->q_state)) a->q_state = QS_OK;    if (strncmp(a->q_user, "owner-", 6) == 0 || strlen(a->q_user) > sizeof obuf - 7) (void) sm_strlcpy(obuf, "owner-owner", sizeof obuf); else (void) sm_strlcpyn(obuf, sizeof obuf, 2, "owner-", a->q_user); owner = aliaslookup(obuf, &status, a->q_host); if (owner == NULL) return;   if (strpbrk(owner, ",:/|\"") != NULL) owner = obuf; a->q_owner = sm_rpool_strdup_x(e->e_rpool, owner);   if (e->e_xfp != NULL) (void) sm_io_fprintf(e->e_xfp, SM_TIME_DEFAULT, "Message delivered to mailing list %s\n", a->q_paddr); e->e_flags |= EF_SENDRECEIPT; a->q_flags |= QDELIVERED|QEXPANDED; }   static char *
aliaslookup(name, pstat, av)	char *name;	int *pstat;	char *av;{	static MAP *map = NULL;#if _FFR_ALIAS_DETAIL	int i;	char *argv[4];#endif /* _FFR_ALIAS_DETAIL */	if (map == NULL)	{		STAB *s = stab("aliases", ST_MAP, ST_FIND);		if (s == NULL)			return NULL;		map = &s->s_map;	}	DYNOPENMAP(map);	/* special case POstMastER -- always use lower case */	if (sm_strcasecmp(name, "postmaster") == 0)		name = "postmaster";#if _FFR_ALIAS_DETAIL	i = 0;	argv[i++] = name;	argv[i++] = av;	/* XXX '+' is hardwired here as delimiter! */	if (av != NULL && *av == '+')		argv[i++] = av + 1;	argv[i++] = NULL;	return (*map->map_class->map_lookup)(map, name, argv, pstat);#else /* _FFR_ALIAS_DETAIL */	return (*map->map_class->map_lookup)(map, name, NULL, pstat);#endif /* _FFR_ALIAS_DETAIL */}