~andreserl/ubuntu/lucid/keepalived/merge-from-squeeze-lp519940

« back to all changes in this revision

Viewing changes to keepalived/check/check_smtp.c

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2009-05-12 20:26:15 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20090512202615-k850bw35qpuvpq4p
Tags: 1.1.17-1ubuntu1
* Merge from debian unstable, remaining changes:
  - debian/rules: DEB_UPDATE_RCD_PARAMS := expicit init start/stop
    parameters (don't stop at 0 and 6)
  - debian/init.d: init script header adapted to stop rule
  - debian/keepalived.postinst: Remove shutdown and reboot links

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
 *
6
6
 * Part:        SMTP CHECK. Check an SMTP-server.
7
7
 *
8
 
 * Version:     $Id: check_smtp.c,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
 
8
 * Version:     $Id: check_smtp.c,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
9
9
 *
10
10
 * Authors:     Jeremy Rumpf, <jrumpf@heavyload.net>
11
11
 *              Alexandre Cassen, <acassen@linux-vs.org>
20
20
 *              as published by the Free Software Foundation; either version
21
21
 *              2 of the License, or (at your option) any later version.
22
22
 *
23
 
 * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
 
23
 * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
24
24
 */
25
25
 
26
26
#include <ctype.h>
27
27
 
28
28
#include "check_smtp.h"
29
29
#include "check_api.h"
 
30
#include "logger.h"
30
31
#include "memory.h"
31
32
#include "ipwrapper.h"
32
33
#include "utils.h"
70
71
smtp_dump_host(void *data)
71
72
{
72
73
        smtp_host *smtp_hst = data;
73
 
        syslog(LOG_INFO, "   Checked ip = %s", inet_ntop2(smtp_hst->ip));
74
 
        syslog(LOG_INFO, "           port = %d", ntohs(smtp_hst->port));
 
74
        log_message(LOG_INFO, "   Checked ip = %s", inet_ntop2(smtp_hst->ip));
 
75
        log_message(LOG_INFO, "           port = %d", ntohs(smtp_hst->port));
75
76
        if (smtp_hst->bindto)
76
 
                syslog(LOG_INFO, "           bindto = %s", inet_ntop2(smtp_hst->bindto));
 
77
                log_message(LOG_INFO, "           bindto = %s", inet_ntop2(smtp_hst->bindto));
77
78
}
78
79
 
79
80
/* 
84
85
dump_smtp_check(void *data)
85
86
{
86
87
        smtp_checker *smtp_chk = CHECKER_DATA(data);
87
 
        syslog(LOG_INFO, "   Keepalive method = SMTP_CHECK");
88
 
        syslog(LOG_INFO, "           helo = %s", smtp_chk->helo_name);
89
 
        syslog(LOG_INFO, "           timeout = %ld", smtp_chk->timeout/TIMER_HZ);
90
 
        syslog(LOG_INFO, "           retry = %d", smtp_chk->retry);
91
 
        syslog(LOG_INFO, "           delay before retry = %ld", smtp_chk->db_retry/TIMER_HZ);
 
88
        log_message(LOG_INFO, "   Keepalive method = SMTP_CHECK");
 
89
        log_message(LOG_INFO, "           helo = %s", smtp_chk->helo_name);
 
90
        log_message(LOG_INFO, "           timeout = %ld", smtp_chk->timeout/TIMER_HZ);
 
91
        log_message(LOG_INFO, "           retry = %d", smtp_chk->retry);
 
92
        log_message(LOG_INFO, "           delay before retry = %ld", smtp_chk->db_retry/TIMER_HZ);
92
93
        dump_list(smtp_chk->host);
93
94
}
94
95
 
297
298
                                va_end(varg_list);
298
299
                                error_buff[512 - 1] = '\0';
299
300
 
300
 
                                syslog(LOG_INFO, error_buff);
 
301
                                log_message(LOG_INFO, error_buff);
301
302
                        } else {
302
 
                                syslog(LOG_INFO, "SMTP_CHECK Unknown error");
 
303
                                log_message(LOG_INFO, "SMTP_CHECK Unknown error");
303
304
                        }
304
305
                }
305
306
 
392
393
 
393
394
        /* wrap the buffer, if full, by clearing it */
394
395
        if (SMTP_BUFF_MAX - smtp_chk->buff_ctr <= 0) {
395
 
                syslog(LOG_INFO, "SMTP_CHECK Buffer overflow reading from server [%s:%d]. "
 
396
                log_message(LOG_INFO, "SMTP_CHECK Buffer overflow reading from server [%s:%d]. "
396
397
                       "Increase SMTP_BUFF_MAX in smtp_check.h",
397
398
                       inet_ntop2(smtp_hst->ip), ntohs(smtp_hst->port));
398
399
                smtp_clear_buff(thread_obj);
779
780
         */
780
781
        if ((smtp_chk->host_ptr = list_element(smtp_chk->host, smtp_chk->host_ctr)) == NULL) {
781
782
                if (!svr_checker_up(chk->id, chk->rs)) {
782
 
                        syslog(LOG_INFO, "Remote SMTP server [%s:%d] succeed on service.",
 
783
                        log_message(LOG_INFO, "Remote SMTP server [%s:%d] succeed on service.",
783
784
                               inet_ntop2(CHECKER_RIP(chk)), ntohs(CHECKER_RPORT(chk)));
784
785
 
785
786
                        smtp_alert(chk->rs, NULL, NULL, "UP",