View | Details | Raw Unified | Return to bug 1192449
Collapse All | Expand All

(-)logrotate-3.7.7/config.c (-5 / +12 lines)
Lines 632-637 static int readConfigFile(const char *co Link Here
632
	    oldchar = *endtag;
632
	    oldchar = *endtag;
633
	    *endtag = '\0';
633
	    *endtag = '\0';
634
634
635
	    if (oldchar == '\0') {
636
		message(MESS_ERROR, "%s:%d failed to parse keyword\n",
637
			configFile, lineNum);
638
		return 1;
639
	    }
640
	    if (!isspace((unsigned char)oldchar) && oldchar != '=') {
641
		message(MESS_ERROR, "%s:%d keyword '%s' not properly"
642
			" separated, found %#x\n",
643
			configFile, lineNum, start, oldchar);
644
		return 1;
645
	    }
635
	    if (!strcmp(start, "compress")) {
646
	    if (!strcmp(start, "compress")) {
636
		newlog->flags |= LOG_FLAG_COMPRESS;
647
		newlog->flags |= LOG_FLAG_COMPRESS;
637
648
Lines 1544-1554 duperror: Link Here
1544
	    message(MESS_ERROR, "%s:%d lines must begin with a keyword "
1555
	    message(MESS_ERROR, "%s:%d lines must begin with a keyword "
1545
		    "or a filename (possibly in double quotes)\n",
1556
		    "or a filename (possibly in double quotes)\n",
1546
		    configFile, lineNum);
1557
		    configFile, lineNum);
1547
1558
	    return 1;
1548
	    while (*start != '\n')
1549
		start++;
1550
	    lineNum++;
1551
	    start++;
1552
	}
1559
	}
1553
    }
1560
    }
1554
1561
(-)logrotate-3.7.7/test/test (+71 lines)
Lines 594-597 fi Link Here
594
594
595
rm -f *test.log*
595
rm -f *test.log*
596
596
597
cleanup 102
598
599
# ------------------------------- Test 102 ------------------------------------
600
# test invalid config file with binary content
601
preptest test.log 102 1
602
603
$RLR test-config.102 --force
604
605
if [ $? -eq 0 ]; then
606
   echo "No error, but there should be one."
607
  exit 3
608
fi
609
610
checkoutput <<EOF
611
test.log 0 zero
612
EOF
613
614
cleanup 103
615
616
# ------------------------------- Test 103 ------------------------------------
617
# test invalid config file with unknown keywords
618
preptest test.log 103 1
619
620
$RLR test-config.103 --force
621
622
if [ $? -eq 0 ]; then
623
   echo "No error, but there should be one."
624
   exit 3
625
fi
626
627
checkoutput <<EOF
628
test.log 0 zero
629
EOF
630
631
cleanup 104
632
633
# ------------------------------- Test 104 ------------------------------------
634
# test config with unknown (new?) keyword
635
preptest test1.log 104 1
636
preptest test2.log 104 1
637
638
$RLR test-config.104 --force || exit 23
639
640
checkoutput <<EOF
641
test1.log 0
642
test1.log.1 0 zero
643
test2.log 0
644
test2.log.1 0 zero
645
EOF
646
647
cleanup 105
648
649
# ------------------------------- Test 105 ------------------------------------
650
# test config with garbage keyword bails out
651
preptest test1.log 105 1
652
preptest test2.log 105 1
653
654
$RLR test-config.105 --force
655
656
if [ $? -eq 0 ]; then
657
   echo "No error, but there should be one."
658
   exit 3
659
fi
660
661
662
checkoutput <<EOF
663
test1.log 0 zero
664
test2.log 0 zero
665
EOF
666
597
cleanup
667
cleanup
668
(-)logrotate-3.7.7/test/test-config.102.in (+10 lines)
Line 0 Link Here
1
ELF
2
3
&DIR&/test.log {
4
    daily
5
    size=0
6
7
    firstaction
8
    /bin/sh -c "echo test123"
9
    endscript
10
}
(-)logrotate-3.7.7/test/test-config.103.in (+12 lines)
Line 0 Link Here
1
random noise
2
a b c d
3
a::x
4
5
&DIR&/test.log {
6
    daily
7
    size=0
8
9
    firstaction
10
    /bin/sh -c "echo test123"
11
    endscript
12
}
(-)logrotate-3.7.7/test/test-config.104.in (+8 lines)
Line 0 Link Here
1
&DIR&/test1.log {
2
    newkeyword
3
    rotate 1
4
}
5
6
&DIR&/test2.log {
7
    rotate 1
8
}
(-)logrotate-3.7.7/test/test-config.105.in (+8 lines)
Line 0 Link Here
1
&DIR&/test1.log {
2
    g@rbag€[]+#*
3
    rotate 1
4
}
5
6
&DIR&/test2.log {
7
    rotate 1
8
}

Return to bug 1192449