From 626c328215894db61bdf4ff2013d4eb644e96ffd Mon Sep 17 00:00:00 2001 From: John Kohl Date: Fri, 1 Mar 1991 15:44:56 +0000 Subject: [PATCH] use the internal sequence-numbering code git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@1832 dc483132-0cff-0310-8789-dd5450dbe970 --- src/slave/kprop.c | 13 +++---------- src/slave/kpropd.c | 13 ++++--------- 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/src/slave/kprop.c b/src/slave/kprop.c index 45ae9b260..05351df42 100644 --- a/src/slave/kprop.c +++ b/src/slave/kprop.c @@ -53,8 +53,8 @@ krb5_principal my_principal; /* The Kerberos principal we'll be */ /* get_tickets() */ krb5_ccache ccache; /* Credentials cache which we'll be using */ krb5_creds my_creds; /* My credentials */ -int my_seq_num; /* Sequence number to use for connection */ -int his_seq_num; /* Remote sequence number */ +krb5_int32 my_seq_num; /* Sequence number to use for connection */ +krb5_int32 his_seq_num; /* Remote sequence number */ krb5_address sender_addr; krb5_address receiver_addr; @@ -350,15 +350,8 @@ void kerberos_authenticate(fd, me) krb5_ap_rep_enc_part *rep_result; struct timeval mytime; - /* - * Generate a random key to use as a sequence number - */ - gettimeofday(&mytime, NULL); - srandom(mytime.tv_usec ^ mytime.tv_sec ^ (9 * getpid())); - my_seq_num = random(); - if (retval = krb5_sendauth(fd, kprop_version, me, my_creds.server, - AP_OPTS_MUTUAL_REQUIRED, my_seq_num, NULL, + AP_OPTS_MUTUAL_REQUIRED, &my_seq_num, NULL, NULL, &my_creds, NULL, &error, &rep_result)) { com_err(progname, retval, "while authenticating to server"); diff --git a/src/slave/kpropd.c b/src/slave/kpropd.c index 002ad5b4b..6691ddf87 100644 --- a/src/slave/kpropd.c +++ b/src/slave/kpropd.c @@ -70,8 +70,8 @@ char *kdb5_edit = KPROPD_DEFAULT_KDB5_EDIT; char *kerb_database = KPROPD_DEFAULT_KRB_DB; int database_fd; -int my_seq_num; /* Sequence number */ -int his_seq_num; /* The remote's sequence number */ +krb5_int32 my_seq_num; /* Sequence number */ +krb5_int32 his_seq_num; /* The remote's sequence number */ krb5_address sender_addr; krb5_address receiver_addr; @@ -204,12 +204,7 @@ void doit(fd) if (debug) printf("Connection from %s\n", hp->h_name); } - /* - * Create a random number for my sequence number. - */ - gettimeofday(&my_time, NULL); - srandom(my_time.tv_usec ^ my_time.tv_sec ^ (9 * getpid())); - my_seq_num = random(); + /* * Now do the authentication */ @@ -500,7 +495,7 @@ kerberos_authenticate(fd, clientp, sin) sizeof(r_sin.sin_addr)); if (retval = krb5_recvauth(fd, kprop_version, server, &sender_addr, - kerb_keytab, NULL, NULL, my_seq_num, + kerb_keytab, NULL, NULL, &my_seq_num, "dfl", clientp, &ticket, &authent)) { syslog(LOG_ERR, "Error in krb5_recvauth: %s", error_message(retval)); -- 2.26.2