$Log$
+ Revision 590.89 2002/01/26 04:59:57 ajc
+ * smtp FROM command now validates sender using the validate_recipients() loop
+ (yeah, it's good for that too) making it directory-aware
+
Revision 590.88 2002/01/26 04:01:10 error
* Formatter now uses more of the available screen width
Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
* Initial CVS import
-
striplt(this_recp);
lprintf(9, "Evaluating recipient #%d <%s>\n", i, this_recp);
mailtype = alias(this_recp);
+ mailtype = alias(this_recp);
+ mailtype = alias(this_recp);
invalid = 0;
switch(mailtype) {
case MES_LOCAL:
strcpy(ret->errormsg, "No recipients specified.");
}
+ lprintf(9, "validate_recipients()\n");
+ lprintf(9, " local: %d <%s>\n", ret->num_local, ret->recp_local);
+ lprintf(9, " room: %d <%s>\n", ret->num_room, ret->recp_room);
+ lprintf(9, " inet: %d <%s>\n", ret->num_internet, ret->recp_internet);
+ lprintf(9, " ignet: %d <%s>\n", ret->num_ignet, ret->recp_ignet);
+ lprintf(9, " error: %d <%s>\n", ret->num_error, ret->errormsg);
+
return(ret);
}
void smtp_mail(char *argbuf) {
char user[SIZ];
char node[SIZ];
- int cvt;
+ char name[SIZ];
+ struct recptypes *valid;
if (strlen(SMTP->from) != 0) {
cprintf("503 Only one sender permitted\r\n");
strcpy(SMTP->from, &argbuf[5]);
striplt(SMTP->from);
+ stripallbut(SMTP->from, '<', '>');
if (strlen(SMTP->from) == 0) {
cprintf("501 Empty sender name is not permitted\r\n");
return;
}
-
/* If this SMTP connection is from a logged-in user, make sure that
* the user only sends email from his/her own address.
*/
if (CC->logged_in) {
- cvt = convert_internet_address(user, node, SMTP->from);
- lprintf(9, "cvt=%d, citaddr=<%s@%s>\n", cvt, user, node);
- if ( (cvt != 0) || (strcasecmp(user, CC->usersupp.fullname))) {
+ valid = validate_recipients(SMTP->from);
+ if ( (valid->num_local == 1) &&
+ (!strcasecmp(valid->recp_local, CC->usersupp.fullname)) ) {
+ cprintf("250 Sender ok <%s>\r\n", valid->recp_local);
+ SMTP->message_originated_locally = 1;
+ }
+ else {
cprintf("550 <%s> is not your address.\r\n",
SMTP->from);
strcpy(SMTP->from, "");
- return;
- }
- else {
- SMTP->message_originated_locally = 1;
}
+ phree(valid);
+ return;
}
+
/* Otherwise, make sure outsiders aren't trying to forge mail from
* this system.
*/
else {
- cvt = convert_internet_address(user, node, SMTP->from);
- lprintf(9, "cvt=%d, citaddr=<%s@%s>\n", cvt, user, node);
- if (CtdlHostAlias(node) == hostalias_localhost) {
+ process_rfc822_addr(SMTP->from, user, node, name);
+ if (CtdlHostAlias(node) != hostalias_nomatch) {
cprintf("550 You must log in to send mail from %s\r\n",
node);
strcpy(SMTP->from, "");