|
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17 System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64 User : nobody ( 99) PHP Version : 5.2.17 Disable Function : NONE Directory : /proc/21573/task/21573/root/usr/bin/ |
Upload File : |
#!/usr/bin/python
# Wrapper script to get proxy information out of gconf and launch
# things with it in the environment.
#
# Copyright 2007, Red Hat, Inc.
# Jeremy Katz <katzj@redhat.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 only
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Library General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
import gconf
import os, sys
import subprocess
if len(sys.argv) < 2:
print >> sys.stderr, "Need a command to run"
sys.exit(1)
try:
client = gconf.client_get_default()
except:
client = None
if client and client.get_bool("/system/http_proxy/use_http_proxy"):
host = client.get_string("/system/http_proxy/host")
port = client.get_int("/system/http_proxy/port")
if port == 0: # default to something reasonable
port = 8080
# don't set the environment variable if using authentication as
# that can lead to it being snooped
if host and not client.get_bool("/system/http_proxy/use_authentication"):
os.environ["http_proxy"] = "%s:%d" %(host, port)
if client and client.get_string("/system/proxy/ftp_host"):
host = client.get_string("/system/proxy/ftp_host")
port = client.get_int("/system/proxy/ftp_port")
if port == 0:
os.environ["ftp_proxy"] = "%s" %(host,)
else:
os.environ["ftp_proxy"] = "%s:%d" %(host, port)
rc = subprocess.call(sys.argv[1:])
sys.exit(rc)