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 {"quota_type", "TYPE", "USER"},
79 {"quota_type", "TYPE", "GROUP"},
80 {"quota_type", "TYPE", "ANY"},
81 {"rmember", "TYPE", "LIST"},
82 {"rmember", "TYPE", "STRING"},
83 {"rmember", "TYPE", "USER"},
84 {"rmember", "TYPE", "KERBEROS"},
85 {"rmember", "TYPE", "RLIST"},
86 {"rmember", "TYPE", "RSTRING"},
87 {"rmember", "TYPE", "RUSER"},
88 {"rmember", "TYPE", "RKERBEROS"},
89 {"service", "TYPE", "REPLICAT"},
90 {"service", "TYPE", "REPLICATED"},
91 {"service", "TYPE", "UNIQUE"},
92 {"slabel", "TYPE", "LPR"},
93 {"slabel", "TYPE", "KERBEROS"},
94 {"slabel", "TYPE", "USRLIB"},
95 {"slabel", "TYPE", "SYSLIB"},
96 {"slabel", "TYPE", "ZEPHYR"},
97 {"ANY", "TYPEDATA", "none"},
98 {"KERBEROS", "TYPEDATA", "string"},
99 {"GROUP", "TYPEDATA", "list"},
100 {"LIST", "TYPEDATA", "list"},
101 {"NONE", "TYPEDATA", "none"},
102 {"POP", "TYPEDATA", "machine"},
103 {"RLIST", "TYPEDATA", "list"},
104 {"RSTRING", "TYPEDATA", "string"},
105 {"RUSER", "TYPEDATA", "user"},
106 {"SMTP", "TYPEDATA", "string"},
107 {"STRING", "TYPEDATA", "string"},
108 {"USER", "TYPEDATA", "user"},
117 ## char *table, *user, *value, *query, *trans, *type, *db;
127 printf("Unable to open the database\n");
131 strcpy(buffer, "root");
134 for (i = 0; table = tables[i]; i++) {
135 ## define permit all on table to user
137 printf("Unable to give %s permission to access table %s\n",
142 printf("Enter the name of another user to be given direct access to\n");
143 printf("the database, or [RETURN] if none: ");
148 for (i = 0; table = tables[i]; i++) {
149 ## repeat append tblstats (#table = @table, modtime = "now")
151 printf("Unable to initialize tblstats for %s\n", table);
156 for (i = 0; value = values[i]; i++) {
157 ## repeat append values (#name = @value, #value = 1)
159 printf("Unable to install initial value of %s\n", value);
164 printf("What is the starting UID to assign: ");
168 ## append values (#name = "uid", #value = i)
170 printf("Unable to install value for uid\n");
174 printf("What is the starting GID to assign: ");
178 ## append values (#name = "gid", #value = i)
180 printf("Unable to install value for gid\n");
184 printf("What is the default NFS quota to assign: ");
188 ## append values (#name = "def_quota", #value = i)
190 printf("Unable to install value for def_quota\n");
194 /* place holder records */
195 ## append users (login = "[nobody]", potype="NONE")
197 printf("Unable to install 0 user\n");
200 ## append machine (name = "[NONE]", #type="NONE")
202 printf("Unable to install 0 machine\n");
205 ## append cluster (name = "[unassigned]")
207 printf("Unable to install 0 cluster\n");
210 ## append list (name = "[none]", acl_type = "NONE")
212 printf("Unable to install 0 list\n");
215 ## append filesys (label = "[none]", #type = "NONE")
217 printf("Unable to install 0 filesys\n");
220 ## append nfsphys (device = "/dev/null")
222 printf("Unable to install 0 nfsphys\n");
226 /* magic for ALL_USERS */
227 ## append users (login = "default", users_id = 1, potype="NONE")
229 printf("Unable to install default user\n");
232 ## append list (name = "default", list_id = 1, acl_type = "NONE")
234 printf("Unable to install default list\n");
237 ## append imembers (list_id = 1, member_type = "USER", member_id = 1,
238 ## ref_count = 1, direct = 1)
240 printf("Unable to install default user on default list\n");
244 /* Privileged users */
245 ## append users (login = "root", users_id = 2, potype="NONE")
247 printf("Unable to install root user\n");
250 ## append list (name = "dbadmin", list_id = 2, acl_type = "LIST", acl_id = 2)
252 printf("Unable to install default dbadmin list\n");
256 printf("What is the name of a privileged user: ");
260 ## append users (login = user, users_id = 3, potype="NONE")
262 printf("Unable to install user %s\n", buffer);
265 ## append imembers (list_id = 2, member_type = "USER", member_id = 2,
266 ## ref_count = 1, direct = 1)
268 printf("Unable to put user root on list dbadmin\n");
271 ## append imembers (list_id = 2, member_type = "USER", member_id = 3,
272 ## ref_count = 1, direct = 1)
274 printf("Unable to put user %s on list dbadmin\n", buffer);
278 /* And the capacls */
279 for (i = 0; i < QueryCount2; i++) {
280 query = Queries2[i].name;
281 value = Queries2[i].shortname;
282 ## repeat append capacls (capability = @query, tag = @value, list_id = 2)
284 printf("Unable to install query ACL for %s (%s)\n", query, value);
288 ## append capacls (capability = "trigger_dcm", tag = "tdcm", list_id = 2)
290 /* and the aliases */
291 for (i = 0; aliases[i].name ; i++) {
292 value = aliases[i].name;
293 type = aliases[i].type;
294 trans = aliases[i].trans;
295 ## repeat append alias (#name = @value, #type = @type, #trans = @trans)
305 * ingerr: (supposedly) called when Ingres indicates an error.
306 * I have not yet been able to get this to work to intercept a
307 * database open error.
320 int access_visible_list() {}
321 int access_maillist() {}
323 int access_login() {}
324 int access_filesys() {}
339 int uusr_login_check() {}
341 int set_modtime_by_id() {}
342 int set_user_modtime() {}
343 int set_user_modtime_by_id() {}
344 int set_finger_modtime() {}
345 int set_filesys_modtime() {}
346 int set_mach_modtime() {}
347 int set_mach_modtime_by_id() {}
348 int set_serverhost_modtime() {}
349 int set_zephyr_modtime() {}
350 int followup_amtl() {}
351 int followup_ausr() {}
352 int followup_delete_list() {}
353 int followup_add_pobox() {}
354 int followup_delete_pobox() {}
355 int followup_usha() {}
356 int followup_old_gpob() {}
357 int followup_gsha() {}
358 int followup_anfq() {}
359 int followup_gzcl() {}
360 int followup_fix_acl() {}
361 int followup_fix_modby() {}
362 int translate_ids() {}
363 int expand_list_flags() {}
364 int add_new_quota() {}
365 int count_members_of_list() {}
366 int get_list_is_group() {}
367 int get_list_is_maillist() {}
369 int delete_locker() {}
370 int add_user_group() {}
371 int set_user_pobox() {}
372 int get_members_of_list() {}
373 int get_groups_of_user() {}
374 int get_groups_of_all_users() {}
375 int get_all_poboxes() {}
376 int get_new_poboxes() {}
377 int get_lists_of_administrator() {}
378 int followup_gpob() {}
381 int set_pobox_modtime() {}
383 int set_cluster_modtime_by_id() {}
384 int access_service() {}
385 int followup_glin() {}
386 int qualified_get_server() {}
387 int qualified_get_serverhost() {}
389 int set_nfsphys_modtime() {}
391 int access_member() {}
394 int qualified_get_lists() {}
395 int delete_current_quota() {}
396 int setup_add_group() {}
399 int get_lists_of_member() {}
401 int get_list_info() {}
402 int register_user() {}
403 int access_vis_list_by_name() {}
404 int set_uppercase_modtime() {}
405 int add_member_to_list() {}
406 int delete_member_from_list() {}
408 int followup_gnfq() {}
409 int followup_gqot() {}
410 int followup_aqot() {}