Kaydet (Commit) dc3359af authored tarafından Suleyman Poyraz's avatar Suleyman Poyraz

Şu an sorunsuz çalışıyor

üst 526edf17
......@@ -10,11 +10,11 @@
<arg name="package" type="s" direction="in"/>
<annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/>
</method>
<method name="listModelApplications" action_id="tr.org.sulin.scom.listModelApplications">
<method name="listModelApplications" action_id="">
<arg name="model" type="s" direction="in"/>
<arg name="apps" type="as" direction="out"/>
</method>
<method name="listApplicationModels" action_id="tr.org.sulin.scom.listApplicationModels">
<method name="listApplicationModels" action_id="">
<arg name="app" type="s" direction="in"/>
<arg name="models" type="as" direction="out"/>
</method>
......
......@@ -78,19 +78,21 @@ message_execute(DBusMessage *msg, const char *app, const char *model, const char
if (strcmp(action_id, "") != 0) {
int result;
if (policy_check(sender, action_id, &result) == 0) {
if (policy_check(sender, action_id, &result) == 0) {
if (result != POLICY_YES) {
bus_reply_error(msg, "Scom.PolicyKit", action_id);
return;
}
}
else {
else {
bus_reply_error(msg, "Scom.PolicyKit", "error");
return;
}
}
}
// Execute method
switch (py_execute(app, model, method, py_args, &py_ret)) {
case 0:
......@@ -127,6 +129,7 @@ handle_message(DBusMessage *msg)
if (method == NULL || path == NULL || iface == NULL) {
bus_reply_unknown_method(msg);
}
else if (strcmp("org.freedesktop.DBus.Introspectable", iface) == 0 && strcmp("Introspect", method) == 0) {
// Introspection method
message_execute(msg, NULL, "Core", "introspect");
......
......@@ -293,7 +293,7 @@ pydbus_export_item(DBusMessageIter *iter, PyObject *obj, char *signature)
p.s = PyBytes_AsString(obj);
}
//If returned Unicode type return utf-8 coded string
if (PyUnicode_Check(obj)) {
else if (PyUnicode_Check(obj)) {
p.s = PyUnicode_AsUTF8(obj);
}
else {
......
......@@ -529,6 +529,7 @@ py_execute(const char *app, const char *model, const char *method, PyObject *py_
PyObject *py_dict_core;
PyObject *py_mod_core;
// Add core module directory to sys.path
py_module = PyImport_ImportModule("sys");
py_dict = PyModule_GetDict(py_module);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment