#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
+#ifdef HAVE_KRB4
#include <des.h>
#include <krb.h>
+#endif
+#include <krb5.h>
RCSID("$Header$");
+#ifdef HAVE_KRB4
extern des_cblock session;
+#endif
+extern char *whoami;
+extern krb5_context context;
-int send_auth(int conn, char *host_name)
+int mr_send_krb5_auth(int conn, char *host_name)
{
+ krb5_data auth;
+ int code;
+ long response;
+
+ memset(&auth, 0, sizeof(auth));
+
+ code = get_mr_krb5_update_ticket(host_name, &auth);
+ if (code)
+ goto out;
+ code = send_string(conn, "AUTH_003", 9);
+ if (code)
+ goto out;
+ code = recv_int(conn, &response);
+ if (code)
+ goto out;
+ if (response)
+ {
+ /* Talking to a server that doesn't do AUTH_003 */
+ krb5_free_data_contents(context, &auth);
+ return response;
+ }
+ code = send_string(conn, (char *)auth.data, auth.length);
+ if (code)
+ goto out;
+ code = recv_int(conn, &response);
+ if (code)
+ goto out;
+ if (response)
+ {
+ krb5_free_data_contents(context, &auth);
+ return response;
+ }
+
+ return MR_SUCCESS;
+
+ out:
+ krb5_free_data_contents(context, &auth);
+ return code;
+}
+
+int mr_send_auth(int conn, char *host_name)
+{
+#ifdef HAVE_KRB4
KTEXT_ST ticket_st;
int code, auth_version = 2;
long response;
}
return MR_SUCCESS;
+#else
+ return MR_NO_KRB4;
+#endif
}
-int execute(int conn, char *path)
+int mr_execute(int conn, char *path)
{
long response;
char *data;
return MR_SUCCESS;
}
-void send_quit(int conn)
+void mr_send_quit(int conn)
{
send_string(conn, "quit", 5);
}
void fail(int conn, int err, char *msg)
{
+ com_err(whoami, err, msg);
return;
}