]> andersk Git - moira.git/blobdiff - lib/mr_auth.c
Diane Delgado's changes for a fixed table-locking order
[moira.git] / lib / mr_auth.c
index 3316d3efe3d34f1ac7a4bc41a2070d0296a26be5..d6db8ca0cbf146197b1074fb636fc984e01cf369 100644 (file)
@@ -3,12 +3,12 @@
  *     $Author$
  *     $Header$
  *
- *     Copyright (C) 1987 by the Massachusetts Institute of Technology
+ *     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 sms server.     
+ * the mr server.      
  */
 
 #ifndef lint
@@ -16,71 +16,65 @@ static char *rcsid_sms_auth_c = "$Header$";
 #endif lint
 
 #include <mit-copyright.h>
-#include "sms_private.h"
+#include "mr_private.h"
+#include <ctype.h>
 #include <krb.h>
+#include <krb_et.h>
+#include <string.h>
 
-extern int krb_err_base;
-
-/* Authenticate this client with the SMS server.  prog is the name of the
+/* Authenticate this client with the MR server.  prog is the name of the
  * client program, and will be recorded in the database.
  */
 
-int sms_auth(prog)
+int mr_auth(prog)
 char *prog;
 {
     register int status;
-    sms_params params_st;
+    mr_params params_st;
     char *args[2];
     int argl[2];
-    char realm[REALM_SZ];
+    char realm[REALM_SZ], host[BUFSIZ], *p;
 
-    register sms_params *params = &params_st;
-    sms_params *reply = NULL;
+    register mr_params *params = &params_st;
+    mr_params *reply = NULL;
     KTEXT_ST auth;
 
     CHECK_CONNECTED;
        
-    /*
-     * Build a Kerberos authenticator.
-     * The "service" and "instance" should not be hardcoded here.
-     */
+    /* Build a Kerberos authenticator. */
        
-    if ((status = get_krbrlm(realm, 1)) != KSUCCESS) {
+    memset(host, 0, sizeof(host));
+    if (status = mr_host(host, sizeof(host) - 1))
        return status;
-    }
-    status = krb_mk_req(&auth, "sms", "sms", realm, 0);
+
+    strcpy(realm, (char *)krb_realmofhost(host));
+    for (p = host; *p && *p != '.'; p++)
+      if (isupper(*p))
+       *p = tolower(*p);
+    *p = 0;
+
+    status = krb_mk_req(&auth, MOIRA_SNAME, host, realm, 0);
     if (status != KSUCCESS) {
-       status += krb_err_base;
+       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;
+    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 == SMS_VERSION_1)
-       params->sms_argc = 1;
+    if (sending_version_no == MR_VERSION_1)
+       params->mr_argc = 1;
 
-    if ((status = sms_do_call(params, &reply)) == 0)
-       status = reply->sms_status;
+    if ((status = mr_do_call(params, &reply)) == 0)
+       status = reply->mr_status;
 
-    sms_destroy_reply(reply);
+    mr_destroy_reply(reply);
 
     return status;
 }
-
-/*
- * Local Variables:
- * mode: c
- * c-indent-level: 4
- * c-continued-statement-offset: 4
- * c-brace-offset: -4
- * c-argdecl-indent: 4
- * c-label-offset: -4
- * End:
- */
This page took 0.040167 seconds and 4 git commands to generate.