Source: nn
Version: 6.7.3-14
Severity: normal
Tags: patch

Dear Maintainer,

  I forgot to send this patch, it comes after "nntp.c: fix use of mkstemp()"

Author: Bjarni Ingi Gislason <bjarn...@rhi.hi.is>
>Date:   Tue Feb 23 22:37:47 2021 +0000

    nntp.c: fix use of ipport_nntp
    
      nntp.c: add use of ipport_nntp.
    
    Signed-off-by: Bjarni Ingi Gislason <bjarn...@rhi.hi.is>

diff --git a/nntp.c b/nntp.c
index ccd02da..29a3ffa 100644
--- a/nntp.c
+++ b/nntp.c
@@ -91,6 +91,12 @@ static void     clean_cache(void);
 static void     set_domain(void);
 static void     nntp_doauth(void);
 
+#ifdef EXCELAN
+int      ipport_nntp = IPPORT_NNTP;
+#else
+int      ipport_nntp = 0;
+#endif
+
 #ifndef NOV
 static int      sort_art_list(register article_number * f1, register 
article_number * f2);
 #endif                         /* !NOV */
@@ -296,6 +302,7 @@ get_socket(void)
 {
     int             s;
     struct sockaddr_in sin;
+    char   string[64];
 
 #ifndef EXCELAN
     struct servent *sp;
@@ -318,7 +325,11 @@ get_socket(void)
 
     clearobj(&sin, sizeof(sin), 1);
     sin.sin_family = hp->h_addrtype;
-    sin.sin_port = sp->s_port;
+
+    if (ipport_nntp == 0 || htons(ipport_nntp) == sp->s_port)
+       sin.sin_port = sp->s_port;
+    else
+       sin.sin_port = htons(ipport_nntp);
 
 #else                          /* EXCELAN */
     char           *machine;
@@ -362,7 +373,7 @@ get_socket(void)
     if ((s = socket(SOCK_STREAM, NULL, &sin, SO_KEEPALIVE)) < 0)
        goto sock_err;
 
-    sin.sin_port = htons(IPPORT_NNTP);
+    sin.sin_port = htons(ipport_nntp);
     machine = nntp_server;
     if ((sin.sin_addr.s_addr = rhost(&machine)) == -1) {
        (void) close(s);
@@ -546,9 +557,10 @@ static int
 reconnect_server(int retry)
 {
     char            buf[NNTP_STRLEN];
+    int             connect_server_return;
 
     retry--;
-    msg("Reconnecting");
+    msg("Reconnecting, retry = %d", retry);
     if (nntp_debug) {
        msg("retry = %d", retry);
        user_delay(2);


-- System Information:
Debian Release: bullseye/sid
  APT prefers testing
  APT policy: (500, 'testing'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 5.10.9-1 (SMP w/2 CPU threads)
Locale: LANG=is_IS.iso88591, LC_CTYPE=is_IS.iso88591 (charmap=ISO-8859-1), 
LANGUAGE not set
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)

-- debconf information excluded

-- 
Bjarni I. Gislason

Reply via email to