mirror of https://gitee.com/openkylin/libvirt.git
virgdbus: add DBus reply format check
We used to check the format of reply data with libdbus so we should do the same with GLib DBus as well. Signed-off-by: Pavel Hrdina <phrdina@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
7d4b04087c
commit
a961d93768
|
@ -487,6 +487,7 @@ virNetDaemonCallInhibit(virNetDaemonPtr dmn,
|
|||
|
||||
rc = virGDBusCallMethodWithFD(systemBus,
|
||||
&reply,
|
||||
G_VARIANT_TYPE("(h)"),
|
||||
&replyFD,
|
||||
NULL,
|
||||
"org.freedesktop.login1",
|
||||
|
|
|
@ -95,6 +95,7 @@ virFirewallDGetVersion(unsigned long *version)
|
|||
|
||||
if (virGDBusCallMethod(sysbus,
|
||||
&reply,
|
||||
G_VARIANT_TYPE("(v)"),
|
||||
NULL,
|
||||
VIR_FIREWALL_FIREWALLD_SERVICE,
|
||||
"/org/fedoraproject/FirewallD1",
|
||||
|
@ -147,6 +148,7 @@ virFirewallDGetBackend(void)
|
|||
|
||||
if (virGDBusCallMethod(sysbus,
|
||||
&reply,
|
||||
G_VARIANT_TYPE("(v)"),
|
||||
error,
|
||||
VIR_FIREWALL_FIREWALLD_SERVICE,
|
||||
"/org/fedoraproject/FirewallD1/config",
|
||||
|
@ -207,6 +209,7 @@ virFirewallDGetZones(char ***zones, size_t *nzones)
|
|||
|
||||
if (virGDBusCallMethod(sysbus,
|
||||
&reply,
|
||||
G_VARIANT_TYPE("(as)"),
|
||||
NULL,
|
||||
VIR_FIREWALL_FIREWALLD_SERVICE,
|
||||
"/org/fedoraproject/FirewallD1",
|
||||
|
@ -295,6 +298,7 @@ virFirewallDApplyRule(virFirewallLayer layer,
|
|||
|
||||
if (virGDBusCallMethod(sysbus,
|
||||
&reply,
|
||||
G_VARIANT_TYPE("(s)"),
|
||||
error,
|
||||
VIR_FIREWALL_FIREWALLD_SERVICE,
|
||||
"/org/fedoraproject/FirewallD1",
|
||||
|
@ -357,6 +361,7 @@ virFirewallDInterfaceSetZone(const char *iface,
|
|||
message = g_variant_new("(ss)", zone, iface);
|
||||
|
||||
return virGDBusCallMethod(sysbus,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
VIR_FIREWALL_FIREWALLD_SERVICE,
|
||||
|
|
|
@ -181,6 +181,7 @@ virGDBusCloseSystemBus(void)
|
|||
* virGDBusCallMethod:
|
||||
* @conn: a DBus connection
|
||||
* @reply: pointer to receive reply message, or NULL
|
||||
* @replyType: pointer to GVariantType to validate reply data, or NULL
|
||||
* @error: libvirt error pointer or NULL
|
||||
* @busName: bus identifier of the target service
|
||||
* @objectPath: object path of the target service
|
||||
|
@ -198,6 +199,7 @@ virGDBusCloseSystemBus(void)
|
|||
int
|
||||
virGDBusCallMethod(GDBusConnection *conn,
|
||||
GVariant **reply,
|
||||
const GVariantType *replyType,
|
||||
virErrorPtr error,
|
||||
const char *busName,
|
||||
const char *objectPath,
|
||||
|
@ -220,7 +222,7 @@ virGDBusCallMethod(GDBusConnection *conn,
|
|||
ifaceName,
|
||||
method,
|
||||
data,
|
||||
NULL,
|
||||
replyType,
|
||||
G_DBUS_CALL_FLAGS_NONE,
|
||||
VIR_DBUS_METHOD_CALL_TIMEOUT_MILIS,
|
||||
NULL,
|
||||
|
@ -250,6 +252,7 @@ virGDBusCallMethod(GDBusConnection *conn,
|
|||
int
|
||||
virGDBusCallMethodWithFD(GDBusConnection *conn,
|
||||
GVariant **reply,
|
||||
const GVariantType *replyType,
|
||||
GUnixFDList **replyFD,
|
||||
virErrorPtr error,
|
||||
const char *busName,
|
||||
|
@ -274,7 +277,7 @@ virGDBusCallMethodWithFD(GDBusConnection *conn,
|
|||
ifaceName,
|
||||
method,
|
||||
data,
|
||||
NULL,
|
||||
replyType,
|
||||
G_DBUS_CALL_FLAGS_NONE,
|
||||
VIR_DBUS_METHOD_CALL_TIMEOUT_MILIS,
|
||||
dataFD,
|
||||
|
@ -342,6 +345,7 @@ virGDBusIsServiceInList(const char *listMethod,
|
|||
|
||||
rc = virGDBusCallMethod(conn,
|
||||
&reply,
|
||||
G_VARIANT_TYPE("(as)"),
|
||||
NULL,
|
||||
"org.freedesktop.DBus",
|
||||
"/org/freedesktop/DBus",
|
||||
|
|
|
@ -45,6 +45,7 @@ virGDBusCloseSystemBus(void);
|
|||
int
|
||||
virGDBusCallMethod(GDBusConnection *conn,
|
||||
GVariant **reply,
|
||||
const GVariantType *replyType,
|
||||
virErrorPtr error,
|
||||
const char *busName,
|
||||
const char *objectPath,
|
||||
|
@ -55,6 +56,7 @@ virGDBusCallMethod(GDBusConnection *conn,
|
|||
int
|
||||
virGDBusCallMethodWithFD(GDBusConnection *conn,
|
||||
GVariant **reply,
|
||||
const GVariantType *replyType,
|
||||
GUnixFDList **replyFD,
|
||||
virErrorPtr error,
|
||||
const char *busName,
|
||||
|
|
|
@ -104,6 +104,7 @@ int virPolkitCheckAuth(const char *actionid,
|
|||
|
||||
if (virGDBusCallMethod(sysbus,
|
||||
&reply,
|
||||
G_VARIANT_TYPE("((bba{ss}))"),
|
||||
NULL,
|
||||
"org.freedesktop.PolicyKit1",
|
||||
"/org/freedesktop/PolicyKit1/Authority",
|
||||
|
|
|
@ -214,6 +214,7 @@ virSystemdGetMachineNameByPID(pid_t pid)
|
|||
|
||||
if (virGDBusCallMethod(conn,
|
||||
&reply,
|
||||
G_VARIANT_TYPE("(o)"),
|
||||
NULL,
|
||||
"org.freedesktop.machine1",
|
||||
"/org/freedesktop/machine1",
|
||||
|
@ -236,6 +237,7 @@ virSystemdGetMachineNameByPID(pid_t pid)
|
|||
|
||||
if (virGDBusCallMethod(conn,
|
||||
&reply,
|
||||
G_VARIANT_TYPE("(v)"),
|
||||
NULL,
|
||||
"org.freedesktop.machine1",
|
||||
object,
|
||||
|
@ -384,6 +386,7 @@ int virSystemdCreateMachine(const char *name,
|
|||
gprops);
|
||||
|
||||
rc = virGDBusCallMethod(conn,
|
||||
NULL,
|
||||
NULL,
|
||||
error,
|
||||
"org.freedesktop.machine1",
|
||||
|
@ -430,6 +433,7 @@ int virSystemdCreateMachine(const char *name,
|
|||
gprops);
|
||||
|
||||
rc = virGDBusCallMethod(conn,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
"org.freedesktop.machine1",
|
||||
|
@ -457,6 +461,7 @@ int virSystemdCreateMachine(const char *name,
|
|||
gprops);
|
||||
|
||||
rc = virGDBusCallMethod(conn,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
"org.freedesktop.systemd1",
|
||||
|
@ -507,6 +512,7 @@ int virSystemdTerminateMachine(const char *name)
|
|||
|
||||
VIR_DEBUG("Attempting to terminate machine via systemd");
|
||||
if (virGDBusCallMethod(conn,
|
||||
NULL,
|
||||
NULL,
|
||||
error,
|
||||
"org.freedesktop.machine1",
|
||||
|
@ -592,6 +598,7 @@ virSystemdPMSupportTarget(const char *methodName, bool *result)
|
|||
|
||||
if (virGDBusCallMethod(conn,
|
||||
&reply,
|
||||
G_VARIANT_TYPE("(s)"),
|
||||
NULL,
|
||||
"org.freedesktop.login1",
|
||||
"/org/freedesktop/login1",
|
||||
|
|
Loading…
Reference in New Issue