X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?p=ossec-hids.git;a=blobdiff_plain;f=src%2Fos_maild%2Fsendmail.c;h=5b0fd6f8868e9ca25c13819daa1686fd741f91d8;hp=92157a7cf34e9abd9dcf0a515058f7d3b234d4c5;hb=6ef2f786c6c8ead94841b5f93baf9f43421f08c8;hpb=301048b51990573e58a30dc4a5bb4ec285cad554 diff --git a/src/os_maild/sendmail.c b/src/os_maild/sendmail.c index 92157a7..5b0fd6f 100755 --- a/src/os_maild/sendmail.c +++ b/src/os_maild/sendmail.c @@ -1,11 +1,12 @@ -/* @(#) $Id$ */ +/* @(#) $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 - * License (version 2) as published by the FSF - Free Software + * License (version 2) as published by the FSF - Free Software * Foundation */ @@ -64,7 +65,7 @@ int OS_Sendsms(MailConfig *mail, struct tm *p, MailMsg *sms_msg) /* 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); @@ -109,7 +110,7 @@ int OS_Sendsms(MailConfig *mail, struct tm *p, MailMsg *sms_msg) if(msg) free(msg); close(socket); - return(OS_INVALID); + return(OS_INVALID); } } 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; - + 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; - + i++; continue; } @@ -218,7 +219,7 @@ int OS_Sendsms(MailConfig *mail, struct tm *p, MailMsg *sms_msg) /* Sending date */ memset(snd_msg,'\0',128); - + /* 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 - + OS_SendTCP(socket,snd_msg); @@ -287,7 +288,7 @@ int OS_Sendmail(MailConfig *mail, struct tm *p) MailNode *mailmsg; additional_to[0] = '\0'; - + /* 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); } - + /* 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); @@ -345,7 +346,7 @@ int OS_Sendmail(MailConfig *mail, struct tm *p) if(msg) free(msg); close(socket); - return(OS_INVALID); + return(OS_INVALID); } } else @@ -438,9 +439,9 @@ int OS_Sendmail(MailConfig *mail, struct tm *p) free(msg); i++; - continue; + continue; } - + 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; } - + 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 - + OS_SendTCP(socket,snd_msg);