diff options
author | John Kohl <jtkohl@mit.edu> | 1991-04-30 15:01:30 +0000 |
---|---|---|
committer | John Kohl <jtkohl@mit.edu> | 1991-04-30 15:01:30 +0000 |
commit | 859a69628094b254f865f63e4afd7352332e6001 (patch) | |
tree | 8909b53968ec2789b641eec42a1f08298325c9a8 /src/lib/krb425 | |
parent | bb9a5297b07691bc8c3ec7d6886f192fa02a9bc4 (diff) | |
download | krb5-859a69628094b254f865f63e4afd7352332e6001.tar.gz krb5-859a69628094b254f865f63e4afd7352332e6001.tar.xz krb5-859a69628094b254f865f63e4afd7352332e6001.zip |
use new principal building routines
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@2070 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib/krb425')
-rw-r--r-- | src/lib/krb425/get_cred.c | 23 | ||||
-rw-r--r-- | src/lib/krb425/mk_req.c | 19 | ||||
-rw-r--r-- | src/lib/krb425/rd_req.c | 25 |
3 files changed, 33 insertions, 34 deletions
diff --git a/src/lib/krb425/get_cred.c b/src/lib/krb425/get_cred.c index 69bfe6f57e..e4e0aa6002 100644 --- a/src/lib/krb425/get_cred.c +++ b/src/lib/krb425/get_cred.c @@ -28,19 +28,18 @@ CREDENTIALS *c; static krb5_principal client_principal = { 0 }; krb5_creds creds; - krb5_data *server[4]; + krb5_principal server; krb5_data srvdata[3]; krb5_error_code r; krb5_ticket *ticket; - set_data5(srvdata[0], realm); - set_data5(srvdata[1], service); - set_data5(srvdata[2], instance); - - server[0] = &srvdata[0]; - server[1] = &srvdata[1]; - server[2] = &srvdata[2]; - server[3] = 0; + if (r = krb5_build_principal(&server, + strlen(realm), realm, + service, + instance, + 0)) { + return(krb425error(r)); + } if (!_krb425_ccache) krb5_cc_default(&_krb425_ccache); @@ -53,8 +52,10 @@ CREDENTIALS *c; creds.times.endtime = 0; creds.keyblock.keytype = KEYTYPE_DES; - if (r = krb5_get_credentials(0, _krb425_ccache, &creds)) - return(krb425error(r)); + r = krb5_get_credentials(0, _krb425_ccache, &creds); + krb5_free_principal(server); + if (r) + return(krb425error(r)); #ifdef EBUG { diff --git a/src/lib/krb425/mk_req.c b/src/lib/krb425/mk_req.c index 188f6b641a..ea748df149 100644 --- a/src/lib/krb425/mk_req.c +++ b/src/lib/krb425/mk_req.c @@ -26,20 +26,18 @@ char *instance; char *realm; u_long checksum; { - krb5_data *server[4]; - krb5_data srvdata[3]; + krb5_principal server; krb5_error_code r; krb5_data outbuf; krb5_checksum ck; - set_data5(srvdata[0], realm); - set_data5(srvdata[1], service); - set_data5(srvdata[2], instance); - - server[0] = &srvdata[0]; - server[1] = &srvdata[1]; - server[2] = &srvdata[2]; - server[3] = 0; + if (r = krb5_build_principal(&server, + strlen(realm), realm, + service, + instance, + 0)) { + return(krb425error(r)); + } if (!_krb425_ccache) krb5_cc_default(&_krb425_ccache); @@ -62,6 +60,7 @@ u_long checksum; if (r) ERROR(r) #endif + krb5_free_principal(server); if (!r) { if (outbuf.length > MAX_KTXT_LEN) { #ifdef EBUG diff --git a/src/lib/krb425/rd_req.c b/src/lib/krb425/rd_req.c index baf041b027..797eeb2609 100644 --- a/src/lib/krb425/rd_req.c +++ b/src/lib/krb425/rd_req.c @@ -43,8 +43,7 @@ char *fn; krb5_address peer; krb5_tkt_authent *authdat; char addr[4]; - krb5_data *server[4]; - krb5_data srvdata[3]; + krb5_principal server; krb5_error_code r; krb5_data authe; extern int gethostname(); @@ -81,15 +80,14 @@ char *fn; } instance = hostname; } - set_data5(srvdata[0], _krb425_local_realm); - set_data5(srvdata[1], service); - set_data5(srvdata[2], instance); - - server[0] = &srvdata[0]; - server[1] = &srvdata[1]; - server[2] = &srvdata[2]; - server[3] = 0; - + if (r = krb5_build_principal(&server, + strlen(_krb425_local_realm), + _krb425_local_realm, + service, + instance, + 0)) { + return(krb425error(r)); + } authe.length = authent->length; authe.data = (char *)authent->dat; @@ -129,16 +127,17 @@ char *fn; /* ? : will break some compilers when dealing with function pointers */ if (use_set_key) r = krb5_rd_req(&authe, - (krb5_principal)server, + server, from_addr ? &peer : 0, fn, setkey_key_proc, 0, 0, &authdat); else r = krb5_rd_req(&authe, - (krb5_principal)server, + server, from_addr ? &peer : 0, fn, 0, 0, 0, &authdat); + krb5_free_principal(server); if (r) { #ifdef EBUG ERROR(r) |