Blame SOURCES/Make-krb5kdc-p-affect-TCP-ports.patch

c41359
From 5587c1de938324faa1871e08ccfc835415acb443 Mon Sep 17 00:00:00 2001
c41359
From: Greg Hudson <ghudson@mit.edu>
c41359
Date: Tue, 17 Jul 2018 11:29:19 -0400
c41359
Subject: [PATCH] Make krb5kdc -p affect TCP ports
c41359
c41359
Now that the KDC listens for TCP connections by default (ticket 6731),
c41359
the "-p" option should affect both UDP and TCP default listening
c41359
ports.
c41359
c41359
ticket: 8715 (new)
c41359
(cherry picked from commit eb514587acc5c357bf0f554199bf0489b5515f8b)
c41359
---
c41359
 doc/admin/admin_commands/krb5kdc.rst | 12 ++++++------
c41359
 src/kdc/main.c                       | 12 ++++--------
c41359
 2 files changed, 10 insertions(+), 14 deletions(-)
c41359
c41359
diff --git a/doc/admin/admin_commands/krb5kdc.rst b/doc/admin/admin_commands/krb5kdc.rst
c41359
index 7ec4ee4d3..bda2c015c 100644
c41359
--- a/doc/admin/admin_commands/krb5kdc.rst
c41359
+++ b/doc/admin/admin_commands/krb5kdc.rst
c41359
@@ -57,12 +57,12 @@ The **-P** *pid_file* option tells the KDC to write its PID into
c41359
 the KDC is still running and to allow init scripts to stop the correct
c41359
 process.
c41359
 
c41359
-The **-p** *portnum* option specifies the default UDP port numbers
c41359
-which the KDC should listen on for Kerberos version 5 requests, as a
c41359
-comma-separated list.  This value overrides the UDP port numbers
c41359
-specified in the :ref:`kdcdefaults` section of :ref:`kdc.conf(5)`, but
c41359
-may be overridden by realm-specific values.  If no value is given from
c41359
-any source, the default port is 88.
c41359
+The **-p** *portnum* option specifies the default UDP and TCP port
c41359
+numbers which the KDC should listen on for Kerberos version 5
c41359
+requests, as a comma-separated list.  This value overrides the port
c41359
+numbers specified in the :ref:`kdcdefaults` section of
c41359
+:ref:`kdc.conf(5)`, but may be overridden by realm-specific values.
c41359
+If no value is given from any source, the default port is 88.
c41359
 
c41359
 The **-w** *numworkers* option tells the KDC to fork *numworkers*
c41359
 processes to listen to the KDC ports and process requests in parallel.
c41359
diff --git a/src/kdc/main.c b/src/kdc/main.c
c41359
index ccac3a759..89dac23ae 100644
c41359
--- a/src/kdc/main.c
c41359
+++ b/src/kdc/main.c
c41359
@@ -793,19 +793,15 @@ initialize_realms(krb5_context kcontext, int argc, char **argv,
c41359
             pid_file = optarg;
c41359
             break;
c41359
         case 'p':
c41359
-            if (def_udp_listen)
c41359
-                free(def_udp_listen);
c41359
+            free(def_udp_listen);
c41359
+            free(def_tcp_listen);
c41359
             def_udp_listen = strdup(optarg);
c41359
-            if (!def_udp_listen) {
c41359
+            def_tcp_listen = strdup(optarg);
c41359
+            if (def_udp_listen == NULL || def_tcp_listen == NULL) {
c41359
                 fprintf(stderr, _(" KDC cannot initialize. Not enough "
c41359
                                   "memory\n"));
c41359
                 exit(1);
c41359
             }
c41359
-#if 0 /* not yet */
c41359
-            if (default_tcp_ports)
c41359
-                free(default_tcp_ports);
c41359
-            default_tcp_ports = strdup(optarg);
c41359
-#endif
c41359
             break;
c41359
         case 'T':
c41359
             time_offset = atoi(optarg);