3 * Handles the client side of the sending of authenticators to the moira server
5 * Copyright (C) 1987-1998 by the Massachusetts Institute of Technology
6 * For copying and distribution information, please see the file
10 #include <mit-copyright.h>
12 #include "mr_private.h"
21 /* Authenticate this client with the Moira server. prog is the name of the
22 * client program, and will be recorded in the database.
25 int mr_auth(char *prog)
31 char realm[REALM_SZ], host[BUFSIZ], *p;
32 mr_params *params = ¶ms_st;
33 mr_params *reply = NULL;
38 /* Build a Kerberos authenticator. */
40 memset(host, 0, sizeof(host));
41 if ((status = mr_host(host, sizeof(host) - 1)))
44 strcpy(realm, krb_realmofhost(host));
45 for (p = host; *p && *p != '.'; p++)
52 status = krb_mk_req(&auth, MOIRA_SNAME, host, realm, 0);
53 if (status != KSUCCESS)
55 status += ERROR_TABLE_BASE_krb;
58 params->mr_version_no = sending_version_no;
59 params->mr_procno = MR_AUTH;
61 params->mr_argv = args;
62 params->mr_argl = argl;
63 params->mr_argv[0] = (char *)auth.dat;
64 params->mr_argl[0] = auth.length;
65 params->mr_argv[1] = prog;
66 params->mr_argl[1] = strlen(prog) + 1;
68 if (sending_version_no == MR_VERSION_1)
71 if ((status = mr_do_call(params, &reply)) == 0)
72 status = reply->mr_status;
74 mr_destroy_reply(reply);