]>
Commit | Line | Data |
---|---|---|
d2543f8c | 1 | /* $Header$ |
2 | * | |
2ce085d2 | 3 | * Declarations for Moira database consistancy checker |
d2543f8c | 4 | * |
5 | * (c) Copyright 1988 by the Massachusetts Institute of Technology. | |
6 | * For copying and distribution information, please see the file | |
7 | * <mit-copyright.h>. | |
8 | */ | |
9 | ||
d2543f8c | 10 | #include <mit-copyright.h> |
7ac48069 | 11 | #include <moira_site.h> |
cfc4f91e | 12 | #include <moira_schema.h> |
d2543f8c | 13 | |
14 | #define MODE_ASK 1 | |
15 | #define MODE_NO 2 | |
16 | #define MODE_PREEN 3 | |
17 | #define MODE_YES 4 | |
18 | ||
6f4e78e6 | 19 | extern int debug, mode, fast, dcmenable, warn; |
fe0a844a | 20 | extern struct hash *users, *machines, *clusters, *lists, *printservers; |
ab05f33a | 21 | extern struct hash *filesys, *nfsphys, *strings, *subnets, *string_dups; |
cb884d06 | 22 | extern struct hash *containers; |
d2543f8c | 23 | |
cda4b4aa | 24 | #define MAX_ID_VALUE 131072 |
d2543f8c | 25 | #define MIN_ID_VALUE 100 |
26 | ||
5eaef520 | 27 | #define dprintf if (debug) printf |
d2543f8c | 28 | |
29 | struct user { | |
cfc4f91e | 30 | char login[USERS_LOGIN_SIZE]; |
ab05f33a | 31 | char potype; |
32 | char *fullname; | |
33 | int status; | |
34 | int users_id; | |
35 | int pobox_id; | |
36 | int comment; | |
37 | int modby; | |
38 | int fmodby; | |
39 | int pmodby; | |
40 | int sigwho; | |
8949c781 | 41 | char sponsor_type; |
42 | int sponsor_id; | |
d2543f8c | 43 | }; |
44 | ||
45 | struct machine { | |
cfc4f91e | 46 | char name[MACHINE_NAME_SIZE]; |
ab05f33a | 47 | char owner_type; |
48 | int owner_id; | |
49 | int snet_id; | |
50 | int mach_id; | |
51 | int clucount; | |
52 | int acomment; | |
53 | int ocomment; | |
54 | int creator; | |
55 | int modby; | |
56 | }; | |
57 | ||
58 | struct subnet { | |
cfc4f91e | 59 | char name[SUBNET_NAME_SIZE]; |
ab05f33a | 60 | char owner_type; |
61 | int owner_id; | |
62 | int snet_id; | |
63 | int modby; | |
d2543f8c | 64 | }; |
65 | ||
66 | struct cluster { | |
cfc4f91e | 67 | char name[CLUSTERS_NAME_SIZE]; |
5eaef520 | 68 | int clu_id; |
69 | int modby; | |
d2543f8c | 70 | }; |
71 | ||
72 | struct list { | |
cfc4f91e | 73 | char name[LIST_NAME_SIZE]; |
5eaef520 | 74 | char acl_type; |
ad47bcbe | 75 | char memacl_type; |
5eaef520 | 76 | int list_id; |
cfc4f91e | 77 | int acl_id; |
ad47bcbe | 78 | int memacl_id; |
cfc4f91e | 79 | int modby; |
5eaef520 | 80 | int members; |
d2543f8c | 81 | }; |
82 | ||
83 | struct string { | |
5eaef520 | 84 | char *name; |
85 | int string_id; | |
86 | int refc; | |
d2543f8c | 87 | }; |
88 | ||
89 | struct filesys { | |
cfc4f91e | 90 | char name[FILESYS_LABEL_SIZE]; |
91 | char dir[FILESYS_NAME_SIZE]; | |
5eaef520 | 92 | char type; |
93 | int filsys_id; | |
94 | int mach_id; | |
95 | int owner; | |
96 | int owners; | |
97 | int phys_id; | |
d2543f8c | 98 | }; |
99 | ||
100 | struct nfsphys { | |
cfc4f91e | 101 | char dir[NFSPHYS_DIR_SIZE]; |
5eaef520 | 102 | int mach_id; |
103 | int nfsphys_id; | |
05d03f93 | 104 | unsigned long long allocated; |
cfc4f91e | 105 | int modby; |
05d03f93 | 106 | unsigned long long count; |
d2543f8c | 107 | }; |
7ac48069 | 108 | |
fe0a844a | 109 | struct printserver { |
110 | int mach_id; | |
111 | int printer_types; | |
112 | char owner_type; | |
113 | int owner_id; | |
114 | int lpc_acl; | |
115 | int modby; | |
116 | }; | |
117 | ||
cb884d06 | 118 | struct container { |
119 | char name[CONTAINERS_NAME_SIZE]; | |
120 | int cnt_id; | |
121 | int list_id; | |
122 | char acl_type; | |
123 | int acl_id; | |
124 | char memacl_type; | |
125 | int memacl_id; | |
126 | int modby; | |
127 | }; | |
128 | ||
7ac48069 | 129 | void dbmserr(void); |
130 | void out_of_mem(char *msg); | |
131 | void cleanup(void); | |
132 | ||
133 | void modified(char *table); | |
134 | ||
135 | void phase1(void); | |
136 | void phase2(void); | |
137 | void phase3(void); | |
138 | void phase4(void); | |
139 | void count_only_setup(void); | |
140 | ||
141 | /* prototypes from fix.pc */ | |
142 | void generic_delete(struct save_queue *sq, int (*pfunc)(void *), char *table, | |
143 | char *idfield, int preen); | |
144 | void single_delete(char *table, char *idfield, int id); | |
145 | void zero_fix(char *tbl, char *zrfield, char *idfield, int id); | |
146 | int single_fix(char *msg, int preen); | |
147 | void generic_fix(struct save_queue *sq, int (*pfunc)(void *), char *msg, | |
148 | void (*ffunc)(void *), int preen); | |
149 | int prompt(char *msg); | |
150 | int set_next_object_id(char *object, char *tablename); | |
151 | int generic_fix_id(char *tbl, char *idfield, char *txtfield, | |
152 | int oldid, char *name); | |
153 | ||
154 | /* prototypes from phase3.pc */ | |
155 | struct string *string_check(int id); |