]>
Commit | Line | Data |
---|---|---|
dca0646a | 1 | /* (c) Copyright 1988 by the Massachusetts Institute of Technology. */ |
2 | /* For copying and distribution information, please see the file */ | |
3 | /* <mit-copyright.h>. */ | |
1ba88c34 | 4 | |
dca0646a | 5 | #include <mit-copyright.h> |
1ba88c34 | 6 | #include <stdio.h> |
7 | ##define USERSMS 17069 | |
8 | ||
9 | FILE *open_file(); | |
dca0646a | 10 | char *strsave(), *strtrim(); |
1ba88c34 | 11 | |
12 | do_users() | |
13 | ##{ | |
dca0646a | 14 | register FILE *u; |
1ba88c34 | 15 | ## int flag; |
1ba88c34 | 16 | ## char t_login[9]; |
1ba88c34 | 17 | ## int t_users_id; |
1ba88c34 | 18 | ## int t_uid; |
1ba88c34 | 19 | ## char t_shell[33]; |
1ba88c34 | 20 | ## char t_home[33]; |
1ba88c34 | 21 | ## char t_last[17]; |
1ba88c34 | 22 | ## char t_first[17]; |
1ba88c34 | 23 | ## char t_middle[17]; |
1ba88c34 | 24 | ## int t_status; |
1ba88c34 | 25 | ## char t_mit_id[14]; |
1ba88c34 | 26 | ## char t_mit_year[9]; |
1ba88c34 | 27 | ## char t_expdate[26]; |
1ba88c34 | 28 | ## char t_modtime[26]; |
1ba88c34 | 29 | ## int t_acl_id; |
dca0646a | 30 | ## int err; |
1ba88c34 | 31 | |
32 | u = open_file("users"); | |
dca0646a | 33 | start_counter(10); |
1ba88c34 | 34 | |
35 | ## range of u is users | |
dca0646a | 36 | ## delete u where u.users_id > 0 |
1ba88c34 | 37 | |
38 | while(!feof(u)) { | |
39 | parse_str(u, t_login, 9); | |
40 | if (feof(u)) break; | |
41 | parse_sep(u); | |
42 | t_users_id = parse_int(u); | |
43 | parse_sep(u); | |
44 | t_uid = parse_int(u); | |
45 | parse_sep(u); | |
46 | parse_str(u, t_shell, 33); | |
47 | parse_sep(u); | |
48 | parse_str(u, t_home, 33); | |
49 | parse_sep(u); | |
50 | parse_str(u, t_last, 17); | |
51 | parse_sep(u); | |
52 | parse_str(u, t_first, 17); | |
53 | parse_sep(u); | |
54 | parse_str(u, t_middle, 17); | |
55 | parse_sep(u); | |
56 | t_status = parse_int(u); | |
57 | parse_sep(u); | |
58 | parse_str(u, t_mit_id, 14); | |
59 | parse_sep(u); | |
60 | parse_str(u, t_mit_year, 9); | |
61 | parse_sep(u); | |
62 | parse_str(u, t_expdate, 26); | |
63 | parse_sep(u); | |
64 | parse_str(u, t_modtime, 26); | |
65 | parse_sep(u); | |
66 | t_acl_id = parse_int(u); | |
67 | parse_nl(u); | |
68 | ||
dca0646a | 69 | inc_count(); |
1ba88c34 | 70 | ## append users ( |
71 | ## login = t_login, | |
72 | ## users_id = t_users_id, | |
73 | ## uid = t_uid, | |
74 | ## shell = t_shell, | |
75 | ## last = t_last, | |
76 | ## first = t_first, | |
77 | ## middle = t_middle, | |
78 | ## status = t_status, | |
79 | ## mit_id = t_mit_id, | |
80 | ## mit_year = t_mit_year, | |
81 | ## modtime = t_modtime, | |
82 | ## modwith = "convert", | |
83 | ## modby = USERSMS, | |
dca0646a | 84 | ## mit_affil = t_mit_year, |
85 | ## fmodtime = "now", | |
1ba88c34 | 86 | ## fmodwith = "convert", |
87 | ## fmodby = USERSMS, | |
88 | ## potype = "NONE", | |
89 | ## pop_id = 0, | |
90 | ## box_id = 0, | |
91 | ## pmodtime = "now", | |
92 | ## pmodwith = "convert", | |
93 | ## pmodby = USERSMS | |
94 | ## ) | |
dca0646a | 95 | } |
96 | (void) fclose(u); | |
97 | end_counter(); | |
98 | ## modify users to cbtree unique on users_id | |
99 | ## inquire_equel(err = "errorno"); | |
100 | if (err != 0) | |
101 | punt("modify on users failed"); | |
102 | ## index on users is i_usr_login (login) | |
103 | ## inquire_equel(err = "errorno"); | |
104 | if (err != 0) | |
105 | punt("index on users failed"); | |
106 | ## modify i_usr_login to hash | |
107 | ## inquire_equel(err = "errorno"); | |
108 | if (err != 0) | |
109 | punt("modify on users index failed"); | |
110 | ##} | |
111 | ||
112 | ||
113 | do_finger() | |
114 | ##{ | |
115 | register FILE *f; | |
116 | ## int t_fusers_id; | |
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]; | |
126 | ## int rowcount; | |
127 | ||
128 | f = open_file("finger"); | |
129 | ## range of u is users | |
130 | start_counter(10); | |
131 | ||
132 | while (!feof(f)) { | |
133 | t_fusers_id = parse_int(f); | |
134 | if (feof(f)) | |
135 | break; | |
136 | parse_sep(f); | |
137 | parse_str(f, t_fullname, 33); | |
138 | parse_sep(f); | |
139 | parse_str(f, t_nickname, 17); | |
140 | parse_sep(f); | |
141 | parse_str(f, t_home_addr, 81); | |
142 | parse_sep(f); | |
143 | parse_str(f, t_home_phone, 17); | |
144 | parse_sep(f); | |
145 | parse_str(f, t_office_addr, 17); | |
146 | parse_sep(f); | |
147 | parse_str(f, t_office_phone, 13); | |
148 | parse_sep(f); | |
149 | parse_str(f, t_mit_dept, 13); | |
150 | parse_sep(f); | |
151 | parse_str(f, t_mit_affil, 5); | |
152 | parse_sep(f); | |
153 | parse_str(f, t_modtime, 26); | |
154 | parse_nl(f); | |
155 | ||
156 | inc_count(); | |
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", | |
168 | ## fmodby = USERSMS | |
169 | ## ) where users.users_id = @t_fusers_id | |
170 | ## inquire_equel(rowcount = "rowcount") | |
171 | if (rowcount == 0) | |
172 | printf("\rOrphaned finger entry %d for \"%s\"\n", | |
173 | t_fusers_id, t_fullname); | |
174 | } | |
175 | fclose(f); | |
176 | end_counter(); | |
177 | ##} | |
178 | ||
179 | ||
180 | char **machs; | |
181 | ##int maxmach; | |
182 | ||
183 | do_mach() | |
184 | ##{ | |
185 | register FILE *f; | |
186 | ## char t_name[33]; | |
187 | ## int t_mach_id; | |
188 | ## char t_type[13]; | |
189 | char buf[13]; | |
190 | ||
191 | f = open_file("machine"); | |
192 | ## range of m is machine | |
193 | start_counter(25); | |
194 | ||
195 | while(!feof(f)) { | |
196 | parse_str(f, t_name, 33); | |
197 | if (feof(f)) break; | |
198 | parse_sep(f); | |
199 | t_mach_id = parse_int(f); | |
200 | parse_sep(f); | |
201 | parse_str(f, t_type, 13); | |
202 | parse_sep(f); | |
203 | parse_str(f, buf, 13); | |
204 | parse_sep(f); | |
205 | parse_str(f, buf, 13); | |
206 | parse_sep(f); | |
207 | parse_str(f, buf, 13); | |
208 | parse_sep(f); | |
209 | parse_str(f, buf, 13); | |
210 | parse_nl(f); | |
211 | ||
212 | inc_count(); | |
213 | ## append machine (name = t_name, mach_id = t_mach_id, | |
214 | ## type = t_type, modtime = "now", | |
215 | ## modby = USERSMS, modwith = "convert") | |
216 | } | |
217 | fclose(f); | |
218 | end_counter(); | |
219 | ##} | |
220 | ||
221 | ||
222 | do_clu() | |
223 | ##{ | |
224 | register FILE *f; | |
225 | ## char t_name[33]; | |
226 | ## int t_clu_id; | |
227 | ## char t_desc[33]; | |
228 | ## char t_location[65]; | |
229 | ## int t_acl_id; | |
230 | ## int rowcount; | |
231 | ||
232 | f = open_file("cluster"); | |
233 | ## range of c is cluster | |
234 | start_counter(10); | |
235 | ||
236 | while(!feof(f)) { | |
237 | parse_str(f, t_name, 33); | |
238 | if (feof(f)) break; | |
239 | parse_sep(f); | |
240 | t_clu_id = parse_int(f); | |
241 | parse_sep(f); | |
242 | parse_str(f, t_desc, 33); | |
243 | parse_sep(f); | |
244 | parse_str(f, t_location, 65); | |
245 | parse_sep(f); | |
246 | t_acl_id = parse_int(f); | |
247 | parse_nl(f); | |
248 | ||
249 | inc_count(); | |
250 | ## append cluster ( | |
251 | ## name = t_name, | |
252 | ## clu_id = t_clu_id, | |
253 | ## desc = t_desc, | |
254 | ## location = t_location, | |
255 | ## modtime = "now", | |
256 | ## modby = USERSMS, | |
257 | ## modwith = "convert") | |
258 | } | |
259 | fclose(f); | |
260 | end_counter(); | |
261 | ##} | |
262 | ||
263 | ||
264 | do_mcm() | |
265 | ##{ | |
266 | register FILE *f; | |
267 | ## int t_clu_id; | |
268 | ## int t_mach_id; | |
269 | ||
270 | f = open_file("machclumap"); | |
271 | start_counter(25); | |
272 | ||
273 | while(!feof(f)) { | |
274 | t_clu_id = parse_int(f); | |
275 | if (feof(f)) break; | |
276 | parse_sep(f); | |
277 | t_mach_id = parse_int(f); | |
278 | parse_nl(f); | |
279 | ||
280 | inc_count(); | |
281 | ## append mcmap ( | |
282 | ## clu_id = t_clu_id, | |
283 | ## mach_id = t_mach_id) | |
284 | } | |
285 | (void) fclose(f); | |
286 | end_counter(); | |
287 | ##} | |
288 | ||
289 | ||
290 | do_cld() | |
291 | ##{ | |
292 | register FILE *f; | |
293 | ## int t_clu_id; | |
294 | ## char t_serv_label[17]; | |
295 | ## char t_serv_cluster[33]; | |
296 | ||
297 | f = open_file("svc"); | |
298 | start_counter(10); | |
299 | ||
300 | while(!feof(f)) { | |
301 | t_clu_id = parse_int(f); | |
302 | if (feof(f)) break; | |
303 | parse_sep(f); | |
304 | parse_str(f, t_serv_label, 17); | |
305 | parse_sep(f); | |
306 | parse_str(f, t_serv_cluster, 33); | |
307 | parse_nl(f); | |
308 | ||
309 | inc_count(); | |
310 | ## append svc ( | |
311 | ## clu_id = t_clu_id, | |
312 | ## serv_label = t_serv_label, | |
313 | ## serv_cluster = t_serv_cluster) | |
314 | } | |
315 | (void) fclose(f); | |
316 | end_counter(); | |
317 | ##} | |
318 | ||
319 | ||
320 | do_servers() | |
321 | ##{ | |
322 | register FILE *f; | |
323 | ## char t_service[17]; | |
324 | ## int t_update_int; | |
325 | ## char t_target_file[65]; | |
326 | ## char t_script[129]; | |
327 | ## char t_dfgen[26]; | |
328 | ||
329 | f = open_file("servers"); | |
330 | start_counter(1); | |
331 | ||
332 | while(!feof(f)) { | |
333 | parse_str(f, t_service, 17); | |
334 | if (feof(f)) break; | |
335 | parse_sep(f); | |
336 | t_update_int = parse_int(f); | |
337 | parse_sep(f); | |
338 | parse_str(f, t_target_file, 65); | |
339 | parse_sep(f); | |
340 | parse_str(f, t_script, 129); | |
341 | parse_sep(f); | |
342 | parse_str(f, t_dfgen, 26); | |
343 | parse_nl(f); | |
344 | ||
345 | inc_count(); | |
346 | ## append servers ( | |
347 | ## name = uppercase(t_service), | |
348 | ## update_int = t_update_int, | |
349 | ## target_file = t_target_file, | |
350 | ## script = t_script, | |
351 | ## dfgen = 0, | |
352 | ## type = "UNIQUE", | |
353 | ## enable = 0, | |
354 | ## inprogress = 0, | |
355 | ## harderror = 0, | |
356 | ## errmsg = "", | |
357 | ## acl_type = "NONE", | |
358 | ## acl_id = 0, | |
359 | ## modtime = "now", | |
360 | ## modby = USERSMS, | |
361 | ## modwith = "convert" | |
362 | ## ) | |
363 | } | |
364 | (void) fclose(f); | |
365 | end_counter(); | |
366 | ##} | |
367 | ||
368 | ||
369 | do_serverhosts() | |
370 | ##{ | |
371 | register FILE *f; | |
372 | ## char t_service[17]; | |
373 | ## int t_mach_id; | |
374 | ## char t_enable[33]; | |
375 | ## int t_overide; | |
376 | ## char t_ltt[26]; | |
377 | ## char t_success[2]; | |
378 | ## int t_value1; | |
379 | ## int t_value2; | |
380 | ## int err; | |
381 | ||
382 | f = open_file("serverhosts"); | |
383 | start_counter(5); | |
384 | ||
385 | while(!feof(f)) { | |
386 | parse_str(f, t_service, 17); | |
387 | if (feof(f)) break; | |
388 | parse_sep(f); | |
389 | t_mach_id = parse_int(f); | |
390 | parse_sep(f); | |
391 | parse_str(f, t_enable, 33); | |
392 | parse_sep(f); | |
393 | t_overide = parse_int(f); | |
394 | parse_sep(f); | |
395 | parse_str(f, t_ltt, 26); | |
396 | parse_sep(f); | |
397 | parse_str(f, t_success, 2); | |
398 | parse_sep(f); | |
399 | t_value1 = parse_int(f); | |
400 | parse_sep(f); | |
401 | t_value2 = parse_int(f); | |
402 | parse_nl(f); | |
403 | ||
404 | inc_count(); | |
405 | if (t_mach_id == 0) | |
406 | continue; | |
407 | ## append serverhosts ( | |
408 | ## service = uppercase(t_service), | |
409 | ## mach_id = t_mach_id, | |
410 | ## enable = 0, | |
411 | ## override = t_overide, | |
412 | ## ltt = 0, | |
413 | ## lts = 0, | |
414 | ## success = int1(t_success), | |
415 | ## inprogress = 0, | |
416 | ## hosterror = 0, | |
417 | ## hosterrmsg = "", | |
418 | ## value1 = t_value1, | |
419 | ## value2 = t_value2, | |
420 | ## modtime = "now", | |
421 | ## modby = USERSMS, | |
422 | ## modwith = "convert") | |
423 | } | |
424 | (void) fclose(f); | |
425 | end_counter(); | |
426 | ## modify serverhosts to btree on service | |
427 | ## inquire_equel(err = "errorno") | |
428 | if (err != 0) | |
429 | punt("unable to modify serverhosts"); | |
430 | ## index on serverhosts is i_sho_mach (mach_id) | |
431 | ## inquire_equel(err = "errorno") | |
432 | if (err != 0) | |
433 | punt("unable to index serverhosts"); | |
434 | ## modify i_sho_mach to cbtree | |
435 | ## inquire_equel(err = "errorno") | |
436 | if (err != 0) | |
437 | punt("unable to modify serverhosts index"); | |
438 | ##} | |
439 | ||
440 | ||
441 | do_list() | |
442 | ##{ | |
443 | register FILE *f; | |
444 | ## char t_name[33]; | |
445 | ## int t_list_id; | |
446 | ## int t_flags; | |
447 | ## char t_desc[257]; | |
448 | ## int t_created; | |
449 | ## int t_acl_id; | |
450 | ## char t_expdate[26]; | |
451 | ## char t_modtime[26]; | |
452 | ## int t_active, t_public, t_hidden, err; | |
453 | ||
454 | /* delete default & dbadmin */ | |
455 | ## delete list where list.list_id = 1 or list.list_id = 2 | |
456 | ||
457 | f = open_file("list"); | |
458 | start_counter(5); | |
459 | ||
460 | while(!feof(f)) { | |
461 | parse_str(f, t_name, 33); | |
462 | if (feof(f)) break; | |
463 | parse_sep(f); | |
464 | t_list_id = parse_int(f); | |
465 | parse_sep(f); | |
466 | t_flags = parse_int(f); | |
467 | parse_sep(f); | |
468 | parse_str(f, t_desc, 257); | |
469 | parse_sep(f); | |
470 | t_acl_id = parse_int(f); | |
471 | parse_sep(f); | |
472 | parse_str(f, t_expdate, 26); | |
473 | parse_sep(f); | |
474 | parse_str(f, t_modtime, 26); | |
475 | parse_nl(f); | |
476 | ||
477 | t_active = t_flags & 1; | |
478 | t_public = (t_flags>>1) & 1; | |
479 | t_hidden = (t_flags>>2) & 1; | |
480 | inc_count(); | |
481 | ## append list ( | |
482 | ## name = t_name, | |
483 | ## list_id = t_list_id, | |
484 | ## active = t_active, public = t_public, hidden = t_hidden, | |
485 | ## desc = t_desc, | |
486 | ## acl_type = "LIST", | |
487 | ## acl_id = t_acl_id, | |
1ba88c34 | 488 | ## modtime = t_modtime, |
1ba88c34 | 489 | ## modby = USERSMS, |
dca0646a | 490 | ## modwith = "convert") |
491 | } | |
492 | (void) fclose(f); | |
493 | end_counter(); | |
494 | ||
495 | ## modify list to cbtree unique on list_id | |
496 | ## inquire_equel(err = "errorno") | |
497 | if (err != 0) | |
498 | punt("unable to modify list"); | |
499 | ## index on list is i_lis_name (name) | |
500 | ## inquire_equel(err = "errorno") | |
501 | if (err != 0) | |
502 | punt("unable to index lists by name"); | |
503 | ## modify i_lis_name to hash | |
504 | ## inquire_equel(err = "errorno") | |
505 | if (err != 0) | |
506 | punt("unable to modify list name index"); | |
507 | ##} | |
508 | ||
509 | ||
510 | do_maillists() | |
511 | ##{ | |
512 | register FILE *f; | |
513 | ## int t_list_id; | |
514 | ## int t_ltid; | |
515 | ## int err; | |
516 | ||
517 | f = open_file("maillists"); | |
518 | ## range of l is list | |
519 | start_counter(5); | |
520 | ||
521 | while(!feof(f)) { | |
522 | t_list_id = parse_int(f); | |
523 | if (feof(f)) break; | |
524 | parse_sep(f); | |
525 | t_ltid = parse_int(f); | |
526 | parse_nl(f); | |
527 | ||
528 | inc_count(); | |
529 | ## repeat replace l (maillist = 1) where l.list_id = @t_list_id | |
530 | } | |
531 | end_counter(); | |
532 | (void) fclose(f); | |
533 | ## index on list is i_lis_mail (maillist) | |
534 | ## inquire_equel(err = "errorno") | |
535 | if (err != 0) | |
536 | punt("unable to index lists by maillist"); | |
537 | ##} | |
538 | ||
539 | ||
540 | do_groups() | |
541 | ##{ | |
542 | register FILE *f; | |
543 | ## int t_list_id; | |
544 | ## int t_ltid; | |
545 | ## int t_gid; | |
546 | ## int err; | |
547 | ||
548 | f = open_file("groups"); | |
549 | ## range of l is list | |
550 | start_counter(5); | |
551 | ||
552 | while(!feof(f)) { | |
553 | t_list_id = parse_int(f); | |
554 | if (feof(f)) break; | |
555 | parse_sep(f); | |
556 | t_ltid = parse_int(f); | |
557 | parse_sep(f); | |
558 | t_gid = parse_int(f); | |
559 | parse_nl(f); | |
560 | ||
561 | inc_count(); | |
562 | ## repeat replace l (group = 1, gid = @t_gid) where l.list_id = @t_list_id | |
563 | } | |
564 | end_counter(); | |
565 | (void) fclose(f); | |
566 | ## index on list is i_lis_group (group) | |
567 | ## inquire_equel(err = "errorno") | |
568 | if (err != 0) | |
569 | punt("unable to index lists by group"); | |
570 | ##} | |
571 | ||
572 | ||
573 | do_members() | |
574 | ##{ | |
575 | register FILE *f; | |
576 | ## int t_list_id; | |
577 | ## char t_member_type[9]; | |
578 | ## int t_member_id; | |
579 | ||
580 | f = open_file("members"); | |
581 | start_counter(25); | |
582 | ||
583 | while(!feof(f)) { | |
584 | t_list_id = parse_int(f); | |
585 | if (feof(f)) break; | |
586 | parse_sep(f); | |
587 | parse_str(f, t_member_type, 9); | |
588 | parse_sep(f); | |
589 | t_member_id = parse_int(f); | |
590 | parse_nl(f); | |
591 | ||
592 | inc_count(); | |
593 | ## append members ( | |
594 | ## list_id = t_list_id, | |
595 | ## member_type = t_member_type, | |
596 | ## member_id = t_member_id) | |
597 | } | |
598 | end_counter(); | |
599 | (void) fclose(f); | |
600 | ##} | |
601 | ||
602 | ||
603 | do_strings() | |
604 | ##{ | |
605 | register FILE *f; | |
606 | ## int t_string_id; | |
607 | ## char t_string[129]; | |
608 | ## int t_refc; | |
609 | ||
610 | f = open_file("strings"); | |
611 | start_counter(10); | |
612 | ||
613 | while(!feof(f)) { | |
614 | t_string_id = parse_int(f); | |
615 | if (feof(f)) break; | |
616 | parse_sep(f); | |
617 | parse_str(f, t_string, 129); | |
618 | parse_sep(f); | |
619 | t_refc = parse_int(f); | |
620 | parse_nl(f); | |
621 | ||
622 | inc_count(); | |
623 | ## append strings ( | |
624 | ## string_id = t_string_id, | |
625 | ## string = t_string) | |
626 | } | |
627 | end_counter(); | |
628 | (void) fclose(f); | |
629 | ##} | |
630 | ||
631 | ||
632 | do_nfsphys() | |
633 | ##{ | |
634 | register FILE *f; | |
635 | ## int t_mach_id; | |
636 | ## char t_device[17]; | |
637 | ## char t_dir[17]; | |
638 | ## int t_status; | |
639 | ## int t_allocated; | |
640 | ## int t_size; | |
641 | ## int t_nfsphys_id; | |
642 | ## int err; | |
643 | ||
644 | f = open_file("nfsphys"); | |
645 | start_counter(5); | |
646 | t_nfsphys_id = 0; | |
647 | ||
648 | while(!feof(f)) { | |
649 | t_mach_id = parse_int(f); | |
650 | if (feof(f)) break; | |
651 | parse_sep(f); | |
652 | parse_str(f, t_device, 17); | |
653 | parse_sep(f); | |
654 | parse_str(f, t_dir, 17); | |
655 | parse_sep(f); | |
656 | t_status = parse_int(f); | |
657 | parse_sep(f); | |
658 | t_allocated = parse_int(f); | |
659 | parse_sep(f); | |
660 | t_size = parse_int(f); | |
661 | parse_nl(f); | |
662 | t_nfsphys_id++; | |
663 | ||
664 | inc_count(); | |
665 | ## append nfsphys ( | |
666 | ## nfsphys_id = t_nfsphys_id, | |
667 | ## mach_id = t_mach_id, | |
668 | ## device = t_device, | |
669 | ## dir = t_dir, | |
670 | ## status = t_status, | |
671 | ## allocated = t_allocated, | |
672 | ## size = t_size, | |
673 | ## modtime = "now", | |
674 | ## modby = USERSMS, | |
675 | ## modwith = "convert") | |
676 | } | |
677 | end_counter(); | |
678 | (void) fclose(f); | |
679 | ||
680 | ## modify nfsphys to cbtree unique on nfsphys_id | |
681 | ## inquire_equel(err = "errorno") | |
682 | if (err != 0) | |
683 | punt("cannot modify filesys"); | |
684 | ## index on nfsphys is i_nfs_mach (mach_id) | |
685 | ## inquire_equel(err = "errorno") | |
686 | if (err != 0) | |
687 | punt("cannot index filesys"); | |
688 | ## modify i_nfs_mach to btree | |
689 | ## inquire_equel(err = "errorno") | |
690 | if (err != 0) | |
691 | punt("cannot modify i_nfs_mach"); | |
692 | ##} | |
693 | ||
694 | ||
695 | do_filesys() | |
696 | ##{ | |
697 | register FILE *f; | |
698 | ## char t_label[33]; | |
699 | ## int t_order; | |
700 | ## char t_type[9]; | |
701 | ## char t_name[33]; | |
702 | ## int t_mach_id; | |
703 | ## char t_access[2]; | |
704 | ## char t_mount[33]; | |
705 | ## int t_acl_id; | |
706 | ## int t_filsys_id; | |
707 | ## int t_phys_id; | |
708 | ## int err; | |
709 | ||
710 | f = open_file("filesys"); | |
711 | start_counter(5); | |
712 | t_filsys_id = 0; | |
713 | ||
714 | while(!feof(f)) { | |
715 | parse_str(f, t_label, 33); | |
716 | if (feof(f)) break; | |
717 | parse_sep(f); | |
718 | parse_str(f, t_type, 9); | |
719 | parse_sep(f); | |
720 | t_mach_id = parse_int(f); | |
721 | parse_sep(f); | |
722 | parse_str(f, t_name, 33); | |
723 | parse_sep(f); | |
724 | parse_str(f, t_mount, 33); | |
725 | parse_sep(f); | |
726 | parse_str(f, t_access, 2); | |
727 | parse_sep(f); | |
728 | t_acl_id = parse_int(f); | |
729 | parse_nl(f); | |
730 | t_filsys_id++; | |
731 | if (!strcmp(t_type, "NFS")) | |
732 | t_phys_id = match_phys(t_mach_id, t_name); | |
733 | else | |
734 | t_phys_id = 0; | |
735 | ||
736 | inc_count(); | |
737 | ## append filesys ( | |
738 | ## filsys_id = t_filsys_id, | |
739 | ## phys_id = t_phys_id, | |
740 | ## label = t_label, | |
741 | ## type = t_type, | |
742 | ## mach_id = t_mach_id, | |
743 | ## name = t_name, | |
744 | ## mount = t_mount, | |
745 | ## access = t_access, | |
746 | ## owner = USERSMS, | |
747 | ## owners = t_acl_id, | |
748 | ## createflg = 0, | |
749 | ## lockertype = "UNKNOWN", | |
750 | ## modtime = "now", | |
751 | ## modby = USERSMS, | |
752 | ## modwith = "convert") | |
753 | } | |
754 | end_counter(); | |
755 | (void) fclose(f); | |
756 | ## modify filesys to cbtree unique on filsys_id | |
757 | ## inquire_equel(err = "errorno") | |
758 | if (err != 0) | |
759 | punt("cannot modify filesys"); | |
760 | ## index on filesys is i_fil_name (label) | |
761 | ## inquire_equel(err = "errorno") | |
762 | if (err != 0) | |
763 | punt("cannot index filesys on label"); | |
764 | ## modify i_fil_name to hash | |
765 | ## inquire_equel(err = "errorno") | |
766 | if (err != 0) | |
767 | punt("cannot modify i_fil_name"); | |
768 | ## index on filesys is i_fil_mach (mach_id) | |
769 | ## inquire_equel(err = "errorno") | |
770 | if (err != 0) | |
771 | punt("cannot index filesys on mach_id"); | |
772 | ## modify i_fil_mach to btree | |
773 | ## inquire_equel(err = "errorno") | |
774 | if (err != 0) | |
775 | punt("cannot modify i_fil_mach"); | |
776 | ## index on filesys is i_fil_phys (phys_id) | |
777 | ## inquire_equel(err = "errorno") | |
778 | if (err != 0) | |
779 | punt("cannot index filesys on phys_id"); | |
780 | ## modify i_fil_phys to btree | |
781 | ## inquire_equel(err = "errorno") | |
782 | if (err != 0) | |
783 | punt("cannot modify i_fil_phys"); | |
784 | ##} | |
785 | ||
786 | ||
787 | do_nfsquota() | |
788 | ##{ | |
789 | register FILE *f; | |
790 | ## int t_users_id; | |
791 | ## int t_mach_id; | |
792 | ## char t_device[17]; | |
793 | ## int t_quota; | |
794 | ## int t_filsys_id; | |
795 | ||
796 | f = open_file("nfsquota"); | |
797 | start_counter(1); | |
798 | ## range of f is filesys | |
799 | ## range of u is users | |
800 | ## range of n is nfsphys | |
801 | ||
802 | while(!feof(f)) { | |
803 | t_users_id = parse_int(f); | |
804 | if (feof(f)) break; | |
805 | parse_sep(f); | |
806 | t_mach_id = parse_int(f); | |
807 | parse_sep(f); | |
808 | parse_str(f, t_device, 17); | |
809 | parse_sep(f); | |
810 | t_quota = parse_int(f); | |
811 | parse_nl(f); | |
812 | t_filsys_id = match_filsys(t_mach_id, t_device, t_users_id); | |
813 | ||
814 | inc_count(); | |
815 | ## append nfsquota ( | |
816 | ## users_id = t_users_id, | |
817 | ## filsys_id = t_filsys_id, | |
818 | ## quota = t_quota, | |
819 | ## modtime = "now", | |
820 | ## modby = USERSMS, | |
821 | ## modwith = "convert") | |
822 | } | |
823 | end_counter(); | |
824 | (void) fclose(f); | |
825 | ##} | |
826 | ||
827 | ||
828 | do_pobox() | |
829 | ##{ | |
830 | register FILE *f; | |
831 | ## int t_users_id; | |
832 | ## char t_type[9]; | |
833 | ## int t_mach_id; | |
834 | ## char t_box[33]; | |
835 | ## char t_created[26]; | |
836 | ## char t_string[129]; | |
837 | ## int t_string_id; | |
838 | ## char t_machine[65]; | |
839 | ## int rowcount; | |
840 | ||
841 | f = open_file("pobox"); | |
842 | ## range of u is users | |
843 | ## range of m is machine | |
844 | start_counter(5); | |
845 | ## retrieve (t_string_id = max(strings.string_id)) | |
846 | t_string_id++; | |
847 | ||
848 | while (!feof(f)) { | |
849 | t_users_id = parse_int(f); | |
850 | if (feof(f)) break; | |
851 | parse_sep(f); | |
852 | parse_str(f, t_type, 9); | |
853 | parse_sep(f); | |
854 | t_mach_id = parse_int(f); | |
855 | parse_sep(f); | |
856 | parse_str(f, t_box, 33); | |
857 | parse_sep(f); | |
858 | parse_str(f, t_created, 26); | |
859 | parse_nl(f); | |
860 | ||
861 | inc_count(); | |
862 | if (!strcmp(t_type, "POP")) { | |
863 | ## repeat replace users ( | |
864 | ## potype = @t_type, | |
865 | ## pop_id = @t_mach_id, | |
866 | ## pmodtime = @t_created, | |
867 | ## pmodwith = "convert", | |
868 | ## pmodby = USERSMS | |
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 ( | |
874 | ## potype = "SMTP", | |
1ba88c34 | 875 | ## pop_id = 0, |
dca0646a | 876 | ## box_id = @t_string_id, |
877 | ## pmodtime = @t_created, | |
1ba88c34 | 878 | ## pmodwith = "convert", |
879 | ## pmodby = USERSMS | |
dca0646a | 880 | ## ) where users.users_id = @t_users_id |
881 | ## append strings (string_id = t_string_id, | |
882 | ## string = t_box + "@" + t_machine) | |
883 | t_string_id++; | |
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 ( | |
888 | ## potype = "SMTP", | |
889 | ## pop_id = 0, | |
890 | ## box_id = @t_string_id, | |
891 | ## pmodtime = @t_created, | |
892 | ## pmodwith = "convert", | |
893 | ## pmodby = USERSMS | |
894 | ## ) where users.users_id = @t_users_id | |
895 | ## append strings (string_id = t_string_id, | |
896 | ## string = t_box + "@" + t_string) | |
897 | t_string_id++; | |
898 | } else { | |
899 | printf("Unknown pobox type: %s\n", t_type); | |
1ba88c34 | 900 | } |
901 | } | |
dca0646a | 902 | end_counter(); |
903 | fclose(f); | |
904 | ##} | |
905 | ||
906 | ||
907 | do_services() | |
908 | ##{ | |
909 | register FILE *f; | |
910 | ## char t_name[17]; | |
911 | ## char t_protocol[9]; | |
912 | ## int t_port; | |
913 | ## char t_desc[65]; | |
914 | ||
915 | f = open_file("services"); | |
916 | start_counter(5); | |
917 | ||
918 | while(!feof(f)) { | |
919 | parse_str(f, t_name, 17); | |
920 | if (feof(f)) break; | |
921 | parse_sep(f); | |
922 | parse_str(f, t_protocol, 9); | |
923 | parse_sep(f); | |
924 | t_port = parse_int(f); | |
925 | parse_sep(f); | |
926 | parse_str(f, t_desc, 65); | |
927 | parse_nl(f); | |
928 | ||
929 | inc_count(); | |
930 | ## append services ( | |
931 | ## name = t_name, | |
932 | ## protocol = t_protocol, | |
933 | ## port = t_port, | |
934 | ## desc = t_desc, | |
935 | ## modtime = "now", | |
936 | ## modby = USERSMS, | |
937 | ## modwith = "convert") | |
938 | } | |
939 | (void) fclose(f); | |
940 | end_counter(); | |
941 | ##} | |
942 | ||
943 | ||
944 | do_printcap() | |
945 | ##{ | |
946 | register FILE *f; | |
947 | ## char t_name[17]; | |
948 | ## char t_pcap[513]; | |
949 | ||
950 | f = open_file("printcap"); | |
951 | start_counter(1); | |
952 | ||
953 | while(!feof(f)) { | |
954 | parse_str(f, t_name, 17); | |
955 | if (feof(f)) break; | |
956 | parse_sep(f); | |
957 | parse_str(f, t_pcap, 513); | |
958 | parse_nl(f); | |
959 | ||
960 | inc_count(); | |
961 | ## append printcap ( | |
962 | ## name = t_name, | |
963 | ## mach_id = 0, | |
964 | ## dir = "/usr/spool/printer/" + t_name, | |
965 | ## rp = t_name, | |
966 | ## modtime = "now", | |
967 | ## modby = USERSMS, | |
968 | ## modwith = "convert") | |
969 | } | |
970 | end_counter(); | |
971 | (void) fclose(f); | |
972 | ##} | |
973 | ||
974 | ||
975 | do_values() | |
976 | ##{ | |
977 | register FILE *f; | |
978 | ## char t_name[33]; | |
979 | ## int t_value; | |
980 | ||
981 | f = open_file("values"); | |
982 | while(!feof(f)) { | |
983 | parse_str(f, t_name, 33); | |
984 | if (feof(f)) break; | |
985 | parse_sep(f); | |
986 | t_value = parse_int(f); | |
987 | parse_nl(f); | |
988 | ||
989 | if (strcmp(t_name, "def_quota") && | |
990 | strcmp(t_name, "gid") && | |
991 | strcmp(t_name, "uid")) | |
992 | continue; | |
993 | ||
994 | ## replace values (value = t_value) where values.name = t_name | |
995 | } | |
996 | (void) fclose(f); | |
997 | ##} | |
998 | ||
999 | ||
1000 | do_alias() | |
1001 | ##{ | |
1002 | register FILE *f; | |
1003 | ## char t_name[33]; | |
1004 | ## char t_type[17]; | |
1005 | ## char t_trans[129]; | |
1006 | ||
1007 | f = open_file("alias"); | |
1008 | start_counter(5); | |
1009 | while(!feof(f)) { | |
1010 | parse_str(f, t_name, 33); | |
1011 | if (feof(f)) break; | |
1012 | parse_sep(f); | |
1013 | parse_str(f, t_type, 17); | |
1014 | parse_sep(f); | |
1015 | parse_str(f, t_trans, 129); | |
1016 | parse_nl(f); | |
1017 | inc_count(); | |
1018 | ||
1019 | if (!strcmp(t_type, "TYPE") || | |
1020 | !strcmp(t_type, "TYPEDATA")) | |
1021 | continue; | |
1022 | ||
1023 | ## append alias ( | |
1024 | ## name = t_name, | |
1025 | ## type = t_type, | |
1026 | ## trans = t_trans) | |
1027 | } | |
1028 | end_counter(); | |
1029 | (void) fclose(f); | |
1ba88c34 | 1030 | ##} |
1031 |