Changes from Ian Taylor <ian@cygnus.com> to support testsuite.
authorMark Eichin <eichin@mit.edu>
Thu, 20 Apr 1995 22:11:56 +0000 (22:11 +0000)
committerMark Eichin <eichin@mit.edu>
Thu, 20 Apr 1995 22:11:56 +0000 (22:11 +0000)
* adm_extern.h: declare admin_port.
* adm_extern.c: define admin_port.
* adm_server.c (process_args): set admin_port from -p command line
argument.
(usage): document -p port option.
* adm_network.c (setup_network): use admin_port if set.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@5410 dc483132-0cff-0310-8789-dd5450dbe970

src/kadmin/server/ChangeLog
src/kadmin/server/adm_extern.c
src/kadmin/server/adm_extern.h
src/kadmin/server/adm_network.c
src/kadmin/server/adm_server.c

index 16dfcab4d10b83c23d494145a1bff94ef2a801bf..949b0cdb0dc28f05060da6371d6eed00b2e3841c 100644 (file)
@@ -1,3 +1,13 @@
+Thu Apr 20 18:05:00 1995  Mark Eichin  <eichin@cygnus.com>
+
+       Changes from Ian Taylor <ian@cygnus.com> to support testsuite.
+       * adm_extern.h: declare admin_port.
+       * adm_extern.c: define admin_port.
+       * adm_server.c (process_args): set admin_port from -p command line
+       argument.
+       (usage): document -p port option.
+       * adm_network.c (setup_network): use admin_port if set.
+
 Thu Apr 20 11:47:53 1995    <tytso@rsx-11.mit.edu>
 
        * adm_extern.h: #include adm_defs.h, since that's no longer
index 5bcf5e58e453ae9b1ab8f508e32eca18fab39aff..ed0709218fe1d781ae7c5a0901201cd8ecbb31ba 100644 (file)
@@ -52,3 +52,5 @@ krb5_data *tgs_server[4] = {0, &tgs_name, 0, 0};
 */
 
 krb5_principal tgs_server;
+
+short admin_port = 0;
index cc49405831c2721b7a8670d2cec1fd66c2f0c14d..5fc11d219efe66b5fe14e90ef17d9302a0785267 100644 (file)
@@ -76,6 +76,8 @@ extern int send_seqno;
 
 extern int exit_now;
 
+extern short admin_port;
+
 extern krb5_data inbuf;
 extern krb5_data msg_data;
 
index d1e296c056a1ec1bb956aed9a3811c096adecd89..f211f4f43ea18028b0f9cfc995365fffb6097b1f 100644 (file)
@@ -209,27 +209,27 @@ setup_network(context, prog)
 #endif /* DEBUG */
 
     service_servent = getservbyname(adm5_tcp_portname, "tcp");
-
-    if (service_servent) {
-       client_server_info.server_name.sin_port = service_servent->s_port;
+    if (admin_port) {
+      client_server_info.server_name.sin_port = admin_port;
+    } else 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);
+      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);
+      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);
+      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
     }
 
-    client_server_info.server_name.sin_port =  service_servent->s_port;
 
     if ((client_server_info.server_socket = 
                socket(AF_INET, SOCK_STREAM, 0)) < 0) {
index 33020eb5afe8d02b80309614f01b819c0a066e05..ff7542d27fdc92ffdab9f2e74dd9e2768823c40b 100644 (file)
@@ -103,7 +103,7 @@ char *name;
 {
     fprintf(stderr, "Usage: %s\t[-a aclfile] [-d dbname] [-k masterkeytype]", 
                        name);
-    fprintf(stderr, "\n\t[-h] [-m] [-M masterkeyname] [-r realm]\n");
+    fprintf(stderr, "\n\t[-h] [-m] [-M masterkeyname] [-r realm] [-p port]\n");
     return;
 }
  
@@ -148,7 +148,7 @@ process_args(context, argc, argv)
         fclose(startup_file);
     }
 #endif
-    while ((c = getopt(argc, argv, "hmM:a:d:k:r:De:")) != EOF) {
+    while ((c = getopt(argc, argv, "hmM:a:d:k:r:De:p:")) != EOF) {
        switch(c) {
            case 'a':                   /* new acl directory */
                acl_file_name = optarg;
@@ -189,6 +189,10 @@ process_args(context, argc, argv)
                adm_debug_flag = 1;
                break;
 
+           case 'p':
+               admin_port = atoi(optarg);
+               break;
+
            case 'h':                   /* get help on using adm_server */
            default:
                usage(argv[0]);