~ubuntu-branches/ubuntu/hardy/postfix/hardy-security

« back to all changes in this revision

Viewing changes to src/smtpstone/smtp-source.c

  • Committer: Bazaar Package Importer
  • Author(s): LaMont Jones
  • Date: 2007-04-15 16:00:44 UTC
  • mfrom: (1.1.13 upstream)
  • Revision ID: james.westby@ubuntu.com-20070415160044-xl1vjlhf9mdmf43a
Tags: 2.4.0-3
Have preinst get user approval before installing (and being broken) on a
pre-2.6 kernel.  Closes: #417530

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
/*      Connections can be made to UNIX-domain and IPv4 or IPv6 servers.
18
18
/*      IPv4 and IPv6 are the default.
19
19
/*
 
20
/*      Note: this is an unsupported test program. No attempt is made
 
21
/*      to maintain compatibility between successive versions.
 
22
/*
20
23
/*      Arguments:
21
24
/* .IP \fB-4\fR
22
25
/*      Connect to the server with IPv4. This option has no effect when
134
137
 
135
138
#include <smtp_stream.h>
136
139
#include <mail_date.h>
 
140
#include <mail_version.h>
137
141
 
138
142
/* Application-specific. */
139
143
 
464
468
        fail_connect(session);
465
469
    } else {
466
470
        non_blocking(fd, BLOCKING);
 
471
        /* Disable write events. */
467
472
        event_disable_readwrite(fd);
468
473
        event_enable_read(fd, read_banner, (char *) session);
469
474
        dequeue_connect(session);
510
515
     * Send the standard greeting with our hostname
511
516
     */
512
517
    if ((except = vstream_setjmp(session->stream)) != 0)
513
 
        msg_fatal("%s while sending HELO", exception_text(except));
 
518
        msg_fatal("%s while sending %s", exception_text(except), protocol);
514
519
 
515
520
    command(session->stream, "%s %s", protocol, var_myhostname);
516
521
 
517
522
    /*
518
523
     * Prepare for the next event.
519
524
     */
520
 
    event_disable_readwrite(vstream_fileno(session->stream));
521
525
    event_enable_read(vstream_fileno(session->stream), helo_done, (char *) session);
522
526
}
523
527
 
528
532
    SESSION *session = (SESSION *) context;
529
533
    RESPONSE *resp;
530
534
    int     except;
 
535
    const char *protocol = (talk_lmtp ? "LHLO" : "HELO");
531
536
 
532
537
    /*
533
538
     * Get response to HELO command.
534
539
     */
535
540
    if ((except = vstream_setjmp(session->stream)) != 0)
536
 
        msg_fatal("%s while sending HELO", exception_text(except));
 
541
        msg_fatal("%s while sending %s", exception_text(except), protocol);
537
542
 
538
543
    if ((resp = response(session->stream, buffer))->code / 100 != 2)
539
 
        msg_fatal("HELO rejected: %d %s", resp->code, resp->str);
 
544
        msg_fatal("%s rejected: %d %s", protocol, resp->code, resp->str);
540
545
 
541
546
    send_mail(session);
542
547
}
558
563
    /*
559
564
     * Prepare for the next event.
560
565
     */
561
 
    event_disable_readwrite(vstream_fileno(session->stream));
562
566
    event_enable_read(vstream_fileno(session->stream), mail_done, (char *) session);
563
567
}
564
568
 
609
613
    /*
610
614
     * Prepare for the next event.
611
615
     */
612
 
    event_disable_readwrite(vstream_fileno(session->stream));
613
616
    event_enable_read(vstream_fileno(session->stream), rcpt_done, (char *) session);
614
617
}
615
618
 
656
659
    /*
657
660
     * Prepare for the next event.
658
661
     */
659
 
    event_disable_readwrite(vstream_fileno(session->stream));
660
662
    event_enable_read(vstream_fileno(session->stream), data_done, (char *) session);
661
663
}
662
664
 
732
734
    /*
733
735
     * Prepare for the next event.
734
736
     */
735
 
    event_disable_readwrite(vstream_fileno(session->stream));
736
737
    event_enable_read(vstream_fileno(session->stream), dot_done, (char *) session);
737
738
}
738
739
 
771
772
static void send_quit(SESSION *session)
772
773
{
773
774
    command(session->stream, "QUIT");
774
 
    event_disable_readwrite(vstream_fileno(session->stream));
775
775
    event_enable_read(vstream_fileno(session->stream), quit_done, (char *) session);
776
776
}
777
777
 
795
795
    msg_fatal("usage: %s -cdLNov -s sess -l msglen -m msgs -C count -M myhostname -f from -t to -r rcptcount -R delay -w delay host[:port]", myname);
796
796
}
797
797
 
 
798
MAIL_VERSION_STAMP_DECLARE;
 
799
 
798
800
/* main - parse JCL and start the machine */
799
801
 
800
802
int     main(int argc, char **argv)
814
816
    const char *protocols = INET_PROTO_NAME_ALL;
815
817
    INET_PROTO_INFO *proto_info;
816
818
 
 
819
    /*
 
820
     * Fingerprint executables and core dumps.
 
821
     */
 
822
    MAIL_VERSION_STAMP_ALLOCATE;
 
823
 
817
824
    signal(SIGPIPE, SIG_IGN);
818
825
    msg_vstream_init(argv[0], VSTREAM_ERR);
819
826