source: trunk/third/moira/server/mr_server.h @ 24319

Revision 24319, 12.6 KB checked in by broder, 14 years ago (diff)
New Moira snapshot from SVN.
1/* $Id: mr_server.h 3956 2010-01-05 20:56:56Z zacheiss $
2 *
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>.
6 */
8#include <moira.h>
9#include <mr_private.h>
10#include <moira_site.h>
11#include <moira_schema.h>
13#include <netinet/in.h>
15#include <stdarg.h>
17#ifdef HAVE_KRB4
18#include <krb.h>
20#include <mr_krb.h>
22#include <krb5.h>
27 * This structure holds all per-client information; one of these is
28 * allocated for each active client.
29 */
31typedef struct _client {
32  int con;                      /* Connection to the client */
33  int id;                       /* Unique id of client */
34  struct sockaddr_in haddr;     /* IP address of client */
35  enum clstate state;           /* State of the connection */
36  char clname[MAX_K_NAME_SZ];   /* Name client authenticated to */
37  char entity[USERS_MODWITH_SIZE]; /* client program being used */
38  int users_id;                 /* Moira-internal ID of authenticated user */
39  int client_id;                /* Moira-internal ID of client */
40  int proxy_id;                 /* client_id of orig user, if proxied */
41  int version;                  /* Max query version known by client */
42  time_t last_time_used;        /* Last time connection used */
43  mr_params req;                /* Current request */
44  mr_params *tuples;            /* Tuples waiting to send back to client */
45  int ntuples;                  /* Number of tuples waiting */
46  int tuplessize;               /* Current size of tuple array */
47  int nexttuple;                /* Next tuple to return */
48  char *hsbuf;                  /* Buffer for initial connection handshaking */
49  int hslen;                    /* Length of data in hsbuf */
50} client;
52struct mxentry
54  char *name;
55  int pref;
58extern char *krb_realm;
60/* max length of query argument allowed */
61#define ARGLEN  257
62/* Used to setup static argv, maximum argc */
63#define QMAXARGS        25
65/* statistics on number of queries by version number */
66extern int newqueries;
68/* Maximum and minimum values that will be used for uids and gids */
69#define MAX_ID_VALUE    131072
70#define MIN_ID_VALUE    100
72/* Sleepy states for the server! */
73#define AWAKE 0
74#define SLEEPY 1
75#define ASLEEP 2
76#define GROGGY 3
77extern int dormant;
79/* state for the incremental update system */
80extern int inc_running, inc_pid;
81extern time_t inc_started, now;
82#define INC_TIMEOUT (3 * 60)    /* 3 minutes */
85#define SQL_NO_MATCH 1403 /* oracle, not ingres (= 100) */
87/* types needed for prototypes */
88struct query;
89struct validate;
90struct valobj;
92/* prototypes from increment.dc */
93void incremental_init(void);
94void next_incremental(void);
95void incremental_update(void);
96void incremental_flush(void);
98/* prototypes from qrtn.dc */
99void dbmserr(void);
100void dosql(char *buffers[]);
101int mr_open_database(void);
102void mr_close_database(void);
103int mr_process_query(client *cl, char *name, int argc, char *argv_ro[],
104                     int (*action)(int, char *[], void *), void *actarg);
105int mr_check_access(client *cl, char *name, int argc, char *argv_ro[]);
106void sanity_check_queries(void);
107int set_krb_mapping(char *name, char *login, int ok, int *kid, int *uid);
108int find_member(char *list_type, int list_id, client *cl);
109int do_for_all_rows(char *query, int count,
110                    int (*action)(int, char *[], void *), void *actarg);
111char *build_qual(char *fmt, int argc, char *argv[]);
114/* prototyoes from qsupport.dc */
115int set_pop_usage(int id, int cnt);
117/* prototypes from qvalidate.dc */
118void sanity_check_database(void);
119int add_string(char *name);
120int convert_wildcards(char *arg);
122/* prototypes from mr_main.c */
123void clist_delete(client *cp);
125/* prototypes from mr_sauth.c */
126void do_auth(client *cl);
127void do_proxy(client *cl);
128void do_krb5_auth(client *cl);
130/* prototypes from mr_scall.c */
131void do_client(client *cl);
132void client_reply(client *cl, long status);
133void client_return_tuple(client *cl, int argc, char **argv);
134void client_read(client *cl);
135void client_write(client *cl);
137/* prototypes from mr_shutdown.c */
138void sigshut(int);
139void do_shutdown(client *cl);
141/* prototypes from mr_util.c */
142char *requote(char *buf);
143void log_args(char *tag, int version, int argc, char **argv);
144void mr_com_err(const char *whoami, long code, const char *fmt, va_list pvar);
145int mr_trim_args(int argc, char **argv);
146char **mr_copy_args(char **argv, int argc);
147void *xmalloc(size_t);
148void *xrealloc(void *, size_t);
149char *xstrdup(char *);
151/* prototypes from qaccess.pc */
152int access_user(struct query *q, char *argv[], client *cl);
153int access_login(struct query *q, char *argv[], client *cl);
154int access_spob(struct query *q, char *argv[], client *cl);
155int access_list(struct query *q, char *argv[], client *cl);
156int access_visible_list(struct query *q, char *argv[], client *cl);
157int access_vis_list_by_name(struct query *q, char *argv[], client *cl);
158int access_member(struct query *q, char *argv[], client *cl);
159int access_qgli(struct query *q, char *argv[], client *cl);
160int access_service(struct query *q, char *argv[], client *cl);
161int access_filesys(struct query *q, char *argv[], client *cl);
162int access_host(struct query *q, char *argv[], client *cl);
163int access_ahal(struct query *q, char *argv[], client *cl);
164int access_snt(struct query *q, char *argv[], client *cl);
165int access_printer(struct query *q, char *argv[], client *cl);
166int access_zephyr(struct query *q, char *argv[], client *cl);
167int access_container(struct query *q, char *argv[], client *cl);
168int access_update_user(struct query *q, char *argv[], client *cl);
169int check_mail_string(char *mailstring);
170struct mxentry *getmxrecords(const char *);
172/* prototypes from qfollow.pc */
173int followup_fix_modby(struct query *q, struct save_queue *sq,
174                       struct validate *v, int (*action)(int, char **, void *),
175                       void *actarg, client *cl);
176int followup_gpob(struct query *q, struct save_queue *sq, struct validate *v,
177                  int (*action)(int, char **, void *), void *actarg,
178                  client *cl);
179int followup_glin(struct query *q, struct save_queue *sq, struct validate *v,
180                  int (*action)(int, char **, void *), void *actarg,
181                  client *cl);
182int followup_gsin(struct query *q, struct save_queue *sq, struct validate *v,
183                  int (*action)(int, char **, void *), void *actarg,
184                  client *cl);
185int followup_gzcl(struct query *q, struct save_queue *sq, struct validate *v,
186                  int (*action)(int, char **, void *), void *actarg,
187                  client *cl);
188int followup_gsha(struct query *q, struct save_queue *sq, struct validate *v,
189                  int (*action)(int, char **, void *), void *actarg,
190                  client *cl);
191int followup_gqot(struct query *q, struct save_queue *sq, struct validate *v,
192                  int (*action)(int, char **, void *), void *actarg,
193                  client *cl);
194int followup_guax(struct query *q, struct save_queue *sq, struct validate *v,
195                  int (*action)(int, char **, void *), void *actarg,
196                  client *cl);
197int followup_gsnt(struct query *q, struct save_queue *sq, struct validate *v,
198                  int (*action)(int, char **, void *), void *actarg,
199                  client *cl);
200int followup_ghst(struct query *q, struct save_queue *sq, struct validate *v,
201                  int (*action)(int, char **, void *), void *actarg,
202                  client *cl);
203int followup_gpsv(struct query *q, struct save_queue *sq, struct validate *v,
204                  int (*action)(int, char **, void *), void *actarg,
205                  client *cl);
206int followup_gcon(struct query *q, struct save_queue *sq, struct validate *v,
207                  int (*action)(int, char **, void *), void *actarg,
208                  client *cl);
209int followup_get_user(struct query *q, struct save_queue *sq,
210                      struct validate *v, int (*action)(int, char **, void *),
211                      void *actarg, client *cl);
213int followup_ausr(struct query *q, char *argv[], client *cl);
214int followup_aqot(struct query *q, char *argv[], client *cl);
215int followup_dqot(struct query *q, char *argv[], client *cl);
217int set_modtime(struct query *q, char *argv[], client *cl);
218int set_modtime_by_id(struct query *q, char *argv[], client *cl);
219int set_finger_modtime(struct query *q, char *argv[], client *cl);
220int set_pobox_modtime(struct query *q, char *argv[], client *cl);
221int set_uppercase_modtime(struct query *q, char *argv[], client *cl);
222int set_mach_modtime_by_id(struct query *q, char *argv[], client *cl);
223int set_cluster_modtime_by_id(struct query *q, char *argv[], client *cl);
224int set_serverhost_modtime(struct query *q, char *argv[], client *cl);
225int set_nfsphys_modtime(struct query *q, char *argv[], client *cl);
226int set_filesys_modtime(struct query *q, char *argv[], client *cl);
227int set_zephyr_modtime(struct query *q, char *argv[], client *cl);
228int set_service_modtime(struct query *q, char *argv[], client *cl);
229int _sdl_followup(struct query *q, char *argv[], client *cl);
230int trigger_dcm(struct query *q, char *argv[], client *cl);
232/* prototypes from qsetup.pc */
233int prefetch_value(struct query *q, char *argv[], client *cl);
234int prefetch_filesys(struct query *q, char *argv[], client *cl);
235int setup_ausr(struct query *q, char *argv[], client *cl);
236int setup_dusr(struct query *q, char *argv[], client *cl);
237int setup_dpob(struct query *q, char *argv[], client *cl);
238int setup_dmac(struct query *q, char *argv[], client *cl);
239int setup_dclu(struct query *q, char *argv[], client *cl);
240int setup_alis(struct query *q, char *argv[], client *cl);
241int setup_dlis(struct query *q, char *argv[], client *cl);
242int setup_dsin(struct query *q, char *argv[], client *cl);
243int setup_dshi(struct query *q, char *argv[], client *cl);
244int setup_afil(struct query *q, char *argv[], client *cl);
245int setup_ufil(struct query *q, char *argv[], client *cl);
246int setup_dfil(struct query *q, char *argv[], client *cl);
247int setup_aftg(struct query *q, char *argv[], client *cl);
248int setup_dnfp(struct query *q, char *argv[], client *cl);
249int setup_dqot(struct query *q, char *argv[], client *cl);
250int setup_asnt(struct query *q, char *argv[], client *cl);
251int setup_dsnt(struct query *q, char *argv[], client *cl);
252int setup_ghst(struct query *q, char *argv[], client *cl);
253int setup_ahst(struct query *q, char *argv[], client *cl);
254int setup_ahal(struct query *q, char *argv[], client *cl);
255int setup_uhha(struct query *q, char *argv[], client *cl);
256int setup_aprn(struct query *q, char *argv[], client *cl);
257int setup_dpsv(struct query *q, char *argv[], client *cl);
258int setup_dcon(struct query *q, char *argv[], client *cl);
259int setup_acon(struct query *q, char *argv[], client *cl);
260int setup_scli(struct query *q, char *argv[], client *cl);
261int setup_aali(struct query *q, char *argv[], client *cl);
263/* prototypes from qsupport.pc */
264int set_pobox(struct query *q, char *argv[], client *cl);
265int set_pobox_pop(struct query *q, char *argv[], client *cl);
266int add_member_to_list(struct query *q, char *argv[], client *cl);
267int delete_member_from_list(struct query *q, char *argv[], client *cl);
268int tag_member_of_list(struct query *q, char *argv[], client *cl);
269int register_user(struct query *q, char *argv[], client *cl);
270int do_user_reservation(struct query *q, char *argv[], client *cl);
271int update_container(struct query *q, char *argv[], client *cl);
272int set_container_list(struct query *q, char *argv[], client *cl);
274int get_ace_use(struct query *q, char **argv, client *cl,
275                int (*action)(int, char *[], void *), void *actarg);
276int get_host_by_owner(struct query *q, char **argv, client *cl,
277                int (*action)(int, char *[], void *), void *actarg);
278int get_user_account_by_sponsor(struct query *q, char **argv, client *cl,
279                                int (*action)(int, char *[], void *),
280                                void *actarg);
281int qualified_get_lists(struct query *q, char **argv, client *cl,
282                        int (*action)(int, char *[], void *), void *actarg);
283int get_members_of_list(struct query *q, char **argv, client *cl,
284                        int (*action)(int, char *[], void *), void *actarg);
285int qualified_get_server(struct query *q, char **argv, client *cl,
286                         int (*action)(int, char *[], void *), void *actarg);
287int qualified_get_serverhost(struct query *q, char **argv, client *cl,
288                             int (*action)(int, char *[], void *),
289                             void *actarg);
290int count_members_of_list(struct query *q, char **argv, client *cl,
291                          int (*action)(int, char *[], void *), void *actarg);
292int get_lists_of_member(struct query *q, char **argv, client *cl,
293                        int (*action)(int, char *[], void *), void *actarg);
294int get_user_reservations(struct query *q, char **argv, client *cl,
295                          int (*action)(int, char *[], void *), void *actarg);
296int get_user_by_reservation(struct query *q, char **argv, client *cl,
297                            int (*action)(int, char *[], void *),
298                            void *actarg);
299int get_machines_of_container(struct query *q, char **argv, client *cl,
300                            int (*action)(int, char *[], void *),
301                            void *actarg);
302int get_subcontainers_of_container(struct query *q, char **argv, client *cl,
303                            int (*action)(int, char *[], void *),
304                            void *actarg);
307/* prototypes from qvalidate.pc */
308int validate_fields(struct query *q, char *argv[], struct valobj *vo, int n);
309int validate_row(struct query *q, char *argv[], struct validate *v);
Note: See TracBrowser for help on using the repository browser.