From: Mads Martin Joergensen <mmj@mmj.dk>
To: mlmmj@mlmmj.org
Subject: Re: mlmmj-1.2.3 released. Features added and bugs squashed.
Date: Tue, 08 Feb 2005 16:19:34 +0000 [thread overview]
Message-ID: <20050208161934.GE67839@mmj.dk> (raw)
In-Reply-To: <20050208095412.GE56543@mmj.dk>
* Allan Joergensen <allan@nowhere.dk> [Feb 08. 2005 17:02]:
> > The ChangeLog has the glory details, I can recommend an upgrade:
> > 1.2.3
>
> I would like to request a feature. It's been on my wishlist for quite
> some time; I would like the port of the outgoing relay server to be
> configurable (just changing init_socket.c works i know).
Allan, could you try this patch. It'll make the port configurable with
LISTDIR/control/smtpport.
--- include/init_sockfd.h
+++ include/init_sockfd.h
@@ -24,6 +24,6 @@
#ifndef INIT_SOCKFD_H
#define INIT_SOCKFD_H
-void init_sockfd(int *sockfd, const char *relayhost);
+void init_sockfd(int *sockfd, const char *relayhost, unsigned short port);
#endif /* INIT_SOCKFD_H */
--- include/mlmmj-send.h
+++ include/mlmmj-send.h
@@ -45,7 +45,7 @@
size_t mailsize, const char *from, const char *listdir,
const char *hdrs, size_t hdrslen, const char *body,
size_t bodylen, const char *extra);
-int initsmtp(int *sockfd, const char *relayhost);
+int initsmtp(int *sockfd, const char *relayhost, unsigned short port);
int endsmtp(int *sockfd);
#endif /* MMJML_SEND_H */
--- src/init_sockfd.c
+++ src/init_sockfd.c
@@ -32,11 +32,10 @@
#include "init_sockfd.h"
#include "log_error.h"
-void init_sockfd(int *sockfd, const char *relayhost)
+void init_sockfd(int *sockfd, const char *relayhost, unsigned short port)
{
int len;
struct sockaddr_in addr;
- u_short port = 25;
if (getenv("MLMMJ_TESTING")) {
relayhost = "127.0.0.1";
--- src/mlmmj-send.c
+++ src/mlmmj-send.c
@@ -290,13 +290,13 @@
return 0;
}
-int initsmtp(int *sockfd, const char *relayhost)
+int initsmtp(int *sockfd, const char *relayhost, unsigned short port)
{
int retval = 0;
char *reply = NULL;
char *myhostname = hostnamestr();
- init_sockfd(sockfd, relayhost);
+ init_sockfd(sockfd, relayhost, port);
if((reply = checkwait_smtpreply(*sockfd, MLMMJ_CONNECT)) != NULL) {
log_error(LOG_ARGS, "No proper greeting to our connect"
@@ -600,7 +600,7 @@
char *mlmmjbounce = NULL, *bindir, *mailmap, *probefile, *a;
char *body = NULL, *hdrs = NULL, *memmailsizestr = NULL, *verp = NULL;
char relay[16], *listname, *listfqdn, *verpfrom, *maxverprecipsstr;
- char strindex[32], *reply;
+ char strindex[32], *reply, *strport;
ssize_t memmailsize = 0;
DIR *subddir;
struct dirent *dp;
@@ -608,6 +608,7 @@
struct hostent *relayent;
uid_t uid;
struct strlist stl;
+ unsigned short smtpport;
CHECKFULLPATH(argv[0]);
@@ -863,11 +864,13 @@
strncpy(relay, RELAYHOST, sizeof(relay));
}
}
+ strport = ctrlvalue(listdir, "smtpport");
+ smtpport = (unsigned short)atol(strport);
switch(listctrl[0]) {
case '1': /* A single mail is to be sent */
case '6':
- initsmtp(&sockfd, relay);
+ initsmtp(&sockfd, relay, smtpport);
sendres = send_mail(sockfd, bounceaddr, to_addr, replyto,
mailmap, st.st_size, listdir, NULL,
hdrs, hdrslen, body, bodylen);
@@ -910,7 +913,7 @@
}
break;
case '2': /* Moderators */
- initsmtp(&sockfd, relay);
+ initsmtp(&sockfd, relay, smtpport);
if(send_mail_many_fd(sockfd, bounceaddr, NULL, mailmap,
st.st_size, subfd, NULL, NULL, listdir,
NULL, hdrs, hdrslen, body, bodylen))
@@ -919,7 +922,7 @@
endsmtp(&sockfd);
break;
case '3': /* resending earlier failed mails */
- initsmtp(&sockfd, relay);
+ initsmtp(&sockfd, relay, smtpport);
if(send_mail_many_fd(sockfd, NULL, NULL, mailmap, st.st_size,
subfd, listaddr, mailfilename, listdir,
mlmmjbounce, hdrs, hdrslen, body, bodylen))
@@ -929,7 +932,7 @@
unlink(subfilename);
break;
case '4': /* send mails to owner */
- initsmtp(&sockfd, relay);
+ initsmtp(&sockfd, relay, smtpport);
if(send_mail_many_fd(sockfd, bounceaddr, NULL, mailmap,
st.st_size, subfd, listaddr, mailfilename,
listdir, mlmmjbounce, hdrs, hdrslen, body,
@@ -939,7 +942,7 @@
endsmtp(&sockfd);
break;
case '5': /* bounceprobe - handle relayhost local users bouncing*/
- initsmtp(&sockfd, relay);
+ initsmtp(&sockfd, relay, smtpport);
sendres = send_mail(sockfd, bounceaddr, to_addr, replyto,
mailmap, st.st_size, listdir, NULL,
hdrs, hdrslen, body, bodylen);
@@ -999,7 +1002,7 @@
}
if(verp) {
- initsmtp(&sockfd, relay);
+ initsmtp(&sockfd, relay, smtpport);
if(write_mail_from(sockfd, verpfrom, verp)) {
log_error(LOG_ARGS,
"Could not write MAIL FROM\n");
@@ -1034,7 +1037,7 @@
res = getaddrsfromfd(&stl, subfd,
maxverprecips);
if(stl.count = maxverprecips) {
- initsmtp(&sockfd, relay);
+ initsmtp(&sockfd, relay, smtpport);
if(verp) {
sendres = send_mail_verp(
sockfd, &stl,
@@ -1072,7 +1075,7 @@
}
if(stl.count) {
- initsmtp(&sockfd, relay);
+ initsmtp(&sockfd, relay, smtpport);
if(verp) {
sendres = send_mail_verp(sockfd, &stl, mailmap,
st.st_size, verpfrom, listdir,
--
Mads Martin Joergensen, http://mmj.dk
"Why make things difficult, when it is possible to make them cryptic
and totally illogical, with just a little bit more effort?"
-- A. P. J.
next prev parent reply other threads:[~2005-02-08 16:19 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-02-08 9:54 mlmmj-1.2.3 released. Features added and bugs squashed Mads Martin Joergensen
2005-02-08 11:37 ` Wolf Bergenheim
2005-02-08 11:40 ` Mads Martin Joergensen
2005-02-08 11:44 ` Allan Joergensen
2005-02-08 11:45 ` Wolf Bergenheim
2005-02-08 12:17 ` Mads Martin Joergensen
2005-02-08 12:56 ` Wolf Bergenheim
2005-02-08 14:07 ` Mads Martin Joergensen
2005-02-08 16:19 ` Mads Martin Joergensen [this message]
2005-02-08 16:20 ` Mads Martin Joergensen
2005-02-08 16:22 ` Mads Martin Joergensen
2005-02-08 17:57 ` Morten K. Poulsen
2005-02-08 18:08 ` Allan Joergensen
2005-02-08 18:33 ` Mads Martin Joergensen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050208161934.GE67839@mmj.dk \
--to=mmj@mmj.dk \
--cc=mlmmj@mlmmj.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.