1
0
mirror of https://github.com/gryf/wicd.git synced 2025-12-20 12:58:07 +01:00

Make sure we run to_unicode on all properties we read from disk or get from the user (bug 390680).

Don't try to run global scripts of the global script directory doesn't exist (bug 386244).
This commit is contained in:
Dan O'Reilly
2009-07-02 18:26:37 -04:00
parent 27f2890c12
commit 6cedaf0199
3 changed files with 7 additions and 5 deletions

View File

@@ -116,7 +116,7 @@ class ConfigManager(RawConfigParser):
Int32(ret) Int32(ret)
except OverflowError: except OverflowError:
ret = long(ret) ret = long(ret)
return ret return to_unicode(ret)
def get(self, *args, **kargs): def get(self, *args, **kargs):
""" Calls the get_option method """ """ Calls the get_option method """

View File

@@ -182,6 +182,8 @@ def WriteLine(my_file, text):
def ExecuteScripts(scripts_dir, verbose=False): def ExecuteScripts(scripts_dir, verbose=False):
""" Execute every executable file in a given directory. """ """ Execute every executable file in a given directory. """
if not os.path.exists(scripts_dir):
return
for obj in os.listdir(scripts_dir): for obj in os.listdir(scripts_dir):
obj = os.path.abspath(os.path.join(scripts_dir, obj)) obj = os.path.abspath(os.path.join(scripts_dir, obj))
if os.path.isfile(obj) and os.access(obj, os.X_OK): if os.path.isfile(obj) and os.access(obj, os.X_OK):

View File

@@ -1055,14 +1055,14 @@ class WirelessDaemon(dbus.service.Object):
return value return value
@dbus.service.method('org.wicd.daemon.wireless') @dbus.service.method('org.wicd.daemon.wireless')
def SetWirelessProperty(self, networkid, property, value): def SetWirelessProperty(self, netid, prop, value):
""" Sets property to value in network specified. """ """ Sets property to value in network specified. """
# We don't write script settings here. # We don't write script settings here.
if (property.strip()).endswith("script"): if (prop.strip()).endswith("script"):
print "Setting script properties through the daemon is not" \ print "Setting script properties through the daemon is not" \
+ " permitted." + " permitted."
return False return False
self.LastScan[networkid][property] = misc.Noneify(value) self.LastScan[netid][prop] = misc.to_unicode(misc.Noneify(value))
@dbus.service.method('org.wicd.daemon.wireless') @dbus.service.method('org.wicd.daemon.wireless')
def DetectWirelessInterface(self): def DetectWirelessInterface(self):
@@ -1373,7 +1373,7 @@ class WiredDaemon(dbus.service.Object):
print "Setting script properties through the daemon" \ print "Setting script properties through the daemon" \
+ " is not permitted." + " is not permitted."
return False return False
self.WiredNetwork[property] = misc.Noneify(value) self.WiredNetwork[property] = misc.to_unicode(misc.Noneify(value))
return True return True
else: else:
print 'SetWiredProperty: WiredNetwork does not exist' print 'SetWiredProperty: WiredNetwork does not exist'