]> andersk Git - moira.git/blob - lib/mr_auth.c
Initial revision
[moira.git] / lib / mr_auth.c
1 /*
2  *      $Source$
3  *      $Author$
4  *      $Header$
5  *
6  *      Copyright (C) 1987 by the Massachusetts Institute of Technology
7  *
8  *      $Log$
9  *      Revision 1.4  1987-10-20 15:09:22  mar
10  *      replace hardcoded ATHENA realm with call to get_krbrlm();
11  *
12  * Revision 1.3  87/06/16  17:47:20  wesommer
13  * Clean up memory allocation, indenting.
14  * 
15  * Revision 1.2  87/05/31  22:03:23  wesommer
16  * It's working better.
17  * 
18  * Revision 1.1  87/05/20  03:11:18  wesommer
19  * Initial revision
20  * 
21  *
22  *      Handles the client side of the sending of authenticators to
23  * the sms server.      
24  */
25
26 #ifndef lint
27 static char *rcsid_sms_auth_c = "$Header$";
28 #endif lint
29
30 #include "sms_private.h"
31 #include <krb.h>
32
33 extern int krb_err_base;
34
35 int sms_auth()
36 {
37     register int status;
38     sms_params params_st;
39     char *args[1];
40     int argl[1];
41     char realm[REALM_SZ];
42
43     register sms_params *params = &params_st;
44     sms_params *reply = NULL;
45     KTEXT_ST auth;
46
47     CHECK_CONNECTED;
48         
49     /*
50      * Build a Kerberos authenticator.
51      * The "service" and "instance" should not be hardcoded here.
52      */
53         
54     if ((status = get_krbrlm(realm, 1)) != KSUCCESS) {
55         return status;
56     }
57     status = mk_ap_req(&auth, "sms", "sms", realm, 0);
58     if (status != KSUCCESS) {
59         status += krb_err_base;
60         return status;
61     }
62     params->sms_procno = SMS_AUTH;
63     params->sms_argc = 1;
64     params->sms_argv = args;
65     params->sms_argl = argl;
66     params->sms_argv[0] = (char *)auth.dat;
67     params->sms_argl[0] = auth.length;
68         
69     if ((status = sms_do_call(params, &reply)) == 0)
70         status = reply->sms_status;
71
72     sms_destroy_reply(reply);
73
74     return status;
75 }
76
77 /*
78  * Local Variables:
79  * mode: c
80  * c-indent-level: 4
81  * c-continued-statement-offset: 4
82  * c-brace-offset: -4
83  * c-argdecl-indent: 4
84  * c-label-offset: -4
85  * End:
86  */
This page took 0.03864 seconds and 5 git commands to generate.