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