]> andersk Git - moira.git/blobdiff - update/client.c
Merge changes from moira-krb5 CVS branch.
[moira.git] / update / client.c
index 160d6d1d28cd7bb4c09f6003e144602990485fda..1f6bbdb0ddd3d6475d677f501a0ed89cf7d52f64 100644 (file)
 
 #include <des.h>
 #include <krb.h>
+#include <krb5.h>
 
 RCSID("$Header$");
 
 extern des_cblock session;
 extern char *whoami;
+extern krb5_context context;
+
+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)
 {
This page took 0.050116 seconds and 4 git commands to generate.