Thread View: news.software.nntp
6 messages
6 total messages
Started by N.A.
Wed, 31 Mar 2004 00:04
Perl5.8.2 NDBM_File + ckpasswd script appears to corrupt passwd DB
Author: N.A.
Date: Wed, 31 Mar 2004 00:04
Date: Wed, 31 Mar 2004 00:04
6 lines
1362 bytes
1362 bytes
After upgrading to perl-5.8.2 from -5.6.1, the CKPASSWD manual page Perl script for creating a local password database, appears to have a problem. Rather, the perl-5.8.2 NDBM_File module appears to have a problem as it inserts gobs of what looks like Perl code into the password DB file (as viewable via STRINGS).
Re: Perl5.8.2 NDBM_File + ckpasswd script appears to corrupt passwd DB
Author: Jeffrey M. Vinocur
Date: Wed, 31 Mar 2004 02:34
Date: Wed, 31 Mar 2004 02:34
16 lines
1604 bytes
1604 bytes
In article <pan.2004.03.31.00.04.19.234631@siu.edu>, N.A. <leftfoot@siu.edu> wrote: >After upgrading to perl-5.8.2 from -5.6.1, the CKPASSWD manual page Perl >script for creating a local password database, appears to have a problem. >Rather, the perl-5.8.2 NDBM_File module appears to have a problem as it >inserts gobs of what looks like Perl code into the password DB file (as >viewable via STRINGS). Hmm. I can't reproduce this with 5.8.0 -- can you post the output of `strings` (on a test database, of course). -- Jeffrey M. Vinocur jeff@litech.org
Re: Perl5.8.2 NDBM_File + ckpasswd script appears to corrupt passwd DB
Author: none
Date: Wed, 31 Mar 2004 07:58
Date: Wed, 31 Mar 2004 07:58
292 lines
12569 bytes
12569 bytes
Using "gen.passwd" script from CKPASSWD manual page:
#!/usr/bin/perl
use NDBM_File;
use Fcntl;
tie (%db, 'NDBM_File', '/usr/local/news/db/gen.passwd', O_RDWR | O_CREAT, 0640)
or die "Cannot open /usr/local/news/db/gen.passwd: $!\n";
$| = 1;
print "Username: ";
my $user = <STDIN>;
chomp $user;
print "Password: ";
my $passwd = <STDIN>;
chomp $passwd;
my @alphabet = ('.', '/', 0..9, 'A'..'Z', 'a'..'z');
my $salt = join '', @alphabet[rand 64, rand 64];
$db{$user} = crypt ($passwd, $salt);
untie %db;
shows the following results from "strings:"
strings ../db/gen.passwd.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]} = () }
Te1EqjUOJFWfoabcdefg
where perl -V:
Summary of my perl5 (revision 5.0 version 8 subversion 2) configuration:
Platform:
osname=freebsd, osvers=4.9-release, archname=i386-freebsd
uname='freebsd localhost 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'
Characteristics of this binary (from libperl):
Compile-time options: USE_LARGE_FILES Built under freebsd Compiled at
Mar 27 2004 16:45:13
@INC:
/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
Interestingly enough, under Solaris8/9-sparc, (with both perl-5.6.1 and
-5.8.2 installed) I get different results:
gen.passwd.dir
gen.passwd.pag
strings gen.passwd.pag
<crypt password><userid>
Solaris8-Sparc Perl config:
Summary of my perl5 (revision 5.0 version 8 subversion 2) configuration:
Platform:
osname=solaris, osvers=2.8, archname=sun4-solaris
uname='sunos sparc8host 5.8 generic_108528-14 sun4u sparc sunw,ultra-5_10 '
config_args=''
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
useperlio=define d_sfio=undef uselargefiles=undef usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='gcc', ccflags ='-fno-strict-aliasing -I/usr/local/include',
optimize='-O',
cppflags='-fno-strict-aliasing -I/usr/local/include'
ccversion='', gccversion='2.95.2 19991024 (release)', gccosandvers='solaris2.8'
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=4
alignbytes=8, prototype=define
Linker and Libraries:
ld='gcc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /usr/lib /usr/ccs/lib
libs=-lsocket -lnsl -lgdbm -ldb -ldl -lm -lc
perllibs=-lsocket -lnsl -ldl -lm -lc
libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
cccdlflags='-fPIC', lddlflags='-G -L/usr/local/lib'
Characteristics of this binary (from libperl):
Compile-time options:
Built under solaris
Compiled at Mar 26 2004 15:30:31
@INC:
/usr/local/lib/perl5/5.8.2/sun4-solaris
/usr/local/lib/perl5/5.8.2
/usr/local/lib/perl5/site_perl/5.8.2/sun4-solaris
/usr/local/lib/perl5/site_perl/5.8.2
/usr/local/lib/perl5/site_perl/5.6.1
/usr/local/lib/perl5/site_perl
Solaris9-Sparc Perl-5.8.2 config:
Summary of my perl5 (revision 5.0 version 8 subversion 2) configuration:
Platform:
osname=solaris, osvers=2.9, archname=sun4-solaris
uname='sunos sparc9host 5.9 generic_112233-11 sun4u sparc sunw,ultraax-i2 '
config_args=''
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
useperlio=define d_sfio=undef uselargefiles=undef usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='gcc', ccflags ='-fno-strict-aliasing -I/usr/local/include',
optimize='-O',
cppflags='-fno-strict-aliasing -I/usr/local/include'
ccversion='', gccversion='2.95.3 20010315 (release)', gccosandvers='solaris2.9'
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=4
alignbytes=8, prototype=define
Linker and Libraries:
ld='gcc', ldflags =' -L/usr/local/lib'
libpth=/opt/sfw/lib /usr/local/lib /usr/lib /usr/ccs/lib
libs=-lsocket -lnsl -ldb -ldl -lm -lc
perllibs=-lsocket -lnsl -ldl -lm -lc
libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
cccdlflags='-fPIC', lddlflags='-G -L/usr/local/lib'
Characteristics of this binary (from libperl):
Compile-time options:
Built under solaris
Compiled at Mar 26 2004 17:20:59
@INC:
/usr/local/lib/perl5/5.8.2/sun4-solaris
/usr/local/lib/perl5/5.8.2
/usr/local/lib/perl5/site_perl/5.8.2/sun4-solaris
/usr/local/lib/perl5/site_perl/5.8.2
/usr/local/lib/perl5/site_perl/5.6.1
/usr/local/lib/perl5/site_perl
Characteristics of this binary (from libperl):
Compile-time options:
Built under solaris
Compiled at Mar 26 2004 15:30:31
@INC:
/usr/local/lib/perl5/5.8.2/sun4-solaris
/usr/local/lib/perl5/5.8.2
/usr/local/lib/perl5/site_perl/5.8.2/sun4-solaris
/usr/local/lib/perl5/site_perl/5.8.2
/usr/local/lib/perl5/site_perl/5.6.1
/usr/local/lib/perl5/site_perl
On Wed, 31 Mar 2004 02:34:04 +0000, Jeffrey M. Vinocur wrote:
> In article <pan.2004.03.31.00.04.19.234631@siu.edu>,
> N.A. <leftfoot@siu.edu> wrote:
>>After upgrading to perl-5.8.2 from -5.6.1, the CKPASSWD manual page Perl
>>script for creating a local password database, appears to have a problem.
>>Rather, the perl-5.8.2 NDBM_File module appears to have a problem as it
>>inserts gobs of what looks like Perl code into the password DB file (as
>>viewable via STRINGS).
>
> Hmm. I can't reproduce this with 5.8.0 -- can you post the
> output of `strings` (on a test database, of course).
Re: Perl5.8.2 NDBM_File + ckpasswd script appears to corrupt passwd DB
Author: Russ Allbery
Date: Wed, 31 Mar 2004 17:49
Date: Wed, 31 Mar 2004 17:49
19 lines
1792 bytes
1792 bytes
none <supraexpress@globaleyes.net> writes:
> Using "gen.passwd" script from CKPASSWD manual page:
> shows the following results from "strings:"
If you look up $user, do you still get the right password back?
I've seen this happen before, where lots of random strange junk gets
inserted into the database according to strings, but the database works
just fine. I don't know what causes that; I always wrote it off as some
weirdness in the NDBM libraries.
--
Russ Allbery (rra@stanford.edu) <http://www.eyrie.org/~eagle/>
Please post questions rather than mailing me directly.
<http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
Re: Perl5.8.2 NDBM_File + ckpasswd script appears to corrupt passwd DB
Author: none
Date: Fri, 02 Apr 2004 03:41
Date: Fri, 02 Apr 2004 03:41
41 lines
2646 bytes
2646 bytes
No - CKPASSWD fails. While a userid/password string does get inserted into
the "garbage filled" DB, CKPASSWD cannot validate the password, returning
"user <userid> unknown", while 'strings <passwd.DB>|tail -1' shows:
<crypted password><userid>.
Example "flat file" password generating script derived from earlier Perl
script called 'gen.passwd' (commands from CKPASSWD manual page):
#!/usr/bin/perl
open(pwfile,">>newpasswdfile") || die "Couldn't open 'newpasswdfile'";
print "Username: ";
my $user = <STDIN>;
chomp $user;
print "Password: ";
my $passwd = <STDIN>;
chomp $passwd;
my @alphabet = ('.', '/', 0..9, 'A'..'Z', 'a'..'z');
my $salt = join '', @alphabet[rand 64, rand 64];
my $cryptpasswd = crypt ($passwd, $salt);
print(pwfile "$user:$cryptpasswd\n");
close(pwfile);
exit;
CKPASSWD has no problem with the "flat file".
On Wed, 31 Mar 2004 09:49:42 -0800, Russ Allbery wrote:
> none <supraexpress@globaleyes.net> writes:
>
>> Using "gen.passwd" script from CKPASSWD manual page:
>
>> shows the following results from "strings:"
>
> If you look up $user, do you still get the right password back?
>
> I've seen this happen before, where lots of random strange junk gets
> inserted into the database according to strings, but the database works
> just fine. I don't know what causes that; I always wrote it off as some
> weirdness in the NDBM libraries.
Re: Perl5.8.2 NDBM_File + ckpasswd script appears to corrupt passwd DB
Author: Russ Allbery
Date: Fri, 02 Apr 2004 05:21
Date: Fri, 02 Apr 2004 05:21
15 lines
1969 bytes
1969 bytes
none <supraexpress@globaleyes.net> writes:
> No - CKPASSWD fails. While a userid/password string does get inserted
> into the "garbage filled" DB, CKPASSWD cannot validate the password,
> returning "user <userid> unknown", while 'strings <passwd.DB>|tail -1'
> shows: <crypted password><userid>.
Are you sure that ckpasswd is linked against the same version of the ndbm
libraries as Perl is?
--
Russ Allbery (rra@stanford.edu) <http://www.eyrie.org/~eagle/>
Please post questions rather than mailing me directly.
<http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads