]>
Commit | Line | Data |
---|---|---|
1 | /* | |
2 | * $Source$ | |
3 | * $Author$ | |
4 | * $Header$ | |
5 | * | |
6 | * Copyright (C) 1987 by the Massachusetts Institute of Technology | |
7 | * | |
8 | */ | |
9 | ||
10 | #include <sys/types.h> | |
11 | #include <sys/uio.h> | |
12 | #include <sys/socket.h> | |
13 | #include <netinet/in.h> | |
14 | #include "sms_proto.h" | |
15 | #include <krb.h> | |
16 | ||
17 | typedef struct returned_tuples { | |
18 | struct returned_tuples *next; | |
19 | OPERATION op; | |
20 | sms_params *retval; | |
21 | } returned_tuples; | |
22 | ||
23 | /* | |
24 | * This should be in the kerberos header file. | |
25 | */ | |
26 | ||
27 | struct krbname { | |
28 | char name[ANAME_SZ]; | |
29 | char inst[INST_SZ]; | |
30 | char realm[REALM_SZ]; | |
31 | }; | |
32 | ||
33 | /* | |
34 | * This structure holds all per-client information; one of these is | |
35 | * allocated for each active client. | |
36 | */ | |
37 | ||
38 | typedef struct _client { | |
39 | OPERATION pending_op; /* Primary pending operation */ | |
40 | CONNECTION con; /* Connection to the client */ | |
41 | int action; /* what action is pending? */ | |
42 | sms_params *args, reply; | |
43 | int id; /* Unique id of client */ | |
44 | struct sockaddr_in haddr; /* IP address of client */ | |
45 | char *clname; /* Name client authenticated to */ | |
46 | int users_id; /* SMS internal ID of authenticated user */ | |
47 | struct krbname kname; /* Parsed version of the above */ | |
48 | returned_tuples *first, *last; | |
49 | time_t last_time_used; /* Last time connection used */ | |
50 | char *entity; /* entity on other end of the connection */ | |
51 | } client; | |
52 | ||
53 | /* | |
54 | * States | |
55 | */ | |
56 | ||
57 | #define CL_DEAD 0 | |
58 | #define CL_STARTING 1 | |
59 | ||
60 | /* | |
61 | * Actions. | |
62 | */ | |
63 | ||
64 | #define CL_ACCEPT 0 | |
65 | #define CL_RECEIVE 1 | |
66 | #define CL_SEND 2 | |
67 | ||
68 | extern char *krb_realm; | |
69 | ||
70 | /* | |
71 | * Debugging options. | |
72 | */ | |
73 | ||
74 | extern int log_flags; | |
75 | ||
76 | #define LOG_CONNECT 0x0001 | |
77 | #define LOG_REQUESTS 0x0002 | |
78 | #define LOG_ARGS 0x0004 | |
79 | #define LOG_RESP 0x0008 | |
80 | #define LOG_RES 0x0010 | |
81 | #define LOG_VALID 0x0020 | |
82 | ||
83 | ||
84 | /* max length of query argument allowed */ | |
85 | #define ARGLEN 257 | |
86 | ||
87 | /* statistics on number of queries by version number */ | |
88 | extern int newqueries, oldqueries; | |
89 | ||
90 | /* Maximum and minimum values that will ever be chosen for IDs */ | |
91 | #define MAX_ID_VALUE 32765 | |
92 | #define MIN_ID_VALUE 100 | |
93 | ||
94 | /* Sleepy states for the server! */ | |
95 | #define AWAKE 0 | |
96 | #define SLEEPY 1 | |
97 | #define ASLEEP 2 | |
98 | #define GROGGY 3 | |
99 | extern int dormant; | |
100 | ||
101 | /* If the motd file exists, the server will go to sleep. */ | |
102 | #define SMS_MOTD_FILE "/etc/smsdown" |