EA_LOCAL, // Local message, do no network processing
EA_INTERNET // Convert msg and send as Internet mail
};
-char *killo[] = { // FIXME remove this when diags are complete
- "error",
- "multiple",
- "local",
- "internet"
-};
-/*
- * Aliasing for network mail.
- */
-int expand_aliases(char *name) { /* process alias and routing info for mail */
+// Process alias and routing info for email addresses
+int expand_aliases(char *name) {
int a;
char aaa[SIZ];
int at = 0;
char node[64];
+ char *t;
+ char *aliases = CtdlGetSysConfig(GLOBAL_ALIASES); // First hit the Global Alias Table
+ if (aliases) {
+ char *aptr = aliases;
+ while ((t = strtok_r(aptr, "\n", &aptr))) {
+ char *bar = strchr(t, '|');
+ if (bar) {
+ bar[0] = 0;
+ ++bar;
+ if (!strcasecmp(name, t)) {
+ syslog(LOG_DEBUG, "internet_addressing: global alias <%s> to <%s>", name, bar);
+ strcpy(name, bar);
+ }
+ }
+ }
-
-
- // FIXME write a "real" alias table here
-
-
- // temporary test of expansion
- if (!strcasecmp(name, "root")) {
- strcpy(name, "root");
- return(EA_MULTIPLE);
- }
- if (!strcasecmp(name, "qux")) {
- strcpy(name, "eggroll,blat,fun@eek.boop");
- return(EA_MULTIPLE);
+ free(aliases);
+ if (strchr(name, ',')) {
+ return(EA_MULTIPLE);
+ }
}
-
-
-
-
- char original_name[256];
+ char original_name[256]; // Now go for the regular aliases
safestrncpy(original_name, name, sizeof original_name);
// should these checks still be here, or maybe move them to split_recps() ?
}
if (strcasecmp(original_name, name)) {
- syslog(LOG_INFO, "internet_addressing: %s is being forwarded to %s", original_name, name);
+ syslog(LOG_INFO, "internet_addressing: directory alias <%s> to <%s>", original_name, name);
}
/* Change "user @ xxx" to "user" if xxx is an alias for this host */
if (name[a] == '@') {
if (CtdlHostAlias(&name[a+1]) == hostalias_localhost) {
name[a] = 0;
- syslog(LOG_DEBUG, "internet_addressing: changed to <%s>", name);
+ syslog(LOG_DEBUG, "internet_addressing: host is local, recipient is <%s>", name);
break;
}
}
strcat(ret->display_recp, append);
}
}
- syslog(LOG_DEBUG, "org_recp: \033[31m%-30s\033[0m this_recp: \033[32m%-30s\033[0m mailtype: %s", org_recp, this_recp, killo[mailtype]);
}
if ( (ret->num_local + ret->num_internet + ret->num_room + ret->num_error) == 0) {