Open p5pRT opened 20 years ago
Using perl-5.8.2 NDBM_File\, a new DB entry causes the DB file to be filled with "Perl code fragments".
====== Sample script used =====
#!/usr/bin/perl
use NDBM_File;
use Fcntl;
#tie (%db\, 'NDBM_File'\, 'newspwfile'\, O_RDWR | O_CREAT\, 0640)
my $db = NDBM_File::TIEHASH('NDBM_File'\, 'newspwfile'\, O_RDWR | O_CREAT\, 0640)
or die "Cannot open newspwfile: $!\n";
$| = 1;
print "Username: ";
my $user = \
===== Sample DB contents (via Unix "strings") ===== strings newspwfile.db
IXUSR S_IRWXU S_IRGRP S_IWGRP S_IXGRP S_IRWXG S_IROTH S_IWOTH S_IXOTH S_IRWXO S_IREAD S_IWRITE S_IEXEC S_ISREG S_ISDIR S_ISLNK S_ISSOCK S_ISBLK S_ISCHR S_ISFIFO S_ISWHT S_ISENFMT S_IFMT S_IMODE )]\, sub S_IFMT { @_ ? ( $_[0] & _S_IFMT() ) : _S_IFMT() } sub S_IMODE { $_[0] & 07777 } sub S_ISREG { ( $_[0] & _S_IFMT() ) == S_IFREG() } sub S_ISDIR { ( $_[0] & _S_IFMT() ) == S_IFDIR() } sub S_ISLNK { ( $_[0] & _S_IFMT() ) == S_IFLNK() } sub S_ISSOCK { ( $_[0] & _S_IFMT() ) == S_IFSOCK() } sub S_ISBLK { ( $_[0] & _S_IFMT() ) == S_IFBLK() } sub S_ISCHR { ( $_[0] & _S_IFMT() ) == S_IFCHR() } sub S_ISFIFO { ( $_[0] & _S_IFMT() ) == S_IFIFO() } sub S_ISWHT { ( $_[0] & _S_IFMT() ) == S_IFWHT() } sub S_ISENFMT { ( $_[0] & _S_IFMT() ) == S_IFENFMT() } sub AUTOLOAD { (my $constname = $AUTOLOAD) =~ s/.*:://; die "&Fcntl::constant not defined" if $constname eq 'constant'; my ($error\, $val) = constant($constname); if ($error) { my (undef\,$file\,$line) = caller; die "$error at $file line $line.\n"; } *$AUTOLOAD = sub { $val }; goto &$AUTOLOAD; XSLoader::load 'Fcntl'\, $VERSION; = shift; $pkg->TIEHASH(@_); # Grandfather "new" sub TIEHASH { my $pkg = shift; if (defined &{"${pkg}::new"}) { warnings::warnif("WARNING: calling ${pkg}->new since ${pkg}->TIEHASH is missing"); $pkg->new(@_); } else { croak "$pkg doesn't define a TIEHASH method"; } sub EXISTS { my $pkg = ref $_[0]; croak "$pkg doesn't define an EXISTS method"; sub CLEAR { my $self = shift; my $key = $self->FIRSTKEY(@_); my @keys; while (defined $key) { push @keys\, $key; $key = $self->NEXTKEY(@_\, $key); } foreach $key (@keys) { $self->DELETE(@_\, $key); } # The Tie::StdHash package implements standard perl hash behaviour. # It exists to act as a base class for classes which only wish to # alter some parts of their behaviour. package Tie::StdHash; # @ISA = qw(Tie::Hash); # would inherit new() only sub TIEHASH { bless {}\, $_[0] } sub STORE { $_[0]->{$_[1]} = $_[2] } sub FETCH { $_[0]->{$_[1]} } sub FIRSTKEY { my $a = scalar keys %{$_[0]}; each %{$_[0]} } sub NEXTKEY { each %{$_[0]} } sub EXISTS { exists $_[0]->{$_[1]} } sub DELETE { delete $_[0]->{$_[1]} } sub CLEAR { %{$_[0]} = () } package Tie::ExtraHash; sub TIEHASH { my $p = shift; bless [{}\, @_]\, $p } sub STORE { $_[0][0]{$_[1]} = $_[2] } sub FETCH { $_[0][0]{$_[1]} } sub FIRSTKEY { my $a = scalar keys %{$_[0][0]}; each %{$_[0][0]} } sub NEXTKEY { each %{$_[0][0]} } sub EXISTS { exists $_[0][0]->{$_[1]} } sub DELETE { delete $_[0][0]->{$_[1]} } sub CLEAR { %{$_[0][0]} = () } \
On Tue\, 30 Mar 2004\, Supraexpress@Globaleyes.Net wrote:
Using perl-5.8.2 NDBM_File\, a new DB entry causes the DB file to be filled with "Perl code fragments".
I can't reproduce this problem under either Solaris or Linux/SPARC (perl-5.8.3 for both\, though I'm unsure if that'd be relevant.) Thanks for the good sample script.
====== Sample script used ===== #!/usr/bin/perl use NDBM_File;
Ok\, here you're asking for NDBM_File.
strings newspwfile.db
But traditional NDBM_File uses *two* files\, newspwfile.dir and newspwfile.pag. Since you got 'newspwfile.db' instead\, I'm wondering if the NDBM_File interface is being emulated by another package.
In my case\, I do get a file with a ton of nulls in it. I wonder if whatever library you're using to supply the underlying NDBM_File support is properly zeroing memory.
First step here is probably to figure out where the NDBM_File support is coming from.
----------------------------------------------------------------- --- Flags: category=core severity=medium --- Site configuration information for perl v5.8.2:
Configured by genuser at Sat Mar 27 16:44:42 CST 2004.
Summary of my perl5 (revision 5.0 version 8 subversion 2) configuration: Platform: osname=freebsd\, osvers=4.9-release\, archname=i386-freebsd uname='freebsd localhostl 4.9-release freebsd 4.9-release #0: mon jan 19 13:47:35 cst 2004 genuser@localhost:usrsrcsyscompilexsystem i386 ' config_args='-sde -Dprefix=/usr/local -Darchlib=/usr/local/lib/perl5/5.8.2/mach -Dprivlib=/usr/local/lib/perl5/5.8.2 -Dman3dir=/usr/local/lib/perl5/5.8.2/man/man3 -Dman1dir=/usr/local/man/man1 -Dsitearch=/usr/local/lib/perl5/site_perl/5.8.2/mach -Dsitelib=/usr/local/lib/perl5/site_perl/5.8.2 -Dscriptdir=/usr/local/bin -Ui_malloc -Ui_iconv -Uinstallusrbinperl -Dcc=cc -Doptimize=-O -mcpu=pentiumpro -march=pentiumpro -Duseshrplib -Dccflags=-DAPPLLIB_EXP="/usr/local/lib/perl5/5.8.2/BSDPAN" -Ud_dosuid -Ui_gdbm -Dusethreads=n -Dusemymalloc=y' hint=recommended\, useposix=true\, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=y\, bincompat5005=undef Compiler: cc='cc'\, ccflags ='-DAPPLLIB_EXP="/usr/local/lib/perl5/5.8.2/BSDPAN" -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -I/usr/local/include'\, optimize='-O -mcpu=pentiumpro -march=pentiumpro '\, cppflags='-DAPPLLIB_EXP="/usr/local/lib/perl5/5.8.2/BSDPAN" -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -I/usr/local/include' ccversion=''\, gccversion='2.95.4 20020320 [FreeBSD]'\, gccosandvers='' intsize=4\, longsize=4\, ptrsize=4\, doublesize=8\, byteorder=1234 d_longlong=define\, longlongsize=8\, d_longdbl=define\, longdblsize=12 ivtype='long'\, ivsize=4\, nvtype='double'\, nvsize=8\, Off_t='off_t'\, lseeksize=8 alignbytes=4\, prototype=define Linker and Libraries: ld='cc'\, ldflags ='-Wl\,-E -L/usr/local/lib' libpth=/usr/lib /usr/local/lib libs=-lgdbm -lm -lcrypt -lutil -lc perllibs=-lm -lcrypt -lutil -lc libc=\, so=so\, useshrplib=true\, libperl=libperl.so gnulibc_version='' Dynamic Linking: dlsrc=dl_dlopen.xs\, dlext=so\, d_dlsymun=undef\, ccdlflags=' -Wl\,-R/usr/local/lib/perl5/5.8.2/mach/CORE' cccdlflags='-DPIC -fPIC'\, lddlflags='-shared -L/usr/local/lib'
Locally applied patches:
--- @INC for perl v5.8.2: /usr/local/lib/perl5/site_perl/5.8.2/mach /usr/local/lib/perl5/site_perl/5.8.2 /usr/local/lib/perl5/site_perl /usr/local/lib/perl5/5.8.2/BSDPAN /usr/local/lib/perl5/5.8.2/mach /usr/local/lib/perl5/5.8.2 .
--- Environment for perl v5.8.2: HOME=/home/genuser LANG (unset) LANGUAGE (unset) LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=/bin:/sbin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin:/usr/X11R6/bin:.:/usr/local/jdk1.4.2/bin:/usr/local/ssl/bin PERL_BADLANG (unset) SHELL=/bin/tcsh
-- Andy Dougherty doughera@lafayette.edu
The RT System itself - Status changed from 'new' to 'open'
On Wed\, Mar 31\, 2004 at 11:53:38AM -0500\, Andrew Dougherty wrote:
On Tue\, 30 Mar 2004\, Supraexpress@Globaleyes.Net wrote:
Using perl-5.8.2 NDBM_File\, a new DB entry causes the DB file to be filled with "Perl code fragments".
I can't reproduce this problem under either Solaris or Linux/SPARC (perl-5.8.3 for both\, though I'm unsure if that'd be relevant.) Thanks for the good sample script.
====== Sample script used ===== #!/usr/bin/perl use NDBM_File;
Ok\, here you're asking for NDBM_File.
strings newspwfile.db
But traditional NDBM_File uses *two* files\, newspwfile.dir and newspwfile.pag. Since you got 'newspwfile.db' instead\, I'm wondering if the NDBM_File interface is being emulated by another package.
On some platforms\, including FreeBSD\, NDBM is BerkeleyDB.
Tim.
In my case\, I do get a file with a ton of nulls in it. I wonder if whatever library you're using to supply the underlying NDBM_File support is properly zeroing memory.
First step here is probably to figure out where the NDBM_File support is coming from.
----------------------------------------------------------------- --- Flags: category=core severity=medium --- Site configuration information for perl v5.8.2:
Configured by genuser at Sat Mar 27 16:44:42 CST 2004.
Summary of my perl5 (revision 5.0 version 8 subversion 2) configuration: Platform: osname=freebsd\, osvers=4.9-release\, archname=i386-freebsd uname='freebsd localhostl 4.9-release freebsd 4.9-release #0: mon jan 19 13:47:35 cst 2004 genuser@localhost:usrsrcsyscompilexsystem i386 ' config_args='-sde -Dprefix=/usr/local -Darchlib=/usr/local/lib/perl5/5.8.2/mach -Dprivlib=/usr/local/lib/perl5/5.8.2 -Dman3dir=/usr/local/lib/perl5/5.8.2/man/man3 -Dman1dir=/usr/local/man/man1 -Dsitearch=/usr/local/lib/perl5/site_perl/5.8.2/mach -Dsitelib=/usr/local/lib/perl5/site_perl/5.8.2 -Dscriptdir=/usr/local/bin -Ui_malloc -Ui_iconv -Uinstallusrbinperl -Dcc=cc -Doptimize=-O -mcpu=pentiumpro -march=pentiumpro -Duseshrplib -Dccflags=-DAPPLLIB_EXP="/usr/local/lib/perl5/5.8.2/BSDPAN" -Ud_dosuid -Ui_gdbm -Dusethreads=n -Dusemymalloc=y' hint=recommended\, useposix=true\, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=y\, bincompat5005=undef Compiler: cc='cc'\, ccflags ='-DAPPLLIB_EXP="/usr/local/lib/perl5/5.8.2/BSDPAN" -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -I/usr/local/include'\, optimize='-O -mcpu=pentiumpro -march=pentiumpro '\, cppflags='-DAPPLLIB_EXP="/usr/local/lib/perl5/5.8.2/BSDPAN" -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -I/usr/local/include' ccversion=''\, gccversion='2.95.4 20020320 [FreeBSD]'\, gccosandvers='' intsize=4\, longsize=4\, ptrsize=4\, doublesize=8\, byteorder=1234 d_longlong=define\, longlongsize=8\, d_longdbl=define\, longdblsize=12 ivtype='long'\, ivsize=4\, nvtype='double'\, nvsize=8\, Off_t='off_t'\, lseeksize=8 alignbytes=4\, prototype=define Linker and Libraries: ld='cc'\, ldflags ='-Wl\,-E -L/usr/local/lib' libpth=/usr/lib /usr/local/lib libs=-lgdbm -lm -lcrypt -lutil -lc perllibs=-lm -lcrypt -lutil -lc libc=\, so=so\, useshrplib=true\, libperl=libperl.so gnulibc_version='' Dynamic Linking: dlsrc=dl_dlopen.xs\, dlext=so\, d_dlsymun=undef\, ccdlflags=' -Wl\,-R/usr/local/lib/perl5/5.8.2/mach/CORE' cccdlflags='-DPIC -fPIC'\, lddlflags='-shared -L/usr/local/lib'
Locally applied patches:
--- @INC for perl v5.8.2: /usr/local/lib/perl5/site_perl/5.8.2/mach /usr/local/lib/perl5/site_perl/5.8.2 /usr/local/lib/perl5/site_perl /usr/local/lib/perl5/5.8.2/BSDPAN /usr/local/lib/perl5/5.8.2/mach /usr/local/lib/perl5/5.8.2 .
--- Environment for perl v5.8.2: HOME=/home/genuser LANG (unset) LANGUAGE (unset) LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=/bin:/sbin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin:/usr/X11R6/bin:.:/usr/local/jdk1.4.2/bin:/usr/local/ssl/bin PERL_BADLANG (unset) SHELL=/bin/tcsh
-- Andy Dougherty doughera@lafayette.edu
Two FreeBSD systems with Perl-5.8.2 and NDBM_File\, have multiple instances of Perl\, but only one 5.8.2 "user" version via /usr/bin/perl and /usr/local/bin/perl\, and they both exhibit the 5.8.2 NDBM_File problem. NOTE that NEITHER of these systems had this "NDBM_File problem" under Perl-5.6.1. No other system changes were made as the upgrade from 5.6.1 to 5.8.2 Perl just recently occurred\, by itself.
On one FreeBSD-4.9 system I have:
db41-4.1.25_1 The Berkeley DB package\, revision 4.1 gdbm-1.8.3_1 The GNU database manager
ll /usr/bin/perl* lrwxrwxr-x 1 root wheel 19 Mar 27 17:15 /usr/bin/perl -> /usr/local/bin/perl lrwxrwxr-x 1 root wheel 20 Jan 20 02:36 /usr/bin/perl5 -> /usr/local/bin/perl5 -r-xr-xr-x 1 root wheel 10168 Oct 27 09:24 /usr/bin/perl5.00503 lrwxrwxr-x 1 root wheel 19 Jan 20 01:29 /usr/bin/perl5.6.1 -> /usr/local/bin/perl lrwxrwxr-x 1 root wheel 19 Mar 27 17:15 /usr/bin/perl5.8.2 -> /usr/local/bin/perl -r-xr-xr-x 1 root wheel 31723 Oct 27 09:25 /usr/bin/perlbug5.00503 -r-xr-xr-x 1 root wheel 26305 Oct 27 09:25 /usr/bin/perlcc5.005.03 -r-xr-xr-x 1 root wheel 16807 Oct 27 09:25 /usr/bin/perldoc5.00503
ll /usr/local/bin/perl* -rwxr-xr-x 2 root wheel 9448 Mar 27 16:53 /usr/local/bin/perl lrwxrwxr-x 1 root wheel 24 Mar 27 16:53 /usr/local/bin/perl5 -> /usr/local/bin/perl5.8.2 -rwxr-xr-x 2 root wheel 9448 Mar 27 16:53 /usr/local/bin/perl5.8.2 -rwxr-xr-x 1 root wheel 36897 Mar 27 16:52 /usr/local/bin/perlbug -rwxr-xr-x 1 root wheel 17965 Mar 27 16:52 /usr/local/bin/perlcc -rwxr-xr-x 1 root wheel 236 Mar 27 16:52 /usr/local/bin/perldoc -rwxr-xr-x 1 root wheel 11679 Mar 27 16:52 /usr/local/bin/perlivp
ldconfig -r|grep libperl 50:-lperl.3 => /usr/lib/libperl.so.3
ldconfig -r | grep libdb 252:-ldb41_cxx.1 => /usr/local/lib/libdb41_cxx.so.1 318:-ldb41.1 => /usr/local/lib/libdb41.so.1
ldconfig -r|grep dbm 235:-lgdbm.3 => /usr/local/lib/libgdbm.so.3
On a FreeBSD-4.8 system I have (because of "idiot" applications):
db3-3.3.11\,1 The Berkeley DB package\, revision 3 db4-4.0.14 The Berkeley DB package\, revision 4 db41-4.1.25_1 The Berkeley DB package\, revision 4.1 gdbm-1.8.3 The GNU database manager
While the libraries all wind up in one directory\, the include files are in seperate directories.
ll /usr/bin/perl* lrwxrwxr-x 1 root wheel 19 Mar 29 10:54 /usr/bin/perl -> /usr/local/bin/perl lrwxrwxr-x 1 root wheel 19 May 2 2003 /usr/bin/perl5 -> /usr/local/bin/perl -r-xr-xr-x 1 root wheel 10168 Apr 3 2003 /usr/bin/perl5.00503 lrwxrwxr-x 1 root wheel 19 May 2 2003 /usr/bin/perl5.6.1 -> /usr/local/bin/perl lrwxrwxr-x 1 root wheel 19 Mar 29 10:54 /usr/bin/perl5.8.2 -> /usr/local/bin/perl -r-xr-xr-x 1 root wheel 10224 Jun 10 2002 /usr/bin/perl_500503 -r-xr-xr-x 1 root wheel 31723 Apr 3 2003 /usr/bin/perlbug -r-xr-xr-x 1 root wheel 26305 Apr 3 2003 /usr/bin/perlcc -r-xr-xr-x 1 root wheel 16807 Apr 3 2003 /usr/bin/perldoc
ll /usr/local/bin/perl* -rwxr-xr-x 2 root wheel 9320 Mar 29 10:39 /usr/local/bin/perl lrwxrwxr-x 1 root wheel 24 Mar 29 10:39 /usr/local/bin/perl5 -> /usr/local/bin/perl5.8.2 -rwxr-xr-x 2 root wheel 9320 Mar 29 10:39 /usr/local/bin/perl5.8.2 -rwxr-xr-x 1 root wheel 36897 Mar 29 10:38 /usr/local/bin/perlbug -rwxr-xr-x 1 root wheel 17965 Mar 29 10:38 /usr/local/bin/perlcc -rwxr-xr-x 1 root wheel 236 Mar 29 10:38 /usr/local/bin/perldoc -rwxr-xr-x 1 root wheel 11679 Mar 29 10:38 /usr/local/bin/perlivp
ldconfig -r|grep libperl 49:-lperl.3 => /usr/lib/libperl.so.3
ldconfig -r|grep libdb 101:-ldb3.3 => /usr/local/lib/libdb3.so.3 102:-ldb3_cxx.3 => /usr/local/lib/libdb3_cxx.so.3 298:-ldb4.0 => /usr/local/lib/libdb4.so.0 299:-ldb4_cxx.0 => /usr/local/lib/libdb4_cxx.so.0 358:-ldb41.1 => /usr/local/lib/libdb41.so.1 359:-ldb41_cxx.1 => /usr/local/lib/libdb41_cxx.so.1
ldconfig -r|grep dbm 97:-lgdbm.2 => /usr/local/lib/libgdbm.so.2 314:-lgdbm.3 => /usr/local/lib/libgdbm.so.3
On 31 Mar\, Tim Bunce via RT wrote:
On Wed\, Mar 31\, 2004 at 11:53:38AM -0500\, Andrew Dougherty wrote:
On Tue\, 30 Mar 2004\, Supraexpress@Globaleyes.Net wrote:
Using perl-5.8.2 NDBM_File\, a new DB entry causes the DB file to be filled with "Perl code fragments".
I can't reproduce this problem under either Solaris or Linux/SPARC (perl-5.8.3 for both\, though I'm unsure if that'd be relevant.) Thanks for the good sample script.
====== Sample script used ===== #!/usr/bin/perl use NDBM_File;
Ok\, here you're asking for NDBM_File.
strings newspwfile.db
But traditional NDBM_File uses *two* files\, newspwfile.dir and newspwfile.pag. Since you got 'newspwfile.db' instead\, I'm wondering if the NDBM_File interface is being emulated by another package.
On some platforms\, including FreeBSD\, NDBM is BerkeleyDB.
Tim.
In my case\, I do get a file with a ton of nulls in it. I wonder if whatever library you're using to supply the underlying NDBM_File support is properly zeroing memory.
First step here is probably to figure out where the NDBM_File support is coming from.
On Wed\, Mar 31\, 2004 at 09:01:08PM -0600\, supraexpress@globaleyes.net wrote:
Two FreeBSD systems with Perl-5.8.2 and NDBM_File\, have multiple instances of Perl\, but only one 5.8.2 "user" version via /usr/bin/perl and /usr/local/bin/perl\, and they both exhibit the 5.8.2 NDBM_File problem. NOTE that NEITHER of these systems had this "NDBM_File problem" under Perl-5.6.1. No other system changes were made as the upgrade from 5.6.1 to 5.8.2 Perl just recently occurred\, by itself.
Some questions.
Did you compile these perls yourself on the system in question\, or did they come as pre-compiled binaries?
Is there actually anything corrupt about the keys and values you're storing in the file\, or are you only concerned with leakage in the padding bytes of the file?
Also\, could you do a truss/strace (or whatever it is on BSD) to see what version of the db library is actually being linked in at run-time by the 5.6.1 run and the 5.8.2 run?
Dave.
-- Technology is dominated by two types of people: those who understand what they do not manage\, and those who manage what they do not understand.
In answer to building perl-5.8.2: I have used both the FreeBSD "port" and a standalone-source\, but I believe that I installed only the FreeBSD Perl-5.8.2 "port".
In answer to "corrupt keys and values": using 'strings'\, I can see a
\
I have been trying to figure out just what libraries are being used with Perl-5.8.2 and Inn-2.4.1. The Perl compile configuration looks for BerekeleyDB-3\,4\,4.1 but will also include GDBM. Inn-CKPASSWD looks for NDBM\, "gdbm-ndbm" (???)\, and DB-1. I dont' find any statically linked database libraries for the Perl module\, libperl.so.3\, NDBM_File.pm/so\, INND\, NNRPD\, or CKPASSWD (the latter three from Inn-2.4.1).
I have asked the FreeBSD "maintainers" of the Perl-5.8.2 and Inn-2.4.1 ports to also take a look at this situation which I don't doubt could be complicated by multiple Perl and database installations\, some as a part of the "base system"\, some as prerequisites for other applications\, and some because of user selection.
I will try the TRUSS suggestion and get back to you.
On 3 Apr\, Dave Mitchell via RT wrote:
On Wed\, Mar 31\, 2004 at 09:01:08PM -0600\, supraexpress@globaleyes.net wrote:
Two FreeBSD systems with Perl-5.8.2 and NDBM_File\, have multiple instances of Perl\, but only one 5.8.2 "user" version via /usr/bin/perl and /usr/local/bin/perl\, and they both exhibit the 5.8.2 NDBM_File problem. NOTE that NEITHER of these systems had this "NDBM_File problem" under Perl-5.6.1. No other system changes were made as the upgrade from 5.6.1 to 5.8.2 Perl just recently occurred\, by itself.
Some questions.
Did you compile these perls yourself on the system in question\, or did they come as pre-compiled binaries?
Is there actually anything corrupt about the keys and values you're storing in the file\, or are you only concerned with leakage in the padding bytes of the file?
Also\, could you do a truss/strace (or whatever it is on BSD) to see what version of the db library is actually being linked in at run-time by the 5.6.1 run and the 5.8.2 run?
Dave.
Tried the ktrace/truss commands in FBSD-4.9(perl-5.8.2)\, 5.1(perl-5.6.1)\,
5.2.1(perl-5.6.1) and could not find ANY database library being used. There
must be something going on at a lower abstraction (system) level that I don't
see.
I haven't heard anything\, yet\, from the FBSD perl5.8 maintainer
(tobez@FreeBSD.org) or the FBSD inn maintainer (clement@FreeBSD.org).
On 2004.04.03 09:43\, Dave Mitchell via RT wrote:
On Wed\, Mar 31\, 2004 at 09:01:08PM -0600\, supraexpress@globaleyes.net
wrote:Two FreeBSD systems with Perl-5.8.2 and NDBM_File\, have multiple instances of Perl\, but only one 5.8.2 "user" version via /usr/bin/perl and /usr/local/bin/perl\, and they both exhibit the 5.8.2 NDBM_File problem. NOTE that NEITHER of these systems had this "NDBM_File problem" under Perl-5.6.1. No other system changes were made as the upgrade from 5.6.1 to 5.8.2 Perl just recently occurred\, by itself.
Also\, could you do a truss/strace (or whatever it is on BSD) to see what version of the db library is actually being linked in at run-time by the 5.6.1 run and the 5.8.2 run?
Some of the "slieght-of-hand" comes from INN-CKPASSWD using NDBM/DB1 via
system dbm_open call found in (system) libc. I don't know\, yet\, just what
FBSD-4/libc/dbm_open "points" to (or uses) with regards to database code (ie;
ndbm\, gdbm\, DB1/2/3/4/\, ?).
Perl and other INN executables are being linked (currently) to DB4.x\, but
with CKPASSWD NOT being able to use DB4.x\, it can't read what Perl DB modules
using DB4.x create. This appears to be more of an INN/CKPASSWD problem than
Perl per se. It just did not affect "me" using "base system Perl" or Perl-
5.6.1.
The "base system Perl" (5.05xxx?) and possibly even the 5.6.1 installation
may have not been using the latest DB4.x libraries that have been installed
on the system since its initial upgrade to FBSD-4.9 a few months ago. This
may have allowed INN/CKPASSWD to properly parse the DB file created by the
(sample CKPASSWD) perl script.
The Perl-5.8.2 generating garbage in the DB file\, however\, can be
circumvented by using p5-BerkeleyDB. Using Perl-5.8.2/NDBM_File in this FBSD-
4 system STILL produces "Perl code garbage" in the DB file\, though.
On 2004.04.03 09:43\, Dave Mitchell via RT wrote:
On Wed\, Mar 31\, 2004 at 09:01:08PM -0600\, supraexpress@globaleyes.net
wrote:Two FreeBSD systems with Perl-5.8.2 and NDBM_File\, have multiple instances of Perl\, but only one 5.8.2 "user" version via /usr/bin/perl and /usr/local/bin/perl\, and they both exhibit the 5.8.2 NDBM_File problem. NOTE that NEITHER of these systems had this "NDBM_File problem" under Perl-5.6.1. No other system changes were made as the upgrade from 5.6.1 to 5.8.2 Perl just recently occurred\, by itself.
Some questions.
Did you compile these perls yourself on the system in question\, or did they come as pre-compiled binaries?
Is there actually anything corrupt about the keys and values you're storing in the file\, or are you only concerned with leakage in the padding bytes of the file?
Also\, could you do a truss/strace (or whatever it is on BSD) to see what version of the db library is actually being linked in at run-time by the 5.6.1 run and the 5.8.2 run?
Alternate subject:
Re: Apparent DB incompatibilities between FBSD Perl-5.8.2 and FBSD Inn-2.4.1 ports
With Perl-5.8.2\, INN-2.4.1 CKPASSWD (on "my" FBSD-4.9 system) appears to no longer be able to find a userid in an NDBM database file created by the sample Perl script in the INN CKPASSWD MANual page. CKPASSWD is a C program.
I still have not figured out whether this is due to FBSD-4 methodoligies provided for NDBM calls where there is no NDBM library present in the system\, but there is a libgdbm.so.3 present\, or something else. All that I can say for sure is: this problem did NOT occur with FBSD-4\, Perl-5.6.1/5.00503\, and INN-2.4.1.
At this point\, I am inclined to identify this as a FreeBSD(-4) + Perl-5.8.2 + INN-2.4.1 "bug"\, and am developing other local scripts to create and read various database file formats\, including NDBM\, which I will submit to INN.org when completed.
For example ...
create "newspwfile.db" with one user\,
./gen.passwd Username: abcde Password: abcde
cat gen.passwd [from CKPASSWD MANual page]
#!/usr/bin/perl
use NDBM_File;
use Fcntl;
tie (%db\, 'NDBM_File'\, 'newspwfile'\, O_RDWR | O_CREAT\, 0640)
or die "Cannot open newspwfile: $!\n";
$| = 1;
print "Username: ";
my $user = \
Use INN CKPASSWD to validate previous user:
/usr/local/news/bin/auth/passwd/ckpasswd -d newspwfile.db -u "abcde" -p "abcde" ckpasswd: user abcde unknown
strings newspwfile.db IXUSR S_IRWXU S_IRGRP S_IWGRP S_IXGRP S_IRWXG S_IROTH S_IWOTH S_IXOTH S_IRWXO S_IREAD S_IWRITE S_IEXEC S_ISREG S_ISDIR S_ISLNK S_ISSOCK S_ISBLK S_ISCHR S_ISFIFO S_ISWHT S_ISENFMT S_IFMT S_IMODE )]\, sub S_IFMT { @_ ? ( $_[0] & _S_IFMT() ) : _S_IFMT() } sub S_IMODE { $_[0] & 07777 } sub S_ISREG { ( $_[0] & _S_IFMT() ) == S_IFREG() } sub S_ISDIR { ( $_[0] & _S_IFMT() ) == S_IFDIR() } sub S_ISLNK { ( $_[0] & _S_IFMT() ) == S_IFLNK() } sub S_ISSOCK { ( $_[0] & _S_IFMT() ) == S_IFSOCK() } sub S_ISBLK { ( $_[0] & _S_IFMT() ) == S_IFBLK() } sub S_ISCHR { ( $_[0] & _S_IFMT() ) == S_IFCHR() } sub S_ISFIFO { ( $_[0] & _S_IFMT() ) == S_IFIFO() } sub S_ISWHT { ( $_[0] & _S_IFMT() ) == S_IFWHT() } sub S_ISENFMT { ( $_[0] & _S_IFMT() ) == S_IFENFMT() } sub AUTOLOAD { (my $constname = $AUTOLOAD) =~ s/.*:://; die "&Fcntl::constant not defined" if $constname eq 'constant'; my ($error\, $val) = constant($constname); if ($error) { my (undef\,$file\,$line) = caller; die "$error at $file line $line.\n"; } *$AUTOLOAD = sub { $val }; goto &$AUTOLOAD; XSLoader::load 'Fcntl'\, $VERSION; = shift; $pkg->TIEHASH(@_); # Grandfather "new" sub TIEHASH { my $pkg = shift; if (defined &{"${pkg}::new"}) { warnings::warnif("WARNING: calling ${pkg}->new since ${pkg}->TIEHASH is missing"); $pkg->new(@_); } else { croak "$pkg doesn't define a TIEHASH method"; } sub EXISTS { my $pkg = ref $_[0]; croak "$pkg doesn't define an EXISTS method"; sub CLEAR { my $self = shift; my $key = $self->FIRSTKEY(@_); my @keys; while (defined $key) { push @keys\, $key; $key = $self->NEXTKEY(@_\, $key); } foreach $key (@keys) { $self->DELETE(@_\, $key); } # The Tie::StdHash package implements standard perl hash behaviour. # It exists to act as a base class for classes which only wish to # alter some parts of their behaviour. package Tie::StdHash; # @ISA = qw(Tie::Hash); # would inherit new() only sub TIEHASH { bless {}\, $_[0] } sub STORE { $_[0]->{$_[1]} = $_[2] } sub FETCH { $_[0]->{$_[1]} } sub FIRSTKEY { my $a = scalar keys %{$_[0]}; each %{$_[0]} } sub NEXTKEY { each %{$_[0]} } sub EXISTS { exists $_[0]->{$_[1]} } sub DELETE { delete $_[0]->{$_[1]} } sub CLEAR { %{$_[0]} = () } package Tie::ExtraHash; sub TIEHASH { my $p = shift; bless [{}\, @_]\, $p } sub STORE { $_[0][0]{$_[1]} = $_[2] } sub FETCH { $_[0][0]{$_[1]} } sub FIRSTKEY { my $a = scalar keys %{$_[0][0]}; each %{$_[0][0]} } sub NEXTKEY { each %{$_[0][0]} } sub EXISTS { exists $_[0][0]->{$_[1]} } sub DELETE { delete $_[0][0]->{$_[1]} } sub CLEAR { %{$_[0][0]} = () } JH9LWvYDgJ8FUabcde
Use a locally developed NDBM DB "reader" perl script:
./read.passwd.ndbm Username: abcde Password: abcde pwfpasswd:JH9LWvYDgJ8FU cryptpasswd:JH9LWvYDgJ8FU
cat read.passwd.ndbm
#!/usr/bin/perl
use NDBM_File;
use Fcntl;
tie (%db\, 'NDBM_File'\, 'newspwfile'\, O_RDONLY\, 0440)
or die "Cannot open newspwfile: $!\n";
print "Username: ";
my $user = \
Alternate subject:
Re: Apparent DB incompatibilities between FBSD Perl-5.8.2 and FBSD Inn-2.4.1 ports
Not being able to determine the cause of the aformentioned problem\, I have developed and tested the following attached scripts\, primarily for use with Perl-5.8.2 as I used its new SWITCH/CASE capability (which could be "unrolled" for earlier Perl versions) in the 'password gen/read' scripts.
1) "gen.passwd.new" script to create a password file and insert user entries for NDBM\, DB1\, DB2/3/4\, and 'flatfile' (ala INN/CKPASSWD -f)
2) "read.passwd.new" script to read an NDBM\, DB1\, DB2/3/4\, or 'flatfile' database for a specific user entry (primarily for testing/verification)
3) "nnrpd_auth_DB1.pl" INN/readers.conf/perl_auth script for DB1 databases
4) "nnrpd_auth_DB234.pl" INN/readers.conf/perl_auth script for DB2/3/4 databases
5) "nnrpd_auth_NDBM.pl" INN/readers.conf/perl_auth script for NDBM databases
6) "nnrpd_auth_FLATFILE.pl" INN/readers.conf/perl_auth script for 'flat file' databases ala CKPASSWD -f
The "nnrpd..." scripts should work with other versions of Perl\, but I have not yet tested them for that. Note that the current\, live\, INN testing was done under Solaris9-x86/Perl-5.8.2/5.6.1\, but the initial script development and testing was done under FreeBSD-4.9/Perl-5.8.2. I will test again\, later\, with a FreeBSD-4 INN host\, but don't expect any problems.
#!/usr/local/bin/perl
# print usage
if ($#ARGV != 7) {
print("\nUsage: gen.passwd.new -n \
require 5.008;
# process options use Switch; for ($I=0;$I\<8;$I=$I+2) { switch (@ARGV[$I]) { case "-n" {$pwfilename = @ARGV[$I + 1]} case "-t" {$filetype = lc(@ARGV[$I + 1])} case "-u" {$userid = @ARGV[$I + 1]} case "-p" {$userpw = @ARGV[$I + 1]} else {print("INVALID PARAMETER: @ARGV[$I]\n"); exit 1} } }
my @alphabet = ('.'\, '/'\, 0..9\, 'A'..'Z'\, 'a'..'z'); my $salt = join ''\, @alphabet[rand 64\, rand 64]; my $cryptpasswd = crypt ($userpw\, $salt);
# validate filetype switch ($filetype) { case /n|ndbm/ {NDBM()} case /db2|db3|db4/ {DB234()} case /db|db1/ {DB1()} case /f|flatfile/ {FLATFILE()} else {print("INVALID FILETYPE: $filetype\n")} } exit; ############## sub DB234 { if ($pwfilename =~ /.*\.db/) { print("Invalid '.db' in '$pwfilename'\n"); return } $pwfilename=$pwfilename.".db"; print("DB234 pwfilename: $pwfilename\, userid:$userid\n"); use BerkeleyDB; use Fcntl; my $db = new BerkeleyDB::Hash -Filename => "$pwfilename"\, -Flags => DB_CREATE or die "cannot create '$pwfilename': $BerkeleyDB::Error\n"; $db->db_put("$userid"\, "$cryptpasswd"); $status=$db->db_close(); undef $db; } ############## sub NDBM { if ($pwfilename =~ /.*\.db/) { print("Invalid '.db' in '$pwfilename'\n"); return } print("NDBM pwfilename: $pwfilename.db\, userid:$userid\n"); use NDBM_File; use Fcntl; my $db = NDBM_File::TIEHASH('NDBM_File'\, "$pwfilename"\, O_RDWR | O_CREAT\, 0640) or die "Cannot open '$pwfilename': $!\n"; $rc = NDBM_File::STORE($db\, $userid\, $cryptpasswd); } ############## sub FLATFILE { print("FLATFILE pwfilename: $pwfilename\, userid:$userid\n"); open(pwfile\,">>$pwfilename") || die "Couldn't open '$pwfilename'\n"; print(pwfile "$userid:$cryptpasswd\n"); close(pwfile); } ############## sub DB1 { if ($pwfilename =~ /.*\.db/) { print("Invalid '.db' in '$pwfilename'\n"); return } $pwfilename=$pwfilename.".db"; print("DB1 pwfilename: $pwfilename\, userid:$userid\n"); use DB_File; use Fcntl; tie (%db\, 'DB_File'\, $pwfilename\, O_RDWR | O_CREAT\, 0640\, $DB_HASH) or die "Cannot open '$pwfilename': $!\n"; $db{$userid} = $cryptpasswd; untie %db; }
#!/usr/local/bin/perl
# print usage
if ($#ARGV != 7) {
print("\nUsage: read.passwd.new -n \
require 5.008;
# process options use Switch; for ($I=0;$I\<8;$I=$I+2) { switch (@ARGV[$I]) { case "-n" {$pwfilename = @ARGV[$I + 1]} case "-t" {$filetype = lc(@ARGV[$I + 1])} case "-u" {$userid = @ARGV[$I + 1]} case "-p" {$userpw = @ARGV[$I + 1]} else {print("INVALID PARAMETER: @ARGV[$I]\n"); exit 1} } }
# validate filetype
switch ($filetype) {
case /n|ndbm/ {NDBM()}
case /db2|db3|db4/ {DB234()}
case /db|db1/ {DB1()}
case /f|flatfile/ {FLATFILE()}
else {print("INVALID FILETYPE: $filetype\n")}
}
exit;
##############
sub DB234 {
$pwfilename=$pwfilename.".db";
print("\nDB234 pwfilename: $pwfilename\n\n");
use BerkeleyDB;
my $db = new BerkeleyDB::Hash
-Filename => "$pwfilename"
or die "cannot open '$pwfilename': $BerkeleyDB::Error\n";
$db->db_get("$userid"\, $pwfpasswd);
if ($pwfpasswd eq "") {print("Userid:$userid - Not Found\n\n")}
else {
my $cryptpasswd = crypt($userpw\,$pwfpasswd);
print("User:$userid\, InputPW:$userpw\n");
print("pwfpasswd:'$pwfpasswd'\, cryptInputPW:'$cryptpasswd'\n");
if ("$pwfpasswd" eq "$cryptpasswd") {print("Passwords MATCH\n\n");}
else {print("Passwords do NOT match\n\n");}
}
$db->db_close();
undef $db;
}
##############
sub NDBM {
print("\nNDBM pwfilename: $pwfilename\n\n");
use NDBM_File;
use Fcntl;
tie (%db\, 'NDBM_File'\, "$pwfilename"\, O_RDONLY\, 0440)
or die "Cannot open '$pwfilename': $!\n";
my $pwfpasswd = $db{$userid};
if ("$pwfpasswd" eq "") {print("User:$userid - NOT FOUND\n\n")}
else {
my $cryptpasswd = crypt ($userpw\, $pwfpasswd);
print("User:$userid\, InputPW:$userpw\n");
print("pwfpasswd:'$pwfpasswd'\, cryptInputPW:'$cryptpasswd'\n");
if ("$pwfpasswd" eq "$cryptpasswd") {print("Passwords MATCH\n\n")}
else {print("Passwords do NOT match\n\n")}
}
untie %db;
}
##############
sub FLATFILE {
print("\nFLATFILE pwfilename: $pwfilename\n\n");
open(pwfile\,"$pwfilename") || die "Couldn't open '$pwfilename'\n";
my $userfound = "no"; my $cryptpasswd = "";
while(\
@iabyn - Status changed from 'open' to 'stalled'
Is this a problem that still exists? Are we able to fix it\, or is it a bug in INN or some other package?
The RT System itself - Status changed from 'stalled' to 'open'
@dcollinsn - Status changed from 'open' to 'stalled'
Migrated from rt.perl.org#28075 (status was 'stalled')
Searchable as RT28075$