#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>
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) {
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);
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",
* 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);
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);
* 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)
#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>
int on = 1, fromlen;
struct hostent *hp;
krb5_error_code retval;
- struct timeval my_time;
int lock_fd;
fromlen = sizeof (from);
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);
/*
* 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");
*/
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);
"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");
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);