]>
Commit | Line | Data |
---|---|---|
eab30d01 | 1 | /* |
2 | * $Source$ | |
3 | * $Author$ | |
4 | * $Header$ | |
5 | * | |
6 | * Copyright (C) 1987 by the Massachusetts Institute of Technology | |
7 | * | |
eab30d01 | 8 | */ |
9 | ||
5dbd09a0 | 10 | #include <sys/types.h> |
11 | #include <sys/uio.h> | |
12 | #include <sys/socket.h> | |
13 | #include <netinet/in.h> | |
c27b3454 | 14 | #include "sms_proto.h" |
0311b667 | 15 | #include <krb.h> |
5dbd09a0 | 16 | |
c27b3454 | 17 | typedef struct returned_tuples { |
18 | struct returned_tuples *next; | |
19 | OPERATION op; | |
0311b667 | 20 | sms_params *retval; |
c27b3454 | 21 | } returned_tuples; |
5dbd09a0 | 22 | |
0311b667 | 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 | */ | |
5d354f89 | 37 | |
38 | #define NLISTS 100 | |
0311b667 | 39 | |
0fa91a0a | 40 | typedef struct _client { |
0311b667 | 41 | OPERATION pending_op; /* Primary pending operation */ |
42 | CONNECTION con; /* Connection to the client */ | |
0311b667 | 43 | int action; /* what action is pending? */ |
eab30d01 | 44 | sms_params *args, reply; |
45 | int id; /* Unique id of client */ | |
0311b667 | 46 | struct sockaddr_in haddr; /* IP address of client */ |
5d354f89 | 47 | char clname[MAX_K_NAME_SZ];/* Name client authenticated to */ |
0311b667 | 48 | struct krbname kname; /* Parsed version of the above */ |
5d354f89 | 49 | int users_id; /* SMS internal ID of authenticated user */ |
50 | int client_id; /* SMS internal ID of client for modby field */ | |
c27b3454 | 51 | returned_tuples *first, *last; |
50f51267 | 52 | time_t last_time_used; /* Last time connection used */ |
5d354f89 | 53 | char entity[9]; /* entity on other end of the connection */ |
54 | int lists[NLISTS]; /* lists this person is a member of */ | |
0fa91a0a | 55 | } client; |
56 | ||
57 | /* | |
58 | * States | |
59 | */ | |
60 | ||
61 | #define CL_DEAD 0 | |
62 | #define CL_STARTING 1 | |
63 | ||
64 | /* | |
65 | * Actions. | |
66 | */ | |
67 | ||
68 | #define CL_ACCEPT 0 | |
69 | #define CL_RECEIVE 1 | |
70 | #define CL_SEND 2 | |
71 | ||
0311b667 | 72 | extern char *krb_realm; |
16904979 | 73 | |
74 | /* | |
75 | * Debugging options. | |
76 | */ | |
77 | ||
78 | extern int log_flags; | |
79 | ||
80 | #define LOG_CONNECT 0x0001 | |
81 | #define LOG_REQUESTS 0x0002 | |
82 | #define LOG_ARGS 0x0004 | |
83 | #define LOG_RESP 0x0008 | |
84 | #define LOG_RES 0x0010 | |
15516f43 | 85 | #define LOG_VALID 0x0020 |
16904979 | 86 | |
90052a6f | 87 | |
88 | /* max length of query argument allowed */ | |
9608e722 | 89 | #define ARGLEN 257 |
7a2ebcdf | 90 | |
91 | /* statistics on number of queries by version number */ | |
92 | extern int newqueries, oldqueries; | |
93 | ||
fcd67f6a | 94 | /* Maximum and minimum values that will ever be chosen for IDs */ |
95 | #define MAX_ID_VALUE 32765 | |
96 | #define MIN_ID_VALUE 100 | |
87f17989 | 97 | |
98 | /* Sleepy states for the server! */ | |
99 | #define AWAKE 0 | |
100 | #define SLEEPY 1 | |
101 | #define ASLEEP 2 | |
102 | #define GROGGY 3 | |
103 | extern int dormant; | |
104 | ||
105 | /* If the motd file exists, the server will go to sleep. */ | |
106 | #define SMS_MOTD_FILE "/etc/smsdown" |