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