3 * Creates a new sms database
5 * Copyright 1988 by the Massachusetts Institute of Technology.
9 #include "../server/query.h"
11 static int ingres_errno = 0;
14 extern char *tables[];
15 extern struct query Queries1[], Queries2[];
16 extern int QueryCount1, QueryCount2;
18 char *values[] = { "users_id", "machine_id", "cluster_id", "list_id",
19 "nfsphys_id", "filsys_id", "strings_id", 0 };
21 struct alias { char *name;
25 {"acl_type", "TYPE", "USER"},
26 {"acl_type", "TYPE", "LIST"},
27 {"acl_type", "TYPE", "NONE"},
28 {"alias", "TYPE", "TYPE"},
29 {"alias", "TYPE", "TYPEDATA"},
30 {"boolean", "TYPE", "FALSE"},
31 {"boolean", "TYPE", "DONTCARE"},
32 {"boolean", "TYPE", "TRUE"},
33 {"class", "TYPE", "staff"},
34 {"class", "TYPE", "1988"},
35 {"class", "TYPE", "1989"},
36 {"class", "TYPE", "1990"},
37 {"class", "TYPE", "1991"},
38 {"class", "TYPE", "1992"},
39 {"class", "TYPE", "G"},
40 {"class", "TYPE", "guest"},
41 {"filesys", "TYPE", "NFS"},
42 {"filesys", "TYPE", "RVD"},
43 {"mac_type", "TYPE", "#"},
44 {"mac_type", "TYPE", "RT"},
45 {"mac_type", "TYPE", "VAX"},
46 {"member", "TYPE", "LIST"},
47 {"member", "TYPE", "STRING"},
48 {"member", "TYPE", "USER"},
49 {"pobox", "TYPE", "SMTP"},
50 {"pobox", "TYPE", "NONE"},
51 {"pobox", "TYPE", "POP"},
52 {"service", "TYPE", "replicated"},
53 {"service", "TYPE", "unique"},
54 {"slabel", "TYPE", "usrlib"},
55 {"slabel", "TYPE", "syslib"},
56 {"slabel", "TYPE", "lpr"},
57 {"slabel", "TYPE", "zephyr"},
58 {"slabel", "TYPE", "kerberos"},
59 {"LIST", "TYPEDATA", "list"},
60 {"NONE", "TYPEDATA", ""},
61 {"POP", "TYPEDATA", "machine"},
62 {"SMTP", "TYPEDATA", "string"},
63 {"STRING", "TYPEDATA", "string"},
64 {"USER", "TYPEDATA", "user"},
73 ## char *table, *user, *value, *query, *trans, *type;
79 printf("Unable to open the database\n");
83 strcpy(buffer, "root");
86 for (i = 0; table = tables[i]; i++) {
87 ## define permit all on table to user
89 printf("Unable to give %s permission to access table %s\n",
94 printf("Enter the name of another user to be given direct access to\n");
95 printf("the database, or [RETURN] if none: ");
100 for (i = 0; table = tables[i]; i++) {
101 ## repeat append tblstats (#table = @table, modtime = "now")
103 printf("Unable to initialize tblstats for %s\n", table);
108 for (i = 0; value = values[i]; i++) {
109 ## repeat append values (#name = @value, #value = 1)
111 printf("Unable to install initial value of %s\n", value);
116 printf("What is the starting UID to assign: ");
120 ## append values (#name = "uid", #value = i)
122 printf("Unable to install value for uid\n");
126 printf("What is the starting GID to assign: ");
130 ## append values (#name = "gid", #value = i)
132 printf("Unable to install value for gid\n");
136 printf("What is the default NFS quota to assign: ");
140 ## append values (#name = "def_quota", #value = i)
142 printf("Unable to install value for def_quota\n");
146 /* place holder records */
147 ## append users (login = "[nobody]", potype="NONE")
149 printf("Unable to install 0 user\n");
152 ## append machine (name = "[none]", #type="NONE")
154 printf("Unable to install 0 machine\n");
157 ## append cluster (name = "[unassigned]")
159 printf("Unable to install 0 cluster\n");
162 ## append list (name = "[none]", acl_type = "NONE")
164 printf("Unable to install 0 list\n");
168 /* magic for ALL_USERS */
169 ## append users (login = "default", users_id = 1, potype="NONE")
171 printf("Unable to install default user\n");
174 ## append list (name = "default", list_id = 1, acl_type = "NONE")
176 printf("Unable to install default list\n");
179 ## append members (list_id = 1, member_type = "USER", member_id = 1)
181 printf("Unable to install default user on default list\n");
185 /* Priveleged users */
186 ## append users (login = "root", users_id = 2, potype="NONE")
188 printf("Unable to install root user\n");
191 ## append list (name = "dbadmin", list_id = 2, acl_type = "LIST", acl_id = 2)
193 printf("Unable to install default dbadmin list\n");
197 printf("What is the name of a priveleged user: ");
201 ## append users (login = user, users_id = 3, potype="NONE")
203 printf("Unable to install user %s\n", buffer);
206 ## append members (list_id = 2, member_type = "USER", member_id = 3)
208 printf("Unable to put user %s on list dbadmin\n", buffer);
212 /* And the capacls */
213 for (i = 0; i < QueryCount1; i++) {
214 query = Queries1[i].name;
215 value = Queries1[i].shortname;
216 ## repeat append capacls (capability = @query, tag = @value, list_id = 2)
218 printf("Unable to install query ACL for %s (%s)\n", query, value);
222 for (i = 0; i < QueryCount2; i++) {
223 query = Queries2[i].name;
224 value = Queries2[i].shortname;
225 ## repeat retrieve (flag = any(capacls.tag where capacls.tag = @value))
227 ## repeat append capacls (capability = @query, tag = @value, list_id = 2)
229 printf("Unable to install query ACL for %s (%s)\n", query, value);
235 /* and the aliases */
236 for (i = 0; aliases[i].name ; i++) {
237 value = aliases[i].name;
238 type = aliases[i].type;
239 trans = aliases[i].trans;
240 ## repeat append alias (#name = @value, #type = @type, #trans = @trans)
250 * ingerr: (supposedly) called when Ingres indicates an error.
251 * I have not yet been able to get this to work to intercept a
252 * database open error.
265 int access_visible_list() {}
266 int access_maillist() {}
269 int setup_add_group() {}
270 int setup_add_filesys() {}
271 int setup_update_filesys() {}
280 int validate_label() {}
281 int validate_label_2() {}
282 int uusr_login_check() {}
283 int delete_user_poboxes() {}
284 int delete_current_quota() {}
286 int set_modtime_by_id() {}
287 int set_user_modtime() {}
288 int set_user_modtime_by_id() {}
289 int set_finger_modtime() {}
290 int set_filesys_modtime() {}
291 int set_mach_modtime() {}
292 int set_mach_modtime_by_id() {}
293 int set_serverhost_modtime() {}
294 int followup_amtl() {}
295 int followup_ausr() {}
296 int followup_delete_list() {}
297 int followup_add_pobox() {}
298 int followup_delete_pobox() {}
299 int followup_usha() {}
300 int followup_old_gpob() {}
301 int followup_fix_acl() {}
302 int translate_ids() {}
303 int expand_list_flags() {}
304 int add_new_quota() {}
305 int add_hostaccess() {}
306 int delete_hostaccess() {}
307 int get_query_need() {}
308 int get_list_is_group() {}
309 int get_list_is_maillist() {}
311 int delete_locker() {}
312 int add_user_group() {}
313 int set_user_pobox() {}
314 int get_members_of_list() {}
315 int get_groups_of_user() {}
316 int get_groups_of_all_users() {}
317 int get_all_poboxes() {}
318 int get_new_poboxes() {}
319 int get_lists_of_administrator() {}
320 int followup_gpob() {}
323 int set_pobox_modtime() {}
325 int set_cluster_modtime_by_id() {}
326 int access_service() {}
327 int followup_glin() {}
328 int qualified_get_server() {}
329 int qualified_get_serverhost() {}
331 int set_nfsphys_modtime() {}
333 int access_member() {}
336 int qualified_get_lists() {}