If /etc/services doesn't have the kadmin port, use a compiled in default
authorTheodore Tso <tytso@mit.edu>
Fri, 24 Mar 1995 22:26:07 +0000 (22:26 +0000)
committerTheodore Tso <tytso@mit.edu>
Fri, 24 Mar 1995 22:26:07 +0000 (22:26 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@5231 dc483132-0cff-0310-8789-dd5450dbe970

src/kadmin/server/ChangeLog
src/kadmin/server/adm_network.c

index b60bd93adeb1be1997247ef720c5c693375e9b2b..2d34d2c13d2e18110cfc930624ca477712a5e526 100644 (file)
@@ -1,3 +1,8 @@
+Fri Mar 24 14:38:06 1995    <tytso@rsx-11.mit.edu>
+
+       * adm_network.c (setup_network): If /etc/services doesn't have the
+               administration port, use a compiled in port.
+
 Thu Mar  2 12:24:50 1995  Theodore Y. Ts'o  <tytso@dcl>
 
        * Makefile.in (ISODELIB): Remove reference to $(ISODELIB).
index 58cc9fc5ab2852fddcd41ef4cee9ade0e39a121b..d1e296c056a1ec1bb956aed9a3811c096adecd89 100644 (file)
@@ -210,18 +210,25 @@ setup_network(context, prog)
 
     service_servent = getservbyname(adm5_tcp_portname, "tcp");
 
-    if (!service_servent) {
-        krb5_free_principal(context, client_server_info.server);
+    if (service_servent) {
+       client_server_info.server_name.sin_port = service_servent->s_port;
+#ifdef DEBUG
+       fprintf(stderr, "Official service name = %s\n", service_servent->s_name);
+#endif /* DEBUG */
+    } else {
+#ifdef ADM5_DEFAULT_PORT
+       client_server_info.server_name.sin_port = htons(ADM5_DEFAULT_PORT);
+       com_err("setup_network", 0, "adm_network: using default port %d",
+               ADM5_DEFAULT_PORT);
+#else
+        krb5_free_principal(client_server_info.server);
         free(client_server_info.name_of_service);
        com_err("setup_network", 0, "adm_network: %s/tcp service unknown", 
                        adm5_tcp_portname);
        return(1);
+#endif
     }
 
-#ifdef DEBUG
-    fprintf(stderr, "Official service name = %s\n", service_servent->s_name);
-#endif /* DEBUG */
-
     client_server_info.server_name.sin_port =  service_servent->s_port;
 
     if ((client_server_info.server_socket =