2007-06-06

FreeBSD 附的 cvs 可以隨意的 remote init CVSROOT, 只要有檔案寫入權限的話.
在等待重建世界的同時, 乾脆來 binary patch /usr/bin/cvs 算了..

Binary patch for the cvs remote init problem

#http://www.freebsd.org/cgi/cvsweb.cgi/src/contrib/cvs/src/server.c?rev=1.24

#!/usr/bin/perl
undef $/;
$_ = <>;

s/(\x00...........\x01...........\x01...........\x01...........\x00...........\x00...........\x00...........\x00...........\x
00...........\x00...........\x00...........\x00...........\x00...........\x00...........\x00...........\x00...........\x00...
........\x00...........\x00...........\x00...........\x00...........\x00...........\x00...........\x00...........\x00........
...\x00.......)(....)(\x08...........\x00...........\x00...........\x08.......)(....)(\x08...........\x00)/$1$4$3$4$5/s;

print;


__END__
#!/usr/bin/perl
undef $/;
$_ = <>;

print length($_), "\n";
my $e = '\x01';
my $r = '\x08';
my $z = '\x00';


foreach $n (11)
{
my $pad = '.' x $n;
my $reg = join($pad, $z, $e, $e, $e, ($z) x 22, $r, $z, $z, $r, $r, $z);
#print "$n $reg\n";

while (/$reg/sg)
{
printf("ok! $reg\n");
}

}

No comments: