]>
Commit | Line | Data |
---|---|---|
e2a67c78 | 1 | /* |
2 | * $Source$ | |
3 | * $Author$ | |
4 | * $Header$ | |
5 | * | |
6 | * Copyright (C) 1987 by the Massachusetts Institute of Technology | |
babbc197 | 7 | * For copying and distribution information, please see the file |
8 | * <mit-copyright.h>. | |
e2a67c78 | 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 | ||
babbc197 | 18 | #include <mit-copyright.h> |
e2a67c78 | 19 | #include "sms_private.h" |
20 | #include <krb.h> | |
11cf0ee5 | 21 | #include <krb_et.h> |
20e1c093 | 22 | |
6e20c6e8 | 23 | /* Authenticate this client with the SMS server. prog is the name of the |
24 | * client program, and will be recorded in the database. | |
25 | */ | |
26 | ||
27 | int sms_auth(prog) | |
28 | char *prog; | |
e2a67c78 | 29 | { |
83e80378 | 30 | register int status; |
31 | sms_params params_st; | |
6e20c6e8 | 32 | char *args[2]; |
33 | int argl[2]; | |
a29db7d1 | 34 | char realm[REALM_SZ]; |
11cf0ee5 | 35 | char host[BUFSIZ]; |
a29db7d1 | 36 | |
83e80378 | 37 | register sms_params *params = ¶ms_st; |
38 | sms_params *reply = NULL; | |
39 | KTEXT_ST auth; | |
40 | ||
41 | CHECK_CONNECTED; | |
e2a67c78 | 42 | |
83e80378 | 43 | /* |
44 | * Build a Kerberos authenticator. | |
45 | * The "service" and "instance" should not be hardcoded here. | |
46 | */ | |
e2a67c78 | 47 | |
11cf0ee5 | 48 | bzero(host, sizeof(host)); |
49 | if (status = sms_host(host, sizeof(host) - 1)) | |
a29db7d1 | 50 | return status; |
11cf0ee5 | 51 | |
52 | strcpy(realm, krb_realmofhost(host)); | |
53 | ||
9eed2cf8 | 54 | status = krb_mk_req(&auth, "sms", "sms", realm, 0); |
83e80378 | 55 | if (status != KSUCCESS) { |
3ebfd545 | 56 | status += ERROR_TABLE_BASE_krb; |
83e80378 | 57 | return status; |
89371417 | 58 | } |
59 | params->sms_version_no = sending_version_no; | |
83e80378 | 60 | params->sms_procno = SMS_AUTH; |
6e20c6e8 | 61 | params->sms_argc = 2; |
83e80378 | 62 | params->sms_argv = args; |
63 | params->sms_argl = argl; | |
64 | params->sms_argv[0] = (char *)auth.dat; | |
65 | params->sms_argl[0] = auth.length; | |
6e20c6e8 | 66 | params->sms_argv[1] = prog; |
67 | params->sms_argl[1] = strlen(prog) + 1; | |
e2a67c78 | 68 | |
6e20c6e8 | 69 | if (sending_version_no == SMS_VERSION_1) |
70 | params->sms_argc = 1; | |
71 | ||
83e80378 | 72 | if ((status = sms_do_call(params, &reply)) == 0) |
73 | status = reply->sms_status; | |
e2a67c78 | 74 | |
83e80378 | 75 | sms_destroy_reply(reply); |
76 | ||
77 | return status; | |
e2a67c78 | 78 | } |