X-Git-Url: http://andersk.mit.edu/gitweb/moira.git/blobdiff_plain/e2a67c78ae291e815fba7a2a859b8a1205ec757d..refs/heads/LOCKING:/lib/mr_auth.c diff --git a/lib/mr_auth.c b/lib/mr_auth.c index b3c9f4e7..d6db8ca0 100644 --- a/lib/mr_auth.c +++ b/lib/mr_auth.c @@ -3,49 +3,78 @@ * $Author$ * $Header$ * - * Copyright (C) 1987 by the Massachusetts Institute of Technology - * - * $Log$ - * Revision 1.1 1987-05-20 03:11:18 wesommer - * Initial revision - * + * Copyright (C) 1987, 1990 by the Massachusetts Institute of Technology + * For copying and distribution information, please see the file + * . * * Handles the client side of the sending of authenticators to - * the sms server. + * the mr server. */ #ifndef lint static char *rcsid_sms_auth_c = "$Header$"; #endif lint -#include "sms_private.h" +#include +#include "mr_private.h" +#include #include +#include +#include + +/* 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() +int mr_auth(prog) +char *prog; { - int status; - struct sms_params aparms; + register int status; + mr_params params_st; + char *args[2]; + int argl[2]; + char realm[REALM_SZ], host[BUFSIZ], *p; + + register mr_params *params = ¶ms_st; + mr_params *reply = NULL; + KTEXT_ST auth; + + CHECK_CONNECTED; - if (!_sms_conn) { - return SMS_NOT_CONNECTED; - } + /* Build a Kerberos authenticator. */ - /* - * 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)); + 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 += 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; - status = mk_ap_req(&auth, "sms", "sms", "ATHENA.MIT.EDU", 0); - if (status != KSUCCESS) { - status += krb_err_base; - goto punt; - } + if (sending_version_no == MR_VERSION_1) + params->mr_argc = 1; - if (!sms_call_op) - sms_call_op = create_operation(); + if ((status = mr_do_call(params, &reply)) == 0) + status = reply->mr_status; + mr_destroy_reply(reply); - - - - + return status; }