chiark / gitweb /
fixes and improvements
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Thu, 29 Apr 2010 00:45:09 +0000 (01:45 +0100)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Thu, 29 Apr 2010 00:45:09 +0000 (01:45 +0100)
backends/innduct.c
doc/man/innduct.8

index 288c9dc654c06fa4b60d0b67295e038137731a5d..46d88bc65baf2a72eab1f9911f0ea5acc44708b3 100644 (file)
@@ -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");
 }
index 72ee35ff2c37cc7fbb746d9a3005e98de68bd3d8..fb6e038f5a6976c1dcd6c439475438397c3b0a83 100644 (file)
@@ -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 <ijackson@chiark.greenend.org.uk>
 .SH "SEE ALSO"