From: Chris Provenzano Date: Fri, 10 Mar 1995 17:27:20 +0000 (+0000) Subject: * kadmin.c, kadmin_adr.c, kadmin_cpw.c, kadmin_done.c, kadmin_mod.c X-Git-Tag: krb5-1.0-beta5~572 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=2e91e7c2b5f969fd689082910471e3d6c0584b72;p=krb5.git * kadmin.c, kadmin_adr.c, kadmin_cpw.c, kadmin_done.c, kadmin_mod.c * kadmin_add.c, kadmin_cpr.c, kadmin_del.c, kadmin_inq.c, kadmin_msnd.c Use new calling convention for krb5_sendauth(), krb5_mk_priv(), krb5_rd_priv(), krb5_mk_safe(), and krb5_rd_safe(). git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@5100 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/kadmin/client/ChangeLog b/src/kadmin/client/ChangeLog index deee1c937..d6753db06 100644 --- a/src/kadmin/client/ChangeLog +++ b/src/kadmin/client/ChangeLog @@ -1,3 +1,11 @@ + +Fri Mar 10 11:09:34 1995 Chris Provenzano (proven@mit.edu) + + * kadmin.c, kadmin_adr.c, kadmin_cpw.c, kadmin_done.c, kadmin_mod.c + * kadmin_add.c, kadmin_cpr.c, kadmin_del.c, kadmin_inq.c, kadmin_msnd.c + Use new calling convention for krb5_sendauth(), krb5_mk_priv(), + krb5_rd_priv(), krb5_mk_safe(), and krb5_rd_safe(). + Thu Mar 2 12:24:25 1995 Theodore Y. Ts'o * Makefile.in (ISODELIB): Remove reference to $(ISODELIB). diff --git a/src/kadmin/client/kadmin.c b/src/kadmin/client/kadmin.c index 93ce5e9ed..44d9219db 100644 --- a/src/kadmin/client/kadmin.c +++ b/src/kadmin/client/kadmin.c @@ -35,7 +35,7 @@ #define MAXPATHLEN 1024 #endif -#include "k5-int.h" +#include "krb5.h" static krb5_error_code get_first_ticket PROTOTYPE((krb5_context, @@ -83,9 +83,7 @@ main(argc,argv) kadmin_requests rd_priv_resp; krb5_context context; - krb5_checksum send_cksum; krb5_data msg_data, inbuf; - krb5_int32 seqno; char buffer[255]; char command_type[120]; char princ_name[120]; @@ -94,6 +92,9 @@ main(argc,argv) int oper_type; int nflag = 0; + krb5_auth_context * new_auth_context; + krb5_replay_data replaydata; + krb5_init_context(&context); krb5_init_ets(context); @@ -209,49 +210,34 @@ main(argc,argv) foreign_addr.length = SIZEOF_INADDR ; foreign_addr.contents = (krb5_octet *) &remote_sin.sin_addr; - /* compute checksum, using CRC-32 */ - if (!(send_cksum.contents = (krb5_octet *) - malloc(krb5_checksum_size(context, CKSUMTYPE_CRC32)))) { - fprintf(stderr, "Insufficient Memory while Allocating Checksum!\n"); - (void) krb5_cc_destroy(context, cache); - exit(1); - } - - /* choose some random stuff to compute checksum from */ - if (retval = krb5_calculate_checksum(context, CKSUMTYPE_CRC32, - ADM5_ADM_VERSION, - strlen(ADM5_ADM_VERSION), - 0, - 0, /* if length is 0, crc-32 doesn't - use the seed */ - &send_cksum)) { - fprintf(stderr, "Error while Computing Checksum: %s!\n", - error_message(retval)); - free(send_cksum.contents); - (void) krb5_cc_destroy(context, cache); - exit(1); - } + krb5_auth_con_init(context, &new_auth_context); + krb5_auth_con_setflags(context, new_auth_context, + KRB5_AUTH_CONTEXT_RET_SEQUENCE); + + krb5_auth_con_setaddrs(context, new_auth_context, + &local_addr, &foreign_addr); /* call Kerberos library routine to obtain an authenticator, pass it over the socket to the server, and obtain mutual authentication. */ - if ((retval = krb5_sendauth(context, (krb5_pointer) &local_socket, + inbuf.data = ADM5_ADM_VERSION; + inbuf.length = strlen(ADM5_ADM_VERSION); + + if ((retval = krb5_sendauth(context, &new_auth_context, + (krb5_pointer) &local_socket, ADM_CPW_VERSION, my_creds.client, my_creds.server, AP_OPTS_MUTUAL_REQUIRED, - &send_cksum, + &inbuf, &my_creds, 0, - &seqno, - 0, /* don't need a subsession key */ &err_ret, &rep_ret, NULL))) { fprintf(stderr, "Error while performing sendauth: %s!\n", error_message(retval)); - free(send_cksum.contents); exit(1); } @@ -259,21 +245,18 @@ main(argc,argv) if (retval = krb5_read_message(context, &local_socket, &inbuf)){ fprintf(stderr, " Read Message Error: %s!\n", error_message(retval)); - free(send_cksum.contents); exit(1); } if ((inbuf.length != 2) || (inbuf.data[0] != KADMIND) || (inbuf.data[1] != KADMSAG)){ fprintf(stderr, " Invalid ack from admin server.!\n"); - free(send_cksum.contents); exit(1); } free(inbuf.data); if ((inbuf.data = (char *) calloc(1, 2)) == (char *) 0) { fprintf(stderr, "No memory for command!\n"); - free(send_cksum.contents); exit(1); } @@ -281,20 +264,11 @@ main(argc,argv) inbuf.data[1] = 0xff; inbuf.length = 2; - if ((retval = krb5_mk_priv(context, &inbuf, - ETYPE_DES_CBC_CRC, - &my_creds.keyblock, - &local_addr, - &foreign_addr, - seqno, - KRB5_PRIV_DOSEQUENCE|KRB5_PRIV_NOTIME, - 0, - 0, - &msg_data))) { + if ((retval = krb5_mk_priv(context, new_auth_context, &inbuf, + &msg_data, &replaydata))) { fprintf(stderr, "Error during First Message Encoding: %s!\n", error_message(retval)); free(inbuf.data); - free(send_cksum.contents); exit(1); } free(inbuf.data); @@ -302,7 +276,6 @@ main(argc,argv) /* write private message to server */ if (krb5_write_message(context, &local_socket, &msg_data)){ fprintf(stderr, "Write Error During First Message Transmission!\n"); - free(send_cksum.contents); exit(1); } free(msg_data.data); @@ -312,22 +285,13 @@ main(argc,argv) if (retval = krb5_read_message(context, &local_socket, &inbuf)){ fprintf(stderr, "Read Error During First Reply: %s!\n", error_message(retval)); - free(send_cksum.contents); exit(1); } - if ((retval = krb5_rd_priv(context, &inbuf, - &my_creds.keyblock, - &foreign_addr, - &local_addr, - rep_ret->seq_number, - KRB5_PRIV_DOSEQUENCE|KRB5_PRIV_NOTIME, - 0, - 0, - &msg_data))) { + if ((retval = krb5_rd_priv(context, new_auth_context, &inbuf, + &msg_data, &replaydata))) { fprintf(stderr, "Error during First Read Decoding: %s!\n", error_message(retval)); - free(send_cksum.contents); exit(1); } free(inbuf.data); @@ -346,109 +310,65 @@ repeat: if (!strcmp(command_type, "add")) { valid++; oper_type = ADDOPER; - if (retval = kadm_add_user(context, &my_creds, - rep_ret, - &local_addr, - &foreign_addr, - &local_socket, - &seqno, - oper_type, - princ_name)) break; + if (retval = kadm_add_user(context, new_auth_context, &my_creds, + &local_socket, oper_type, princ_name)) + break; } if (!strcmp(command_type, "cpw")) { valid++; oper_type = CHGOPER; - if (retval = kadm_cpw_user(context, &my_creds, - rep_ret, - &local_addr, - &foreign_addr, - &local_socket, - &seqno, - oper_type, - princ_name)) break; + if (retval = kadm_cpw_user(context, new_auth_context, &my_creds, + &local_socket, oper_type, princ_name)) + break; } if (!strcmp(command_type, "addrnd")) { valid++; - if (retval = kadm_add_user_rnd(context, &my_creds, - rep_ret, - &local_addr, - &foreign_addr, - &local_socket, - &seqno, - princ_name)) break; + if (retval = kadm_add_user_rnd(context, new_auth_context, &my_creds, + &local_socket, princ_name)) + break; } if (!strcmp(command_type, "cpwrnd")) { valid++; - if (retval = kadm_cpw_user_rnd(context, &my_creds, - rep_ret, - &local_addr, - &foreign_addr, - &local_socket, - &seqno, - princ_name)) break; + if (retval = kadm_cpw_user_rnd(context, new_auth_context, &my_creds, + &local_socket, princ_name)) + break; } if (!strcmp(command_type, "del")) { valid++; - if (retval = kadm_del_user(context, &my_creds, - rep_ret, - &local_addr, - &foreign_addr, - &local_socket, - &seqno, - princ_name)) break; + if (retval = kadm_del_user(context, new_auth_context, &my_creds, + &local_socket, princ_name)) + break; } if (!strcmp(command_type, "inq")) { valid++; - if (retval = kadm_inq_user(context, &my_creds, - rep_ret, - &local_addr, - &foreign_addr, - &local_socket, - &seqno, - princ_name)) break; + if (retval = kadm_inq_user(context, new_auth_context, &my_creds, + &local_socket, princ_name)) + break; } if (!strcmp(command_type, "mod")) { valid++; - if (retval = kadm_mod_user(context, &my_creds, - rep_ret, - &local_addr, - &foreign_addr, - &local_socket, - &seqno, - princ_name)) break; + if (retval = kadm_mod_user(context, new_auth_context, &my_creds, + &local_socket, princ_name)) + break; } if (!strcmp(command_type, "addv4")) { valid++; oper_type = AD4OPER; - if (retval = kadm_add_user(context, &my_creds, - rep_ret, - &local_addr, - &foreign_addr, - &local_socket, - &seqno, - oper_type, - princ_name)) break; + if (retval = kadm_add_user(context, new_auth_context, &my_creds, + &local_socket, oper_type, princ_name)) + break; } if (!strcmp(command_type, "cpwv4")) { valid++; oper_type = CH4OPER; - if (retval = kadm_cpw_user(context, &my_creds, - rep_ret, - &local_addr, - &foreign_addr, - &local_socket, - &seqno, - oper_type, - princ_name)) break; + if (retval = kadm_cpw_user(context, new_auth_context, &my_creds, + &local_socket, oper_type, princ_name)) + break; } if (!strcmp(command_type, "q")) { valid++; - retval = kadm_done(context, &my_creds, - rep_ret, - &local_addr, - &foreign_addr, - &local_socket, - &seqno); + retval = kadm_done(context, new_auth_context, &my_creds, + &local_socket); break; } @@ -459,7 +379,6 @@ repeat: } if (retval) { - free(send_cksum.contents); exit(1); } @@ -467,22 +386,13 @@ repeat: if (retval = krb5_read_message(context, &local_socket, &inbuf)){ fprintf(stderr, "Read Error During Final Reply: %s!\n", error_message(retval)); - free(send_cksum.contents); exit(1); } - if ((retval = krb5_rd_priv(context, &inbuf, - &my_creds.keyblock, - &foreign_addr, - &local_addr, - rep_ret->seq_number, - KRB5_PRIV_DOSEQUENCE|KRB5_PRIV_NOTIME, - 0, - 0, - &msg_data))) { + if ((retval = krb5_rd_priv(context, new_auth_context, &inbuf, + &msg_data, &replaydata))) { fprintf(stderr, "Error during Final Read Decoding :%s!\n", error_message(retval)); - free(send_cksum.contents); free(inbuf.data); exit(1); } @@ -505,7 +415,6 @@ repeat: if (rd_priv_resp.message) free(rd_priv_resp.message); - free(send_cksum.contents); exit(retval); } diff --git a/src/kadmin/client/kadmin_add.c b/src/kadmin/client/kadmin_add.c index b8f15eba2..6c98be9a0 100644 --- a/src/kadmin/client/kadmin_add.c +++ b/src/kadmin/client/kadmin_add.c @@ -29,22 +29,21 @@ #include "com_err.h" #include -#include "k5-int.h" + +#include "krb5.h" void decode_kadmind_reply(); int print_status_message(); krb5_error_code -kadm_add_user(context, my_creds, rep_ret, local_addr, foreign_addr, - local_socket, seqno, oper_type, principal) - krb5_context context; - krb5_creds *my_creds; - krb5_ap_rep_enc_part *rep_ret; - krb5_address *local_addr, *foreign_addr; - int *local_socket; - krb5_int32 *seqno; - int oper_type; - char *principal; +kadm_add_user(context, auth_context, my_creds, local_socket, + oper_type, principal) + krb5_context context; + krb5_auth_context * auth_context; + krb5_creds * my_creds; + int * local_socket; + int oper_type; + char * principal; { krb5_data msg_data, inbuf; kadmin_requests rd_priv_resp; @@ -52,6 +51,7 @@ kadm_add_user(context, my_creds, rep_ret, local_addr, foreign_addr, char *password; int pwsize; int count; + krb5_replay_data replaydata; krb5_error_code retval; /* return code */ if ((inbuf.data = (char *) calloc(1, 3 + sizeof(username))) == (char *) 0) { @@ -86,16 +86,8 @@ kadm_add_user(context, my_creds, rep_ret, local_addr, foreign_addr, (void) memcpy( inbuf.data + 3, username, strlen(username)); inbuf.length = strlen(username) + 3; - if ((retval = krb5_mk_priv(context, &inbuf, - ETYPE_DES_CBC_CRC, - &my_creds->keyblock, - local_addr, - foreign_addr, - *seqno, - KRB5_PRIV_DOSEQUENCE|KRB5_PRIV_NOTIME, - 0, - 0, - &msg_data))) { + if ((retval = krb5_mk_priv(context, auth_context, &inbuf, + &msg_data, &replaydata))) { fprintf(stderr, "Error during Second Message Encoding: %s!\n", error_message(retval)); free(inbuf.data); @@ -117,15 +109,8 @@ kadm_add_user(context, my_creds, rep_ret, local_addr, foreign_addr, return(1); } - if (retval = krb5_rd_priv(context, &inbuf, - &my_creds->keyblock, - foreign_addr, - local_addr, - rep_ret->seq_number, - KRB5_PRIV_DOSEQUENCE|KRB5_PRIV_NOTIME, - 0, - 0, - &msg_data)) { + if (retval = krb5_rd_priv(context, auth_context, &inbuf, + &msg_data, &replaydata)) { fprintf(stderr, "Error during Second Read Decoding :%s!\n", error_message(retval)); free(inbuf.data); @@ -207,16 +192,8 @@ kadm_add_user(context, my_creds, rep_ret, local_addr, foreign_addr, #endif /* MACH_PASS */ - if ((retval = krb5_mk_priv(context, &inbuf, - ETYPE_DES_CBC_CRC, - &my_creds->keyblock, - local_addr, - foreign_addr, - *seqno, - KRB5_PRIV_DOSEQUENCE|KRB5_PRIV_NOTIME, - 0, - 0, - &msg_data))) { + if ((retval = krb5_mk_priv(context, auth_context, &inbuf, + &msg_data, &replaydata))) { fprintf(stderr, "Error during Second Message Encoding: %s!\n", error_message(retval)); free(inbuf.data); @@ -238,15 +215,8 @@ kadm_add_user(context, my_creds, rep_ret, local_addr, foreign_addr, retval = 1; } - if ((retval = krb5_rd_priv(context, &inbuf, - &my_creds->keyblock, - foreign_addr, - local_addr, - rep_ret->seq_number, - KRB5_PRIV_DOSEQUENCE|KRB5_PRIV_NOTIME, - 0, - 0, - &msg_data))) { + if ((retval = krb5_rd_priv(context, auth_context, &inbuf, + &msg_data, &replaydata))) { fprintf(stderr, "Error during Final Read Decoding :%s!\n", error_message(retval)); free(inbuf.data); diff --git a/src/kadmin/client/kadmin_adr.c b/src/kadmin/client/kadmin_adr.c index 7f9d75b0e..52a8d3f73 100644 --- a/src/kadmin/client/kadmin_adr.c +++ b/src/kadmin/client/kadmin_adr.c @@ -26,20 +26,20 @@ #include #include #include -#include "com_err.h" +#include + #include -#include "k5-int.h" + +#include void decode_kadmind_reply(); int print_status_message(); krb5_error_code -kadm_add_user_rnd(context, my_creds, rep_ret, local_addr, foreign_addr, +kadm_add_user_rnd(context, auth_context, my_creds, local_socket, seqno, principal) krb5_context context; - krb5_creds *my_creds; - krb5_ap_rep_enc_part *rep_ret; - krb5_address *local_addr, *foreign_addr; + krb5_auth_context *auth_context; int *local_socket; krb5_int32 *seqno; char *principal; @@ -48,6 +48,7 @@ kadm_add_user_rnd(context, my_creds, rep_ret, local_addr, foreign_addr, kadmin_requests rd_priv_resp; char username[755]; int count; + krb5_replay_data replaydata; krb5_error_code retval; /* return code */ if ((inbuf.data = (char *) calloc(1, 3 + sizeof(username))) == (char *) 0) { @@ -83,16 +84,8 @@ kadm_add_user_rnd(context, my_creds, rep_ret, local_addr, foreign_addr, (void) memcpy( inbuf.data + 3, username, strlen(username)); inbuf.length = strlen(username) + 3; - if ((retval = krb5_mk_priv(context, &inbuf, - ETYPE_DES_CBC_CRC, - &my_creds->keyblock, - local_addr, - foreign_addr, - *seqno, - KRB5_PRIV_DOSEQUENCE|KRB5_PRIV_NOTIME, - 0, - 0, - &msg_data))) { + if ((retval = krb5_mk_priv(context, auth_context, &inbuf, + &msg_data, &replaydata))) { fprintf(stderr, "Error during Second Message Encoding: %s!\n", error_message(retval)); free(inbuf.data); @@ -115,15 +108,8 @@ kadm_add_user_rnd(context, my_creds, rep_ret, local_addr, foreign_addr, retval = 1; } - if ((retval = krb5_rd_priv(context, &inbuf, - &my_creds->keyblock, - foreign_addr, - local_addr, - rep_ret->seq_number, - KRB5_PRIV_DOSEQUENCE|KRB5_PRIV_NOTIME, - 0, - 0, - &msg_data))) { + if ((retval = krb5_rd_priv(context, auth_context, &inbuf, + &msg_data, &replaydata))) { fprintf(stderr, "Error during Final Read Decoding :%s!\n", error_message(retval)); free(inbuf.data); diff --git a/src/kadmin/client/kadmin_cpr.c b/src/kadmin/client/kadmin_cpr.c index fec738ebd..d938ff3f5 100644 --- a/src/kadmin/client/kadmin_cpr.c +++ b/src/kadmin/client/kadmin_cpr.c @@ -27,22 +27,20 @@ #include #include #include -#include "com_err.h" +#include #include -#include "k5-int.h" +#include void decode_kadmind_reply(); int print_status_message(); krb5_error_code -kadm_cpw_user_rnd(context, my_creds, rep_ret, local_addr, foreign_addr, +kadm_cpw_user_rnd(context, auth_context, my_creds, local_socket, seqno, principal) krb5_context context; - krb5_creds *my_creds; - krb5_ap_rep_enc_part *rep_ret; - krb5_address *local_addr, *foreign_addr; + krb5_auth_context *auth_context; int *local_socket; krb5_int32 *seqno; char *principal; @@ -51,6 +49,7 @@ kadm_cpw_user_rnd(context, my_creds, rep_ret, local_addr, foreign_addr, kadmin_requests rd_priv_resp; char username[755]; int count; + krb5_replay_data replaydata; krb5_error_code retval; /* return code */ if ((inbuf.data = (char *) calloc(1, 3 + sizeof(username))) == (char *) 0) { fprintf(stderr, "No memory for command!\n"); @@ -86,16 +85,8 @@ kadm_cpw_user_rnd(context, my_creds, rep_ret, local_addr, foreign_addr, inbuf.length = strlen(username) + 3; /* Transmit Principal Name */ - if ((retval = krb5_mk_priv(context, &inbuf, - ETYPE_DES_CBC_CRC, - &my_creds->keyblock, - local_addr, - foreign_addr, - *seqno, - KRB5_PRIV_DOSEQUENCE|KRB5_PRIV_NOTIME, - 0, - 0, - &msg_data))) { + if ((retval = krb5_mk_priv(context, auth_context, &inbuf, + &msg_data, &replaydata))) { fprintf(stderr, "Error during Second Message Encoding: %s!\n", error_message(retval)); free(inbuf.data); @@ -117,15 +108,8 @@ kadm_cpw_user_rnd(context, my_creds, rep_ret, local_addr, foreign_addr, retval = 1; } - if ((retval = krb5_rd_priv(context, &inbuf, - &my_creds->keyblock, - foreign_addr, - local_addr, - rep_ret->seq_number, - KRB5_PRIV_DOSEQUENCE|KRB5_PRIV_NOTIME, - 0, - 0, - &msg_data))) { + if ((retval = krb5_rd_priv(context, auth_context, &inbuf, + &msg_data, &replaydata))) { fprintf(stderr, "Error during Final Read Decoding :%s!\n", error_message(retval)); free(inbuf.data); diff --git a/src/kadmin/client/kadmin_cpw.c b/src/kadmin/client/kadmin_cpw.c index 194e0f98b..34d39acba 100644 --- a/src/kadmin/client/kadmin_cpw.c +++ b/src/kadmin/client/kadmin_cpw.c @@ -27,24 +27,21 @@ #include #include #include -#include "com_err.h" +#include #include -#include "k5-int.h" +#include void decode_kadmind_reply(); int print_status_message(); krb5_error_code -kadm_cpw_user(context, my_creds, rep_ret, local_addr, foreign_addr, - local_socket, seqno, oper_type, principal) +kadm_cpw_user(context, auth_context, my_creds, + local_socket, oper_type, principal) krb5_context context; - krb5_creds *my_creds; - krb5_ap_rep_enc_part *rep_ret; - krb5_address *local_addr, *foreign_addr; + krb5_auth_context *auth_context; int *local_socket; - krb5_int32 *seqno; int oper_type; char *principal; { @@ -54,6 +51,7 @@ kadm_cpw_user(context, my_creds, rep_ret, local_addr, foreign_addr, char *password; int pwsize; int count; + krb5_replay_data replaydata; krb5_error_code retval; /* return code */ if ((inbuf.data = (char *) calloc(1, 3 + sizeof(username))) == (char *) 0) { fprintf(stderr, "No memory for command!\n"); @@ -90,16 +88,8 @@ kadm_cpw_user(context, my_creds, rep_ret, local_addr, foreign_addr, inbuf.length = strlen(username) + 3; /* Transmit Principal Name */ - if ((retval = krb5_mk_priv(context, &inbuf, - ETYPE_DES_CBC_CRC, - &my_creds->keyblock, - local_addr, - foreign_addr, - *seqno, - KRB5_PRIV_DOSEQUENCE|KRB5_PRIV_NOTIME, - 0, - 0, - &msg_data))) { + if ((retval = krb5_mk_priv(context, auth_context, &inbuf, + &msg_data, &replaydata))) { fprintf(stderr, "Error during Second Message Encoding: %s!\n", error_message(retval)); free(inbuf.data); @@ -121,15 +111,8 @@ kadm_cpw_user(context, my_creds, rep_ret, local_addr, foreign_addr, return(1); } - if ((retval = krb5_rd_priv(context, &inbuf, - &my_creds->keyblock, - foreign_addr, - local_addr, - rep_ret->seq_number, - KRB5_PRIV_DOSEQUENCE|KRB5_PRIV_NOTIME, - 0, - 0, - &msg_data))) { + if ((retval = krb5_rd_priv(context, auth_context, &inbuf, + &msg_data, &replaydata))) { fprintf(stderr, "Error during Second Read Decoding :%s!\n", error_message(retval)); free(inbuf.data); @@ -219,16 +202,8 @@ kadm_cpw_user(context, my_creds, rep_ret, local_addr, foreign_addr, #endif /* MACH_PASS */ - if ((retval = krb5_mk_priv(context, &inbuf, - ETYPE_DES_CBC_CRC, - &my_creds->keyblock, - local_addr, - foreign_addr, - *seqno, - KRB5_PRIV_DOSEQUENCE|KRB5_PRIV_NOTIME, - 0, - 0, - &msg_data))) { + if ((retval = krb5_mk_priv(context, auth_context, &inbuf, + &msg_data, &replaydata))) { fprintf(stderr, "Error during Second Message Encoding: %s!\n", error_message(retval)); free(inbuf.data); @@ -250,15 +225,8 @@ kadm_cpw_user(context, my_creds, rep_ret, local_addr, foreign_addr, retval = 1; } - if ((retval = krb5_rd_priv(context, &inbuf, - &my_creds->keyblock, - foreign_addr, - local_addr, - rep_ret->seq_number, - KRB5_PRIV_DOSEQUENCE|KRB5_PRIV_NOTIME, - 0, - 0, - &msg_data))) { + if ((retval = krb5_rd_priv(context, auth_context, &inbuf, + &msg_data, &replaydata))) { fprintf(stderr, "Error during Final Read Decoding :%s!\n", error_message(retval)); free(inbuf.data); diff --git a/src/kadmin/client/kadmin_del.c b/src/kadmin/client/kadmin_del.c index be4c9a91d..16ccfdffb 100644 --- a/src/kadmin/client/kadmin_del.c +++ b/src/kadmin/client/kadmin_del.c @@ -26,27 +26,25 @@ #include #include #include -#include "com_err.h" -#include "k5-int.h" +#include + +#include void decode_kadmind_reply(); int print_status_message(); krb5_error_code -kadm_del_user(context, my_creds, rep_ret, local_addr, foreign_addr, - local_socket, seqno, principal) +kadm_del_user(context, auth_context, my_creds, local_socket, principal) krb5_context context; - krb5_creds *my_creds; - krb5_ap_rep_enc_part *rep_ret; - krb5_address *local_addr, *foreign_addr; + krb5_auth_context *auth_context; int *local_socket; - krb5_int32 *seqno; char *principal; { krb5_data msg_data, inbuf; kadmin_requests rd_priv_resp; char username[755]; int count; + krb5_replay_data replaydata; krb5_error_code retval; /* return code */ if ((inbuf.data = (char *) calloc(1, 3 + sizeof(username))) == (char *) 0) { @@ -82,16 +80,8 @@ kadm_del_user(context, my_creds, rep_ret, local_addr, foreign_addr, (void) memcpy( inbuf.data + 3, username, strlen(username)); inbuf.length = strlen(username) + 3; - if ((retval = krb5_mk_priv(context, &inbuf, - ETYPE_DES_CBC_CRC, - &my_creds->keyblock, - local_addr, - foreign_addr, - *seqno, - KRB5_PRIV_DOSEQUENCE|KRB5_PRIV_NOTIME, - 0, - 0, - &msg_data))) { + if ((retval = krb5_mk_priv(context, auth_context, &inbuf, + &msg_data, &replaydata))) { fprintf(stderr, "Error during Second Message Encoding: %s!\n", error_message(retval)); free(inbuf.data); @@ -114,15 +104,8 @@ kadm_del_user(context, my_creds, rep_ret, local_addr, foreign_addr, return(1); } - if ((retval = krb5_rd_priv(context, &inbuf, - &my_creds->keyblock, - foreign_addr, - local_addr, - rep_ret->seq_number, - KRB5_PRIV_DOSEQUENCE|KRB5_PRIV_NOTIME, - 0, - 0, - &msg_data))) { + if ((retval = krb5_rd_priv(context, auth_context, &inbuf, + &msg_data, &replaydata))) { fprintf(stderr, "Error during Second Decoding :%s!\n", error_message(retval)); return(1); diff --git a/src/kadmin/client/kadmin_done.c b/src/kadmin/client/kadmin_done.c index a9585851d..6590096b0 100644 --- a/src/kadmin/client/kadmin_done.c +++ b/src/kadmin/client/kadmin_done.c @@ -26,20 +26,18 @@ #include #include #include -#include "com_err.h" +#include -#include "k5-int.h" +#include krb5_error_code -kadm_done(context, my_creds, rep_ret, local_addr, foreign_addr, - local_socket, seqno) +kadm_done(context, auth_context, my_creds, local_socket, seqno) krb5_context context; - krb5_creds *my_creds; - krb5_ap_rep_enc_part *rep_ret; - krb5_address *local_addr, *foreign_addr; + krb5_auth_context *auth_context; int *local_socket; krb5_int32 *seqno; { + krb5_replay_data replaydata; krb5_data msg_data, inbuf; krb5_error_code retval; /* return code */ char buf[16]; @@ -53,16 +51,8 @@ kadm_done(context, my_creds, rep_ret, local_addr, foreign_addr, (void) memset( inbuf.data + 4, 0, 4); inbuf.length = 16; - if ((retval = krb5_mk_priv(context, &inbuf, - ETYPE_DES_CBC_CRC, - &my_creds->keyblock, - local_addr, - foreign_addr, - *seqno, - KRB5_PRIV_DOSEQUENCE|KRB5_PRIV_NOTIME, - 0, - 0, - &msg_data))) { + if ((retval = krb5_mk_priv(context, auth_context, &inbuf, + &msg_data, &replaydata))) { fprintf(stderr, "Error during Second Message Encoding: %s!\n", error_message(retval)); return(1); diff --git a/src/kadmin/client/kadmin_inq.c b/src/kadmin/client/kadmin_inq.c index aa46cadfe..55988cdb7 100644 --- a/src/kadmin/client/kadmin_inq.c +++ b/src/kadmin/client/kadmin_inq.c @@ -27,24 +27,21 @@ #include #include #include -#include "com_err.h" +#include -#include "k5-int.h" +#include void decode_kadmind_reply(); int print_status_message(); krb5_error_code -kadm_inq_user(context, my_creds, rep_ret, local_addr, foreign_addr, - local_socket, seqno, principal) +kadm_inq_user(context, auth_context, my_creds, local_socket, principal) krb5_context context; - krb5_creds *my_creds; - krb5_ap_rep_enc_part *rep_ret; - krb5_address *local_addr, *foreign_addr; + krb5_auth_context *auth_context; int *local_socket; - krb5_int32 *seqno; char *principal; { + krb5_replay_data replaydata; krb5_data msg_data, inbuf; kadmin_requests rd_priv_resp; char username[755]; @@ -85,16 +82,8 @@ kadm_inq_user(context, my_creds, rep_ret, local_addr, foreign_addr, (void) memcpy( inbuf.data + 3, username, strlen(username)); inbuf.length = strlen(username) + 3; - if (retval = krb5_mk_priv(context, &inbuf, - ETYPE_DES_CBC_CRC, - &my_creds->keyblock, - local_addr, - foreign_addr, - *seqno, - KRB5_PRIV_DOSEQUENCE|KRB5_PRIV_NOTIME, - 0, - 0, - &msg_data)) { + if (retval = krb5_mk_priv(context, auth_context, &inbuf, + &msg_data, &replaydata)) { fprintf(stderr, "Error during Second Message Encoding: %s!\n", error_message(retval)); free(inbuf.data); @@ -116,15 +105,8 @@ kadm_inq_user(context, my_creds, rep_ret, local_addr, foreign_addr, return(1); } - if (retval = krb5_rd_priv(context, &inbuf, - &my_creds->keyblock, - foreign_addr, - local_addr, - rep_ret->seq_number, - KRB5_PRIV_DOSEQUENCE|KRB5_PRIV_NOTIME, - 0, - 0, - &msg_data)) { + if (retval = krb5_rd_priv(context, auth_context, &inbuf, + &msg_data, &replaydata)) { fprintf(stderr, "Error during Second Read Decoding :%s!\n", error_message(retval)); free(inbuf.data); @@ -170,16 +152,8 @@ kadm_inq_user(context, my_creds, rep_ret, local_addr, foreign_addr, inbuf.data[1] = KADMGOOD; inbuf.length = 2; - if (retval = krb5_mk_priv(context, &inbuf, - ETYPE_DES_CBC_CRC, - &my_creds->keyblock, - local_addr, - foreign_addr, - *seqno, - KRB5_PRIV_DOSEQUENCE|KRB5_PRIV_NOTIME, - 0, - 0, - &msg_data)) { + if (retval = krb5_mk_priv(context, auth_context, &inbuf, + &msg_data, &replaydata)) { fprintf(stderr, "Error during Second Message Encoding: %s!\n", error_message(retval)); free(inbuf.data); @@ -202,15 +176,8 @@ kadm_inq_user(context, my_creds, rep_ret, local_addr, foreign_addr, retval = 1; } - if (retval = krb5_rd_priv(context, &inbuf, - &my_creds->keyblock, - foreign_addr, - local_addr, - rep_ret->seq_number, - KRB5_PRIV_DOSEQUENCE|KRB5_PRIV_NOTIME, - 0, - 0, - &msg_data)) { + if (retval = krb5_rd_priv(context, auth_context, &inbuf, + &msg_data, &replaydata)) { fprintf(stderr, "Error during Final Read Decoding :%s!\n", error_message(retval)); free(inbuf.data); diff --git a/src/kadmin/client/kadmin_mod.c b/src/kadmin/client/kadmin_mod.c index d955e27ae..88105281e 100644 --- a/src/kadmin/client/kadmin_mod.c +++ b/src/kadmin/client/kadmin_mod.c @@ -27,27 +27,26 @@ #include #include #include -#include "k5-int.h" -#include "com_err.h" +#include + +#include void decode_kadmind_reply(); int print_status_message(); krb5_error_code -kadm_mod_user(context, my_creds, rep_ret, local_addr, foreign_addr, - local_socket, seqno, principal) +kadm_mod_user(context, auth_context, my_creds, local_socket, principal) krb5_context context; + krb5_auth_context *auth_context; krb5_creds *my_creds; - krb5_ap_rep_enc_part *rep_ret; - krb5_address *local_addr, *foreign_addr; int *local_socket; - krb5_int32 *seqno; char *principal; { krb5_data msg_data, inbuf; kadmin_requests rd_priv_resp; char username[755]; int count; + krb5_replay_data replaydata; krb5_error_code retval; /* return code */ if ((inbuf.data = (char *) calloc(1, 3 + sizeof(username))) == (char *) 0) { fprintf(stderr, "No memory for command!\n"); @@ -82,16 +81,8 @@ kadm_mod_user(context, my_creds, rep_ret, local_addr, foreign_addr, (void) memcpy( inbuf.data + 3, username, strlen(username)); inbuf.length = strlen(username) + 3; - if ((retval = krb5_mk_priv(context, &inbuf, - ETYPE_DES_CBC_CRC, - &my_creds->keyblock, - local_addr, - foreign_addr, - *seqno, - KRB5_PRIV_DOSEQUENCE|KRB5_PRIV_NOTIME, - 0, - 0, - &msg_data))) { + if ((retval = krb5_mk_priv(context, auth_context, &inbuf, + &msg_data, &replaydata))) { fprintf(stderr, "Error during Second Message Encoding: %s!\n", error_message(retval)); free(inbuf.data); @@ -113,15 +104,8 @@ kadm_mod_user(context, my_creds, rep_ret, local_addr, foreign_addr, return(1); } - if ((retval = krb5_rd_priv(context, &inbuf, - &my_creds->keyblock, - foreign_addr, - local_addr, - rep_ret->seq_number, - KRB5_PRIV_DOSEQUENCE|KRB5_PRIV_NOTIME, - 0, - 0, - &msg_data))) { + if ((retval = krb5_rd_priv(context, auth_context, &inbuf, + &msg_data, &replaydata))) { fprintf(stderr, "Error during Second Read Decoding :%s!\n", error_message(retval)); free(inbuf.data); @@ -142,8 +126,7 @@ kadm_mod_user(context, my_creds, rep_ret, local_addr, foreign_addr, } free(msg_data.data); - kadm_snd_mod(my_creds, rep_ret, local_addr, - foreign_addr, local_socket, seqno); + kadm_snd_mod(context, auth_context, my_creds, local_socket); if ((inbuf.data = (char *) calloc(1, 2)) == (char *) 0) { fprintf(stderr, "No memory for command!\n"); @@ -156,16 +139,8 @@ kadm_mod_user(context, my_creds, rep_ret, local_addr, foreign_addr, inbuf.data[2] = SENDDATA3; inbuf.length = 3; - if ((retval = krb5_mk_priv(context, &inbuf, - ETYPE_DES_CBC_CRC, - &my_creds->keyblock, - local_addr, - foreign_addr, - *seqno, - KRB5_PRIV_DOSEQUENCE|KRB5_PRIV_NOTIME, - 0, - 0, - &msg_data))) { + if ((retval = krb5_mk_priv(context, auth_context, &inbuf, + &msg_data, &replaydata))) { fprintf(stderr, "Error during Second Message Encoding: %s!\n", error_message(retval)); free(inbuf.data); @@ -188,15 +163,8 @@ kadm_mod_user(context, my_creds, rep_ret, local_addr, foreign_addr, retval = 1; } - if ((retval = krb5_rd_priv(context, &inbuf, - &my_creds->keyblock, - foreign_addr, - local_addr, - rep_ret->seq_number, - KRB5_PRIV_DOSEQUENCE|KRB5_PRIV_NOTIME, - 0, - 0, - &msg_data))) { + if ((retval = krb5_rd_priv(context, auth_context, &inbuf, + &msg_data, &replaydata))) { fprintf(stderr, "Error during Final Read Decoding :%s!\n", error_message(retval)); free(inbuf.data); diff --git a/src/kadmin/client/kadmin_msnd.c b/src/kadmin/client/kadmin_msnd.c index c106e2841..7fc626de1 100644 --- a/src/kadmin/client/kadmin_msnd.c +++ b/src/kadmin/client/kadmin_msnd.c @@ -28,29 +28,27 @@ #include #include #include -#include "com_err.h" +#include #include #include #include -#include "k5-int.h" +#include #ifndef MAXPATHLEN #define MAXPATHLEN 1024 #endif krb5_error_code -kadm_snd_mod(context, my_creds, rep_ret, local_addr, foreign_addr, - local_socket, seqno) +kadm_snd_mod(context, auth_context, my_creds, local_socket) krb5_context context; + krb5_auth_context *auth_context; krb5_creds *my_creds; - krb5_ap_rep_enc_part *rep_ret; - krb5_address *local_addr, *foreign_addr; int *local_socket; - krb5_int32 *seqno; { + krb5_replay_data replaydata; krb5_error_code retval; /* return code */ krb5_data msg_data, inbuf; char mod_type[10]; @@ -210,16 +208,8 @@ repeat3: inbuf.data[1] = MODOPER; inbuf.data[2] = SENDDATA3; - if ((retval = krb5_mk_priv(context, &inbuf, - ETYPE_DES_CBC_CRC, - &my_creds->keyblock, - local_addr, - foreign_addr, - *seqno, - KRB5_PRIV_DOSEQUENCE|KRB5_PRIV_NOTIME, - 0, - 0, - &msg_data))) { + if ((retval = krb5_mk_priv(context, auth_context, &inbuf, + &msg_data, &replaydata))) { fprintf(stderr, "Error during Second Message Encoding: %s!\n", error_message(retval)); free(inbuf.data); @@ -241,15 +231,8 @@ repeat3: return(1); } - if ((retval = krb5_rd_priv(context, &inbuf, - &my_creds->keyblock, - foreign_addr, - local_addr, - rep_ret->seq_number, - KRB5_PRIV_DOSEQUENCE|KRB5_PRIV_NOTIME, - 0, - 0, - &msg_data))) { + if ((retval = krb5_rd_priv(context, auth_context, &inbuf, + &msg_data, &replaydata))) { fprintf(stderr, "Error during Second Read Decoding :%s!\n", error_message(retval)); free(inbuf.data); @@ -269,16 +252,8 @@ alldone: inbuf.data[2] = SENDDATA3; inbuf.length = 3; - if ((retval = krb5_mk_priv(context, &inbuf, - ETYPE_DES_CBC_CRC, - &my_creds->keyblock, - local_addr, - foreign_addr, - *seqno, - KRB5_PRIV_DOSEQUENCE|KRB5_PRIV_NOTIME, - 0, - 0, - &msg_data))) { + if ((retval = krb5_mk_priv(context, auth_context, &inbuf, + &msg_data, &replaydata))) { fprintf(stderr, "Error during Second Message Encoding: %s!\n", error_message(retval)); free(inbuf.data);