1 /* (c) Copyright 1988 by the Massachusetts Institute of Technology. */
2 /* For copying and distribution information, please see the file */
3 /* <mit-copyright.h>. */
5 #include <mit-copyright.h>
10 char *strsave(), *strtrim();
26 ## char t_mit_year[9];
27 ## char t_expdate[26];
28 ## char t_modtime[26];
32 u = open_file("users");
35 ## range of u is users
36 ## delete u where u.users_id > 0
39 parse_str(u, t_login, 9);
42 t_users_id = parse_int(u);
46 parse_str(u, t_shell, 33);
48 parse_str(u, t_home, 33);
50 parse_str(u, t_last, 17);
52 parse_str(u, t_first, 17);
54 parse_str(u, t_middle, 17);
56 t_status = parse_int(u);
58 parse_str(u, t_mit_id, 14);
60 parse_str(u, t_mit_year, 9);
62 parse_str(u, t_expdate, 26);
64 parse_str(u, t_modtime, 26);
66 t_acl_id = parse_int(u);
72 ## users_id = t_users_id,
80 ## mit_year = t_mit_year,
81 ## modtime = t_modtime,
82 ## modwith = "convert",
84 ## mit_affil = t_mit_year,
86 ## fmodwith = "convert",
92 ## pmodwith = "convert",
98 ## modify users to cbtree unique on users_id
99 ## inquire_equel(err = "errorno");
101 punt("modify on users failed");
102 ## index on users is i_usr_login (login)
103 ## inquire_equel(err = "errorno");
105 punt("index on users failed");
106 ## modify i_usr_login to hash
107 ## inquire_equel(err = "errorno");
109 punt("modify on users index failed");
117 ## char t_fullname[33];
118 ## char t_nickname[17];
119 ## char t_home_addr[81];
120 ## char t_home_phone[17];
121 ## char t_office_addr[17];
122 ## char t_office_phone[13];
123 ## char t_mit_dept[13];
124 ## char t_mit_affil[5];
125 ## char t_modtime[26];
128 f = open_file("finger");
129 ## range of u is users
133 t_fusers_id = parse_int(f);
137 parse_str(f, t_fullname, 33);
139 parse_str(f, t_nickname, 17);
141 parse_str(f, t_home_addr, 81);
143 parse_str(f, t_home_phone, 17);
145 parse_str(f, t_office_addr, 17);
147 parse_str(f, t_office_phone, 13);
149 parse_str(f, t_mit_dept, 13);
151 parse_str(f, t_mit_affil, 5);
153 parse_str(f, t_modtime, 26);
157 ## repeat replace users (
158 ## fullname = @t_fullname,
159 ## nickname = @t_nickname,
160 ## home_addr = @t_home_addr,
161 ## home_phone = @t_home_phone,
162 ## office_addr = @t_office_addr,
163 ## office_phone = @t_office_phone,
164 ## mit_dept = @t_mit_dept,
165 ## mit_affil = @t_mit_affil,
166 ## fmodtime = @t_modtime,
167 ## fmodwith = "convert",
169 ## ) where users.users_id = @t_fusers_id
170 ## inquire_equel(rowcount = "rowcount")
172 printf("\rOrphaned finger entry %d for \"%s\"\n",
173 t_fusers_id, t_fullname);
191 f = open_file("machine");
192 ## range of m is machine
196 parse_str(f, t_name, 33);
199 t_mach_id = parse_int(f);
201 parse_str(f, t_type, 13);
203 parse_str(f, buf, 13);
205 parse_str(f, buf, 13);
207 parse_str(f, buf, 13);
209 parse_str(f, buf, 13);
213 ## append machine (name = t_name, mach_id = t_mach_id,
214 ## type = t_type, modtime = "now",
215 ## modby = USERSMS, modwith = "convert")
228 ## char t_location[65];
232 f = open_file("cluster");
233 ## range of c is cluster
237 parse_str(f, t_name, 33);
240 t_clu_id = parse_int(f);
242 parse_str(f, t_desc, 33);
244 parse_str(f, t_location, 65);
246 t_acl_id = parse_int(f);
252 ## clu_id = t_clu_id,
254 ## location = t_location,
257 ## modwith = "convert")
270 f = open_file("machclumap");
274 t_clu_id = parse_int(f);
277 t_mach_id = parse_int(f);
282 ## clu_id = t_clu_id,
283 ## mach_id = t_mach_id)
294 ## char t_serv_label[17];
295 ## char t_serv_cluster[33];
297 f = open_file("svc");
301 t_clu_id = parse_int(f);
304 parse_str(f, t_serv_label, 17);
306 parse_str(f, t_serv_cluster, 33);
311 ## clu_id = t_clu_id,
312 ## serv_label = t_serv_label,
313 ## serv_cluster = t_serv_cluster)
323 ## char t_service[17];
325 ## char t_target_file[65];
326 ## char t_script[129];
329 f = open_file("servers");
333 parse_str(f, t_service, 17);
336 t_update_int = parse_int(f);
338 parse_str(f, t_target_file, 65);
340 parse_str(f, t_script, 129);
342 parse_str(f, t_dfgen, 26);
347 ## name = uppercase(t_service),
348 ## update_int = t_update_int,
349 ## target_file = t_target_file,
350 ## script = t_script,
357 ## acl_type = "NONE",
361 ## modwith = "convert"
372 ## char t_service[17];
374 ## char t_enable[33];
377 ## char t_success[2];
382 f = open_file("serverhosts");
386 parse_str(f, t_service, 17);
389 t_mach_id = parse_int(f);
391 parse_str(f, t_enable, 33);
393 t_overide = parse_int(f);
395 parse_str(f, t_ltt, 26);
397 parse_str(f, t_success, 2);
399 t_value1 = parse_int(f);
401 t_value2 = parse_int(f);
407 ## append serverhosts (
408 ## service = uppercase(t_service),
409 ## mach_id = t_mach_id,
411 ## override = t_overide,
414 ## success = int1(t_success),
418 ## value1 = t_value1,
419 ## value2 = t_value2,
422 ## modwith = "convert")
426 ## modify serverhosts to btree on service
427 ## inquire_equel(err = "errorno")
429 punt("unable to modify serverhosts");
430 ## index on serverhosts is i_sho_mach (mach_id)
431 ## inquire_equel(err = "errorno")
433 punt("unable to index serverhosts");
434 ## modify i_sho_mach to cbtree
435 ## inquire_equel(err = "errorno")
437 punt("unable to modify serverhosts index");
450 ## char t_expdate[26];
451 ## char t_modtime[26];
452 ## int t_active, t_public, t_hidden, err;
454 /* delete default & dbadmin */
455 ## delete list where list.list_id = 1 or list.list_id = 2
457 f = open_file("list");
461 parse_str(f, t_name, 33);
464 t_list_id = parse_int(f);
466 t_flags = parse_int(f);
468 parse_str(f, t_desc, 257);
470 t_acl_id = parse_int(f);
472 parse_str(f, t_expdate, 26);
474 parse_str(f, t_modtime, 26);
477 t_active = t_flags & 1;
478 t_public = (t_flags>>1) & 1;
479 t_hidden = (t_flags>>2) & 1;
483 ## list_id = t_list_id,
484 ## active = t_active, public = t_public, hidden = t_hidden,
486 ## acl_type = "LIST",
487 ## acl_id = t_acl_id,
488 ## modtime = t_modtime,
490 ## modwith = "convert")
495 ## modify list to cbtree unique on list_id
496 ## inquire_equel(err = "errorno")
498 punt("unable to modify list");
499 ## index on list is i_lis_name (name)
500 ## inquire_equel(err = "errorno")
502 punt("unable to index lists by name");
503 ## modify i_lis_name to hash
504 ## inquire_equel(err = "errorno")
506 punt("unable to modify list name index");
517 f = open_file("maillists");
518 ## range of l is list
522 t_list_id = parse_int(f);
525 t_ltid = parse_int(f);
529 ## repeat replace l (maillist = 1) where l.list_id = @t_list_id
533 ## index on list is i_lis_mail (maillist)
534 ## inquire_equel(err = "errorno")
536 punt("unable to index lists by maillist");
548 f = open_file("groups");
549 ## range of l is list
553 t_list_id = parse_int(f);
556 t_ltid = parse_int(f);
558 t_gid = parse_int(f);
562 ## repeat replace l (group = 1, gid = @t_gid) where l.list_id = @t_list_id
566 ## index on list is i_lis_group (group)
567 ## inquire_equel(err = "errorno")
569 punt("unable to index lists by group");
577 ## char t_member_type[9];
580 f = open_file("members");
584 t_list_id = parse_int(f);
587 parse_str(f, t_member_type, 9);
589 t_member_id = parse_int(f);
594 ## list_id = t_list_id,
595 ## member_type = t_member_type,
596 ## member_id = t_member_id)
607 ## char t_string[129];
610 f = open_file("strings");
614 t_string_id = parse_int(f);
617 parse_str(f, t_string, 129);
619 t_refc = parse_int(f);
624 ## string_id = t_string_id,
625 ## string = t_string)
636 ## char t_device[17];
644 f = open_file("nfsphys");
649 t_mach_id = parse_int(f);
652 parse_str(f, t_device, 17);
654 parse_str(f, t_dir, 17);
656 t_status = parse_int(f);
658 t_allocated = parse_int(f);
660 t_size = parse_int(f);
666 ## nfsphys_id = t_nfsphys_id,
667 ## mach_id = t_mach_id,
668 ## device = t_device,
670 ## status = t_status,
671 ## allocated = t_allocated,
675 ## modwith = "convert")
680 ## modify nfsphys to cbtree unique on nfsphys_id
681 ## inquire_equel(err = "errorno")
683 punt("cannot modify filesys");
684 ## index on nfsphys is i_nfs_mach (mach_id)
685 ## inquire_equel(err = "errorno")
687 punt("cannot index filesys");
688 ## modify i_nfs_mach to btree
689 ## inquire_equel(err = "errorno")
691 punt("cannot modify i_nfs_mach");
710 f = open_file("filesys");
715 parse_str(f, t_label, 33);
718 parse_str(f, t_type, 9);
720 t_mach_id = parse_int(f);
722 parse_str(f, t_name, 33);
724 parse_str(f, t_mount, 33);
726 parse_str(f, t_access, 2);
728 t_acl_id = parse_int(f);
731 if (!strcmp(t_type, "NFS"))
732 t_phys_id = match_phys(t_mach_id, t_name);
738 ## filsys_id = t_filsys_id,
739 ## phys_id = t_phys_id,
742 ## mach_id = t_mach_id,
745 ## access = t_access,
747 ## owners = t_acl_id,
749 ## lockertype = "UNKNOWN",
752 ## modwith = "convert")
756 ## modify filesys to cbtree unique on filsys_id
757 ## inquire_equel(err = "errorno")
759 punt("cannot modify filesys");
760 ## index on filesys is i_fil_name (label)
761 ## inquire_equel(err = "errorno")
763 punt("cannot index filesys on label");
764 ## modify i_fil_name to hash
765 ## inquire_equel(err = "errorno")
767 punt("cannot modify i_fil_name");
768 ## index on filesys is i_fil_mach (mach_id)
769 ## inquire_equel(err = "errorno")
771 punt("cannot index filesys on mach_id");
772 ## modify i_fil_mach to btree
773 ## inquire_equel(err = "errorno")
775 punt("cannot modify i_fil_mach");
776 ## index on filesys is i_fil_phys (phys_id)
777 ## inquire_equel(err = "errorno")
779 punt("cannot index filesys on phys_id");
780 ## modify i_fil_phys to btree
781 ## inquire_equel(err = "errorno")
783 punt("cannot modify i_fil_phys");
792 ## char t_device[17];
796 f = open_file("nfsquota");
798 ## range of f is filesys
799 ## range of u is users
800 ## range of n is nfsphys
803 t_users_id = parse_int(f);
806 t_mach_id = parse_int(f);
808 parse_str(f, t_device, 17);
810 t_quota = parse_int(f);
812 t_filsys_id = match_filsys(t_mach_id, t_device, t_users_id);
816 ## users_id = t_users_id,
817 ## filsys_id = t_filsys_id,
821 ## modwith = "convert")
835 ## char t_created[26];
836 ## char t_string[129];
838 ## char t_machine[65];
841 f = open_file("pobox");
842 ## range of u is users
843 ## range of m is machine
845 ## retrieve (t_string_id = max(strings.string_id))
849 t_users_id = parse_int(f);
852 parse_str(f, t_type, 9);
854 t_mach_id = parse_int(f);
856 parse_str(f, t_box, 33);
858 parse_str(f, t_created, 26);
862 if (!strcmp(t_type, "POP")) {
863 ## repeat replace users (
865 ## pop_id = @t_mach_id,
866 ## pmodtime = @t_created,
867 ## pmodwith = "convert",
869 ## ) where users.users_id = @t_users_id
870 } else if (!strcmp(t_type, "LOCAL")) {
871 ## repeat retrieve (t_machine = machine.name)
872 ## where machine.mach_id = @t_mach_id
873 ## repeat replace users (
876 ## box_id = @t_string_id,
877 ## pmodtime = @t_created,
878 ## pmodwith = "convert",
880 ## ) where users.users_id = @t_users_id
881 ## append strings (string_id = t_string_id,
882 ## string = t_box + "@" + t_machine)
884 } else if (!strcmp(t_type, "FOREIGN")) {
885 ## repeat retrieve (t_string = strings.string)
886 ## where strings.string_id = @t_mach_id
887 ## repeat replace users (
890 ## box_id = @t_string_id,
891 ## pmodtime = @t_created,
892 ## pmodwith = "convert",
894 ## ) where users.users_id = @t_users_id
895 ## append strings (string_id = t_string_id,
896 ## string = t_box + "@" + t_string)
899 printf("Unknown pobox type: %s\n", t_type);
911 ## char t_protocol[9];
915 f = open_file("services");
919 parse_str(f, t_name, 17);
922 parse_str(f, t_protocol, 9);
924 t_port = parse_int(f);
926 parse_str(f, t_desc, 65);
932 ## protocol = t_protocol,
937 ## modwith = "convert")
950 f = open_file("printcap");
954 parse_str(f, t_name, 17);
957 parse_str(f, t_pcap, 513);
964 ## dir = "/usr/spool/printer/" + t_name,
968 ## modwith = "convert")
981 f = open_file("values");
983 parse_str(f, t_name, 33);
986 t_value = parse_int(f);
989 if (strcmp(t_name, "def_quota") &&
990 strcmp(t_name, "gid") &&
991 strcmp(t_name, "uid"))
994 ## replace values (value = t_value) where values.name = t_name
1005 ## char t_trans[129];
1007 f = open_file("alias");
1010 parse_str(f, t_name, 33);
1013 parse_str(f, t_type, 17);
1015 parse_str(f, t_trans, 129);
1019 if (!strcmp(t_type, "TYPE") ||
1020 !strcmp(t_type, "TYPEDATA"))