From: Mark Eichin Date: Thu, 20 Apr 1995 22:20:47 +0000 (+0000) Subject: Changes from Ian Taylor to support testsuite. X-Git-Tag: krb5-1.0-beta5~334 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=a6fd8a758047e266e9e8660c0eb97e27bf1fbef3;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@5412 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/kadmin/client/ChangeLog b/src/kadmin/client/ChangeLog index ba10fca8b..c51961207 100644 --- a/src/kadmin/client/ChangeLog +++ b/src/kadmin/client/ChangeLog @@ -1,3 +1,12 @@ +Thu Apr 20 18:18:48 1995 Mark Eichin + + Changes from Ian Taylor to support testsuite. + Support -p port argument to kadmin client. + * kadmin.c (main): parse -p argument. + (adm5_init_link): new port argument, use it in preference to + getservbyname. + (usage): document new -p argument. + Thu Apr 20 11:45:10 1995 * kadmin.c, kadmin_add.c, kadmin_adr.c, kadmin_cpr.c kadmin_cpw.c, diff --git a/src/kadmin/client/kadmin.c b/src/kadmin/client/kadmin.c index 65c89ea6d..397a7df0a 100644 --- a/src/kadmin/client/kadmin.c +++ b/src/kadmin/client/kadmin.c @@ -92,6 +92,7 @@ main(argc,argv) int option; int oper_type; int nflag = 0; + int port = 0; krb5_auth_context * new_auth_context; krb5_replay_data replaydata; @@ -102,7 +103,7 @@ main(argc,argv) client_name = (char *) malloc(755); memset((char *) client_name, 0, sizeof(client_name)); - while ((option = getopt(argc, argv, "c:n")) != EOF) { + while ((option = getopt(argc, argv, "c:np:")) != EOF) { switch (option) { case 'c': strcpy (cache_name, optarg); @@ -110,6 +111,9 @@ main(argc,argv) case 'n': nflag++; break; + case 'p': + port = htons(atoi(optarg)); + break; case '?': default: usage(); @@ -178,7 +182,8 @@ main(argc,argv) /* Initiate Link to Server */ - if ((retval = adm5_init_link(context, requested_realm, &local_socket))) { + if ((retval = adm5_init_link(context, requested_realm, port, + &local_socket))) { (void) krb5_cc_destroy(context, cache); exit(1); } @@ -508,9 +513,10 @@ get_first_ticket(context, cache, client, my_creds) } krb5_error_code -adm5_init_link(context, realm_of_server, local_socket) +adm5_init_link(context, realm_of_server, port, local_socket) krb5_context context; krb5_data *realm_of_server; + int port; int * local_socket; { struct servent *service_process; /* service we will talk to */ @@ -524,14 +530,18 @@ adm5_init_link(context, realm_of_server, local_socket) /* clear out the structure first */ (void) memset((char *)&remote_sin, 0, sizeof(remote_sin)); - if ((service_process = getservbyname(CPW_SNAME, "tcp")) == NULL) { - fprintf(stderr, "Unable to find Service (%s) Check services file!\n", - CPW_SNAME); - return(1); - } + if (port != 0) { + remote_sin.sin_port = port; + } else { + if ((service_process = getservbyname(CPW_SNAME, "tcp")) == NULL) { + fprintf(stderr, "Unable to find Service (%s) Check services file!\n", + CPW_SNAME); + return(1); + } - /* Copy the Port Number */ - remote_sin.sin_port = service_process->s_port; + /* Copy the Port Number */ + remote_sin.sin_port = service_process->s_port; + } hostlist = 0; @@ -655,7 +665,7 @@ get_def_princ(context, client) usage() { fprintf(stderr, "Usage: "); - fprintf(stderr, "kadmin [-n] [Administrator name]\n\n"); + fprintf(stderr, "kadmin [-n] [-p port] [Administrator name]\n\n"); fprintf(stderr, " If an Administrator name is not supplied, kadmin "); fprintf(stderr, "will first\n attempt to locate the name from "); fprintf(stderr, "the default ticket file, then\n by using the ");