Skip to content
Snippets Groups Projects
Commit cb117f26 authored by rswindell's avatar rswindell
Browse files

Utilizes matchuser() new automatic support for "user_name" and "user.name".

Added comments and clarified the code a bit.
"real.name" and "sysop.alias" will retain original receipt names in message headers now (whoa).
parent 2605e781
No related branches found
No related tags found
No related merge requests found
...@@ -1682,40 +1682,45 @@ static void smtp_thread(void* arg) ...@@ -1682,40 +1682,45 @@ static void smtp_thread(void* arg)
state=SMTP_STATE_RCPT_TO; state=SMTP_STATE_RCPT_TO;
continue; continue;
} }
*tp=0; *tp=0; /* truncate at '@' */
} }
while(*p && !isalnum(*p)) p++; /* Skip '<' or '"' */ while(*p && !isalnum(*p)) p++; /* Skip '<' or '"' */
tp=strrchr(p,'"'); /* Convert first.last"@domain.com */ tp=strrchr(p,'"');
if(tp!=NULL) *tp=0; if(tp!=NULL) *tp=0; /* truncate at '"' */
p=alias(p,alias_buf); p=alias(p,alias_buf);
/* RX by sysop alias */
if(!stricmp(p,"SYSOP") || !stricmp(p,scfg.sys_id) if(!stricmp(p,"SYSOP") || !stricmp(p,scfg.sys_id)
|| !stricmp(p,"POSTMASTER")) || !stricmp(p,"POSTMASTER") || !stricmp(p,scfg.sys_op))
usernum=1; usernum=1;
else if(startup->options&MAIL_OPT_ALLOW_RX_BY_NUMBER else if(startup->options&MAIL_OPT_ALLOW_RX_BY_NUMBER
&& isdigit(*p)) { && isdigit(*p)) {
usernum=atoi(p); usernum=atoi(p); /* RX by user number */
/* verify usernum */ /* verify usernum */
username(&scfg,usernum,str); username(&scfg,usernum,str);
if(!str[0] || !stricmp(str,"DELETED USER")) if(!str[0] || !stricmp(str,"DELETED USER"))
usernum=0; usernum=0;
p=str; p=str;
} else { } else {
usernum=matchuser(&scfg,p); usernum=matchuser(&scfg,p); /* RX by "user alias", "user.alias" or "user_alias" */
if(!usernum && !stricmp(p,scfg.sys_op))
usernum=1; if(!usernum) { /* RX by "real name", "real.name", or "sysop.alias" */
if(!usernum) {
/* convert "first.last" to "first last" */ /* convert "user.name" to "user name" */
for(i=0;str[i];i++) sprintf(rcpt_name,"%.*s",sizeof(rcpt_name)-1,p);
if(str[i]=='.') for(tp=rcpt_name;*tp;tp++)
str[i]=' '; if(*tp=='.') *tp=' ';
usernum=matchuser(&scfg,p);
} if(!stricmp(rcpt_name,scfg.sys_op))
if(!usernum && !stricmp(p,scfg.sys_op)) usernum=1; /* RX by "sysop.alias" */
usernum=1;
if(!usernum) if(!usernum) /* RX by "real name" */
usernum=userdatdupe(&scfg, 0, U_NAME, LEN_NAME, p, FALSE); usernum=userdatdupe(&scfg, 0, U_NAME, LEN_NAME, p, FALSE);
if(!usernum) /* RX by "real.name" */
usernum=userdatdupe(&scfg, 0, U_NAME, LEN_NAME, rcpt_name, FALSE);
}
} }
if(!usernum) { if(!usernum) {
lprintf("%04d !SMTP UNKNOWN USER: %s", socket, buf+8); lprintf("%04d !SMTP UNKNOWN USER: %s", socket, buf+8);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment