]> andersk Git - moira.git/blame - server/mr_server.h
Use krb5 auth, not krb4.
[moira.git] / server / mr_server.h
CommitLineData
7ac48069 1/* $Id$
eab30d01 2 *
7ac48069 3 * Copyright (C) 1987-1998 by the Massachusetts Institute of Technology
4 * For copying and distribution information, please see the file
5 * <mit-copyright.h>.
eab30d01 6 */
7
7ac48069 8#include <moira.h>
85330553 9#include <mr_private.h>
d548a4e7 10#include <moira_site.h>
e688520a 11#include <moira_schema.h>
7ac48069 12
13#include <netinet/in.h>
14
98a7b0ee 15#include <stdarg.h>
5dbd09a0 16
7ac48069 17#include <krb.h>
0bb1ca53 18#include <krb5.h>
7ac48069 19
8691463b 20enum clstate { CL_ACCEPTING, CL_ACTIVE, CL_CLOSING };
21
0311b667 22/*
23 * This structure holds all per-client information; one of these is
24 * allocated for each active client.
25 */
5d354f89 26
0fa91a0a 27typedef struct _client {
85330553 28 int con; /* Connection to the client */
5eaef520 29 int id; /* Unique id of client */
30 struct sockaddr_in haddr; /* IP address of client */
8691463b 31 enum clstate state; /* State of the connection */
5eaef520 32 char clname[MAX_K_NAME_SZ]; /* Name client authenticated to */
ed00e35e 33 char entity[USERS_MODWITH_SIZE]; /* client program being used */
59ec8dae 34 int users_id; /* Moira-internal ID of authenticated user */
85330553 35 int client_id; /* Moira-internal ID of client */
ed00e35e 36 int proxy_id; /* client_id of orig user, if proxied */
c44ddfa7 37 int version; /* Max query version known by client */
5eaef520 38 time_t last_time_used; /* Last time connection used */
8691463b 39 mr_params req; /* Current request */
85330553 40 mr_params *tuples; /* Tuples waiting to send back to client */
41 int ntuples; /* Number of tuples waiting */
42 int tuplessize; /* Current size of tuple array */
43 int nexttuple; /* Next tuple to return */
8691463b 44 char *hsbuf; /* Buffer for initial connection handshaking */
45 int hslen; /* Length of data in hsbuf */
0fa91a0a 46} client;
47
85330553 48extern char krb_realm[REALM_SZ];
90052a6f 49
50/* max length of query argument allowed */
9608e722 51#define ARGLEN 257
58e1747c 52/* Used to setup static argv, maximum argc */
4f6b1a05 53#define QMAXARGS 25
7a2ebcdf 54
55/* statistics on number of queries by version number */
85330553 56extern int newqueries;
7a2ebcdf 57
edba5c0f 58/* Maximum and minimum values that will be used for uids and gids */
59#define MAX_ID_VALUE 65535
fcd67f6a 60#define MIN_ID_VALUE 100
87f17989 61
62/* Sleepy states for the server! */
63#define AWAKE 0
64#define SLEEPY 1
65#define ASLEEP 2
66#define GROGGY 3
67extern int dormant;
68
13f6b8bb 69/* state for the incremental update system */
70extern int inc_running, inc_pid;
71extern time_t inc_started, now;
72#define INC_TIMEOUT (3 * 60) /* 3 minutes */
03c05291 73
74
75#define SQL_NO_MATCH 1403 /* oracle, not ingres (= 100) */
76
7ac48069 77/* types needed for prototypes */
78struct query;
79struct validate;
80struct valobj;
81
03c05291 82/* prototypes from increment.dc */
83void incremental_init(void);
84void next_incremental(void);
85void incremental_update(void);
86void incremental_flush(void);
87
88/* prototypes from qrtn.dc */
89void dbmserr(void);
90void dosql(char *buffers[]);
91int mr_open_database(void);
92void mr_close_database(void);
93int mr_process_query(client *cl, char *name, int argc, char *argv_ro[],
7ac48069 94 int (*action)(int, char *[], void *), void *actarg);
03c05291 95int mr_check_access(client *cl, char *name, int argc, char *argv_ro[]);
96void sanity_check_queries(void);
97int set_krb_mapping(char *name, char *login, int ok, int *kid, int *uid);
f3c08a60 98int find_member(char *list_type, int list_id, client *cl);
7ac48069 99int do_for_all_rows(char *query, int count,
100 int (*action)(int, char *[], void *), void *actarg);
263a36d4 101char *build_qual(char *fmt, int argc, char *argv[]);
03c05291 102
103
104/* prototyoes from qsupport.dc */
105int set_pop_usage(int id, int cnt);
106
107/* prototypes from qvalidate.dc */
108void sanity_check_database(void);
109int add_string(char *name);
110int convert_wildcards(char *arg);
111
112/* prototypes from mr_main.c */
113void clist_delete(client *cp);
114
115/* prototypes from mr_sauth.c */
8691463b 116void do_auth(client *cl);
ed00e35e 117void do_proxy(client *cl);
0bb1ca53 118void do_krb5_auth(client *cl);
03c05291 119
120/* prototypes from mr_scall.c */
85330553 121void do_client(client *cl);
122void client_reply(client *cl, long status);
123void client_return_tuple(client *cl, int argc, char **argv);
124void client_read(client *cl);
125void client_write(client *cl);
03c05291 126
127/* prototypes from mr_shutdown.c */
128void sigshut(int);
129void do_shutdown(client *cl);
130
131/* prototypes from mr_util.c */
e688520a 132char *requote(char *buf);
03c05291 133void log_args(char *tag, int version, int argc, char **argv);
98a7b0ee 134void mr_com_err(const char *whoami, long code, const char *fmt, va_list pvar);
03c05291 135int mr_trim_args(int argc, char **argv);
136char **mr_copy_args(char **argv, int argc);
85330553 137void *xmalloc(size_t);
138void *xrealloc(void *, size_t);
e688520a 139char *xstrdup(char *);
7ac48069 140
141/* prototypes from qaccess.pc */
142int access_user(struct query *q, char *argv[], client *cl);
143int access_login(struct query *q, char *argv[], client *cl);
f659afb2 144int access_spob(struct query *q, char *argv[], client *cl);
7ac48069 145int access_list(struct query *q, char *argv[], client *cl);
146int access_visible_list(struct query *q, char *argv[], client *cl);
147int access_vis_list_by_name(struct query *q, char *argv[], client *cl);
148int access_member(struct query *q, char *argv[], client *cl);
149int access_qgli(struct query *q, char *argv[], client *cl);
150int access_service(struct query *q, char *argv[], client *cl);
151int access_filesys(struct query *q, char *argv[], client *cl);
152int access_host(struct query *q, char *argv[], client *cl);
153int access_ahal(struct query *q, char *argv[], client *cl);
154int access_snt(struct query *q, char *argv[], client *cl);
1a9a0a59 155int access_printer(struct query *q, char *argv[], client *cl);
d7ddc011 156int access_zephyr(struct query *q, char *argv[], client *cl);
2fb668b0 157int access_container(struct query *q, char *argv[], client *cl);
7ac48069 158
159/* prototypes from qfollow.pc */
160int followup_fix_modby(struct query *q, struct save_queue *sq,
161 struct validate *v, int (*action)(int, char **, void *),
162 void *actarg, client *cl);
163int followup_gpob(struct query *q, struct save_queue *sq, struct validate *v,
164 int (*action)(int, char **, void *), void *actarg,
165 client *cl);
166int followup_glin(struct query *q, struct save_queue *sq, struct validate *v,
167 int (*action)(int, char **, void *), void *actarg,
168 client *cl);
59c3208b 169int followup_gsin(struct query *q, struct save_queue *sq, struct validate *v,
170 int (*action)(int, char **, void *), void *actarg,
171 client *cl);
7ac48069 172int followup_gzcl(struct query *q, struct save_queue *sq, struct validate *v,
173 int (*action)(int, char **, void *), void *actarg,
174 client *cl);
175int followup_gsha(struct query *q, struct save_queue *sq, struct validate *v,
176 int (*action)(int, char **, void *), void *actarg,
177 client *cl);
178int followup_gqot(struct query *q, struct save_queue *sq, struct validate *v,
179 int (*action)(int, char **, void *), void *actarg,
180 client *cl);
7ac48069 181int followup_guax(struct query *q, struct save_queue *sq, struct validate *v,
182 int (*action)(int, char **, void *), void *actarg,
183 client *cl);
184int followup_gsnt(struct query *q, struct save_queue *sq, struct validate *v,
185 int (*action)(int, char **, void *), void *actarg,
186 client *cl);
187int followup_ghst(struct query *q, struct save_queue *sq, struct validate *v,
188 int (*action)(int, char **, void *), void *actarg,
189 client *cl);
1a9a0a59 190int followup_gpsv(struct query *q, struct save_queue *sq, struct validate *v,
191 int (*action)(int, char **, void *), void *actarg,
192 client *cl);
2fb668b0 193int followup_gcon(struct query *q, struct save_queue *sq, struct validate *v,
194 int (*action)(int, char **, void *), void *actarg,
195 client *cl);
3b634eb3 196int followup_get_user(struct query *q, struct save_queue *sq,
197 struct validate *v, int (*action)(int, char **, void *),
198 void *actarg, client *cl);
7ac48069 199
200int followup_ausr(struct query *q, char *argv[], client *cl);
201int followup_aqot(struct query *q, char *argv[], client *cl);
202int followup_dqot(struct query *q, char *argv[], client *cl);
7ac48069 203
204int set_modtime(struct query *q, char *argv[], client *cl);
205int set_modtime_by_id(struct query *q, char *argv[], client *cl);
206int set_finger_modtime(struct query *q, char *argv[], client *cl);
207int set_pobox_modtime(struct query *q, char *argv[], client *cl);
208int set_uppercase_modtime(struct query *q, char *argv[], client *cl);
209int set_mach_modtime_by_id(struct query *q, char *argv[], client *cl);
210int set_cluster_modtime_by_id(struct query *q, char *argv[], client *cl);
211int set_serverhost_modtime(struct query *q, char *argv[], client *cl);
212int set_nfsphys_modtime(struct query *q, char *argv[], client *cl);
213int set_filesys_modtime(struct query *q, char *argv[], client *cl);
214int set_zephyr_modtime(struct query *q, char *argv[], client *cl);
69eb9470 215int set_service_modtime(struct query *q, char *argv[], client *cl);
7ac48069 216int _sdl_followup(struct query *q, char *argv[], client *cl);
85330553 217int trigger_dcm(struct query *q, char *argv[], client *cl);
7ac48069 218
219/* prototypes from qsetup.pc */
220int prefetch_value(struct query *q, char *argv[], client *cl);
221int prefetch_filesys(struct query *q, char *argv[], client *cl);
222int setup_ausr(struct query *q, char *argv[], client *cl);
223int setup_dusr(struct query *q, char *argv[], client *cl);
7ac48069 224int setup_dpob(struct query *q, char *argv[], client *cl);
225int setup_dmac(struct query *q, char *argv[], client *cl);
226int setup_dclu(struct query *q, char *argv[], client *cl);
227int setup_alis(struct query *q, char *argv[], client *cl);
228int setup_dlis(struct query *q, char *argv[], client *cl);
229int setup_dsin(struct query *q, char *argv[], client *cl);
230int setup_dshi(struct query *q, char *argv[], client *cl);
231int setup_afil(struct query *q, char *argv[], client *cl);
232int setup_ufil(struct query *q, char *argv[], client *cl);
233int setup_dfil(struct query *q, char *argv[], client *cl);
234int setup_aftg(struct query *q, char *argv[], client *cl);
235int setup_dnfp(struct query *q, char *argv[], client *cl);
236int setup_dqot(struct query *q, char *argv[], client *cl);
4f6b1a05 237int setup_asnt(struct query *q, char *argv[], client *cl);
7ac48069 238int setup_dsnt(struct query *q, char *argv[], client *cl);
239int setup_ahst(struct query *q, char *argv[], client *cl);
240int setup_ahal(struct query *q, char *argv[], client *cl);
2884200f 241int setup_uhha(struct query *q, char *argv[], client *cl);
242int setup_aprn(struct query *q, char *argv[], client *cl);
1a9a0a59 243int setup_dpsv(struct query *q, char *argv[], client *cl);
2fb668b0 244int setup_dcon(struct query *q, char *argv[], client *cl);
73155abd 245int setup_acon(struct query *q, char *argv[], client *cl);
246int setup_scli(struct query *q, char *argv[], client *cl);
7ac48069 247
248/* prototypes from qsupport.pc */
249int set_pobox(struct query *q, char *argv[], client *cl);
17cb3de8 250int set_pobox_pop(struct query *q, char *argv[], client *cl);
7ac48069 251int add_member_to_list(struct query *q, char *argv[], client *cl);
252int delete_member_from_list(struct query *q, char *argv[], client *cl);
20541c25 253int tag_member_of_list(struct query *q, char *argv[], client *cl);
7ac48069 254int register_user(struct query *q, char *argv[], client *cl);
77eb4bdf 255int do_user_reservation(struct query *q, char *argv[], client *cl);
2fb668b0 256int update_container(struct query *q, char *argv[], client *cl);
73155abd 257int set_container_list(struct query *q, char *argv[], client *cl);
7ac48069 258
7ac48069 259int get_ace_use(struct query *q, char **argv, client *cl,
260 int (*action)(int, char *[], void *), void *actarg);
d3051625 261int get_host_by_owner(struct query *q, char **argv, client *cl,
262 int (*action)(int, char *[], void *), void *actarg);
7ac48069 263int qualified_get_lists(struct query *q, char **argv, client *cl,
264 int (*action)(int, char *[], void *), void *actarg);
265int get_members_of_list(struct query *q, char **argv, client *cl,
266 int (*action)(int, char *[], void *), void *actarg);
7ac48069 267int qualified_get_server(struct query *q, char **argv, client *cl,
268 int (*action)(int, char *[], void *), void *actarg);
269int qualified_get_serverhost(struct query *q, char **argv, client *cl,
270 int (*action)(int, char *[], void *),
271 void *actarg);
272int count_members_of_list(struct query *q, char **argv, client *cl,
273 int (*action)(int, char *[], void *), void *actarg);
274int get_lists_of_member(struct query *q, char **argv, client *cl,
275 int (*action)(int, char *[], void *), void *actarg);
77eb4bdf 276int get_user_reservations(struct query *q, char **argv, client *cl,
277 int (*action)(int, char *[], void *), void *actarg);
278int get_user_by_reservation(struct query *q, char **argv, client *cl,
279 int (*action)(int, char *[], void *),
280 void *actarg);
2fb668b0 281int get_machines_of_container(struct query *q, char **argv, client *cl,
282 int (*action)(int, char *[], void *),
283 void *actarg);
284int get_subcontainers_of_container(struct query *q, char **argv, client *cl,
285 int (*action)(int, char *[], void *),
286 void *actarg);
287
7ac48069 288
289/* prototypes from qvalidate.pc */
7ac48069 290int validate_fields(struct query *q, char *argv[], struct valobj *vo, int n);
291int validate_row(struct query *q, char *argv[], struct validate *v);
This page took 0.15421 seconds and 5 git commands to generate.