3 * Creates a new sms database
5 * Copyright 1988 by the Massachusetts Institute of Technology.
6 * For copying and distribution information, please see the file
10 #include <mit-copyright.h>
12 #include "../server/query.h"
14 static int ingres_errno = 0;
17 extern char *tables[];
18 extern struct query Queries2[];
19 extern int QueryCount2;
21 char *values[] = { "users_id", "mach_id", "clu_id", "list_id",
22 "nfsphys_id", "filsys_id", "strings_id", "dcm_enable",
25 struct alias { char *name;
29 {"ace_type", "TYPE", "KERBEROS"},
30 {"ace_type", "TYPE", "LIST"},
31 {"ace_type", "TYPE", "NONE"},
32 {"ace_type", "TYPE", "USER"},
33 {"alias", "TYPE", "FILESYS"},
34 {"alias", "TYPE", "PALLADIUM"},
35 {"alias", "TYPE", "TYPE"},
36 {"alias", "TYPE", "SERVICE"},
37 {"alias", "TYPE", "TYPEDATA"},
38 {"alias", "TYPE", "VALUE"},
39 {"boolean", "TYPE", "FALSE"},
40 {"boolean", "TYPE", "DONTCARE"},
41 {"boolean", "TYPE", "TRUE"},
42 {"class", "TYPE", "STAFF"},
43 {"class", "TYPE", "1990"},
44 {"class", "TYPE", "1991"},
45 {"class", "TYPE", "1992"},
46 {"class", "TYPE", "1993"},
47 {"class", "TYPE", "FACULTY"},
48 {"class", "TYPE", "G"},
49 {"class", "TYPE", "GUEST"},
50 {"class", "TYPE", "TEST"},
51 {"class", "TYPE", "SYSTEM"},
52 {"filesys", "TYPE", "ERR"},
53 {"filesys", "TYPE", "FSGROUP"},
54 {"filesys", "TYPE", "NFS"},
55 {"filesys", "TYPE", "RVD"},
56 {"filesys", "TYPE", "AFS"},
57 {"gaus", "TYPE", "LIST"},
58 {"gaus", "TYPE", "USER"},
59 {"gaus", "TYPE", "RLIST"},
60 {"gaus", "TYPE", "RUSER"},
61 {"lockertype", "TYPE", "COURSE"},
62 {"lockertype", "TYPE", "HOMEDIR"},
63 {"lockertype", "TYPE", "OTHER"},
64 {"lockertype", "TYPE", "PROJECT"},
65 {"lockertype", "TYPE", "SYSTEM"},
66 {"mac_type", "TYPE", "MAC"},
67 {"mac_type", "TYPE", "NEXT"},
68 {"mac_type", "TYPE", "PMAX"},
69 {"mac_type", "TYPE", "RT"},
70 {"mac_type", "TYPE", "VAX"},
71 {"member", "TYPE", "KERBEROS"},
72 {"member", "TYPE", "LIST"},
73 {"member", "TYPE", "STRING"},
74 {"member", "TYPE", "USER"},
75 {"pobox", "TYPE", "SMTP"},
76 {"pobox", "TYPE", "NONE"},
77 {"pobox", "TYPE", "POP"},
78 {"rmember", "TYPE", "LIST"},
79 {"rmember", "TYPE", "STRING"},
80 {"rmember", "TYPE", "USER"},
81 {"rmember", "TYPE", "KERBEROS"},
82 {"rmember", "TYPE", "RLIST"},
83 {"rmember", "TYPE", "RSTRING"},
84 {"rmember", "TYPE", "RUSER"},
85 {"rmember", "TYPE", "RKERBEROS"},
86 {"service", "TYPE", "REPLICAT"},
87 {"service", "TYPE", "REPLICATED"},
88 {"service", "TYPE", "UNIQUE"},
89 {"slabel", "TYPE", "LPR"},
90 {"slabel", "TYPE", "KERBEROS"},
91 {"slabel", "TYPE", "USRLIB"},
92 {"slabel", "TYPE", "SYSLIB"},
93 {"slabel", "TYPE", "ZEPHYR"},
94 {"KERBEROS", "TYPEDATA", "string"},
95 {"LIST", "TYPEDATA", "list"},
96 {"NONE", "TYPEDATA", "none"},
97 {"POP", "TYPEDATA", "machine"},
98 {"RLIST", "TYPEDATA", "list"},
99 {"RSTRING", "TYPEDATA", "string"},
100 {"RUSER", "TYPEDATA", "user"},
101 {"SMTP", "TYPEDATA", "string"},
102 {"STRING", "TYPEDATA", "string"},
103 {"USER", "TYPEDATA", "user"},
112 ## char *table, *user, *value, *query, *trans, *type, *db;
122 printf("Unable to open the database\n");
126 strcpy(buffer, "root");
129 for (i = 0; table = tables[i]; i++) {
130 ## define permit all on table to user
132 printf("Unable to give %s permission to access table %s\n",
137 printf("Enter the name of another user to be given direct access to\n");
138 printf("the database, or [RETURN] if none: ");
143 for (i = 0; table = tables[i]; i++) {
144 ## repeat append tblstats (#table = @table, modtime = "now")
146 printf("Unable to initialize tblstats for %s\n", table);
151 for (i = 0; value = values[i]; i++) {
152 ## repeat append values (#name = @value, #value = 1)
154 printf("Unable to install initial value of %s\n", value);
159 printf("What is the starting UID to assign: ");
163 ## append values (#name = "uid", #value = i)
165 printf("Unable to install value for uid\n");
169 printf("What is the starting GID to assign: ");
173 ## append values (#name = "gid", #value = i)
175 printf("Unable to install value for gid\n");
179 printf("What is the default NFS quota to assign: ");
183 ## append values (#name = "def_quota", #value = i)
185 printf("Unable to install value for def_quota\n");
189 /* place holder records */
190 ## append users (login = "[nobody]", potype="NONE")
192 printf("Unable to install 0 user\n");
195 ## append machine (name = "[NONE]", #type="NONE")
197 printf("Unable to install 0 machine\n");
200 ## append cluster (name = "[unassigned]")
202 printf("Unable to install 0 cluster\n");
205 ## append list (name = "[none]", acl_type = "NONE")
207 printf("Unable to install 0 list\n");
210 ## append filesys (label = "[none]", #type = "NONE")
212 printf("Unable to install 0 filesys\n");
215 ## append nfsphys (device = "/dev/null")
217 printf("Unable to install 0 filesys\n");
221 /* magic for ALL_USERS */
222 ## append users (login = "default", users_id = 1, potype="NONE")
224 printf("Unable to install default user\n");
227 ## append list (name = "default", list_id = 1, acl_type = "NONE")
229 printf("Unable to install default list\n");
232 ## append imembers (list_id = 1, member_type = "USER", member_id = 1,
233 ## ref_count = 1, direct = 1)
235 printf("Unable to install default user on default list\n");
239 /* Priveleged users */
240 ## append users (login = "root", users_id = 2, potype="NONE")
242 printf("Unable to install root user\n");
245 ## append list (name = "dbadmin", list_id = 2, acl_type = "LIST", acl_id = 2)
247 printf("Unable to install default dbadmin list\n");
251 printf("What is the name of a priveleged user: ");
255 ## append users (login = user, users_id = 3, potype="NONE")
257 printf("Unable to install user %s\n", buffer);
260 ## append imembers (list_id = 2, member_type = "USER", member_id = 3,
261 ## ref_count = 1, direct = 1)
263 printf("Unable to put user %s on list dbadmin\n", buffer);
267 /* And the capacls */
268 for (i = 0; i < QueryCount2; i++) {
269 query = Queries2[i].name;
270 value = Queries2[i].shortname;
271 ## repeat append capacls (capability = @query, tag = @value, list_id = 2)
273 printf("Unable to install query ACL for %s (%s)\n", query, value);
277 ## append capacls (capability = "trigger_dcm", tag = "tdcm", list_id = 2)
279 /* and the aliases */
280 for (i = 0; aliases[i].name ; i++) {
281 value = aliases[i].name;
282 type = aliases[i].type;
283 trans = aliases[i].trans;
284 ## repeat append alias (#name = @value, #type = @type, #trans = @trans)
294 * ingerr: (supposedly) called when Ingres indicates an error.
295 * I have not yet been able to get this to work to intercept a
296 * database open error.
309 int access_visible_list() {}
310 int access_maillist() {}
312 int access_login() {}
313 int access_filesys() {}
328 int uusr_login_check() {}
330 int set_modtime_by_id() {}
331 int set_user_modtime() {}
332 int set_user_modtime_by_id() {}
333 int set_finger_modtime() {}
334 int set_filesys_modtime() {}
335 int set_mach_modtime() {}
336 int set_mach_modtime_by_id() {}
337 int set_serverhost_modtime() {}
338 int set_zephyr_modtime() {}
339 int followup_amtl() {}
340 int followup_ausr() {}
341 int followup_delete_list() {}
342 int followup_add_pobox() {}
343 int followup_delete_pobox() {}
344 int followup_usha() {}
345 int followup_old_gpob() {}
346 int followup_gsha() {}
347 int followup_anfq() {}
348 int followup_gzcl() {}
349 int followup_fix_acl() {}
350 int followup_fix_modby() {}
351 int translate_ids() {}
352 int expand_list_flags() {}
353 int add_new_quota() {}
354 int count_members_of_list() {}
355 int get_list_is_group() {}
356 int get_list_is_maillist() {}
358 int delete_locker() {}
359 int add_user_group() {}
360 int set_user_pobox() {}
361 int get_members_of_list() {}
362 int get_groups_of_user() {}
363 int get_groups_of_all_users() {}
364 int get_all_poboxes() {}
365 int get_new_poboxes() {}
366 int get_lists_of_administrator() {}
367 int followup_gpob() {}
370 int set_pobox_modtime() {}
372 int set_cluster_modtime_by_id() {}
373 int access_service() {}
374 int followup_glin() {}
375 int qualified_get_server() {}
376 int qualified_get_serverhost() {}
378 int set_nfsphys_modtime() {}
380 int access_member() {}
383 int qualified_get_lists() {}
384 int delete_current_quota() {}
385 int setup_add_group() {}
388 int get_lists_of_member() {}
390 int get_list_info() {}
391 int register_user() {}
392 int access_vis_list_by_name() {}
393 int set_uppercase_modtime() {}
394 int add_member_to_list() {}
395 int delete_member_from_list() {}
397 int followup_gnfq() {}