From: Mark Eichin Date: Thu, 20 Apr 1995 22:11:56 +0000 (+0000) Subject: Changes from Ian Taylor to support testsuite. X-Git-Tag: krb5-1.0-beta5~336 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c2246546fbad5944292ef41df449620b605d76b1;p=krb5.git Changes from Ian Taylor 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. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@5410 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/kadmin/server/ChangeLog b/src/kadmin/server/ChangeLog index 16dfcab4d..949b0cdb0 100644 --- a/src/kadmin/server/ChangeLog +++ b/src/kadmin/server/ChangeLog @@ -1,3 +1,13 @@ +Thu Apr 20 18:05:00 1995 Mark Eichin + + Changes from Ian Taylor 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 * adm_extern.h: #include adm_defs.h, since that's no longer diff --git a/src/kadmin/server/adm_extern.c b/src/kadmin/server/adm_extern.c index 5bcf5e58e..ed0709218 100644 --- a/src/kadmin/server/adm_extern.c +++ b/src/kadmin/server/adm_extern.c @@ -52,3 +52,5 @@ krb5_data *tgs_server[4] = {0, &tgs_name, 0, 0}; */ krb5_principal tgs_server; + +short admin_port = 0; diff --git a/src/kadmin/server/adm_extern.h b/src/kadmin/server/adm_extern.h index cc4940583..5fc11d219 100644 --- a/src/kadmin/server/adm_extern.h +++ b/src/kadmin/server/adm_extern.h @@ -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; diff --git a/src/kadmin/server/adm_network.c b/src/kadmin/server/adm_network.c index d1e296c05..f211f4f43 100644 --- a/src/kadmin/server/adm_network.c +++ b/src/kadmin/server/adm_network.c @@ -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) { diff --git a/src/kadmin/server/adm_server.c b/src/kadmin/server/adm_server.c index 33020eb5a..ff7542d27 100644 --- a/src/kadmin/server/adm_server.c +++ b/src/kadmin/server/adm_server.c @@ -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]);