In my original post, I disconnected only if a connection was made. In the stripped down script, I disconnected all the time..
I changed it on the orginal script but doesn't seem to make a difference. ...::: Matt :::... Not everything that is counted counts, and not everything that counts can be counted. - A. Einstein -----Original Message----- From: Carl Jolley [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 02, 2002 2:59 PM To: Matthew Wagenknecht Cc: [EMAIL PROTECTED]; Perl-Win32-Admin (E-mail) Subject: RE: Win32::LanMan question On Tue, 2 Apr 2002, Matthew Wagenknecht wrote: > 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) > } > #***************** > Am I correct that you are always calling Disconnect for a server even those where no connection was established? **** [EMAIL PROTECTED] <Carl Jolley> **** All opinions are my own and not necessarily those of my employer **** _______________________________________________ Perl-Win32-Admin mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
