Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fwd: Possible perl bug? Help! #1929

Closed
p5pRT opened this issue May 2, 2000 · 3 comments
Closed

Fwd: Possible perl bug? Help! #1929

p5pRT opened this issue May 2, 2000 · 3 comments

Comments

@p5pRT
Copy link

p5pRT commented May 2, 2000

Migrated from rt.perl.org#3199 (status was 'resolved')

Searchable as RT3199$

@p5pRT
Copy link
Author

p5pRT commented May 2, 2000

From mfmclean00@yahoo.com

Note​: forwarded message attached.

__________________________________________________
Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.
http​://im.yahoo.com/

@p5pRT
Copy link
Author

p5pRT commented May 2, 2000

From mfmclean00@yahoo.com

Message RFC822:
Return-Path: mfmclean00@yahoo.com
Received: from web1205.mail.yahoo.com (web1205.mail.yahoo.com [128.11.23.141])
by mailman.ghg.net (8.9.1/8.9.1/GHG 1.2) with SMTP id SAA10124
for markm@ghg.net; Tue, 2 May 2000 18:25:32 -0500 (CDT)
Received: (qmail 4599 invoked by uid 60001); 2 May 2000 23:25:33 -0000
Message-ID: 20000502232532.4598.qmail@web1205.mail.yahoo.com
Received: from [137.228.90.10] by web1205.mail.yahoo.com; Tue, 02 May 2000 16:25:32 PDT
Date: Tue, 2 May 2000 16:25:32 -0700 (PDT)
From: Mark McLean mfmclean00@yahoo.com
Subject: Possible perl bug? Help!
To: perlbug@perl.com
Cc: markm@ghg.net
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-DPOP: DPOP Version 2.4k
X-UIDL: 957310040.001
Status: U
Content-Length: 8149

To whom it may concern:
The following program is extremely crude, but I've
inherited it. This installation does not currently
use NIS and the system admins need a way to determine
whether or not a user has a password on a given
machine. The basic algorythm loops through a list of
users. Within this loop there is a loop of hosts.
Each user is checked in the hosts password file and if
they exist we create an output file for that user.
The general output file is user.ostype. Where ostype
is HP-UX, SOLARIS 4.xx or SOLARIS 5.xx. The program
seems to run fine through 10 - 15 users and then spits
out errors;
Use of unitialized value at clear.user.mm line ###
Since receiving this error I've added the following to
all variables;
$variable="something" if !defined($variable);
Yet it doesn't appear that I should need this where
it's been added.
The NAMELIST file has 218 entries. (users)
The LIST file has 379 entries. (hosts)

perl -V:
Summary of my perl5 (5.0 patchlevel 5 subversion 3)
configuration:
Platform:
osname=solaris, osvers=2.7, archname=sun4-solaris
uname='sunos sa1 5.7 generic_106541-07 sun4u sparc
sunw,ultra-1 '
hint=recommended, useposix=true,
d_sigaction=define
usethreads=undef useperlio=undef d_sfio=undef
Compiler:
cc='cc', optimize='-xO4 -xtarget=ultra',
gccversion=
cppflags='-I/usr/local/include'
ccflags ='-I/usr/local/include'
stdchar='char', d_stdstdio=define, usevfork=false
intsize=4, longsize=4, ptrsize=4, doublesize=8
d_longlong=define, longlongsize=8,
d_longdbl=define, longdblsize=16
alignbytes=8, usemymalloc=n, prototype=define
Linker and Libraries:
ld='cc', ldflags ='-L/usr/local/lib
-R/usr/local/lib -L/usr/ucblib -R/usr/ucblib'
libpth=/usr/local/lib /lib /usr/lib /usr/ccs/lib
/usr/ucblib
libs=-lsocket -lnsl -lgdbm -ldbm -ldb -ldl -lm
-lposix4 -lc -lcrypt
libc=/lib/libc.so, so=so, useshrplib=true,
libperl=libperl.so
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef,
ccdlflags=' -R
/usr/local/lib/perl5/5.00503/sun4-solaris/CORE'
cccdlflags='-KPIC', lddlflags='-G -L/usr/local/lib
-R/usr/local/lib -L/usr/ucblib -R/usr/ucblib'

Characteristics of this binary (from libperl):
Built under solaris
Compiled at Oct 22 1999 16:41:54
@inc:
/usr/local/lib/perl5/5.00503/sun4-solaris
/usr/local/lib/perl5/5.00503
/usr/local/lib/perl5/site_perl/5.005/sun4-solaris
/usr/local/lib/perl5/site_perl/5.005

Thanks for your help.
Mark McLean

The following is the program;

#!/usr/bin/perl -w

####################################################################

This script checks all the machines in the

/etc/hosts.snmu file #

for accounts specified by the user. At this time,

the best #

way to check for all possible accounts, is to enter

the #

person last name, because some users may have more

than one #

username or may not be registered with EIS, in

which case, #

how do we know what username to look for?

        #

####################################################################

system 'clear';

$SIG{ ALRM } = &timed_out;

#open(NAMELIST,"/u/sa/accounts/clear9999");
open(NAMELIST,"/home/markm/people");
#open(NOREPLY,">>userdb/000328.NO.PING.REPLY");
open(NOREPLY,">>
/home/markm/perl/000328.NO.PING.REPLY");
#open(DEAD,">>userdb/000328.TIMED.OUT");
open(DEAD,">> /home/markm/perl/000328.TIMED.OUT");

while(){ # 1. While list of users

chomp($inputname=$_);
chomp($login=$inputname);
$login="markm" if !defined($login);

open(LIST,"/home/markm/perl/hosts.all.000204");

open(HP,">userdb/000328.$inputname.hp");

open(HP,">

/home/markm/perl/000328.$inputname.hp");

open(SOLARIS,">userdb/000328.$inputname.solaris");
open(SOLARIS,">
/home/markm/perl/000328.$inputname.solaris");

open(SUNOS,">userdb/000328.$inputname.sunos");

open(SUNOS,">

/home/markm/perl/000328.$inputname.sunos");

open(HPLST,">userdb/000328.$inputname.hp.lst");

open(HPLST,">

/home/markm/perl/000328.$inputname.hp.lst");

open(SOLLST,">userdb/000328.$inputname.solaris.lst");
open(SOLLST,">
/home/markm/perl/000328.$inputname.solaris.lst");

open(SUNLST,">userdb/000328.$inputname.sunos.lst");
open(SUNLST,">
/home/markm/perl/000328.$inputname.sunos.lst");

print `date`;

print "\n  Searching for ${login}'s accounts:\n";
print

"\n***************************************************\n";

while(<LIST>) { # 2. While list of hosts
        chomp($mach=$_);
        $mach="nothing" if !defined($mach);

        #verify machine is online   
        $pingresult=`ping $mach`;
        $pingresult="nothing" if

!defined($pingresult);

        unless ($pingresult =~ /alive/) { # no

response from host
print NOREPLY "$mach\n";
print "$login : NOREPLY FROM $mach AT
THIS TIME.\n";
} # no response from host

        else { # 4. host is alive
            print "Checking $mach.....\n";
            $@=""; # clear possible error from

last loop
eval{
alarm(7);
$ostype = rsh $mach uname -a;
chomp($ostype);
alarm(0);
};

            $@="" if !defined($@);
            $ostype="" if !defined($ostype);

            if ($@ =~ /Got TIRED of Waiting/){
                print DEAD "Timed out on $mach.

\n";
print "$mach TIMED OUT.\n";
}

            else{ # 5. rsh <host> was successful
                if($ostype eq ""){ 
                    ();
                }
                else { # 6. <host> OSTYPE exists
                    if($ostype =~ /\s5\.\d*/){ #

Sol 5.##
$acctexist = rsh $mach grep -i $login /etc/passwd;
chomp($acctexist);
$acctexist="" if
!defined($acctexist);
if($acctexist ne ""){
print "$login :
ACCTEXIST:$acctexist\n";
print SOLARIS
"$mach:$acctexist\n\n";
print SOLLST
"$mach\n";
}
}
elsif($ostype =~ /\s4.\d*/){

Sol 4.##

                        $acctexist = `rsh $mach

grep -i $login /etc/passwd; chomp($acctexist); $acctexist="" if !defined($acctexist); if($acctexist ne ""){ print "SUNACCTEXIST:$acctexist\n"; print SUNOS "$mach:$acctexist\n\n"; print SUNLST "$mach\n"; } } elsif($ostype =~ /HP-UX/){ $acctexist = rsh $mach
grep -i $login /etc/passwd`;
chomp($acctexist);
$acctexist="" if
!defined($acctexist);
if($acctexist ne ""){
print HP
"$mach:$acctexist\n\n";
print HPLST "$mach\n";
}
}
} # 6. OSTYPE exists
} # 5. rsh was successful
} # 4. host is alive
} # 2. While list of hosts

close(LIST);
close(HP);
close(HPLST);
close(SOLARIS);
close(SOLLST);
close(SUNOS);
close(SUNLST);

print

"***************************************************\n";

} # 1. While list of users

close(NAMELIST);
close(NOREPLY);
close(DEAD);

`sort -u /home/markm/perl/000328.NO.PING.REPLY

/home/markm/perl/000328.NO.PING.REPLY.SORTED; sort -u /home/markm/perl/000328.TIMED.OUT
/home/markm/perl/000328.TIMED.OUT.SORTED`;

sub timed_out {
die "Got TIRED of Waiting";
}


Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.
http://im.yahoo.com/

@p5pRT
Copy link
Author

p5pRT commented May 3, 2000

From [Unknown Contact. See original ticket]

As perlbug is not a help desk, may I suggest you take this query to
news​:comp.lang.perl.misc, where some kind soul may assist. But
first, try the -w flag. Or you might even try tangling with the
debugger. (And/or, glancing at the code -- which came through
somewhat mangled by line-wrapping -- rewriting the utility from
scratch as a quicker alternative to fixing it.) Good luck.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant