From: Chris Provenzano Date: Fri, 10 Mar 1995 17:28:38 +0000 (+0000) Subject: * kcmd.c (kcmd()) Use new calling convention for krb5_sendauth(). X-Git-Tag: krb5-1.0-beta5~570 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=05120f89e4e849f6b1a7bed6d0144f2739dcf182;p=krb5.git * kcmd.c (kcmd()) Use new calling convention for krb5_sendauth(). * krcp.c () Use new calling convention for krb5_mk_req_extended(). git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@5102 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/appl/bsd/ChangeLog b/src/appl/bsd/ChangeLog index 25411bca9..6513090dd 100644 --- a/src/appl/bsd/ChangeLog +++ b/src/appl/bsd/ChangeLog @@ -1,3 +1,8 @@ +Fri Mar 10 11:09:34 1995 Chris Provenzano (proven@mit.edu) + + * kcmd.c (kcmd()) Use new calling convention for krb5_sendauth(). + * krcp.c () Use new calling convention for krb5_mk_req_extended(). + Thu Mar 2 12:26:29 1995 Theodore Y. Ts'o * Makefile.in (ISODELIB): Remove reference to $(ISODELIB). diff --git a/src/appl/bsd/kcmd.c b/src/appl/bsd/kcmd.c index 653f40203..e4c1839ce 100644 --- a/src/appl/bsd/kcmd.c +++ b/src/appl/bsd/kcmd.c @@ -97,13 +97,14 @@ kcmd(sock, ahost, rport, locuser, remuser, cmd, fd2p, service, realm, krb5_error_code status; krb5_error *err_ret; krb5_ap_rep_enc_part *rep_ret; - krb5_checksum send_cksum; + krb5_data in_data; char *tmpstr = 0; krb5_error *error = 0; int sin_len; krb5_ccache cc; krb5_data outbuf; krb5_flags options = authopts; + krb5_auth_context * auth_context = NULL; pid = getpid(); hp = gethostbyname(*ahost); @@ -112,7 +113,7 @@ kcmd(sock, ahost, rport, locuser, remuser, cmd, fd2p, service, realm, return (-1); } - host_save = malloc(strlen(hp->h_name) + 1); + host_save = (char *)malloc(strlen(hp->h_name) + 1); if ( host_save == (char *) 0){ fprintf(stderr,"kcmd: no memory\n"); return(-1); @@ -279,33 +280,19 @@ kcmd(sock, ahost, rport, locuser, remuser, cmd, fd2p, service, realm, goto bad2; } - /* compute checksum, using CRC-32 */ - if (!(send_cksum.contents = (krb5_octet *) - malloc(krb5_checksum_size(bsd_context, CKSUMTYPE_CRC32)))) { - status = -1; - goto bad2; - } - /* choose some random stuff to compute checksum from */ - sprintf(tmpstr,"%x %x",pid,pid); - if (status = krb5_calculate_checksum(bsd_context, CKSUMTYPE_CRC32, - tmpstr, - strlen(tmpstr), - 0, - 0, /* if length is 0, crc-32 doesn't - use the seed */ - &send_cksum)) - goto bad3; + in_data.data = tmpstr; + in_data.length = strlen(tmpstr); status = krb5_cc_default(bsd_context, &cc); - if (status) goto bad3; + if (status) goto bad2; status = krb5_cc_get_principal(bsd_context, cc, &get_cred->client); - if (status) goto bad3; + if (status) goto bad2; /* Get ticket from credentials cache or kdc */ status = krb5_get_credentials(bsd_context, 0, cc, get_cred, &ret_cred); krb5_free_creds(bsd_context, get_cred); - if (status) goto bad3; + if (status) goto bad2; /* Reset internal flags; these should not be sent. */ authopts &= (~OPTS_FORWARD_CREDS); @@ -314,14 +301,12 @@ kcmd(sock, ahost, rport, locuser, remuser, cmd, fd2p, service, realm, /* call Kerberos library routine to obtain an authenticator, pass it over the socket to the server, and obtain mutual authentication. */ - status = krb5_sendauth(bsd_context, (krb5_pointer) &s, + status = krb5_sendauth(bsd_context, &auth_context, (krb5_pointer) &s, "KCMDV0.1", ret_cred->client, ret_cred->server, authopts, - &send_cksum, + &in_data, ret_cred, 0, /* We have the credentials */ - seqno, - 0, /* don't need a subsession key */ &error, /* No error return */ &rep_ret, NULL); if (status) { @@ -337,7 +322,7 @@ kcmd(sock, ahost, rport, locuser, remuser, cmd, fd2p, service, realm, error = 0; } } - if (status) goto bad3; + if (status) goto bad2; if (rep_ret && server_seqno) { *server_seqno = rep_ret->seq_number; krb5_free_ap_rep_enc_part(bsd_context, rep_ret); @@ -362,12 +347,12 @@ kcmd(sock, ahost, rport, locuser, remuser, cmd, fd2p, service, realm, /* Send forwarded credentials */ if (status = krb5_write_message(bsd_context, (krb5_pointer)&s, &outbuf)) - goto bad3; + goto bad2; } else { /* Dummy write to signal no forwarding */ outbuf.length = 0; if (status = krb5_write_message(bsd_context, (krb5_pointer)&s, &outbuf)) - goto bad3; + goto bad2; } if ((rc=read(s, &c, 1)) != 1) { @@ -377,7 +362,7 @@ kcmd(sock, ahost, rport, locuser, remuser, cmd, fd2p, service, realm, fprintf(stderr,"kcmd: bad connection with remote host\n"); } status = -1; - goto bad3; + goto bad2; } if (c != 0) { while (read(s, &c, 1) == 1) { @@ -386,7 +371,7 @@ kcmd(sock, ahost, rport, locuser, remuser, cmd, fd2p, service, realm, break; } status = -1; - goto bad3; + goto bad2; } #ifdef POSIX_SIGNALS sigprocmask(SIG_SETMASK, &oldmask, (sigset_t*)0); @@ -401,8 +386,6 @@ kcmd(sock, ahost, rport, locuser, remuser, cmd, fd2p, service, realm, krb5_free_creds(bsd_context, ret_cred); return (0); - bad3: - free(send_cksum.contents); bad2: if (lport) (void) close(*fd2p); diff --git a/src/appl/bsd/krcp.c b/src/appl/bsd/krcp.c index cdc7ffd4b..7aaf4bd05 100644 --- a/src/appl/bsd/krcp.c +++ b/src/appl/bsd/krcp.c @@ -1288,6 +1288,7 @@ void krb5_creds creds, *new_creds; krb5_ccache cc; krb5_error_code status; + krb5_auth_context *auth_context; extern krb5_flags krb5_kdc_default_options; @@ -1326,14 +1327,10 @@ void 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 */ - 0, - 0, /* no need for subkey */ - new_creds, - 0, /* don't need authenticator copy */ - &msg)) { + + if (status = krb5_mk_req_extended(bsd_context, &auth_context, + AP_OPTS_USE_SESSION_KEY, + NULL, new_creds, &msg)) { krb5_cc_destroy(bsd_context, cc); krb5_cc_close(bsd_context, cc); exit(1);