]> andersk Git - moira.git/blob - lib/mr_auth.c
corrected behavior and added Author
[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  *      For copying and distribution information, please see the file
8  *      <mit-copyright.h>.
9  *
10  *      Handles the client side of the sending of authenticators to
11  * the sms server.      
12  */
13
14 #ifndef lint
15 static char *rcsid_sms_auth_c = "$Header$";
16 #endif lint
17
18 #include <mit-copyright.h>
19 #include "sms_private.h"
20 #include <krb.h>
21
22 extern int krb_err_base;
23
24 /* Authenticate this client with the SMS server.  prog is the name of the
25  * client program, and will be recorded in the database.
26  */
27
28 int sms_auth(prog)
29 char *prog;
30 {
31     register int status;
32     sms_params params_st;
33     char *args[2];
34     int argl[2];
35     char realm[REALM_SZ];
36
37     register sms_params *params = &params_st;
38     sms_params *reply = NULL;
39     KTEXT_ST auth;
40
41     CHECK_CONNECTED;
42         
43     /*
44      * Build a Kerberos authenticator.
45      * The "service" and "instance" should not be hardcoded here.
46      */
47         
48     if ((status = get_krbrlm(realm, 1)) != KSUCCESS) {
49         return status;
50     }
51     status = krb_mk_req(&auth, "sms", "sms", realm, 0);
52     if (status != KSUCCESS) {
53         status += krb_err_base;
54         return status;
55     } 
56     params->sms_version_no = sending_version_no;
57     params->sms_procno = SMS_AUTH;
58     params->sms_argc = 2;
59     params->sms_argv = args;
60     params->sms_argl = argl;
61     params->sms_argv[0] = (char *)auth.dat;
62     params->sms_argl[0] = auth.length;
63     params->sms_argv[1] = prog;
64     params->sms_argl[1] = strlen(prog) + 1;
65         
66     if (sending_version_no == SMS_VERSION_1)
67         params->sms_argc = 1;
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.040636 seconds and 5 git commands to generate.