]> andersk Git - moira.git/blobdiff - lib/mr_auth.c
Always reports email addresses of the form username@MIT.EDU, regardless
[moira.git] / lib / mr_auth.c
index d196e5cd3f172994031328ac91f9b89cb27fd28b..06d38d36fae76858a7eb5d45d8aaa1d2ac673741 100644 (file)
@@ -1,27 +1,24 @@
-/*
- *     $Source$
- *     $Author$
- *     $Header$
+/* $Id$
  *
- *     Copyright (C) 1987, 1990 by the Massachusetts Institute of Technology
- *     For copying and distribution information, please see the file
- *     <mit-copyright.h>.
+ * Handles the client side of the sending of authenticators to the moira server
  *
- *     Handles the client side of the sending of authenticators to
- * the mr server.
+ * Copyright (C) 1987-1998 by the Massachusetts Institute of Technology
+ * For copying and distribution information, please see the file
+ * <mit-copyright.h>.
  */
 
-#ifndef lint
-static char *rcsid_mr_auth_c = "$Header$";
-#endif
-
 #include <mit-copyright.h>
+#include <moira.h>
 #include "mr_private.h"
+
 #include <ctype.h>
-#include <krb.h>
-#include <krb_et.h>
+#include <stdio.h>
 #include <string.h>
 
+#include <krb.h>
+
+RCSID("$Header$");
+
 /* Authenticate this client with the Moira server.  prog is the name of the
  * client program, and will be recorded in the database.
  */
@@ -29,24 +26,18 @@ static char *rcsid_mr_auth_c = "$Header$";
 int mr_auth(char *prog)
 {
   int status;
-  mr_params params_st;
+  mr_params params, reply;
   char *args[2];
   int argl[2];
   char realm[REALM_SZ], host[BUFSIZ], *p;
-
-  mr_params *params = &params_st;
-  mr_params *reply = NULL;
   KTEXT_ST auth;
 
   CHECK_CONNECTED;
 
-  /* Build a Kerberos authenticator. */
-
-  memset(host, 0, sizeof(host));
   if ((status = mr_host(host, sizeof(host) - 1)))
     return status;
 
-  strcpy(realm, (char *)krb_realmofhost(host));
+  strcpy(realm, krb_realmofhost(host));
   for (p = host; *p && *p != '.'; p++)
     {
       if (isupper(*p))
@@ -60,21 +51,38 @@ int mr_auth(char *prog)
       status += ERROR_TABLE_BASE_krb;
       return status;
     }
-  params->mr_version_no = sending_version_no;
-  params->mr_procno = MR_AUTH;
-  params->mr_argc = 2;
-  params->mr_argv = args;
-  params->mr_argl = argl;
-  params->mr_argv[0] = (char *)auth.dat;
-  params->mr_argl[0] = auth.length;
-  params->mr_argv[1] = prog;
-  params->mr_argl[1] = strlen(prog) + 1;
-
-  if (sending_version_no == MR_VERSION_1)
-    params->mr_argc = 1;
-
-  if ((status = mr_do_call(params, &reply)) == 0)
-    status = reply->mr_status;
+  params.u.mr_procno = MR_AUTH;
+  params.mr_argc = 2;
+  params.mr_argv = args;
+  params.mr_argl = argl;
+  params.mr_argv[0] = (char *)auth.dat;
+  params.mr_argl[0] = auth.length;
+  params.mr_argv[1] = prog;
+  params.mr_argl[1] = strlen(prog) + 1;
+
+  if ((status = mr_do_call(&params, &reply)) == MR_SUCCESS)
+    status = reply.u.mr_status;
+
+  mr_destroy_reply(reply);
+
+  return status;
+}
+
+int mr_proxy(char *principal, char *orig_authtype)
+{
+  int status;
+  mr_params params, reply;
+  char *args[2];
+
+  params.u.mr_procno = MR_PROXY;
+  params.mr_argc = 2;
+  params.mr_argv = args;
+  params.mr_argv[0] = principal;
+  params.mr_argv[1] = orig_authtype;
+  params.mr_argl = NULL;
+
+  if ((status = mr_do_call(&params, &reply)) == MR_SUCCESS)
+    status = reply.u.mr_status;
 
   mr_destroy_reply(reply);
 
This page took 0.038156 seconds and 4 git commands to generate.