6 * Copyright (C) 1987, 1990 by the Massachusetts Institute of Technology
7 * For copying and distribution information, please see the file
10 * Handles the client side of the sending of authenticators to
15 static char *rcsid_sms_auth_c = "$Header$";
18 #include <mit-copyright.h>
19 #include "mr_private.h"
25 /* Authenticate this client with the MR server. prog is the name of the
26 * client program, and will be recorded in the database.
29 int mr_auth(char *prog)
35 char realm[REALM_SZ], host[BUFSIZ], *p;
37 register mr_params *params = ¶ms_st;
38 mr_params *reply = NULL;
43 /* Build a Kerberos authenticator. */
45 memset(host, 0, sizeof(host));
46 if ((status = mr_host(host, sizeof(host) - 1)))
49 strcpy(realm, (char *)krb_realmofhost(host));
50 for (p = host; *p && *p != '.'; p++)
57 status = krb_mk_req(&auth, MOIRA_SNAME, host, realm, 0);
58 if (status != KSUCCESS)
60 status += ERROR_TABLE_BASE_krb;
63 params->mr_version_no = sending_version_no;
64 params->mr_procno = MR_AUTH;
66 params->mr_argv = args;
67 params->mr_argl = argl;
68 params->mr_argv[0] = (char *)auth.dat;
69 params->mr_argl[0] = auth.length;
70 params->mr_argv[1] = prog;
71 params->mr_argl[1] = strlen(prog) + 1;
73 if (sending_version_no == MR_VERSION_1)
76 if ((status = mr_do_call(params, &reply)) == 0)
77 status = reply->mr_status;
79 mr_destroy_reply(reply);