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