lib/ssltransportagent.rb
def process_call(log, local_port, connection, remote_port, remote_ip, remote_hostname, remote_service)
    begin
      Signal.trap("INT") { } # ignore ^C in the child process
      log.info("%06d"%Process::pid) {"Connection accepted on port #{local_port} from port #{remote_port} at #{remote_ip} (#{remote_hostname})"}
      # open the database, if any is required
      if Host[:host]
        $db = Mysql2::Client.new(Host)
        db_open if defined?(db_open)
        log.info("%06d"%Process::pid) {"MySQL database #{Host[:database]} opened on #{Host[:host]} by #{Host[:username]}"}
      end
      # a new object is created here to provide separation between server and receiver
      # this call receives the email and does basic validation
      TAReceiver::new(log, connection).receive(local_port, Socket::gethostname, remote_port, remote_hostname, remote_ip)
    rescue TAQuit
      # nothing to do here
    ensure
      # close the database
      db_close if defined?(db_close)
      $db.close if $db
      nil # don't return the TAReceiver object
    end
  end
# this is the code executed after the process has been
# forked and root privileges have been dropped
this is the code executed after the process has been
forked and root privileges have been dropped
this is the code executed after the process has been forked and root privileges have been dropped
def process_call(log, local_port, connection, remote_port, remote_ip, remote_hostname, remote_service)
    begin
      Signal.trap("INT") { } 
      log.info("%06d"%Process::pid) {"Connection accepted on port #{local_port} from port #{remote_port} at #{remote_ip} (#{remote_hostname})"}
      if Host[:host]
        $db = Mysql2::Client.new(Host)
        db_open if defined?(db_open)
        log.info("%06d"%Process::pid) {"MySQL database #{Host[:database]} opened on #{Host[:host]} by #{Host[:username]}"}
      end
      TAReceiver::new(log, connection).receive(local_port, Socket::gethostname, remote_port, remote_hostname, remote_ip)
    rescue TAQuit
    ensure
      db_close if defined?(db_close)
      $db.close if $db
      nil 
    end
  end
def process_call ( log , local_port , connection , remote_port , remote_ip , remote_hostname , remote_service ) begin Signal . trap ( "INT" ) { } log . info ( "%06d" % Process :: pid ) { "Connection accepted on port #{local_port} from port #{remote_port} at #{remote_ip} (#{remote_hostname})" } if Host [ :host ] $db = Mysql2 :: Client . new ( Host ) db_open if defined? ( db_open ) log . info ( "%06d" % Process :: pid ) { "MySQL database #{Host[:database]} opened on #{Host[:host]} by #{Host[:username]}" } end TAReceiver :: new ( log , connection ) . receive ( local_port , Socket :: gethostname , remote_port , remote_hostname , remote_ip ) rescue TAQuit ensure db_close if defined? ( db_close ) $db . close if $db nil end end
this is the code executed after the process has been
forked and root privileges have been dropped
this is the code executed after the process has been forked and root privileges have been dropped
# ignore ^C in the child process # open the database, if any is required # a new object is created here to provide separation between server and receiver # this call receives the email and does basic validation # nothing to do here # close the database # don't return the TAReceiver object
log
local_port
connection
remote_port
remote_ip
remote_hostname
remote_service