Skip to content

Commit 3306036

Browse files
committed
From issue ossec#1781
Extend the check for cases where mail->smtpserver[0] != '/'. If forking a program to send email instead of sending it directly, don't expect there to be a network socket. Don't try to use that socket. Just use the program.
1 parent a789a7b commit 3306036

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/os_maild/sendmail.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,10 @@ int OS_Sendmail(MailConfig *mail, struct tm *p)
158158
}
159159

160160
event_dispatch();
161-
}
162161

163-
if (os_sock <= 0) {
164-
ErrorExit("ossec-maild: ERROR: No socket.");
165-
}
162+
if (os_sock <= 0) {
163+
ErrorExit("ossec-maild: ERROR: No socket.");
164+
}
166165

167166
/* Receive the banner */
168167
msg = OS_RecvTCP(os_sock, OS_SIZE_1024);
@@ -305,6 +304,7 @@ int OS_Sendmail(MailConfig *mail, struct tm *p)
305304
}
306305
MAIL_DEBUG("DEBUG: Sent '%s', received: '%s'", DATAMSG, msg);
307306
free(msg);
307+
}
308308

309309
/* Building "From" and "To" in the e-mail header */
310310
memset(snd_msg, '\0', 128);

0 commit comments

Comments
 (0)