From aeb62f189a5d76b8ca0d23a46f7917679e081ea0 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Thu, 29 Apr 2010 01:45:09 +0100 Subject: [PATCH] fixes and improvements --- backends/innduct.c | 27 +++++++++++++++++++++------ doc/man/innduct.8 | 12 +++++------- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/backends/innduct.c b/backends/innduct.c index 288c9dc..46d88bc 100644 --- a/backends/innduct.c +++ b/backends/innduct.c @@ -1268,8 +1268,21 @@ static void connect_start(void) { alarm(connection_setup_timeout); if (NNTPconnect((char*)remote_host, port, &cn_from, &cn_to, buf) < 0) { - if (buf[0]) fatal("connect: failed: %s", sanitise(buf)); - else sysfatal("connect: connection attempt failed"); + int l= strlen(buf); + int stripped=0; + while (l>0) { + unsigned char c= buf[l-1]; + if (!isspace(c)) break; + if (c=='\n' || c=='\r') stripped=1; + --l; + } + if (!buf[0]) { + sysfatal("connect: connection attempt failed"); + } else { + buf[l]= 0; + fatal("connect: %s: %s", stripped ? "rejected" : "failed", + sanitise(buf)); + } } if (NNTPsendpassword((char*)remote_host, cn_from, cn_to) < 0) sysfatal("connect: authentication failed"); @@ -3059,7 +3072,7 @@ static const Option innduct_options[]= { {'q',"quiet-multiple", 0, &quiet_multiple, op_setint, 1 }, {0,"no-daemon", 0, &become_daemon, op_setint, 0 }, {0,"no-streaming", 0, &try_stream, op_setint, 0 }, -{0,"inndconf", "F", &inndconffile, op_string }, +{'C',"inndconf", "F", &inndconffile, op_string }, {'P',"port", "PORT", &port, op_integer }, {0,"help", 0, 0, help }, @@ -3124,6 +3137,9 @@ int main(int argc, char **argv) { /* defaults */ + int r= innconf_read(inndconffile); + if (!r) badusage("could not read inn.conf (more info on stderr)"); + if (!remote_host) remote_host= sitename; if (nocheck_thresh < 0 || nocheck_thresh > 100) @@ -3146,7 +3162,6 @@ int main(int argc, char **argv) { max_bad_data_ratio *= 0.01; if (!feedfile) { - innconf_read(inndconffile); feedfile= xasprintf("%s/%s",innconf->pathoutgoing,sitename); } else if (!feedfile[0]) { badusage("feed filename must be nonempty"); @@ -3225,7 +3240,7 @@ int main(int argc, char **argv) { /* let's go */ - void *r= oop_sys_run(sysloop); - assert(r == OOP_ERROR); + void *run= oop_sys_run(sysloop); + assert(run == OOP_ERROR); sysdie("event loop failed"); } diff --git a/doc/man/innduct.8 b/doc/man/innduct.8 index 72ee35f..fb6e038 100644 --- a/doc/man/innduct.8 +++ b/doc/man/innduct.8 @@ -94,16 +94,11 @@ Do not daemonise. innduct runs in the foreground and all messages Do not try to use the streaming extensions to NNTP (for use eg if the peer can't cope when we send MODE STREAM). .TP -.BI \-\-inndconf= FILE +.BR \-C | \-\-inndconf= \fIFILE\fR Read .I FILE instead of the default .BR inn.conf . -This is currently only used if -.I feedfile -is not specified, to find the value -.I pathoutgoing -for constructing the feedfile name from the site name. .TP .BI \-\-port= PORT Connect to port @@ -385,7 +380,10 @@ before you have finished creating it. .IX Item inn.conf Used to find .IR pathoutgoing -if none is specified. +if none is specified, and also for +.IR sourceaddress +and/or +.IR sourceaddress6 . .SH HISTORY Written by Ian Jackson .SH "SEE ALSO" -- 2.30.2