aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTheodore Tso <tytso@mit.edu>1991-03-29 15:49:29 +0000
committerTheodore Tso <tytso@mit.edu>1991-03-29 15:49:29 +0000
commit4baee4d8daf23a3902dc8fa507534b7413e373b5 (patch)
tree461881b89c92229ec61e5e0d213ba066b3fe6317 /src
parentd54f7c390304abba83886234e2ee03d35b2f07b0 (diff)
downloadkrb5-4baee4d8daf23a3902dc8fa507534b7413e373b5.zip
krb5-4baee4d8daf23a3902dc8fa507534b7413e373b5.tar.gz
krb5-4baee4d8daf23a3902dc8fa507534b7413e373b5.tar.bz2
krb5_sendauth() and company moved to the Kerberos library
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@1973 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src')
-rw-r--r--src/slave/Imakefile8
-rw-r--r--src/slave/kprop.c19
-rw-r--r--src/slave/kprop.h5
-rw-r--r--src/slave/kpropd.c39
4 files changed, 44 insertions, 27 deletions
diff --git a/src/slave/Imakefile b/src/slave/Imakefile
index ddb0b10..1c2fb4c 100644
--- a/src/slave/Imakefile
+++ b/src/slave/Imakefile
@@ -12,11 +12,11 @@
DEPLIBS = $(DEPKLIB)
LOCAL_LIBRARIES = $(KLIB)
-CLIENTSRCS= sendauth.c kprop.c
-CLIENTOBJS= sendauth.o kprop.o
+CLIENTSRCS= kprop.c
+CLIENTOBJS= kprop.o
-SERVERSRCS= sendauth.c kpropd.c
-SERVEROBJS= sendauth.o kpropd.o
+SERVERSRCS= kpropd.c
+SERVEROBJS= kpropd.o
all:: kprop kpropd
diff --git a/src/slave/kprop.c b/src/slave/kprop.c
index cf9a18c..bd79525 100644
--- a/src/slave/kprop.c
+++ b/src/slave/kprop.c
@@ -21,7 +21,7 @@ static char rcsid_kprop_c[] =
#include <krb5/kdb.h>
#include <krb5/kdb_dbm.h>
#include <krb5/ext-proto.h>
-#include <krb5/libos-proto.h>
+#include <krb5/los-proto.h>
#include <com_err.h>
#include <errno.h>
@@ -348,12 +348,11 @@ void kerberos_authenticate(fd, me)
krb5_error_code retval;
krb5_error *error = NULL;
krb5_ap_rep_enc_part *rep_result;
- struct timeval mytime;
- if (retval = krb5_sendauth(fd, kprop_version, me, my_creds.server,
- AP_OPTS_MUTUAL_REQUIRED, &my_seq_num, NULL,
- NULL, &my_creds, NULL, &error,
- &rep_result)) {
+ if (retval = krb5_sendauth((void *)&fd, kprop_version, me,
+ my_creds.server, AP_OPTS_MUTUAL_REQUIRED,
+ NULL, &my_creds, NULL, &my_seq_num, NULL,
+ &error, &rep_result)) {
com_err(progname, retval, "while authenticating to server");
if (error) {
if (error->error == KRB_ERR_GENERIC) {
@@ -472,7 +471,7 @@ xmit_database(fd, database_fd, database_size)
send_error(fd, "while encoding database size", retval);
exit(1);
}
- if (retval = krb5_write_message(fd, &outbuf)) {
+ if (retval = krb5_write_message((void *) &fd, &outbuf)) {
xfree(outbuf.data);
com_err(progname, retval, "while sending database size");
exit(1);
@@ -513,7 +512,7 @@ xmit_database(fd, database_fd, database_size)
send_error(fd, buf, retval);
exit(1);
}
- if (retval = krb5_write_message(fd, &outbuf)) {
+ if (retval = krb5_write_message((void *) &fd, &outbuf)) {
xfree(outbuf.data);
com_err(progname, retval,
"while sending database block starting at %d",
@@ -535,7 +534,7 @@ xmit_database(fd, database_fd, database_size)
* OK, we've sent the database; now let's wait for a success
* indication from the remote end.
*/
- if (retval = krb5_read_message(fd, &inbuf)) {
+ if (retval = krb5_read_message((void *) &fd, &inbuf)) {
com_err(progname, retval,
"while reading response from server");
exit(1);
@@ -611,7 +610,7 @@ send_error(fd, err_text, err_code)
if (error.text.data = malloc(error.text.length)) {
strcpy(error.text.data, text);
if (!krb5_mk_error(&error, &outbuf)) {
- (void) krb5_write_message(fd, &outbuf);
+ (void) krb5_write_message((void *) &fd, &outbuf);
xfree(outbuf.data);
}
free(error.text.data);
diff --git a/src/slave/kprop.h b/src/slave/kprop.h
index 23d1777..04afc47 100644
--- a/src/slave/kprop.h
+++ b/src/slave/kprop.h
@@ -1,8 +1,10 @@
/*
* $Source$
* $Author$
+ * $Id$
*
- * Copyright 1990 by the Massachusetts Institute of Technology.
+ * Copyright 1990,1991 by the Massachusetts Institute of Technology.
+ * All Rights Reserved.
*
* For copying and distribution information, please see the file
* <krb5/copyright.h>.
@@ -22,3 +24,4 @@
#define KPROP_PROT_VERSION "kprop5_01"
#define KPROP_BUFSIZ 32768
+
diff --git a/src/slave/kpropd.c b/src/slave/kpropd.c
index 2e41dc5..f3cc395 100644
--- a/src/slave/kpropd.c
+++ b/src/slave/kpropd.c
@@ -8,6 +8,12 @@
* For copying and distribution information, please see the file
* <krb5/copyright.h>.
*
+ * XXX We need to modify the protocol so that an acknowledge is set
+ * after each block, instead after the entire series is sent over.
+ * The reason for this is so that error packets can get interpreted
+ * right away. If you don't do this, the sender may never get the
+ * error packet, because it will die an EPIPE trying to complete the
+ * write...
*/
#if !defined(lint) && !defined(SABER)
@@ -21,7 +27,7 @@ static char rcsid_kpropd_c[] =
#include <krb5/kdb.h>
#include <krb5/kdb_dbm.h>
#include <krb5/ext-proto.h>
-#include <krb5/libos-proto.h>
+#include <krb5/los-proto.h>
#include <com_err.h>
#include <errno.h>
@@ -177,7 +183,6 @@ void doit(fd)
int on = 1, fromlen;
struct hostent *hp;
krb5_error_code retval;
- struct timeval my_time;
int lock_fd;
fromlen = sizeof (from);
@@ -494,9 +499,10 @@ kerberos_authenticate(fd, clientp, sin)
memcpy((char *) receiver_addr.contents, (char *) &r_sin.sin_addr,
sizeof(r_sin.sin_addr));
- if (retval = krb5_recvauth(fd, kprop_version, server, &sender_addr,
- kerb_keytab, NULL, NULL, &my_seq_num,
- "dfl", clientp, &ticket, &authent)) {
+ if (retval = krb5_recvauth((void *) &fd, kprop_version, server,
+ &sender_addr, kerb_keytab, NULL, NULL,
+ "dfl", &my_seq_num, clientp, &ticket,
+ &authent)) {
syslog(LOG_ERR, "Error in krb5_recvauth: %s",
error_message(retval));
exit(1);
@@ -575,7 +581,7 @@ recv_database(fd, database_fd)
/*
* Receive and decode size from client
*/
- if (retval = krb5_read_message(fd, &inbuf)) {
+ if (retval = krb5_read_message((void *) &fd, &inbuf)) {
send_error(fd, retval, "while reading database size");
com_err(progname, retval,
"while reading size of database from client");
@@ -614,7 +620,7 @@ recv_database(fd, database_fd)
*/
received_size = 0;
while (received_size < database_size) {
- if (retval = krb5_read_message(fd, &inbuf)) {
+ if (retval = krb5_read_message((void *) &fd, &inbuf)) {
sprintf(buf,
"while reading database block starting at offset %d",
received_size);
@@ -683,7 +689,7 @@ recv_database(fd, database_fd)
"while encoding # of received bytes");
exit(1);
}
- if (retval = krb5_write_message(fd, &outbuf)) {
+ if (retval = krb5_write_message((void *) &fd, &outbuf)) {
xfree(outbuf.data);
com_err(progname, retval,
"while sending # of receeived bytes");
@@ -702,23 +708,32 @@ send_error(fd, err_code, err_text)
krb5_error error;
const char *text;
krb5_data outbuf;
+ char buf[1024];
memset((char *)&error, 0, sizeof(error));
krb5_us_timeofday(&error.stime, &error.susec);
error.server = server;
error.client = client;
- error.error = err_code - ERROR_TABLE_BASE_krb5;
- if (error.error < 0 || error.error > 127)
- error.error = KRB_ERR_GENERIC;
+
if (err_text)
text = err_text;
else
text = error_message(err_code);
+
+ error.error = err_code - ERROR_TABLE_BASE_krb5;
+ if (error.error < 0 || error.error > 127) {
+ error.error = KRB_ERR_GENERIC;
+ if (err_text) {
+ sprintf(buf, "%s %s", error_message(err_code),
+ err_text);
+ text = buf;
+ }
+ }
error.text.length = strlen(text) + 1;
if (error.text.data = malloc(error.text.length)) {
strcpy(error.text.data, text);
if (!krb5_mk_error(&error, &outbuf)) {
- (void) krb5_write_message(fd, &outbuf);
+ (void) krb5_write_message((void *) &fd, &outbuf);
xfree(outbuf.data);
}
free(error.text.data);