From e8695ccf0b17580682dc239f46afae4b8e911e6f Mon Sep 17 00:00:00 2001 From: Theodore Tso Date: Sat, 16 Sep 1995 07:41:21 +0000 Subject: [PATCH] Add an optional third argument which allows the user to set the Kerberos service name to be used. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@6801 dc483132-0cff-0310-8789-dd5450dbe970 --- src/appl/sample/sclient/ChangeLog | 4 ++++ src/appl/sample/sclient/sclient.c | 16 ++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/appl/sample/sclient/ChangeLog b/src/appl/sample/sclient/ChangeLog index b46458339..9bea74734 100644 --- a/src/appl/sample/sclient/ChangeLog +++ b/src/appl/sample/sclient/ChangeLog @@ -1,3 +1,7 @@ +Sat Sep 16 03:40:41 1995 Theodore Y. Ts'o + + * sclient.c (main): Add an optional third argument which allows + the user to set the Kerberos service name to be used. Fri Jul 7 15:46:11 EDT 1995 Paul Park (pjpark@mit.edu) * Makefile.in - Remove all explicit library handling and LDFLAGS. diff --git a/src/appl/sample/sclient/sclient.c b/src/appl/sample/sclient/sclient.c index a233f5efa..f7fa222df 100644 --- a/src/appl/sample/sclient/sclient.c +++ b/src/appl/sample/sclient/sclient.c @@ -66,9 +66,10 @@ char *argv[]; krb5_ap_rep_enc_part *rep_ret; krb5_auth_context auth_context = 0; short xmitlen; + char *service = 0; - if (argc != 2 && argc != 3) { - fprintf(stderr, "usage: %s [port]\n",argv[0]); + if (argc != 2 && argc != 3 && argc != 4) { + fprintf(stderr, "usage: %s [port] [service]\n",argv[0]); exit(1); } @@ -84,7 +85,7 @@ char *argv[]; /* clear out the structure first */ (void) memset((char *)&sin, 0, sizeof(sin)); - if (argc == 3) { + if (argc > 2) { sin.sin_family = AF_INET; sin.sin_port = htons(atoi(argv[2])); } else { @@ -100,6 +101,9 @@ char *argv[]; sin.sin_port = sp->s_port; sin.sin_family = AF_INET; } + if (argc > 3) { + service = argv[3]; + } /* look up the server host */ hp = gethostbyname(argv[1]); @@ -108,10 +112,10 @@ char *argv[]; exit(1); } - if (retval = krb5_sname_to_principal(context, argv[1], SAMPLE_SERVICE, + if (retval = krb5_sname_to_principal(context, argv[1], service, KRB5_NT_SRV_HST, &server)) { - com_err(argv[0], retval, "while creating server name for %s", - argv[1]); + com_err(argv[0], retval, "while creating server name for %s/%s", + argv[1], service); exit(1); } -- 2.26.2