Ok.. I've got something else going on..
I stripped all the code down to the following script. It's functionally the
same (I think).. It works fine.. It's dieing somewhere else..
Thanks for the tips!! I'll let you know what I find.
#*****************
#----------------------------------------------------------------------
# eshares.pl
#
# Script to check for EVERYONE shares via null sessions on NT
# machines.
#
# Usage: eshares.pl <IP_ADDR>
# perl esahres.pl <IP_ADDR> > myfile
#
# M. Wagenknecht [EMAIL PROTECTED]
#----------------------------------------------------------------------
#use strict;
use Win32::Lanman;
$test = "";
@phosts=("10.50.2.78","10.50.2.79");
foreach $server(@phosts){
print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n\n";
print "Checking $server :: ";
$authd = ConnectIPC($server, $test, $test, $test);
if ($authd == 1){
print "Null Session to $server successful.\n";
}else{
print "Null Session not established.\n";
}
if(Win32::Lanman::GetLastError()!= 0){ print
Win32::Lanman::GetLastError(),"\n";}
print "\n";
if (Disconnect($server)) {
print "Disconnected from $server.\n\n";
}else{
print "Could not disconnect.\n";
}
}
print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n\n";
print $@,"<=";
#-----------------------------------------------------
# Attempt a connection to IPC$; used for null session
# connections, as well as checking passwords
#-----------------------------------------------------
sub ConnectIPC {
my($server,$passwd,$user,$domain) = @_;
my(%Hash) = (remote => "\\\\$server\\ipc\$",
asg_type => &USE_IPC,
password => $passwd,
username => $user,
domainname => $domain);
Win32::Lanman::NetUseAdd(\%Hash);
}
#-----------------------------------------------------
# Disconnect the IPC$ connection
#-----------------------------------------------------
sub Disconnect {
#print "#";
my(@server) = @_;
Win32::Lanman::NetUseDel("\\\\$server\\ipc\$",&USE_FORCE)
}
#*****************
...::: Matt :::...
Not everything that is counted
counts, and not everything that
counts can be counted. - A. Einstein
-----Original Message-----
From: Edward G. Orton [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 02, 2002 1:44 PM
To: Weir, Jason - Contractor; 'Matthew Wagenknecht';
[EMAIL PROTECTED]; Perl-Win32-Admin (E-mail)
Subject: Re: Win32::LanMan question
----- Original Message -----
From: "Weir, Jason - Contractor" <[EMAIL PROTECTED]>
To: "'Matthew Wagenknecht'" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>; "Perl-Win32-Admin (E-mail)"
<[EMAIL PROTECTED]>
Sent: Tuesday, April 02, 2002 3:27 PM
Subject: RE: Win32::LanMan question
>
>
> How I get around that is to put the function inside a
subroutine like this
>
> sub NetUseAdd{
> Win32::Lanman::NetUseAdd(\%Hash) || return;
> }
Try:
sub NetUseAdd{
return(Win32::Lanman::NetUseAdd(\%Hash));
}
This will return the result of the NetUseAdd. I would change the name of the
subroutine though, since it is the same name as the routine in
Win32::Lanman.
ego
Edward G. Orton, GWN Consultants Inc.
Phone: 613-764-3186, Fax: 613-764-1721
email: [EMAIL PROTECTED]
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs