]> andersk Git - moira.git/blame - lib/mr_auth.c
Initial revision
[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$
20e1c093 9 * Revision 1.2 1987-05-31 22:03:23 wesommer
10 * It's working better.
e2a67c78 11 *
20e1c093 12 * Revision 1.1 87/05/20 03:11:18 wesommer
13 * Initial revision
14 *
e2a67c78 15 *
16 * Handles the client side of the sending of authenticators to
17 * the sms server.
18 */
19
20#ifndef lint
21static char *rcsid_sms_auth_c = "$Header$";
22#endif lint
23
24#include "sms_private.h"
25#include <krb.h>
26
20e1c093 27extern int krb_err_base;
28
e2a67c78 29int sms_auth()
30{
31 int status;
20e1c093 32 sms_params *params = NULL, *reply = NULL;
33 KTEXT_ST auth;
e2a67c78 34
35 if (!_sms_conn) {
36 return SMS_NOT_CONNECTED;
37 }
38
39 /*
40 * Build a Kerberos authenticator.
41 */
42
43 status = mk_ap_req(&auth, "sms", "sms", "ATHENA.MIT.EDU", 0);
44 if (status != KSUCCESS) {
45 status += krb_err_base;
46 goto punt;
47 }
20e1c093 48 params = (struct sms_params *) malloc(sizeof(*params));
49 params->sms_procno = SMS_AUTH;
50 params->sms_argc = 1;
e2a67c78 51
20e1c093 52 params->sms_argv = (char **)malloc(sizeof(char *) * 2);
53 params->sms_argl = (int *)malloc(sizeof(int) * 2);
54 params->sms_argv[0] = (char *)auth.dat;
55 params->sms_argl[0] = auth.length;
56 params->sms_argv[1] = NULL;
57 params->sms_argl[1] = 0;
e2a67c78 58
20e1c093 59 if ((status = sms_do_call(params, &reply)) || (status = reply->sms_status))
60 goto punt;
61punt:
62 sms_destroy_reply(reply);
63ok:
64 if(params) {
65 if(params->sms_argv)
66 free(params->sms_argv);
67 if(params->sms_argl)
68 free(params->sms_argl);
69 free(params);
70 }
71 return status;
e2a67c78 72}
This page took 0.058038 seconds and 5 git commands to generate.