Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
cbcda654
Commit
cbcda654
authored
22 years ago
by
rswindell
Browse files
Options
Downloads
Patches
Plain Diff
Added support for sender addresses that include comments (in parenthesis).
parent
21796e0b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/sbbs3/mailsrvr.c
+30
-47
30 additions, 47 deletions
src/sbbs3/mailsrvr.c
with
30 additions
and
47 deletions
src/sbbs3/mailsrvr.c
+
30
−
47
View file @
cbcda654
...
...
@@ -1152,13 +1152,11 @@ static BOOL chk_email_addr(SOCKET socket, char* p, char* host_name, char* host_i
{
char
addr
[
64
];
char
tmp
[
128
];
char
*
tp
;
while
(
*
p
&&
*
p
<=
' '
)
p
++
;
if
(
*
p
==
'<'
)
p
++
;
/* Skip '<' */
SAFECOPY
(
addr
,
p
);
tp
=
strchr
(
addr
,
'>'
);
if
(
tp
!=
NULL
)
*
tp
=
0
;
truncate
(
addr
,
">( "
);
if
(
!
trashcan
(
&
scfg
,
addr
,
"email"
))
return
(
TRUE
);
...
...
@@ -1758,8 +1756,7 @@ static void smtp_thread(void* arg)
while
(
*
p
&&
*
p
<=
' '
)
p
++
;
if
(
*
p
==
'<'
)
{
p
++
;
tp
=
strrchr
(
p
,
'>'
);
if
(
tp
)
*
tp
=
0
;
truncate
(
p
,
">"
);
SAFECOPY
(
rcpt_name
,
p
);
}
smb_hfield
(
&
msg
,
RFC822TO
,
(
ushort
)
strlen
(
p
),
p
);
...
...
@@ -1770,8 +1767,7 @@ static void smtp_thread(void* arg)
while
(
*
p
&&
*
p
<=
' '
)
p
++
;
if
(
*
p
==
'<'
)
{
p
++
;
tp
=
strchr
(
p
,
'>'
);
if
(
tp
)
*
tp
=
0
;
truncate
(
p
,
">"
);
}
nettype
=
NET_INTERNET
;
smb_hfield
(
&
msg
,
REPLYTONETTYPE
,
nettype
,
&
nettype
);
...
...
@@ -1781,27 +1777,29 @@ static void smtp_thread(void* arg)
if
(
!
strnicmp
(
buf
,
"FROM:"
,
5
))
{
if
(
!
chk_email_addr
(
socket
,
buf
+
5
,
host_name
,
host_ip
,
rcpt_addr
))
break
;
p
=
strchr
(
buf
+
5
,
'<'
);
if
(
p
)
{
/* Get the sender's address */
if
((
p
=
strchr
(
buf
+
5
,
'<'
))
!=
NULL
)
p
++
;
tp
=
strchr
(
p
,
'>'
);
if
(
tp
)
*
tp
=
0
;
SAFECOPY
(
sender_addr
,
p
);
}
else
{
else
p
=
buf
+
5
;
while
(
*
p
&&
*
p
<=
' '
)
p
++
;
SAFECOPY
(
sender_addr
,
p
);
}
while
(
*
p
&&
*
p
<=
' '
)
p
++
;
SAFECOPY
(
sender_addr
,
p
);
truncate
(
sender_addr
,
">( "
);
/* Get the sender's "name" (if possible) */
p
=
buf
+
5
;
while
(
*
p
&&
*
p
<=
' '
)
p
++
;
if
(
*
p
==
'"'
)
{
p
++
;
if
((
tp
=
strchr
(
p
,
'('
))
!=
NULL
)
{
/* name in parenthesis? */
p
=
tp
+
1
;
tp
=
strchr
(
p
,
')'
);
}
else
if
((
tp
=
strchr
(
p
,
'"'
))
!=
NULL
)
{
/* name in quotes? */
p
=
tp
+
1
;
tp
=
strchr
(
p
,
'"'
);
}
else
if
(
*
p
==
'<'
)
{
}
else
if
(
*
p
==
'<'
)
{
/* address in brackets? */
p
++
;
tp
=
strchr
(
p
,
'>'
);
}
else
}
else
/* name, then address in brackets */
tp
=
strchr
(
p
,
'<'
);
if
(
tp
)
*
tp
=
0
;
truncsp
(
p
);
...
...
@@ -1968,8 +1966,7 @@ static void smtp_thread(void* arg)
else
p
++
;
tp
=
strchr
(
str
,
'>'
);
/* Truncate at '>' */
if
(
tp
!=
NULL
)
*
tp
=
0
;
truncate
(
str
,
"> "
);
forward
=
FALSE
;
no_forward
=
FALSE
;
...
...
@@ -2085,8 +2082,7 @@ static void smtp_thread(void* arg)
*
tp
=
0
;
/* truncate at '@' */
while
(
*
p
&&
!
isalnum
(
*
p
))
p
++
;
/* Skip '<' or '"' */
tp
=
strrchr
(
p
,
'"'
);
if
(
tp
!=
NULL
)
*
tp
=
0
;
/* truncate at '"' */
truncate
(
p
,
"
\"
"
);
p
=
alias
(
&
scfg
,
p
,
name_alias_buf
);
if
(
p
==
name_alias_buf
)
...
...
@@ -2239,15 +2235,10 @@ static void smtp_thread(void* arg)
else
p
++
;
strcpy
(
sender_addr
,
p
);
p
=
strchr
(
sender_addr
,
'>'
);
if
(
p
!=
NULL
)
*
p
=
0
;
truncate
(
sender_addr
,
">"
);
/* get sender */
strcpy
(
sender
,
sender_addr
);
p
=
strchr
(
sender
,
'@'
);
if
(
p
!=
NULL
)
*
p
=
0
;
else
if
(
truncate
(
sender
,
"@"
)
==
NULL
)
sender
[
0
]
=
0
;
sockprintf
(
socket
,
"354 send the mail data, end with <CRLF>.<CRLF>"
);
...
...
@@ -2541,14 +2532,8 @@ static void sendmail_thread(void* arg)
*
p
=
0
;
port
=
atoi
(
p
+
1
);
}
sprintf
(
to
,
"%.*s"
,(
int
)
sizeof
(
to
)
-
1
,(
char
*
)
msg
.
to_net
.
addr
);
p
=
strrchr
(
to
,
'>'
);
/* Truncate '>' */
if
(
p
!=
NULL
)
*
p
=
0
;
/* truncate at first white-space char */
p
=
to
;
while
(
*
p
&&
*
p
>
' '
)
p
++
;
*
p
=
0
;
SAFECOPY
(
to
,(
char
*
)
msg
.
to_net
.
addr
);
truncate
(
to
,
"> "
);
p
=
strrchr
(
to
,
'@'
);
if
(
p
==
NULL
)
{
...
...
@@ -2657,6 +2642,7 @@ static void sendmail_thread(void* arg)
strcpy
(
fromaddr
,
msg
.
from_net
.
addr
);
else
usermailaddr
(
&
scfg
,
fromaddr
,
msg
.
from
);
truncate
(
fromaddr
,
" "
);
if
(
fromaddr
[
0
]
==
'<'
)
sockprintf
(
sock
,
"MAIL FROM: %s"
,
fromaddr
);
else
...
...
@@ -2667,15 +2653,12 @@ static void sendmail_thread(void* arg)
continue
;
}
/* RCPT */
p
=
strrchr
((
char
*
)
msg
.
to_net
.
addr
,
'<'
);
if
(
p
==
NULL
)
p
=
(
char
*
)
msg
.
to_net
.
addr
;
else
if
((
p
=
strrchr
((
char
*
)
msg
.
to_net
.
addr
,
'<'
))
!=
NULL
)
p
++
;
else
p
=
(
char
*
)
msg
.
to_net
.
addr
;
SAFECOPY
(
toaddr
,
p
);
p
=
strchr
(
toaddr
,
'>'
);
if
(
p
!=
NULL
)
*
p
=
0
;
truncate
(
toaddr
,
"> "
);
sockprintf
(
sock
,
"RCPT TO: <%s>"
,
toaddr
);
if
(
!
sockgetrsp
(
sock
,
"25"
,
buf
,
sizeof
(
buf
)))
{
sprintf
(
err
,
"%s replied with '%s' instead of 25*"
,
server
,
buf
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment