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
7ee5856a
Commit
7ee5856a
authored
23 years ago
by
rswindell
Browse files
Options
Downloads
Patches
Plain Diff
Added smb.last_error to SMTP/POP3/SendMail SMB error messages.
parent
2afa0e94
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
+70
-65
70 additions, 65 deletions
src/sbbs3/mailsrvr.c
with
70 additions
and
65 deletions
src/sbbs3/mailsrvr.c
+
70
−
65
View file @
7ee5856a
...
...
@@ -732,20 +732,20 @@ static void pop3_thread(void* arg)
for
(
l
=
bytes
=
0
;
l
<
msgs
;
l
++
)
{
msg
.
hdr
.
number
=
mail
[
l
].
number
;
if
((
i
=
smb_getmsgidx
(
&
smb
,
&
msg
))
!=
0
)
{
lprintf
(
"%04d !POP3 ERROR %d getting message index"
,
socket
,
i
);
lprintf
(
"%04d !POP3 ERROR %d
(%s)
getting message index"
,
socket
,
i
,
smb
->
last_error
);
break
;
}
if
((
i
=
smb_lockmsghdr
(
&
smb
,
&
msg
))
!=
0
)
{
lprintf
(
"%04d !POP3 ERROR %d locking message header #%lu"
,
socket
,
i
,
msg
.
hdr
.
number
);
lprintf
(
"%04d !POP3 ERROR %d
(%s)
locking message header #%lu"
,
socket
,
i
,
smb
->
last_error
,
msg
.
hdr
.
number
);
break
;
}
i
=
smb_getmsghdr
(
&
smb
,
&
msg
);
smb_unlockmsghdr
(
&
smb
,
&
msg
);
if
(
i
!=
0
)
{
lprintf
(
"%04d !POP3 ERROR %d getting message header #%lu"
,
socket
,
i
,
msg
.
hdr
.
number
);
lprintf
(
"%04d !POP3 ERROR %d
(%s)
getting message header #%lu"
,
socket
,
i
,
smb
->
last_error
,
msg
.
hdr
.
number
);
break
;
}
for
(
i
=
0
;
i
<
msg
.
hdr
.
total_dfields
;
i
++
)
...
...
@@ -777,26 +777,26 @@ static void pop3_thread(void* arg)
for
(
l
=
0
;
l
<
msgs
;
l
++
)
{
msg
.
hdr
.
number
=
mail
[
l
].
number
;
if
((
i
=
smb_getmsgidx
(
&
smb
,
&
msg
))
!=
0
)
{
lprintf
(
"%04d !POP3 ERROR %d getting message index"
,
socket
,
i
);
lprintf
(
"%04d !POP3 ERROR %d
(%s)
getting message index"
,
socket
,
i
,
smb
->
last_error
);
break
;
}
if
((
i
=
smb_lockmsghdr
(
&
smb
,
&
msg
))
!=
0
)
{
lprintf
(
"%04d !POP3 ERROR %d locking message header #%lu"
,
socket
,
i
,
msg
.
hdr
.
number
);
lprintf
(
"%04d !POP3 ERROR %d
(%s)
locking message header #%lu"
,
socket
,
i
,
smb
->
last_error
,
msg
.
hdr
.
number
);
break
;
}
if
((
i
=
smb_getmsghdr
(
&
smb
,
&
msg
))
!=
0
)
{
smb_unlockmsghdr
(
&
smb
,
&
msg
);
lprintf
(
"%04d !POP3 ERROR %d getting message header #%lu"
,
socket
,
i
,
msg
.
hdr
.
number
);
lprintf
(
"%04d !POP3 ERROR %d
(%s)
getting message header #%lu"
,
socket
,
i
,
smb
->
last_error
,
msg
.
hdr
.
number
);
break
;
}
msg
.
hdr
.
attr
=
mail
[
l
].
attr
;
msg
.
idx
.
attr
=
msg
.
hdr
.
attr
;
if
((
i
=
smb_putmsg
(
&
smb
,
&
msg
))
!=
0
)
lprintf
(
"%04d !POP3 ERROR %d updating message index"
,
socket
,
i
);
lprintf
(
"%04d !POP3 ERROR %d
(%s)
updating message index"
,
socket
,
i
,
smb
->
last_error
);
smb_unlockmsghdr
(
&
smb
,
&
msg
);
smb_freemsgmem
(
&
msg
);
}
...
...
@@ -819,8 +819,8 @@ static void pop3_thread(void* arg)
}
msg
.
hdr
.
number
=
mail
[
msgnum
-
1
].
number
;
if
((
i
=
smb_getmsgidx
(
&
smb
,
&
msg
))
!=
0
)
{
lprintf
(
"%04d !POP3 ERROR %d getting message index"
,
socket
,
i
);
lprintf
(
"%04d !POP3 ERROR %d
(%s)
getting message index"
,
socket
,
i
,
smb
->
last_error
);
sockprintf
(
socket
,
"-ERR %d getting message index"
,
i
);
break
;
}
...
...
@@ -831,8 +831,8 @@ static void pop3_thread(void* arg)
continue
;
}
if
((
i
=
smb_lockmsghdr
(
&
smb
,
&
msg
))
!=
0
)
{
lprintf
(
"%04d !POP3 ERROR %d locking message header #%lu"
,
socket
,
i
,
msg
.
hdr
.
number
);
lprintf
(
"%04d !POP3 ERROR %d
(%s)
locking message header #%lu"
,
socket
,
i
,
smb
->
last_error
,
msg
.
hdr
.
number
);
sockprintf
(
socket
,
"-ERR %d locking message header"
,
i
);
continue
;
}
...
...
@@ -840,8 +840,8 @@ static void pop3_thread(void* arg)
smb_unlockmsghdr
(
&
smb
,
&
msg
);
if
(
i
!=
0
)
{
smb_freemsgmem
(
&
msg
);
lprintf
(
"%04d !POP3 ERROR %d getting message header #%lu"
,
socket
,
i
,
msg
.
hdr
.
number
);
lprintf
(
"%04d !POP3 ERROR %d
(%s)
getting message header #%lu"
,
socket
,
i
,
smb
->
last_error
,
msg
.
hdr
.
number
);
sockprintf
(
socket
,
"-ERR %d getting message header"
,
i
);
continue
;
}
...
...
@@ -862,23 +862,23 @@ static void pop3_thread(void* arg)
for
(
l
=
0
;
l
<
msgs
;
l
++
)
{
msg
.
hdr
.
number
=
mail
[
l
].
number
;
if
((
i
=
smb_getmsgidx
(
&
smb
,
&
msg
))
!=
0
)
{
lprintf
(
"%04d !POP3 ERROR %d getting message index"
,
socket
,
i
);
lprintf
(
"%04d !POP3 ERROR %d
(%s)
getting message index"
,
socket
,
i
,
smb
->
last_error
);
break
;
}
if
(
msg
.
idx
.
attr
&
MSG_DELETE
)
continue
;
if
((
i
=
smb_lockmsghdr
(
&
smb
,
&
msg
))
!=
0
)
{
lprintf
(
"%04d !POP3 ERROR %d locking message header #%lu"
,
socket
,
i
,
msg
.
hdr
.
number
);
lprintf
(
"%04d !POP3 ERROR %d
(%s)
locking message header #%lu"
,
socket
,
i
,
smb
->
last_error
,
msg
.
hdr
.
number
);
break
;
}
i
=
smb_getmsghdr
(
&
smb
,
&
msg
);
smb_unlockmsghdr
(
&
smb
,
&
msg
);
if
(
i
!=
0
)
{
smb_freemsgmem
(
&
msg
);
lprintf
(
"%04d !POP3 ERROR %d getting message header #%lu"
,
socket
,
i
,
msg
.
hdr
.
number
);
lprintf
(
"%04d !POP3 ERROR %d
(%s)
getting message header #%lu"
,
socket
,
i
,
smb
->
last_error
,
msg
.
hdr
.
number
);
break
;
}
if
(
!
strnicmp
(
buf
,
"LIST"
,
4
))
{
...
...
@@ -922,8 +922,8 @@ static void pop3_thread(void* arg)
,
socket
,
user
.
alias
,
msg
.
hdr
.
number
);
if
((
i
=
smb_getmsgidx
(
&
smb
,
&
msg
))
!=
0
)
{
lprintf
(
"%04d !POP3 ERROR %d getting message index"
,
socket
,
i
);
lprintf
(
"%04d !POP3 ERROR %d
(%s)
getting message index"
,
socket
,
i
,
smb
->
last_error
);
sockprintf
(
socket
,
"-ERR %d getting message index"
,
i
);
continue
;
}
...
...
@@ -934,16 +934,16 @@ static void pop3_thread(void* arg)
continue
;
}
if
((
i
=
smb_lockmsghdr
(
&
smb
,
&
msg
))
!=
0
)
{
lprintf
(
"%04d !POP3 ERROR %d locking message header #%lu"
,
socket
,
i
,
msg
.
hdr
.
number
);
lprintf
(
"%04d !POP3 ERROR %d
(%s)
locking message header #%lu"
,
socket
,
i
,
smb
->
last_error
,
msg
.
hdr
.
number
);
sockprintf
(
socket
,
"-ERR %d locking message header"
,
i
);
continue
;
}
i
=
smb_getmsghdr
(
&
smb
,
&
msg
);
smb_unlockmsghdr
(
&
smb
,
&
msg
);
if
(
i
!=
0
)
{
lprintf
(
"%04d !POP3 ERROR %d getting message header #%lu"
,
socket
,
i
,
msg
.
hdr
.
number
);
lprintf
(
"%04d !POP3 ERROR %d
(%s)
getting message header #%lu"
,
socket
,
i
,
smb
->
last_error
,
msg
.
hdr
.
number
);
sockprintf
(
socket
,
"-ERR %d getting message header"
,
i
);
continue
;
}
...
...
@@ -975,11 +975,11 @@ static void pop3_thread(void* arg)
msg
.
hdr
.
netattr
|=
MSG_SENT
;
if
((
i
=
smb_lockmsghdr
(
&
smb
,
&
msg
))
!=
0
)
lprintf
(
"%04d !POP3 ERROR %d locking message header #%lu"
,
socket
,
i
,
msg
.
hdr
.
number
);
lprintf
(
"%04d !POP3 ERROR %d
(%s)
locking message header #%lu"
,
socket
,
i
,
smb
->
last_error
,
msg
.
hdr
.
number
);
if
((
i
=
smb_putmsg
(
&
smb
,
&
msg
))
!=
0
)
lprintf
(
"%04d !POP3 ERROR %d marking message #%lu as read"
,
socket
,
i
,
msg
.
hdr
.
number
);
lprintf
(
"%04d !POP3 ERROR %d
(%s)
marking message #%lu as read"
,
socket
,
i
,
smb
->
last_error
,
msg
.
hdr
.
number
);
smb_unlockmsghdr
(
&
smb
,
&
msg
);
smb_freemsgmem
(
&
msg
);
smb_freemsgtxt
(
msgtxt
);
...
...
@@ -1002,21 +1002,21 @@ static void pop3_thread(void* arg)
,
socket
,
user
.
alias
,
msg
.
hdr
.
number
);
if
((
i
=
smb_getmsgidx
(
&
smb
,
&
msg
))
!=
0
)
{
lprintf
(
"%04d !POP3 ERROR %d getting message index"
,
socket
,
i
);
lprintf
(
"%04d !POP3 ERROR %d
(%s)
getting message index"
,
socket
,
i
,
smb
->
last_error
);
sockprintf
(
socket
,
"-ERR %d getting message index"
,
i
);
continue
;
}
if
((
i
=
smb_lockmsghdr
(
&
smb
,
&
msg
))
!=
0
)
{
lprintf
(
"%04d !POP3 ERROR %d locking message header #%lu"
,
socket
,
i
,
msg
.
hdr
.
number
);
lprintf
(
"%04d !POP3 ERROR %d
(%s)
locking message header #%lu"
,
socket
,
i
,
smb
->
last_error
,
msg
.
hdr
.
number
);
sockprintf
(
socket
,
"-ERR %d locking message header"
,
i
);
continue
;
}
if
((
i
=
smb_getmsghdr
(
&
smb
,
&
msg
))
!=
0
)
{
smb_unlockmsghdr
(
&
smb
,
&
msg
);
lprintf
(
"%04d !POP3 ERROR %d getting message header #%lu"
,
socket
,
i
,
msg
.
hdr
.
number
);
lprintf
(
"%04d !POP3 ERROR %d
(%s)
getting message header #%lu"
,
socket
,
i
,
smb
->
last_error
,
msg
.
hdr
.
number
);
sockprintf
(
socket
,
"-ERR %d getting message header"
,
i
);
continue
;
}
...
...
@@ -1025,7 +1025,8 @@ static void pop3_thread(void* arg)
if
((
i
=
smb_putmsg
(
&
smb
,
&
msg
))
!=
0
)
{
smb_unlockmsghdr
(
&
smb
,
&
msg
);
smb_freemsgmem
(
&
msg
);
lprintf
(
"%04d !POP3 ERROR %d marking message as read"
,
socket
,
i
);
lprintf
(
"%04d !POP3 ERROR %d (%s) marking message as read"
,
socket
,
i
,
smb
->
last_error
);
sockprintf
(
socket
,
"-ERR %d marking message for deletion"
,
i
);
continue
;
}
...
...
@@ -1501,8 +1502,8 @@ static void smtp_thread(void* arg)
smb
.
status
.
attr
=
SMB_EMAIL
;
if
((
i
=
smb_create
(
&
smb
))
!=
0
)
{
smb_close
(
&
smb
);
lprintf
(
"%04d !SMTP ERROR %d creating %s"
,
socket
,
i
,
smb
.
file
);
lprintf
(
"%04d !SMTP ERROR %d
(%s)
creating %s"
,
socket
,
i
,
smb
->
last_error
,
smb
.
file
);
sockprintf
(
socket
,
"452 Insufficient system storage"
);
continue
;
}
...
...
@@ -1510,8 +1511,8 @@ static void smtp_thread(void* arg)
if
((
i
=
smb_locksmbhdr
(
&
smb
))
!=
0
)
{
smb_close
(
&
smb
);
lprintf
(
"%04d !SMTP ERROR %d locking %s"
,
socket
,
i
,
smb
.
file
);
lprintf
(
"%04d !SMTP ERROR %d
(%s)
locking %s"
,
socket
,
i
,
smb
->
last_error
,
smb
.
file
);
sockprintf
(
socket
,
"452 Insufficient system storage"
);
continue
;
}
...
...
@@ -1560,7 +1561,8 @@ static void smtp_thread(void* arg)
smb_unlocksmbhdr
(
&
smb
);
smb_close_da
(
&
smb
);
smb_close
(
&
smb
);
lprintf
(
"%04d !SMTP DUPLICATE MESSAGE"
,
socket
);
lprintf
(
"%04d !SMTP ERROR %d ADDING MESSAGE: %s"
,
socket
,
i
,
smb
->
last_error
);
sockprintf
(
socket
,
"554 Duplicate Message"
);
continue
;
}
...
...
@@ -1575,8 +1577,8 @@ static void smtp_thread(void* arg)
rcpt_count
=
0
;
while
(
!
feof
(
rcptlst
)
&&
rcpt_count
<
MAX_RECIPIENTS
)
{
if
((
i
=
smb_copymsgmem
(
&
newmsg
,
&
msg
))
!=
0
)
{
lprintf
(
"%04d !SMTP ERROR %d copying message"
,
socket
,
i
);
lprintf
(
"%04d !SMTP ERROR %d
(%s)
copying message"
,
socket
,
i
,
smb
->
last_error
);
break
;
}
if
(
fgets
(
str
,
sizeof
(
str
)
-
1
,
rcptlst
)
==
NULL
)
...
...
@@ -1616,8 +1618,8 @@ static void smtp_thread(void* arg)
i
=
smb_addmsghdr
(
&
smb
,
&
newmsg
,
SMB_SELFPACK
);
smb_freemsgmem
(
&
newmsg
);
if
(
i
!=
0
)
{
lprintf
(
"%04d !SMTP ERROR %d adding message header"
,
socket
,
i
);
lprintf
(
"%04d !SMTP ERROR %d
(%s)
adding message header"
,
socket
,
i
,
smb
->
last_error
);
break
;
}
lprintf
(
"%04d SMTP Created message #%ld from %s to %s <%s>"
...
...
@@ -2194,14 +2196,15 @@ BOOL bounce(smb_t* smb, smbmsg_t* msg, char* err, BOOL immediate)
smbmsg_t
newmsg
;
if
((
i
=
smb_lockmsghdr
(
smb
,
msg
))
!=
0
)
{
lprintf
(
"0000 !BOUNCE ERROR %d locking message header #%lu"
,
i
,
msg
->
hdr
.
number
);
lprintf
(
"0000 !BOUNCE ERROR %d
(%s)
locking message header #%lu"
,
i
,
smb
->
last_error
,
msg
->
hdr
.
number
);
return
(
FALSE
);
}
msg
->
hdr
.
delivery_attempts
++
;
if
((
i
=
smb_putmsg
(
smb
,
msg
))
!=
0
)
{
lprintf
(
"0000 !BOUNCE ERROR %d incrementing delivery attempt counter"
,
i
);
lprintf
(
"0000 !BOUNCE ERROR %d (%s) incrementing delivery attempt counter"
,
i
,
smb
->
last_error
);
smb_unlockmsghdr
(
smb
,
msg
);
return
(
FALSE
);
}
...
...
@@ -2222,7 +2225,8 @@ BOOL bounce(smb_t* smb, smbmsg_t* msg, char* err, BOOL immediate)
msg
->
hdr
.
attr
|=
MSG_DELETE
;
msg
->
idx
.
attr
=
msg
->
hdr
.
attr
;
if
((
i
=
smb_putmsg
(
smb
,
msg
))
!=
0
)
{
lprintf
(
"0000 !BOUNCE ERROR %d deleting message"
,
i
);
lprintf
(
"0000 !BOUNCE ERROR %d (%s) deleting message"
,
i
,
smb
->
last_error
);
smb_unlockmsghdr
(
smb
,
msg
);
return
(
FALSE
);
}
...
...
@@ -2257,7 +2261,8 @@ BOOL bounce(smb_t* smb, smbmsg_t* msg, char* err, BOOL immediate)
smb_hfield
(
&
newmsg
,
SUBJECT
,
(
ushort
)
strlen
(
full_err
),
full_err
);
if
((
i
=
smb_addmsghdr
(
smb
,
&
newmsg
,
SMB_SELFPACK
))
!=
0
)
lprintf
(
"0000 !BOUNCE ERROR %d adding message header"
,
i
);
lprintf
(
"0000 !BOUNCE ERROR %d (%s) adding message header"
,
i
,
smb
->
last_error
);
newmsg
.
dfield
=
NULL
;
/* Don't double-free the data fields */
newmsg
.
hdr
.
total_dfields
=
0
;
...
...
@@ -2382,15 +2387,15 @@ static void sendmail_thread(void* arg)
msg
.
offset
=
offset
;
if
((
i
=
smb_lockmsghdr
(
&
smb
,
&
msg
))
!=
0
)
{
lprintf
(
"0000 !SEND ERROR %d locking message header #%lu"
,
i
,
msg
.
idx
.
number
);
lprintf
(
"0000 !SEND ERROR %d
(%s)
locking message header #%lu"
,
i
,
smb
->
last_error
,
msg
.
idx
.
number
);
continue
;
}
i
=
smb_getmsghdr
(
&
smb
,
&
msg
);
smb_unlockmsghdr
(
&
smb
,
&
msg
);
if
(
i
!=
0
)
{
lprintf
(
"0000 !SEND ERROR %d reading message header #%lu"
,
i
,
msg
.
idx
.
number
);
lprintf
(
"0000 !SEND ERROR %d
(%s)
reading message header #%lu"
,
i
,
smb
->
last_error
,
msg
.
idx
.
number
);
continue
;
}
...
...
@@ -2574,13 +2579,13 @@ static void sendmail_thread(void* arg)
msg
.
hdr
.
attr
|=
MSG_DELETE
;
msg
.
idx
.
attr
=
msg
.
hdr
.
attr
;
if
((
i
=
smb_lockmsghdr
(
&
smb
,
&
msg
))
!=
0
)
lprintf
(
"%04d !SEND ERROR %d locking message header #%lu"
lprintf
(
"%04d !SEND ERROR %d
(%s)
locking message header #%lu"
,
sock
,
i
,
msg
.
hdr
.
number
);
,
i
,
smb
->
last_error
,
msg
.
hdr
.
number
);
if
((
i
=
smb_putmsg
(
&
smb
,
&
msg
))
!=
0
)
lprintf
(
"%04d !SEND ERROR %d deleting message #%lu"
lprintf
(
"%04d !SEND ERROR %d
(%s)
deleting message #%lu"
,
sock
,
i
,
msg
.
hdr
.
number
);
,
i
,
smb
->
last_error
,
msg
.
hdr
.
number
);
if
(
msg
.
hdr
.
auxattr
&
MSG_FILEATTACH
)
delfattach
(
&
scfg
,
&
msg
);
smb_unlockmsghdr
(
&
smb
,
&
msg
);
...
...
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