projects
/
ossec-hids.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Imported Upstream version 2.7
[ossec-hids.git]
/
src
/
os_maild
/
sendmail.c
diff --git
a/src/os_maild/sendmail.c
b/src/os_maild/sendmail.c
index
39c5d8b
..
5b0fd6f
100755
(executable)
--- a/
src/os_maild/sendmail.c
+++ b/
src/os_maild/sendmail.c
@@
-1,11
+1,12
@@
-/* @(#) $Id: sendmail.c,v 1.30 2009/06/24 17:06:31 dcid Exp $ */
+/* @(#) $Id: ./src/os_maild/sendmail.c, 2011/09/08 dcid Exp $
+ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
* Foundation
*/
@@
-64,7
+65,7
@@
int OS_Sendsms(MailConfig *mail, struct tm *p, MailMsg *sms_msg)
/* Connecting to the smtp server */
/* Connecting to the smtp server */
- socket = OS_ConnectTCP(SMTP_DEFAULT_PORT, mail->smtpserver);
+ socket = OS_ConnectTCP(SMTP_DEFAULT_PORT, mail->smtpserver, 0);
if(socket < 0)
{
return(socket);
if(socket < 0)
{
return(socket);
@@
-109,7
+110,7
@@
int OS_Sendsms(MailConfig *mail, struct tm *p, MailMsg *sms_msg)
if(msg)
free(msg);
close(socket);
if(msg)
free(msg);
close(socket);
- return(OS_INVALID);
+ return(OS_INVALID);
}
}
else
}
}
else
@@
-152,7
+153,7
@@
int OS_Sendsms(MailConfig *mail, struct tm *p, MailMsg *sms_msg)
/* Additional RCPT to */
final_to[0] = '\0';
final_to_sz = sizeof(final_to) -2;
/* Additional RCPT to */
final_to[0] = '\0';
final_to_sz = sizeof(final_to) -2;
-
+
if(mail->gran_to)
{
i = 0;
if(mail->gran_to)
{
i = 0;
@@
-185,7
+186,7
@@
int OS_Sendsms(MailConfig *mail, struct tm *p, MailMsg *sms_msg)
snprintf(snd_msg,127, TO, mail->gran_to[i]);
strncat(final_to, snd_msg, final_to_sz);
final_to_sz -= strlen(snd_msg) +2;
snprintf(snd_msg,127, TO, mail->gran_to[i]);
strncat(final_to, snd_msg, final_to_sz);
final_to_sz -= strlen(snd_msg) +2;
-
+
i++;
continue;
}
i++;
continue;
}
@@
-218,7
+219,7
@@
int OS_Sendsms(MailConfig *mail, struct tm *p, MailMsg *sms_msg)
/* Sending date */
memset(snd_msg,'\0',128);
/* Sending date */
memset(snd_msg,'\0',128);
-
+
/* Solaris doesn't have the "%z", so we set the timezone to 0. */
#ifdef SOLARIS
/* Solaris doesn't have the "%z", so we set the timezone to 0. */
#ifdef SOLARIS
@@
-226,7
+227,7
@@
int OS_Sendsms(MailConfig *mail, struct tm *p, MailMsg *sms_msg)
#else
strftime(snd_msg, 127, "Date: %a, %d %b %Y %T %z\r\n",p);
#endif
#else
strftime(snd_msg, 127, "Date: %a, %d %b %Y %T %z\r\n",p);
#endif
-
+
OS_SendTCP(socket,snd_msg);
OS_SendTCP(socket,snd_msg);
@@
-287,7
+288,7
@@
int OS_Sendmail(MailConfig *mail, struct tm *p)
MailNode *mailmsg;
additional_to[0] = '\0';
MailNode *mailmsg;
additional_to[0] = '\0';
-
+
/* If there is no sms message, we attempt to get from the
* email list.
*/
/* If there is no sms message, we attempt to get from the
* email list.
*/
@@
-297,10
+298,10
@@
int OS_Sendmail(MailConfig *mail, struct tm *p)
{
merror("%s: No email to be sent. Inconsistent state.",ARGV0);
}
{
merror("%s: No email to be sent. Inconsistent state.",ARGV0);
}
-
+
/* Connecting to the smtp server */
/* Connecting to the smtp server */
- socket = OS_ConnectTCP(SMTP_DEFAULT_PORT, mail->smtpserver);
+ socket = OS_ConnectTCP(SMTP_DEFAULT_PORT, mail->smtpserver, 0);
if(socket < 0)
{
return(socket);
if(socket < 0)
{
return(socket);
@@
-345,7
+346,7
@@
int OS_Sendmail(MailConfig *mail, struct tm *p)
if(msg)
free(msg);
close(socket);
if(msg)
free(msg);
close(socket);
- return(OS_INVALID);
+ return(OS_INVALID);
}
}
else
}
}
else
@@
-438,9
+439,9
@@
int OS_Sendmail(MailConfig *mail, struct tm *p)
free(msg);
i++;
free(msg);
i++;
- continue;
+ continue;
}
}
-
+
MAIL_DEBUG("DEBUG: Sent '%s', received: '%s'", snd_msg, msg);
free(msg);
i++;
MAIL_DEBUG("DEBUG: Sent '%s', received: '%s'", snd_msg, msg);
free(msg);
i++;
@@
-484,7
+485,7
@@
int OS_Sendmail(MailConfig *mail, struct tm *p)
{
break;
}
{
break;
}
-
+
memset(snd_msg,'\0',128);
snprintf(snd_msg,127, TO, mail->to[i]);
OS_SendTCP(socket,snd_msg);
memset(snd_msg,'\0',128);
snprintf(snd_msg,127, TO, mail->to[i]);
OS_SendTCP(socket,snd_msg);
@@
-525,7
+526,7
@@
int OS_Sendmail(MailConfig *mail, struct tm *p)
#else
strftime(snd_msg, 127, "Date: %a, %d %b %Y %T %z\r\n",p);
#endif
#else
strftime(snd_msg, 127, "Date: %a, %d %b %Y %T %z\r\n",p);
#endif
-
+
OS_SendTCP(socket,snd_msg);
OS_SendTCP(socket,snd_msg);