]> andersk Git - moira.git/blame - lib/mr_auth.c
this is what's currently running on SMS
[moira.git] / lib / mr_auth.c
CommitLineData
e2a67c78 1/*
2 * $Source$
3 * $Author$
4 * $Header$
5 *
6 * Copyright (C) 1987 by the Massachusetts Institute of Technology
7 *
8 * $Log$
6e20c6e8 9 * Revision 1.6 1988-06-01 15:31:53 mar
10 * make auth do the right thing for version 2 of the protocol
e2a67c78 11 *
6e20c6e8 12 * Revision 1.5 88/04/19 12:40:29 mar
13 * pass version number on queries
14 *
89371417 15 * Revision 1.4 87/10/20 15:09:22 mar
16 * replace hardcoded ATHENA realm with call to get_krbrlm();
17 *
a29db7d1 18 * Revision 1.3 87/06/16 17:47:20 wesommer
19 * Clean up memory allocation, indenting.
20 *
83e80378 21 * Revision 1.2 87/05/31 22:03:23 wesommer
22 * It's working better.
23 *
20e1c093 24 * Revision 1.1 87/05/20 03:11:18 wesommer
25 * Initial revision
26 *
e2a67c78 27 *
28 * Handles the client side of the sending of authenticators to
29 * the sms server.
30 */
31
32#ifndef lint
33static char *rcsid_sms_auth_c = "$Header$";
34#endif lint
35
36#include "sms_private.h"
37#include <krb.h>
38
20e1c093 39extern int krb_err_base;
40
6e20c6e8 41/* Authenticate this client with the SMS server. prog is the name of the
42 * client program, and will be recorded in the database.
43 */
44
45int sms_auth(prog)
46char *prog;
e2a67c78 47{
83e80378 48 register int status;
49 sms_params params_st;
6e20c6e8 50 char *args[2];
51 int argl[2];
a29db7d1 52 char realm[REALM_SZ];
53
83e80378 54 register sms_params *params = &params_st;
55 sms_params *reply = NULL;
56 KTEXT_ST auth;
57
58 CHECK_CONNECTED;
e2a67c78 59
83e80378 60 /*
61 * Build a Kerberos authenticator.
62 * The "service" and "instance" should not be hardcoded here.
63 */
e2a67c78 64
a29db7d1 65 if ((status = get_krbrlm(realm, 1)) != KSUCCESS) {
66 return status;
67 }
68 status = mk_ap_req(&auth, "sms", "sms", realm, 0);
83e80378 69 if (status != KSUCCESS) {
70 status += krb_err_base;
71 return status;
89371417 72 }
73 params->sms_version_no = sending_version_no;
83e80378 74 params->sms_procno = SMS_AUTH;
6e20c6e8 75 params->sms_argc = 2;
83e80378 76 params->sms_argv = args;
77 params->sms_argl = argl;
78 params->sms_argv[0] = (char *)auth.dat;
79 params->sms_argl[0] = auth.length;
6e20c6e8 80 params->sms_argv[1] = prog;
81 params->sms_argl[1] = strlen(prog) + 1;
e2a67c78 82
6e20c6e8 83 if (sending_version_no == SMS_VERSION_1)
84 params->sms_argc = 1;
85
83e80378 86 if ((status = sms_do_call(params, &reply)) == 0)
87 status = reply->sms_status;
e2a67c78 88
83e80378 89 sms_destroy_reply(reply);
90
91 return status;
e2a67c78 92}
83e80378 93
94/*
95 * Local Variables:
96 * mode: c
97 * c-indent-level: 4
98 * c-continued-statement-offset: 4
99 * c-brace-offset: -4
100 * c-argdecl-indent: 4
101 * c-label-offset: -4
102 * End:
103 */
This page took 0.06697 seconds and 5 git commands to generate.