]> andersk Git - moira.git/commitdiff
Initial revision
authormar <mar>
Thu, 19 May 1988 17:28:08 +0000 (17:28 +0000)
committermar <mar>
Thu, 19 May 1988 17:28:08 +0000 (17:28 +0000)
db/Makefile [new file with mode: 0644]
db/README [new file with mode: 0644]
db/db2tbls.awk [new file with mode: 0644]
db/newdb [new file with mode: 0644]
db/newmoira.qc [new file with mode: 0644]

diff --git a/db/Makefile b/db/Makefile
new file mode 100644 (file)
index 0000000..51a06dd
--- /dev/null
@@ -0,0 +1,19 @@
+# $Header$
+
+INGLIB=/usr/rtingres/lib/libqlib /usr/rtingres/lib/compatlib
+OBJS=newsms.o tables.o ../server/queries.o ../server/queries2.o
+
+newsms: ${OBJS}
+       cc -o newsms ${OBJS} ${INGLIB}
+
+newsms.c: newsms.qc
+       /usr/rtingres/bin/eqc -p newsms.qc
+
+tables.c: newdb db2tbls.awk
+       awk -f db2tbls.awk < newdb > tables.c
+
+clean:
+       rm -f *.o newsms.c tables.c newsms
+
+install: newsms
+       install newsms ../bin
diff --git a/db/README b/db/README
new file mode 100644 (file)
index 0000000..532e44c
--- /dev/null
+++ b/db/README
@@ -0,0 +1,34 @@
+/mit/smsdev/db/README: $Header$
+
+This directory contains stuff necessary to create and initialize an
+sms database.  Note that some other directories rely on files here
+(notably dbbuild), and that the newsms program relies on other files.
+
+STEPS TO CREATE A DATABASE:
+
+1. run "createdb" from the shell
+2. run the quel commands in newdb to create the tables
+3. run newsms
+4. if you want any queries to be publically executable, change their
+   capacls entries from list_id 2 to 1.
+
+Example:
+
+    createdb testsms
+    quel testsms
+           \i newdb
+           \g
+           \q
+    newsms
+           mar
+
+           19000
+           19000
+           600
+           mar
+    renamedb testsms newsms
+
+
+THINGS TO DO:
+
+automate generation of stub procs in newsms.qc
diff --git a/db/db2tbls.awk b/db/db2tbls.awk
new file mode 100644 (file)
index 0000000..7e072a0
--- /dev/null
@@ -0,0 +1,15 @@
+#      $Source$
+#      $Header$
+#
+#      This converts the file used to originally create the database
+#      into a list of tables.
+
+BEGIN { print "/* This file automatically generated */";
+       print "/* Do not edit */";
+       print "char *tables[] = {";
+}
+
+/^create/ { printf "   \"%s\",\n", $2; }
+
+END   { print "        0,";
+       print "};"; }
diff --git a/db/newdb b/db/newdb
new file mode 100644 (file)
index 0000000..d69403f
--- /dev/null
+++ b/db/newdb
@@ -0,0 +1,238 @@
+create users 
+(
+        login          = c8,
+       users_id        = i4,
+       uid             = i2,
+       shell           = c32,
+       last            = c16,
+       first           = c16,
+       middle          = c16,
+       status          = i2,
+       mit_id          = c13,
+       mit_year        = c8,
+       modtime         = date,
+       modby           = i4,
+       modwith         = c8,
+       fullname        = c32,
+       nickname        = c16,
+       home_addr       = c80,
+       home_phone      = c16,
+       office_addr     = c16,
+       office_phone    = c12,
+       mit_dept        = c12,
+       mit_affil       = c4,
+       fmodtime        = date,
+       fmodby          = i4,
+       fmodwith        = c8,
+       potype          = c8,
+       pop_id          = i4,
+       box_id          = i4,
+       pmodtime        = date,
+       pmodby          = i4,
+       pmodwith        = c8,
+       gid             = i2,
+       uglist_id       = i4,
+       ugdefault       = i1
+)
+create machine 
+(
+       name            = c32,
+       mach_id         = i4,
+       type            = c8,
+       modtime         = date,
+       modby           = i4,
+       modwith         = c8
+)
+create cluster 
+(
+       name            = c32,
+       clu_id          = i4,
+       desc            = c32,
+       location        = c64,
+       modtime         = date,
+       modby           = i4,
+       modwith         = c8
+)
+create mcmap 
+(
+       mach_id         = i4,
+       clu_id          = i4
+)
+create svc 
+(
+       clu_id          = i4,
+       serv_label      = c16,
+       serv_cluster    = c32
+)
+create list 
+(
+       name            = c32,
+       list_id         = i4,
+       active          = i1,
+       public          = i1,
+       hidden          = i1,
+       maillist        = i1,
+       group           = i1,
+       gid             = i2,
+       desc            = c255,
+       acl_type        = c8,
+       acl_id          = i4,
+       modtime         = date,
+       modby           = i4,
+       modwith         = c8
+)
+create members 
+(
+       list_id         = i4,
+       member_type     = c8,
+       member_id       = i4
+)
+create servers 
+(
+       service         = c16,
+       update_int      = i4,
+       target_file     = c64,
+       script          = c128,
+       dfgen           = date,
+       type            = c8,
+       enable          = i1,
+       inprogress      = i1,
+       harderror       = i1,
+       errmsg          = c80,
+       acl_type        = c8,
+       acl_id          = i4,
+       modtime         = date,
+       modby           = i4,
+       modwith         = c8
+)
+create serverhosts 
+(
+       service         = c16,
+       mach_id         = i4,
+       success         = i1,
+       enable          = i1,
+       override        = i1,
+       inprogress      = i1,
+       hosterror       = i1,
+       hosterrmsg      = c80,
+       ltt             = date,
+       lts             = date,
+       value1          = i4,
+       value2          = i4,
+       value3          = c32,
+       modtime         = date,
+       modby           = i4,
+       modwith         = c8
+)
+create filesys 
+(
+       filsys_id       = i4,
+       label           = c16,
+       order           = i2,
+       type            = c8,
+       mach_id         = i4,
+       name            = c32,
+       mount           = c32,
+       access          = c1,
+       comments        = c64,
+       owner           = i4,
+       owners          = i4,
+       createflg       = i1,
+       lockertype      = c8,
+       modtime         = date,
+       modby           = i4,
+       modwith         = c8
+)
+create nfsphys 
+(
+       nfspys_id       = i4,
+       mach_id         = i4,
+       device          = c16,
+       dir             = c16,
+       status          = i2,
+       allocated       = i4,
+       size            = i4,
+       modtime         = date,
+       modby           = i4,
+       modwith         = c8
+)
+create nfsquota 
+(
+       users_id        = i4,
+       mach_id         = i4,
+       device          = c16,
+       quota           = i4,
+       modtime         = date,
+       modby           = i4,
+       modwith         = c8
+)
+create zephyr 
+(
+       class           = c16,
+       xmt_type        = c8,
+       xmt_id          = i4,
+       sub_type        = c8,
+       sub_id          = i4,
+       iws_type        = c8,
+       iws_id          = i4,
+       iui_type        = c8,
+       iui_id          = i4,
+       modtime         = date,
+       modby           = i4,
+       modwith         = c8
+)
+create hostaccess 
+(
+       mach_id         = i4,
+       acl_type        = c8,
+       acl_id          = i4,
+       modtime         = date,
+       modby           = i4,
+       modwith         = c8
+)
+create strings 
+(
+       string_id       = i4,
+       string          = c128
+)
+create services 
+(
+       name            = c16,
+       protocol        = c8,
+       port            = i2,
+       desc            = c64,
+       modtime         = date,
+       modby           = i4,
+       modwith         = c8
+)
+create printcap 
+(
+       name            = c16,
+       pcap            = text(512)
+)
+create capacls 
+(
+       capability      = c32,
+       tag             = c4,
+       list_id         = i4
+)
+create alias 
+(
+       name            = c32,
+       type            = c16,
+       trans           = c128
+)
+create values 
+(
+       name            = c32,
+       value           = i4
+)
+create tblstats 
+(
+       table           = c12,
+       modtime         = date,
+       retrieves       = i4,
+       appends         = i4,
+       updates         = i4,
+       deletes         = i4
+)
diff --git a/db/newmoira.qc b/db/newmoira.qc
new file mode 100644 (file)
index 0000000..a937627
--- /dev/null
@@ -0,0 +1,336 @@
+/* $Header$
+ *
+ * Creates a new sms database
+ *
+ * Copyright 1988 by the Massachusetts Institute of Technology.
+ */
+
+#include <stdio.h>
+#include "../server/query.h"
+
+static int ingres_errno = 0;
+int ingerr();
+
+extern char *tables[];
+extern struct query Queries1[], Queries2[];
+extern int QueryCount1, QueryCount2;
+
+char *values[] = { "users_id", "machine_id", "cluster_id", "list_id",
+                  "nfsphys_id", "filsys_id", "strings_id", 0 };
+
+struct alias { char *name;
+              char *type;
+              char *trans;
+          } aliases[] = {
+                  {"acl_type", "TYPE", "USER"},
+                  {"acl_type", "TYPE", "LIST"},
+                  {"acl_type", "TYPE", "NONE"},
+                  {"alias", "TYPE", "TYPE"},
+                  {"alias", "TYPE", "TYPEDATA"},
+                  {"boolean", "TYPE", "FALSE"},
+                  {"boolean", "TYPE", "DONTCARE"},
+                  {"boolean", "TYPE", "TRUE"},
+                  {"class", "TYPE", "staff"},
+                  {"class", "TYPE", "1988"},
+                  {"class", "TYPE", "1989"},
+                  {"class", "TYPE", "1990"},
+                  {"class", "TYPE", "1991"},
+                  {"class", "TYPE", "1992"},
+                  {"class", "TYPE", "G"},
+                  {"class", "TYPE", "guest"},
+                  {"filesys", "TYPE", "NFS"},
+                  {"filesys", "TYPE", "RVD"},
+                  {"mac_type", "TYPE", "#"},
+                  {"mac_type", "TYPE", "RT"},
+                  {"mac_type", "TYPE", "VAX"},
+                  {"member", "TYPE", "LIST"},
+                  {"member", "TYPE", "STRING"},
+                  {"member", "TYPE", "USER"},
+                  {"pobox", "TYPE", "SMTP"},
+                  {"pobox", "TYPE", "NONE"},
+                  {"pobox", "TYPE", "POP"},
+                  {"service", "TYPE", "replicated"},
+                  {"service", "TYPE", "unique"},
+                  {"slabel", "TYPE", "usrlib"},
+                  {"slabel", "TYPE", "syslib"},
+                  {"slabel", "TYPE", "lpr"},
+                  {"slabel", "TYPE", "zephyr"},
+                  {"slabel", "TYPE", "kerberos"},
+                  {"LIST", "TYPEDATA", "list"},
+                  {"NONE", "TYPEDATA", ""},
+                  {"POP", "TYPEDATA", "machine"},
+                  {"SMTP", "TYPEDATA", "string"},
+                  {"STRING", "TYPEDATA", "string"},
+                  {"USER", "TYPEDATA", "user"},
+                  0 };
+
+
+main(argc, argv)
+int argc;
+char **argv;
+{
+    char buffer[256];
+##  char *table, *user, *value, *query, *trans, *type;
+##  int i, flag;
+
+    IIseterr(ingerr);
+##  ingres testsms
+    if (ingres_errno) {
+       printf("Unable to open the database\n");
+       exit(1);
+    }
+
+    strcpy(buffer, "root");
+    user = buffer;
+    while (buffer[0]) {
+       for (i = 0; table = tables[i]; i++) {
+##         define permit all on table to user
+           if (ingres_errno) {
+               printf("Unable to give %s permission to access table %s\n",
+                      user, table);
+               exit(1);
+           }
+       }
+       printf("Enter the name of another user to be given direct access to\n");
+       printf("the database, or [RETURN] if none: ");
+       fflush(stdout);
+       gets(user);
+    }
+
+    for (i = 0; table = tables[i]; i++) {
+##     repeat append tblstats (#table = @table, modtime = "now")
+       if (ingres_errno) {
+           printf("Unable to initialize tblstats for %s\n", table);
+           exit(1);
+       }
+    }
+
+    for (i = 0; value = values[i]; i++) {
+##     repeat append values (#name = @value, #value = 1)
+       if (ingres_errno) {
+           printf("Unable to install initial value of %s\n", value);
+           exit(1);
+       }
+    }
+
+    printf("What is the starting UID to assign: ");
+    fflush(stdout);
+    gets(buffer);
+    i = atoi(buffer);
+##  append values (#name = "uid", #value = i)
+    if (ingres_errno) {
+       printf("Unable to install value for uid\n");
+       exit(1);
+    }
+
+    printf("What is the starting GID to assign: ");
+    fflush(stdout);
+    gets(buffer);
+    i = atoi(buffer);
+##  append values (#name = "gid", #value = i)
+    if (ingres_errno) {
+       printf("Unable to install value for gid\n");
+       exit(1);
+    }
+
+    printf("What is the default NFS quota to assign: ");
+    fflush(stdout);
+    gets(buffer);
+    i = atoi(buffer);
+##  append values (#name = "def_quota", #value = i)
+    if (ingres_errno) {
+       printf("Unable to install value for def_quota\n");
+       exit(1);
+    }
+
+    /* place holder records */
+##  append users (login = "[nobody]", potype="NONE")
+    if (ingres_errno) {
+       printf("Unable to install 0 user\n");
+       exit(1);
+    }
+##  append machine (name = "[none]", #type="NONE")
+    if (ingres_errno) {
+       printf("Unable to install 0 machine\n");
+       exit(1);
+    }
+##  append cluster (name = "[unassigned]")
+    if (ingres_errno) {
+       printf("Unable to install 0 cluster\n");
+       exit(1);
+    }
+##  append list (name = "[none]", acl_type = "NONE")
+    if (ingres_errno) {
+       printf("Unable to install 0 list\n");
+       exit(1);
+    }
+
+    /* magic for ALL_USERS */
+##  append users (login = "default", users_id = 1, potype="NONE")
+    if (ingres_errno) {
+       printf("Unable to install default user\n");
+       exit(1);
+    }
+##  append list (name = "default", list_id = 1, acl_type = "NONE")
+    if (ingres_errno) {
+       printf("Unable to install default list\n");
+       exit(1);
+    }
+##  append members (list_id = 1, member_type = "USER", member_id = 1)
+    if (ingres_errno) {
+       printf("Unable to install default user on default list\n");
+       exit(1);
+    }
+
+    /* Priveleged users */
+##  append users (login = "root", users_id = 2, potype="NONE")
+    if (ingres_errno) {
+       printf("Unable to install root user\n");
+       exit(1);
+    }
+##  append list (name = "dbadmin", list_id = 2, acl_type = "LIST", acl_id = 2)
+    if (ingres_errno) {
+       printf("Unable to install default dbadmin list\n");
+       exit(1);
+    }
+
+    printf("What is the name of a priveleged user: ");
+    fflush(stdout);
+    gets(buffer);
+    user = buffer;
+##  append users (login = user, users_id = 3, potype="NONE")
+    if (ingres_errno) {
+       printf("Unable to install user %s\n", buffer);
+       exit(1);
+    }
+##  append members (list_id = 2, member_type = "USER", member_id = 3)
+    if (ingres_errno) {
+       printf("Unable to put user %s on list dbadmin\n", buffer);
+       exit(1);
+    }
+
+    /* And the capacls */
+    for (i = 0; i < QueryCount1; i++) {
+       query = Queries1[i].name;
+       value = Queries1[i].shortname;
+##     repeat append capacls (capability = @query, tag = @value, list_id = 2)
+       if (ingres_errno) {
+           printf("Unable to install query ACL for %s (%s)\n", query, value);
+           exit(1);
+       }
+    }
+    for (i = 0; i < QueryCount2; i++) {
+       query = Queries2[i].name;
+       value = Queries2[i].shortname;
+##     repeat retrieve (flag = any(capacls.tag where capacls.tag = @value))
+       if (!flag) {
+##       repeat append capacls (capability = @query, tag = @value, list_id = 2)
+         if (ingres_errno) {
+             printf("Unable to install query ACL for %s (%s)\n", query, value);
+             exit(1);
+         }
+        }
+    }
+
+    /* and the aliases */
+    for (i = 0; aliases[i].name ; i++) {
+       value = aliases[i].name;
+       type = aliases[i].type;
+       trans = aliases[i].trans;
+##     repeat append alias (#name = @value, #type = @type, #trans = @trans)
+    }
+
+##  exit
+    printf("done.\n");
+    exit(0);
+}
+
+
+/*
+ * ingerr: (supposedly) called when Ingres indicates an error.
+ * I have not yet been able to get this to work to intercept a
+ * database open error.
+ */
+
+int ingerr(num)
+    int *num;
+{
+    ingres_errno = *num;
+    return *num;
+}
+
+
+/* dummy routines */
+int access_list() {}
+int access_visible_list() {}
+int access_maillist() {}
+int access_user() {}
+int setup_ausr() {}
+int setup_add_group() {}
+int setup_add_filesys() {}
+int setup_update_filesys() {}
+int setup_umac() {}
+int setup_dmac() {}
+int setup_uclu() {}
+int setup_dclu() {}
+int setup_dusr() {}
+int setup_dsin() {}
+int setup_dshi() {}
+int setup_dlis() {}
+int validate_label() {}
+int validate_label_2() {}
+int uusr_login_check() {}
+int delete_user_poboxes() {}
+int delete_current_quota() {}
+int set_modtime() {}
+int set_modtime_by_id() {}
+int set_user_modtime() {}
+int set_user_modtime_by_id() {}
+int set_finger_modtime() {}
+int set_filesys_modtime() {}
+int set_mach_modtime() {}
+int set_mach_modtime_by_id() {}
+int set_serverhost_modtime() {}
+int followup_amtl() {}
+int followup_ausr() {}
+int followup_delete_list() {}
+int followup_add_pobox() {}
+int followup_delete_pobox() {}
+int followup_usha() {}
+int followup_old_gpob() {}
+int followup_fix_acl() {}
+int translate_ids() {}
+int expand_list_flags() {}
+int add_new_quota() {}
+int add_hostaccess() {}
+int delete_hostaccess() {}
+int get_query_need() {}
+int get_list_is_group() {}
+int get_list_is_maillist() {}
+int add_locker() {}
+int delete_locker() {}
+int add_user_group() {}
+int set_user_pobox() {}
+int get_members_of_list() {}
+int get_groups_of_user() {}
+int get_groups_of_all_users() {}
+int get_all_poboxes() {}
+int get_new_poboxes() {}
+int get_lists_of_administrator() {}
+int followup_gpob() {}
+int set_pobox() {}
+int setup_spop() {}
+int set_pobox_modtime() {}
+int setup_dpob() {}
+int set_cluster_modtime_by_id() {}
+int access_service() {}
+int followup_glin() {}
+int qualified_get_server() {}
+int qualified_get_serverhost() {}
+int trigger_dcm() {}
+int set_nfsphys_modtime() {}
+int setup_alis() {}
+int access_member() {}
+int get_acl_use() {}
+int access_qgli() {}
+int qualified_get_lists() {}
This page took 0.068892 seconds and 5 git commands to generate.