krb5_sendauth() and company moved to the Kerberos library
authorTheodore Tso <tytso@mit.edu>
Fri, 29 Mar 1991 15:49:29 +0000 (15:49 +0000)
committerTheodore Tso <tytso@mit.edu>
Fri, 29 Mar 1991 15:49:29 +0000 (15:49 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@1973 dc483132-0cff-0310-8789-dd5450dbe970

src/slave/Imakefile
src/slave/kprop.c
src/slave/kprop.h
src/slave/kpropd.c

index ddb0b10794c2ff3fec967048bd12a573641c22fd..1c2fb4cad0bac6184a20f7c046e68019095e0608 100644 (file)
         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
 
index cf9a18c1cc7a82dddfa68c6cee8cacd4ce1db01f..bd795250e44b3fae7997f1f7250aa0b5fd56c03a 100644 (file)
@@ -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);
index 23d1777d777f9c087978712efd819cc6f3f9ca6f..04afc47fbc90d78f58d196cf9a0c232d983cc52c 100644 (file)
@@ -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
+
index 2e41dc58b9857e0fc3b8e4bf0bbcedfc50e9822a..f3cc395cd47065aa588ebd499172037593416d59 100644 (file)
@@ -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);