... | ... |
@@ -1,6 +1,6 @@ |
1 | 1 |
#! /bin/sh |
2 | 2 |
# Guess values for system-dependent variables and create Makefiles. |
3 |
-# Generated by GNU Autoconf 2.61 for makuosan 0.9.2. |
|
3 |
+# Generated by GNU Autoconf 2.61 for makuosan 0.9.3. |
|
4 | 4 |
# |
5 | 5 |
# Report bugs to <info-makuosan@klab.jp>. |
6 | 6 |
# |
... | ... |
@@ -574,8 +574,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} |
574 | 574 |
# Identity of this package. |
575 | 575 |
PACKAGE_NAME='makuosan' |
576 | 576 |
PACKAGE_TARNAME='makuosan' |
577 |
-PACKAGE_VERSION='0.9.2' |
|
578 |
-PACKAGE_STRING='makuosan 0.9.2' |
|
577 |
+PACKAGE_VERSION='0.9.3' |
|
578 |
+PACKAGE_STRING='makuosan 0.9.3' |
|
579 | 579 |
PACKAGE_BUGREPORT='info-makuosan@klab.jp' |
580 | 580 |
|
581 | 581 |
ac_unique_file="makuosan.c" |
... | ... |
@@ -1209,7 +1209,7 @@ if test "$ac_init_help" = "long"; then |
1209 | 1209 |
# Omit some internal or obsolete options to make the list less imposing. |
1210 | 1210 |
# This message is too long to be a string in the A/UX 3.1 sh. |
1211 | 1211 |
cat <<_ACEOF |
1212 |
-\`configure' configures makuosan 0.9.2 to adapt to many kinds of systems. |
|
1212 |
+\`configure' configures makuosan 0.9.3 to adapt to many kinds of systems. |
|
1213 | 1213 |
|
1214 | 1214 |
Usage: $0 [OPTION]... [VAR=VALUE]... |
1215 | 1215 |
|
... | ... |
@@ -1275,7 +1275,7 @@ fi |
1275 | 1275 |
|
1276 | 1276 |
if test -n "$ac_init_help"; then |
1277 | 1277 |
case $ac_init_help in |
1278 |
- short | recursive ) echo "Configuration of makuosan 0.9.2:";; |
|
1278 |
+ short | recursive ) echo "Configuration of makuosan 0.9.3:";; |
|
1279 | 1279 |
esac |
1280 | 1280 |
cat <<\_ACEOF |
1281 | 1281 |
|
... | ... |
@@ -1359,7 +1359,7 @@ fi |
1359 | 1359 |
test -n "$ac_init_help" && exit $ac_status |
1360 | 1360 |
if $ac_init_version; then |
1361 | 1361 |
cat <<\_ACEOF |
1362 |
-makuosan configure 0.9.2 |
|
1362 |
+makuosan configure 0.9.3 |
|
1363 | 1363 |
generated by GNU Autoconf 2.61 |
1364 | 1364 |
|
1365 | 1365 |
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, |
... | ... |
@@ -1373,7 +1373,7 @@ cat >config.log <<_ACEOF |
1373 | 1373 |
This file contains any messages produced by compilers while |
1374 | 1374 |
running configure, to aid debugging if configure makes a mistake. |
1375 | 1375 |
|
1376 |
-It was created by makuosan $as_me 0.9.2, which was |
|
1376 |
+It was created by makuosan $as_me 0.9.3, which was |
|
1377 | 1377 |
generated by GNU Autoconf 2.61. Invocation command line was |
1378 | 1378 |
|
1379 | 1379 |
$ $0 $@ |
... | ... |
@@ -2064,7 +2064,7 @@ fi |
2064 | 2064 |
|
2065 | 2065 |
# Define the identity of the package. |
2066 | 2066 |
PACKAGE='makuosan' |
2067 |
- VERSION='0.9.2' |
|
2067 |
+ VERSION='0.9.3' |
|
2068 | 2068 |
|
2069 | 2069 |
|
2070 | 2070 |
cat >>confdefs.h <<_ACEOF |
... | ... |
@@ -8845,7 +8845,7 @@ exec 6>&1 |
8845 | 8845 |
# report actual input values of CONFIG_FILES etc. instead of their |
8846 | 8846 |
# values after options handling. |
8847 | 8847 |
ac_log=" |
8848 |
-This file was extended by makuosan $as_me 0.9.2, which was |
|
8848 |
+This file was extended by makuosan $as_me 0.9.3, which was |
|
8849 | 8849 |
generated by GNU Autoconf 2.61. Invocation command line was |
8850 | 8850 |
|
8851 | 8851 |
CONFIG_FILES = $CONFIG_FILES |
... | ... |
@@ -8902,7 +8902,7 @@ Report bugs to <bug-autoconf@gnu.org>." |
8902 | 8902 |
_ACEOF |
8903 | 8903 |
cat >>$CONFIG_STATUS <<_ACEOF |
8904 | 8904 |
ac_cs_version="\\ |
8905 |
-makuosan config.status 0.9.2 |
|
8905 |
+makuosan config.status 0.9.3 |
|
8906 | 8906 |
configured by $0, generated by GNU Autoconf 2.61, |
8907 | 8907 |
with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" |
8908 | 8908 |
|
... | ... |
@@ -1,8 +1,7 @@ |
1 | 1 |
# -*- Autoconf -*- |
2 | 2 |
# Process this file with autoconf to produce a configure script. |
3 |
- |
|
4 | 3 |
AC_PREREQ(2.61) |
5 |
-AC_INIT(makuosan, 0.9.2, info-makuosan@klab.jp) |
|
4 |
+AC_INIT(makuosan, 0.9.3, info-makuosan@klab.jp) |
|
6 | 5 |
AM_INIT_AUTOMAKE |
7 | 6 |
AC_CONFIG_SRCDIR([makuosan.c]) |
8 | 7 |
AC_CONFIG_HEADER([config.h]) |
... | ... |
@@ -9,6 +9,7 @@ char *command_list[]={"quit", /* */ |
9 | 9 |
"exit", /* */ |
10 | 10 |
"bye", /* */ |
11 | 11 |
"send", /* */ |
12 |
+ "syncdir", /* */ |
|
12 | 13 |
"members", /* */ |
13 | 14 |
"status", /* */ |
14 | 15 |
"md5", /* */ |
... | ... |
@@ -237,6 +238,7 @@ int mexec_help(mcomm *c, int n) |
237 | 237 |
cprintf(0, c, " exclude clear\n"); |
238 | 238 |
cprintf(0, c, " send [-n] [-r] [-t host] [filename]\n"); |
239 | 239 |
cprintf(0, c, " md5 [-r] [-t host] [filename]\n"); |
240 |
+ cprintf(0, c, " syncdir [-r] [-t host] [dirname]\n"); |
|
240 | 241 |
cprintf(0, c, " loglevel num (0-9)\n"); |
241 | 242 |
cprintf(0, c, " members\n"); |
242 | 243 |
cprintf(0, c, " help\n"); |
... | ... |
@@ -368,6 +370,118 @@ int mexec_send(mcomm *c, int n) |
368 | 368 |
return(0); |
369 | 369 |
} |
370 | 370 |
|
371 |
+int mexec_md5(mcomm *c, int n) |
|
372 |
+{ |
|
373 |
+ int i; |
|
374 |
+ int r; |
|
375 |
+ ssize_t size; |
|
376 |
+ char *argv[9]; |
|
377 |
+ char *fn = NULL; |
|
378 |
+ mfile *m = NULL; |
|
379 |
+ mhost *t = NULL; |
|
380 |
+ mhash *h = NULL; |
|
381 |
+ int recursive = 0; |
|
382 |
+ |
|
383 |
+ for(i=0;i<c->argc[n];i++) |
|
384 |
+ argv[i] = c->parse[n][i]; |
|
385 |
+ argv[i] = NULL; |
|
386 |
+ optind = 0; |
|
387 |
+ while((i=getopt(c->argc[n], argv, "t:r")) != -1){ |
|
388 |
+ switch(i){ |
|
389 |
+ case 'r': |
|
390 |
+ recursive = 1; |
|
391 |
+ break; |
|
392 |
+ case 't': |
|
393 |
+ for(t=members;t;t=t->next) |
|
394 |
+ if(!strcmp(t->hostname, optarg)) |
|
395 |
+ break; |
|
396 |
+ if(!t){ |
|
397 |
+ cprintf(0, c, "%s is not contained in members\r\n", optarg); |
|
398 |
+ return(0); |
|
399 |
+ } |
|
400 |
+ break; |
|
401 |
+ case '?': |
|
402 |
+ cprintf(0, c, "invalid option -- %c\r\n", optopt); |
|
403 |
+ return(0); |
|
404 |
+ } |
|
405 |
+ } |
|
406 |
+ |
|
407 |
+ while(optind < c->argc[n]) |
|
408 |
+ fn = c->parse[n][optind++]; |
|
409 |
+ |
|
410 |
+ /*----- directory scan -----*/ |
|
411 |
+ if(recursive){ |
|
412 |
+ if(c->cpid){ |
|
413 |
+ cprintf(0, c, "recursive process active now!\n"); |
|
414 |
+ return(0); |
|
415 |
+ } |
|
416 |
+ return(mexec_scan(c, fn, t, MAKUO_MEXEC_MD5)); |
|
417 |
+ } |
|
418 |
+ |
|
419 |
+ /*----- help -----*/ |
|
420 |
+ if(!fn){ |
|
421 |
+ cprintf(0, c,"usage: md5 [-t host] [-r] [path]\r\n"); |
|
422 |
+ cprintf(0, c, " -r # dir recursive\r\n"); |
|
423 |
+ cprintf(0, c, " -t # target host\r\n"); |
|
424 |
+ return(0); |
|
425 |
+ } |
|
426 |
+ |
|
427 |
+ /*----- create mfile -----*/ |
|
428 |
+ m = mfadd(0); |
|
429 |
+ if(!m){ |
|
430 |
+ lprintf(0, "%s: out of memorry\n", __func__); |
|
431 |
+ cprintf(0, c, "error: out of memorry\n"); |
|
432 |
+ return(0); |
|
433 |
+ } |
|
434 |
+ m->mdata.head.reqid = getrid(); |
|
435 |
+ m->mdata.head.seqno = 0; |
|
436 |
+ m->mdata.head.opcode = MAKUO_OP_MD5; |
|
437 |
+ m->mdata.head.nstate = MAKUO_SENDSTATE_OPEN; |
|
438 |
+ m->initstate = 1; |
|
439 |
+ m->comm = c; |
|
440 |
+ m->sendto = 0; |
|
441 |
+ m->dryrun = 0; |
|
442 |
+ m->ln[0] = 0; |
|
443 |
+ strcpy(m->fn, fn); |
|
444 |
+ |
|
445 |
+ /*----- open -----*/ |
|
446 |
+ m->fd = open(m->fn, O_RDONLY); |
|
447 |
+ if(m->fd == -1){ |
|
448 |
+ lprintf(0, "%s: file open error %s\n", __func__, m->fn); |
|
449 |
+ cprintf(0, c, "file open error: %s\r\n", m->fn); |
|
450 |
+ mfdel(m); |
|
451 |
+ return(0); |
|
452 |
+ } |
|
453 |
+ |
|
454 |
+ /*----- md5 -----*/ |
|
455 |
+ h = (mhash *)m->mdata.data; |
|
456 |
+ h->fnlen = strlen(m->fn); |
|
457 |
+ r = md5sum(m->fd, h->hash); |
|
458 |
+ close(m->fd); |
|
459 |
+ m->fd = -1; |
|
460 |
+ if(r == -1){ |
|
461 |
+ lprintf(0, "%s: file read error %s\n", __func__, m->fn); |
|
462 |
+ cprintf(0, c, "error: file read error %s\n", m->fn); |
|
463 |
+ mfdel(m); |
|
464 |
+ return(0); |
|
465 |
+ } |
|
466 |
+ memcpy(h->filename, m->fn, h->fnlen); |
|
467 |
+ m->mdata.head.szdata = sizeof(mhash) + h->fnlen; |
|
468 |
+ h->fnlen = htons(h->fnlen); |
|
469 |
+ |
|
470 |
+ /*----- sendto address -----*/ |
|
471 |
+ if(t){ |
|
472 |
+ m->sendto = 1; |
|
473 |
+ memcpy(&(m->addr.sin_addr), &(t->ad), sizeof(m->addr.sin_addr)); |
|
474 |
+ } |
|
475 |
+ return(0); |
|
476 |
+} |
|
477 |
+ |
|
478 |
+int mexec_syncdir(mcomm *c, int n) |
|
479 |
+{ |
|
480 |
+ return(0); |
|
481 |
+} |
|
482 |
+ |
|
371 | 483 |
int mexec_members(mcomm *c, int n) |
372 | 484 |
{ |
373 | 485 |
int count=0; |
... | ... |
@@ -523,113 +637,6 @@ int mexec_status(mcomm *c, int n) |
523 | 523 |
return(0); |
524 | 524 |
} |
525 | 525 |
|
526 |
-int mexec_md5(mcomm *c, int n) |
|
527 |
-{ |
|
528 |
- int i; |
|
529 |
- int r; |
|
530 |
- ssize_t size; |
|
531 |
- char *argv[9]; |
|
532 |
- char *fn = NULL; |
|
533 |
- mfile *m = NULL; |
|
534 |
- mhost *t = NULL; |
|
535 |
- mhash *h = NULL; |
|
536 |
- int recursive = 0; |
|
537 |
- |
|
538 |
- for(i=0;i<c->argc[n];i++) |
|
539 |
- argv[i] = c->parse[n][i]; |
|
540 |
- argv[i] = NULL; |
|
541 |
- optind = 0; |
|
542 |
- while((i=getopt(c->argc[n], argv, "t:r")) != -1){ |
|
543 |
- switch(i){ |
|
544 |
- case 'r': |
|
545 |
- recursive = 1; |
|
546 |
- break; |
|
547 |
- case 't': |
|
548 |
- for(t=members;t;t=t->next) |
|
549 |
- if(!strcmp(t->hostname, optarg)) |
|
550 |
- break; |
|
551 |
- if(!t){ |
|
552 |
- cprintf(0, c, "%s is not contained in members\r\n", optarg); |
|
553 |
- return(0); |
|
554 |
- } |
|
555 |
- break; |
|
556 |
- case '?': |
|
557 |
- cprintf(0, c, "invalid option -- %c\r\n", optopt); |
|
558 |
- return(0); |
|
559 |
- } |
|
560 |
- } |
|
561 |
- |
|
562 |
- while(optind < c->argc[n]) |
|
563 |
- fn = c->parse[n][optind++]; |
|
564 |
- |
|
565 |
- /*----- directory scan -----*/ |
|
566 |
- if(recursive){ |
|
567 |
- if(c->cpid){ |
|
568 |
- cprintf(0, c, "recursive process active now!\n"); |
|
569 |
- return(0); |
|
570 |
- } |
|
571 |
- return(mexec_scan(c, fn, t, MAKUO_MEXEC_MD5)); |
|
572 |
- } |
|
573 |
- |
|
574 |
- /*----- help -----*/ |
|
575 |
- if(!fn){ |
|
576 |
- cprintf(0, c,"usage: md5 [-t host] [-r] [path]\r\n"); |
|
577 |
- cprintf(0, c, " -r # dir recursive\r\n"); |
|
578 |
- cprintf(0, c, " -t # target host\r\n"); |
|
579 |
- return(0); |
|
580 |
- } |
|
581 |
- |
|
582 |
- /*----- create mfile -----*/ |
|
583 |
- m = mfadd(0); |
|
584 |
- if(!m){ |
|
585 |
- lprintf(0, "%s: out of memorry\n", __func__); |
|
586 |
- cprintf(0, c, "error: out of memorry\n"); |
|
587 |
- return(0); |
|
588 |
- } |
|
589 |
- m->mdata.head.reqid = getrid(); |
|
590 |
- m->mdata.head.seqno = 0; |
|
591 |
- m->mdata.head.opcode = MAKUO_OP_MD5; |
|
592 |
- m->mdata.head.nstate = MAKUO_SENDSTATE_OPEN; |
|
593 |
- m->initstate = 1; |
|
594 |
- m->comm = c; |
|
595 |
- m->sendto = 0; |
|
596 |
- m->dryrun = 0; |
|
597 |
- m->ln[0] = 0; |
|
598 |
- strcpy(m->fn, fn); |
|
599 |
- |
|
600 |
- /*----- open -----*/ |
|
601 |
- m->fd = open(m->fn, O_RDONLY); |
|
602 |
- if(m->fd == -1){ |
|
603 |
- lprintf(0, "%s: file open error %s\n", __func__, m->fn); |
|
604 |
- cprintf(0, c, "file open error: %s\r\n", m->fn); |
|
605 |
- mfdel(m); |
|
606 |
- return(0); |
|
607 |
- } |
|
608 |
- |
|
609 |
- /*----- md5 -----*/ |
|
610 |
- h = (mhash *)m->mdata.data; |
|
611 |
- h->fnlen = strlen(m->fn); |
|
612 |
- r = md5sum(m->fd, h->hash); |
|
613 |
- close(m->fd); |
|
614 |
- m->fd = -1; |
|
615 |
- if(r == -1){ |
|
616 |
- lprintf(0, "%s: file read error %s\n", __func__, m->fn); |
|
617 |
- cprintf(0, c, "error: file read error %s\n", m->fn); |
|
618 |
- mfdel(m); |
|
619 |
- return(0); |
|
620 |
- } |
|
621 |
- memcpy(h->filename, m->fn, h->fnlen); |
|
622 |
- m->mdata.head.szdata = sizeof(mhash) + h->fnlen; |
|
623 |
- h->fnlen = htons(h->fnlen); |
|
624 |
- |
|
625 |
- /*----- sendto address -----*/ |
|
626 |
- if(t){ |
|
627 |
- m->sendto = 1; |
|
628 |
- memcpy(&(m->addr.sin_addr), &(t->ad), sizeof(m->addr.sin_addr)); |
|
629 |
- } |
|
630 |
- return(0); |
|
631 |
-} |
|
632 |
- |
|
633 | 526 |
int mexec_password(char *password) |
634 | 527 |
{ |
635 | 528 |
unsigned char digest[16]; |
... | ... |
@@ -729,15 +736,17 @@ int mexec(mcomm *c, int n) |
729 | 729 |
} |
730 | 730 |
return(-1); |
731 | 731 |
} |
732 |
+ |
|
732 | 733 |
if(n == 1){ |
733 | 734 |
for(m=mftop[0];m;m=m->next){ |
734 | 735 |
if(m->comm == c){ |
735 |
- if(count++ == 8){ |
|
736 |
+ if(count++ == MAKUO_PARALLEL_MAX){ |
|
736 | 737 |
return(-1); |
737 | 738 |
} |
738 | 739 |
} |
739 | 740 |
} |
740 | 741 |
} |
742 |
+ |
|
741 | 743 |
if(!size){ |
742 | 744 |
lprintf(0, "%s: buffer over fllow n=%d\n", __func__, n); |
743 | 745 |
mexec_close(c, n); |
... | ... |
@@ -791,6 +800,9 @@ int mexec(mcomm *c, int n) |
791 | 791 |
if(!strcmp("md5",command_list[r])) |
792 | 792 |
return(mexec_md5(c,n)); |
793 | 793 |
|
794 |
+ if(!strcmp("syncdir",command_list[r])) |
|
795 |
+ return(mexec_syncdir(c,n)); |
|
796 |
+ |
|
794 | 797 |
if(!strcmp("members",command_list[r])) |
795 | 798 |
return(mexec_members(c,n)); |
796 | 799 |
|