From: Chris Provenzano Date: Thu, 23 Feb 1995 13:19:13 +0000 (+0000) Subject: * kcmd.c Call krb5_sendauth() and krb5_get_credentials() with X-Git-Tag: krb5-1.0-beta5~687 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=a46f9798a0bce3dfd7849305ba100dca50a2e6de;p=krb5.git * kcmd.c Call krb5_sendauth() and krb5_get_credentials() with new calling convention. * krcp.c (answer_auth()) Call krb5_mk_req_extended90 with new calling convention. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@4981 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/appl/bsd/ChangeLog b/src/appl/bsd/ChangeLog index 485d21dda..da0ffca47 100644 --- a/src/appl/bsd/ChangeLog +++ b/src/appl/bsd/ChangeLog @@ -1,3 +1,11 @@ +Tue Feb 14 15:30:55 1995 Chris Provenzano (proven@mit.edu) + + * kcmd.c Call krb5_sendauth() and krb5_get_credentials() with + new calling convention. + + * krcp.c (answer_auth()) Call krb5_mk_req_extended90 with new + calling convention. + Fri Feb 3 11:51:55 1995 Theodore Y. Ts'o (tytso@dcl) * krcp.c (tgt_keyproc): Add keytype parameter to field. diff --git a/src/appl/bsd/kcmd.c b/src/appl/bsd/kcmd.c index 83bd7a900..faa1e8afa 100644 --- a/src/appl/bsd/kcmd.c +++ b/src/appl/bsd/kcmd.c @@ -90,7 +90,7 @@ kcmd(sock, ahost, rport, locuser, remuser, cmd, fd2p, service, realm, long oldmask; #endif struct sockaddr_in sin, from, local_laddr; - krb5_creds *ret_cred = 0; + krb5_creds *get_cred, *ret_cred; char c; int lport = START_PORT; struct hostent *hp; @@ -136,12 +136,12 @@ kcmd(sock, ahost, rport, locuser, remuser, cmd, fd2p, service, realm, return(-1); } - if (!(ret_cred = (krb5_creds *)calloc(1,sizeof(*ret_cred)))){ + if (!(get_cred = (krb5_creds *)calloc(1, sizeof(krb5_creds)))) { fprintf(stderr,"kcmd: no memory\n"); return(-1); } status = krb5_sname_to_principal(bsd_context, host_save,service, - KRB5_NT_SRV_HST, &ret_cred->server); + KRB5_NT_SRV_HST, &get_cred->server); if (status) { fprintf(stderr, "kcmd: krb5_sname_to_principal failed: %s\n", error_message(status)); @@ -157,7 +157,7 @@ kcmd(sock, ahost, rport, locuser, remuser, cmd, fd2p, service, realm, strcpy(rdata.data, realm); /* XXX we should free the old realm first */ - krb5_princ_set_realm(bsd_context, ret_cred->server, &rdata); + krb5_princ_set_realm(bsd_context, get_cred->server, &rdata); } #ifdef POSIX_SIGNALS sigemptyset(&urgmask); @@ -180,7 +180,7 @@ kcmd(sock, ahost, rport, locuser, remuser, cmd, fd2p, service, realm, sigsetmask(oldmask); #endif /* POSIX_SIGNALS */ if (tmpstr) krb5_xfree(tmpstr); - krb5_free_creds(bsd_context, ret_cred); + krb5_free_creds(bsd_context, get_cred); return (-1); } #ifdef HAVE_SETOWN @@ -227,7 +227,7 @@ kcmd(sock, ahost, rport, locuser, remuser, cmd, fd2p, service, realm, sigsetmask(oldmask); #endif /* POSIX_SIGNALS */ if (tmpstr) krb5_xfree(tmpstr); - krb5_free_creds(bsd_context, ret_cred); + krb5_free_creds(bsd_context, get_cred); return (-1); } lport--; @@ -301,11 +301,12 @@ kcmd(sock, ahost, rport, locuser, remuser, cmd, fd2p, service, realm, status = krb5_cc_default(bsd_context, &cc); if (status) goto bad3; - status = krb5_cc_get_principal(bsd_context, cc, &ret_cred->client); + status = krb5_cc_get_principal(bsd_context, cc, &get_cred->client); if (status) goto bad3; /* Get ticket from credentials cache or kdc */ - status = krb5_get_credentials(bsd_context, 0, cc, ret_cred); + status = krb5_get_credentials(bsd_context, 0, cc, get_cred, &ret_cred); + krb5_free_creds(bsd_context, get_cred); if (status) goto bad3; /* Reset internal flags; these should not be sent. */ @@ -324,7 +325,7 @@ kcmd(sock, ahost, rport, locuser, remuser, cmd, fd2p, service, realm, seqno, 0, /* don't need a subsession key */ &error, /* No error return */ - &rep_ret); + &rep_ret, NULL); if (status) { printf("Couldn't authenticate to server: %s\n", error_message(status)); if (error) { @@ -398,7 +399,7 @@ kcmd(sock, ahost, rport, locuser, remuser, cmd, fd2p, service, realm, if (tmpstr) krb5_xfree(tmpstr); /* pass back credentials if wanted */ - if (cred) krb5_copy_creds(bsd_context, ret_cred,cred); + if (cred) krb5_copy_creds(bsd_context, ret_cred, cred); krb5_free_creds(bsd_context, ret_cred); return (0); diff --git a/src/appl/bsd/krcp.c b/src/appl/bsd/krcp.c index c9cb36ec4..a914f6599 100644 --- a/src/appl/bsd/krcp.c +++ b/src/appl/bsd/krcp.c @@ -1163,23 +1163,22 @@ void send_auth() int sin_len; char *princ; /* principal in credentials cache */ krb5_ccache cc; - krb5_creds creds; + krb5_creds in_creds, *out_creds; krb5_data reply, princ_data; krb5_tkt_authent *authdat; krb5_error_code status; krb5_address faddr; - if (status = krb5_cc_default(bsd_context, &cc)){ fprintf(stderr,"rcp: send_auth failed krb5_cc_default : %s\n", error_message(status)); exit(1); } - memset ((char*)&creds, 0, sizeof(creds)); + memset ((char*)&in_creds, 0, sizeof(krb5_creds)); - if (status = krb5_cc_get_principal(bsd_context, cc, &creds.client)){ + if (status = krb5_cc_get_principal(bsd_context, cc, &in_creds.client)){ fprintf(stderr, "rcp: send_auth failed krb5_cc_get_principal : %s\n", error_message(status)); @@ -1187,18 +1186,18 @@ void send_auth() exit(1); } - if (status = krb5_unparse_name(bsd_context, creds.client, &princ)){ + if (status = krb5_unparse_name(bsd_context, in_creds.client, &princ)){ fprintf(stderr,"rcp: send_auth failed krb5_parse_name : %s\n", error_message(status)); krb5_cc_close(bsd_context, cc); exit(1); } - if (status = krb5_build_principal_ext(bsd_context, &creds.server, - krb5_princ_realm(bsd_context, creds.client)->length, - krb5_princ_realm(bsd_context, creds.client)->data, + if (status = krb5_build_principal_ext(bsd_context, &in_creds.server, + krb5_princ_realm(bsd_context,in_creds.client)->length, + krb5_princ_realm(bsd_context,in_creds.client)->data, 6, "krbtgt", - krb5_princ_realm(bsd_context, creds.client)->length, - krb5_princ_realm(bsd_context, creds.client)->data, + krb5_princ_realm(bsd_context,in_creds.client)->length, + krb5_princ_realm(bsd_context,in_creds.client)->data, 0)){ fprintf(stderr, "rcp: send_auth failed krb5_build_principal_ext : %s\n", @@ -1208,7 +1207,8 @@ void send_auth() } /* Get TGT from credentials cache */ - if (status = krb5_get_credentials(bsd_context, KRB5_GC_CACHED, cc, &creds)){ + if (status = krb5_get_credentials(bsd_context, KRB5_GC_CACHED, cc, + &in_creds, &out_creds)){ fprintf(stderr, "rcp: send_auth failed krb5_get_credentials: %s\n", error_message(status)); @@ -1229,7 +1229,8 @@ void send_auth() exit(1); } krb5_xfree(princ); - status = krb5_write_message(bsd_context, (krb5_pointer)&rem, &creds.ticket); + status = krb5_write_message(bsd_context, (krb5_pointer)&rem, + &out_creds->ticket); if (status){ fprintf(stderr, "rcp: send_auth failed krb5_write_message: %s\n", @@ -1256,7 +1257,7 @@ void send_auth() &faddr, 0, /* no fetchfrom */ tgt_keyproc, - (krb5_pointer)&creds, /* credentials as arg to + (krb5_pointer)out_creds, /* credentials as arg to keyproc */ 0, /* no rcache for the moment XXX */ &authdat); @@ -1270,7 +1271,7 @@ void send_auth() krb5_copy_keyblock(bsd_context, authdat->ticket->enc_part2->session, &session_key); krb5_free_tkt_authent(bsd_context, authdat); - krb5_free_cred_contents(bsd_context, &creds); + krb5_free_creds(bsd_context, out_creds); krb5_use_keytype(bsd_context, &eblock, session_key->keytype); if ( status = krb5_process_key(bsd_context, &eblock, @@ -1288,7 +1289,7 @@ void answer_auth() { krb5_data pname_data, msg; - krb5_creds creds; + krb5_creds creds, *new_creds; krb5_ccache cc; krb5_error_code status; extern krb5_flags krb5_kdc_default_options; @@ -1323,20 +1324,19 @@ void } krb5_xfree(pname_data.data); - if (status = krb5_get_credentials(bsd_context, KRB5_GC_USER_USER, cc, &creds)){ + if (status = krb5_get_credentials(bsd_context, KRB5_GC_USER_USER, cc, + &creds, &new_creds)){ krb5_cc_destroy(bsd_context, cc); krb5_cc_close(bsd_context, cc); exit(1); } if (status = krb5_mk_req_extended(bsd_context, AP_OPTS_USE_SESSION_KEY, - 0, /* no application checksum here */ - krb5_kdc_default_options, + 0, /* no application checksum here */ 0, - 0, /* no need for subkey */ - cc, - &creds, - 0, /* don't need authenticator copy */ + 0, /* no need for subkey */ + new_creds, + 0, /* don't need authenticator copy */ &msg)) { krb5_cc_destroy(bsd_context, cc); krb5_cc_close(bsd_context, cc); @@ -1351,10 +1351,11 @@ void } /* setup eblock for des_read and write */ - krb5_copy_keyblock(bsd_context, &creds.keyblock,&session_key); + krb5_copy_keyblock(bsd_context, &new_creds->keyblock,&session_key); /* cleanup */ krb5_free_cred_contents(bsd_context, &creds); + krb5_free_creds(bsd_context, new_creds); /* OK process key */ krb5_use_keytype(bsd_context, &eblock, session_key->keytype);