]> andersk Git - moira.git/blobdiff - lib/mr_auth.c
add a cast from unsigned char * to char * for Irix n32 cc
[moira.git] / lib / mr_auth.c
index df046e18ec7e7262f0532641ddc5699ec2c40996..c70cced5edda59bf4d401c586e7916244c42211e 100644 (file)
@@ -1,79 +1,69 @@
-/*
- *     $Source$
- *     $Author$
- *     $Header$
+/* $Id$
  *
- *     Copyright (C) 1987 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 sms 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_sms_auth_c = "$Header$";
-#endif lint
-
 #include <mit-copyright.h>
-#include "sms_private.h"
+#include <moira.h>
+#include "mr_private.h"
+
 #include <ctype.h>
+#include <stdio.h>
+#include <string.h>
+
 #include <krb.h>
-#include <krb_et.h>
 
-/* Authenticate this client with the SMS server.  prog is the name of the
+RCSID("$Header$");
+
+/* Authenticate this client with the Moira server.  prog is the name of the
  * client program, and will be recorded in the database.
  */
 
-int sms_auth(prog)
-char *prog;
+int mr_auth(char *prog)
 {
-    register int status;
-    sms_params params_st;
-    char *args[2];
-    int argl[2];
-    char realm[REALM_SZ], host[BUFSIZ], *p;
+  int status;
+  mr_params params, reply;
+  char *args[2];
+  int argl[2];
+  char realm[REALM_SZ], host[BUFSIZ], *p;
+  KTEXT_ST auth;
 
-    register sms_params *params = &params_st;
-    sms_params *reply = NULL;
-    KTEXT_ST auth;
+  CHECK_CONNECTED;
 
-    CHECK_CONNECTED;
-       
-    /* Build a Kerberos authenticator. */
-       
-    bzero(host, sizeof(host));
-    if (status = sms_host(host, sizeof(host) - 1))
-       return status;
+  if ((status = mr_host(host, sizeof(host) - 1)))
+    return status;
 
-    strcpy(realm, krb_realmofhost(host));
-    for (p = host; *p && *p != '.'; p++)
+  strcpy(realm, krb_realmofhost(host));
+  for (p = host; *p && *p != '.'; p++)
+    {
       if (isupper(*p))
        *p = tolower(*p);
-    *p = 0;
+    }
+  *p = '\0';
 
-    status = krb_mk_req(&auth, MOIRA_SNAME, host, realm, 0);
-    if (status != KSUCCESS) {
-       status += ERROR_TABLE_BASE_krb;
-       return status;
-    } 
-    params->sms_version_no = sending_version_no;
-    params->sms_procno = SMS_AUTH;
-    params->sms_argc = 2;
-    params->sms_argv = args;
-    params->sms_argl = argl;
-    params->sms_argv[0] = (char *)auth.dat;
-    params->sms_argl[0] = auth.length;
-    params->sms_argv[1] = prog;
-    params->sms_argl[1] = strlen(prog) + 1;
-       
-    if (sending_version_no == SMS_VERSION_1)
-       params->sms_argc = 1;
+  status = krb_mk_req(&auth, MOIRA_SNAME, host, realm, 0);
+  if (status != KSUCCESS)
+    {
+      status += ERROR_TABLE_BASE_krb;
+      return 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 = sms_do_call(params, &reply)) == 0)
-       status = reply->sms_status;
+  if ((status = mr_do_call(&params, &reply)) == MR_SUCCESS)
+    status = reply.u.mr_status;
 
-    sms_destroy_reply(reply);
+  mr_destroy_reply(reply);
 
-    return status;
+  return status;
 }
This page took 0.064983 seconds and 4 git commands to generate.