egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Problem with sendftp.tcl

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
Nara
Halfop


Joined: 23 Jul 2006
Posts: 40

PostPosted: Mon Mar 12, 2007 9:35 pm    Post subject: Problem with sendftp.tcl Reply with quote

I am using the sendftp protocol and I get this error whenever I use it:
Code:
[21:36:44] <egln|radiobot> Currently: ftp: bind: Address already in use
[21:36:44] <egln|radiobot> Currently:     while executing
[21:36:44] <egln|radiobot> Currently: "close $pipe"
[21:36:44] <egln|radiobot> Currently:     (procedure "sendftp" line 28)
[21:36:44] <egln|radiobot> Currently:     invoked from within
[21:36:44] <egln|radiobot> Currently: "sendftp /home/century0/hrpeggdrop/djonair.txt [censored] [censored] [censored] /reports/djonair.txt"
[21:36:44] <egln|radiobot> Currently:     (procedure "battle:update" line 2)
[21:36:44] <egln|radiobot> Currently:     invoked from within
[21:36:44] <egln|radiobot> Currently: "battle:update $_pub1 $_pub2 $_pub3 $_pub4 $_pub5"


Does anyone know a way to fix this problem?

~Nara
Back to top
View user's profile Send private message
DragnLord
Owner


Joined: 24 Jan 2004
Posts: 711
Location: C'ville, Virginia, USA

PostPosted: Tue Mar 13, 2007 12:47 pm    Post subject: Reply with quote

There is no "sendftp" protocol in TCL.
You most likely will not get help without posting the script.
Back to top
View user's profile Send private message
Nara
Halfop


Joined: 23 Jul 2006
Posts: 40

PostPosted: Fri Mar 16, 2007 12:05 pm    Post subject: Reply with quote

Here is the script:

Code:
#
# Sendftp v1.01 (12/6/97) by Ernst <ernst@studbox.uni-stuttgart.de>
# Ernst's eggdrop page:  http://www.sodre.net/ernst/eggdrop/
# =============================================================================

# This is a proc to send a file via FTP to another server. Useful in many
# situations, for example to upload a HTML file generated by eggdrop to your
# www server if it is not the same as your eggdrops machine.

# Change this to something to use to check if a host is alife.
# set pingcheck "" to disable this checking.
# "/bin/ping -c 1" works on Linux. Try just "/bin/ping" on other machines
# Set to "" to disable this checking
set pingcheck ""

# Include it with 'source scripts/sendftp.tcl'.  Call it with all parameters:
#
#   sendftp <localfile> <server> <user> <password> <remotefile>
#
# 'localfile' and 'remotefile' *must* both be given as FULL paths to the
# filenames, the first on the local, the second   on the remote server.
#
# For example:
#
# sendftp /home/bill/stats.htm www.ms.com bill secret /bgates/WWW/stats.htm
#             (local-file       server    user  pass       remote-file)

proc sendftp { localfile server user pass remotefile } {
   global pingcheck
   if {![file exist $localfile]} {
      return "sendftp: File $localfile does not exist."
   }
   if {$pingcheck != ""} {
      if {[catch {exec [lindex $pingcheck 0] [lrange $pingcheck 1 end] $server > /dev/null 2> /dev/null}]} {
         return "sendftp: Machine $server seems to be dead."
      }
   }
   set noftp [catch {set ftpprog [exec which ftp]}]
   if {$noftp} {
      if {[file executable /usr/bin/ftp]} {
         set ftpprog /usr/bin/ftp
         set noftp 0
      }
      if {[file executable /bin/ftp]} {
         set ftpprog /bin/ftp
         set noftp 0
      }
   }
   if {$noftp} { return "sendftp: You don't seem to have the 'ftp' tool" }
   set pipe [open "|$ftpprog -n $server" w]
   puts $pipe "user $user $pass"
   puts $pipe "bin"
   puts $pipe "put $localfile $remotefile"
   puts $pipe "quit"
   close $pipe
   return 1
}


Back to top
View user's profile Send private message
DragnLord
Owner


Joined: 24 Jan 2004
Posts: 711
Location: C'ville, Virginia, USA

PostPosted: Fri Mar 16, 2007 12:49 pm    Post subject: Reply with quote

Your problem is with the battle:update procedure.
You should have posted the script with battle:update in it.
The error was quite clear where the problem is:
Quote:
procedure "battle:update" line 2
Back to top
View user's profile Send private message
Nara
Halfop


Joined: 23 Jul 2006
Posts: 40

PostPosted: Fri Mar 16, 2007 2:33 pm    Post subject: Reply with quote

DragnLord wrote:
Your problem is with the battle:update procedure.
You should have posted the script with battle:update in it.
The error was quite clear where the problem is:
Quote:
procedure "battle:update" line 2


Here's the code for that:
Code:
bind pub M @update battle:update

proc battle:update { nick host hand chan text } {
   sendftp /home/century0/hrpeggdrop/djonair.txt [censored personal info] /reports/djonair.txt
   putlog "Updated logs on website."
   putquick "NOTICE $nick :$head Updated logs on website. $tail"
}
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Fri Mar 16, 2007 6:06 pm    Post subject: Reply with quote

Actually, the error is'nt with either tcl's, but with the ftp-binary the sendftp script relies on...
The ftp-binary is unable to create a listening-socket, and thus exits with the error message "ftp: bind: Address already in use".

One way of possibly solving this issue would be to make the client run in passive mode, using proper command with the client. But other than that, your best chance of getting this solved would be to bug your sysadmin.
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
Nara
Halfop


Joined: 23 Jul 2006
Posts: 40

PostPosted: Sat Mar 17, 2007 2:46 pm    Post subject: Reply with quote

I am the sysadmin. I just simply have a very limited linux knowledge. Could you tell me what needs to be done?
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sat Mar 17, 2007 3:06 pm    Post subject: Reply with quote

This would unfortunately be depending on what system and/or ftp client software you've got installed.
Some psuedo-standard approach would be to give the "sendport" command to the client to disable non-passive ("PORT") mode.

To do this, change this:
Code:
   set pipe [open "|$ftpprog -n $server" w]
   puts $pipe "user $user $pass"
   puts $pipe "bin"
   puts $pipe "put $localfile $remotefile"
   puts $pipe "quit"

into this:
Code:
   set pipe [open "|$ftpprog -n $server" w]
   puts $pipe "user $user $pass"
   puts $pipe "bin"
   puts $pipe "sendmode"
   puts $pipe "put $localfile $remotefile"
   puts $pipe "quit"


You might however wish to look into your system's setup, as users should normally be able to bind to non-system (above 1023) ports on all interfaces. Also, all but very antique ftp software would use random non-system ports for PORT-transfers.
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
Nara
Halfop


Joined: 23 Jul 2006
Posts: 40

PostPosted: Sat Mar 17, 2007 8:10 pm    Post subject: Reply with quote

I use the base FTP program. If it would assist you, I can give you a root account on my box temporarily and you can check whether or not that's the problem. I'll also check the sendmode and get back to you.
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sat Mar 17, 2007 8:46 pm    Post subject: Reply with quote

Giving root-access to someone you don't know in person and really, really trust is a very bad idea.

That said, back to the problem:
Which system do you run, and where applicable, which distribution?
Try executing /usr/bin/ftp, or if command not found, /bin/ftp; connect to remote site, logon with the same credentials that you use with your script, and manually try to send the file. See if you get the same error, and wether using the command "sendport" within the ftp-client helps.

Edit:
Your system does'nt happen to be behind a masquerading firewall (NAT)?
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
Nara
Halfop


Joined: 23 Jul 2006
Posts: 40

PostPosted: Sat Mar 17, 2007 10:56 pm    Post subject: Reply with quote

It's behind a firewall, but FTP ports are open. I use a Slackware based distro named Zenwalk. I don't get the error when I manually do it. I have yet to find time to put in sendmode and test it that way.
Back to top
View user's profile Send private message
rosc2112
Revered One


Joined: 19 Feb 2006
Posts: 1454
Location: Northeast Pennsylvania

PostPosted: Sun Mar 18, 2007 12:49 am    Post subject: Reply with quote

[21:36:44] <egln|radiobot> Currently: ftp: bind: Address already in use


Looks like there's more than one process using that address.. If it was not able to bind the port for permissions reasons, it would've given a different error msg.
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sun Mar 18, 2007 1:08 am    Post subject: Reply with quote

@Nara: Then switching to passive will most certainly solve your issues. This is because your client will send both ip-address and port-number to where the server should connect the datachannel. Unfortunately, your client only knows of its local (or LAN) ip and not the "external" (or WAN), and sends this. Obviously, since the server is'nt located behind your firewall, this really does'nt make much sense to the server, giving a "500 Invalid PORT command" response-code. Your ftp-client then returns a somewhat misleading error message, stating that the address is already in use..

In this case it has nothing to do with any other processes running on your shell
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber