From 21e48903597c68ace45c9ad926b74416224e6014 Mon Sep 17 00:00:00 2001 From: Marta Carbone Date: Fri, 5 Sep 2008 18:38:59 +0000 Subject: [PATCH] Removed user id checks, the `apache' user will be always used. --- PLC/Methods/ConfigureDummynetBox.py | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/PLC/Methods/ConfigureDummynetBox.py b/PLC/Methods/ConfigureDummynetBox.py index 9ac69b9..4c75236 100644 --- a/PLC/Methods/ConfigureDummynetBox.py +++ b/PLC/Methods/ConfigureDummynetBox.py @@ -25,6 +25,7 @@ import os # ssh # used to send configuration requests # to the dummynet box. DBOX_KNOWN_HOSTS="/var/tmp/.dbox_known_hosts" +DBOX_KEY="/usr/share/dummynet/dbox_key" DEFAULT_TIMEOUT= "1H" @@ -151,15 +152,6 @@ class ConfigureDummynetBox(Method): SSH = "ssh -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=yes "; SSH += "-o UserKnownHostsFile=" + "'"+DBOX_KNOWN_HOSTS+"'" + " "; - # use the right key, we need - # apache:apache key when called from python, - # root:root when called from php or plcsh - DBOX_KEY="/usr/share/dummynet/dbox_key" - id = os.popen("id -u").read() - id = int(id) - if (id != 0): - DBOX_KEY += "_apache"; - # the ssh command takes as input # the node_ip, the slicename, the port number # a timeout and a filename (0 don't upload) @@ -199,14 +191,16 @@ class ConfigureDummynetBox(Method): cmd_line += " noerror" # send the command to the dummynetbox + # get output and return code command = os.popen(cmd_line); output = command.read(); ret = str(command.close()); + if (ret == "None"): - ret = cmd_line + "Command executed" - return "OK " + ret + "\n" + output + ret = "0" else: - ret = "Some errors occurred, a detailed description of the output follows" - return cmd_line + "ERROR " + ret + "\n" + output + ret = "1" + + ret += " \n" + output return ret -- 2.43.0