mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 17:34:18 +03:00
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,
|
rc = virGDBusCallMethodWithFD(systemBus,
|
||||||
&reply,
|
&reply,
|
||||||
|
G_VARIANT_TYPE("(h)"),
|
||||||
&replyFD,
|
&replyFD,
|
||||||
NULL,
|
NULL,
|
||||||
"org.freedesktop.login1",
|
"org.freedesktop.login1",
|
||||||
|
@ -95,6 +95,7 @@ virFirewallDGetVersion(unsigned long *version)
|
|||||||
|
|
||||||
if (virGDBusCallMethod(sysbus,
|
if (virGDBusCallMethod(sysbus,
|
||||||
&reply,
|
&reply,
|
||||||
|
G_VARIANT_TYPE("(v)"),
|
||||||
NULL,
|
NULL,
|
||||||
VIR_FIREWALL_FIREWALLD_SERVICE,
|
VIR_FIREWALL_FIREWALLD_SERVICE,
|
||||||
"/org/fedoraproject/FirewallD1",
|
"/org/fedoraproject/FirewallD1",
|
||||||
@ -147,6 +148,7 @@ virFirewallDGetBackend(void)
|
|||||||
|
|
||||||
if (virGDBusCallMethod(sysbus,
|
if (virGDBusCallMethod(sysbus,
|
||||||
&reply,
|
&reply,
|
||||||
|
G_VARIANT_TYPE("(v)"),
|
||||||
error,
|
error,
|
||||||
VIR_FIREWALL_FIREWALLD_SERVICE,
|
VIR_FIREWALL_FIREWALLD_SERVICE,
|
||||||
"/org/fedoraproject/FirewallD1/config",
|
"/org/fedoraproject/FirewallD1/config",
|
||||||
@ -207,6 +209,7 @@ virFirewallDGetZones(char ***zones, size_t *nzones)
|
|||||||
|
|
||||||
if (virGDBusCallMethod(sysbus,
|
if (virGDBusCallMethod(sysbus,
|
||||||
&reply,
|
&reply,
|
||||||
|
G_VARIANT_TYPE("(as)"),
|
||||||
NULL,
|
NULL,
|
||||||
VIR_FIREWALL_FIREWALLD_SERVICE,
|
VIR_FIREWALL_FIREWALLD_SERVICE,
|
||||||
"/org/fedoraproject/FirewallD1",
|
"/org/fedoraproject/FirewallD1",
|
||||||
@ -295,6 +298,7 @@ virFirewallDApplyRule(virFirewallLayer layer,
|
|||||||
|
|
||||||
if (virGDBusCallMethod(sysbus,
|
if (virGDBusCallMethod(sysbus,
|
||||||
&reply,
|
&reply,
|
||||||
|
G_VARIANT_TYPE("(s)"),
|
||||||
error,
|
error,
|
||||||
VIR_FIREWALL_FIREWALLD_SERVICE,
|
VIR_FIREWALL_FIREWALLD_SERVICE,
|
||||||
"/org/fedoraproject/FirewallD1",
|
"/org/fedoraproject/FirewallD1",
|
||||||
@ -357,6 +361,7 @@ virFirewallDInterfaceSetZone(const char *iface,
|
|||||||
message = g_variant_new("(ss)", zone, iface);
|
message = g_variant_new("(ss)", zone, iface);
|
||||||
|
|
||||||
return virGDBusCallMethod(sysbus,
|
return virGDBusCallMethod(sysbus,
|
||||||
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
VIR_FIREWALL_FIREWALLD_SERVICE,
|
VIR_FIREWALL_FIREWALLD_SERVICE,
|
||||||
|
@ -181,6 +181,7 @@ virGDBusCloseSystemBus(void)
|
|||||||
* virGDBusCallMethod:
|
* virGDBusCallMethod:
|
||||||
* @conn: a DBus connection
|
* @conn: a DBus connection
|
||||||
* @reply: pointer to receive reply message, or NULL
|
* @reply: pointer to receive reply message, or NULL
|
||||||
|
* @replyType: pointer to GVariantType to validate reply data, or NULL
|
||||||
* @error: libvirt error pointer or NULL
|
* @error: libvirt error pointer or NULL
|
||||||
* @busName: bus identifier of the target service
|
* @busName: bus identifier of the target service
|
||||||
* @objectPath: object path of the target service
|
* @objectPath: object path of the target service
|
||||||
@ -198,6 +199,7 @@ virGDBusCloseSystemBus(void)
|
|||||||
int
|
int
|
||||||
virGDBusCallMethod(GDBusConnection *conn,
|
virGDBusCallMethod(GDBusConnection *conn,
|
||||||
GVariant **reply,
|
GVariant **reply,
|
||||||
|
const GVariantType *replyType,
|
||||||
virErrorPtr error,
|
virErrorPtr error,
|
||||||
const char *busName,
|
const char *busName,
|
||||||
const char *objectPath,
|
const char *objectPath,
|
||||||
@ -220,7 +222,7 @@ virGDBusCallMethod(GDBusConnection *conn,
|
|||||||
ifaceName,
|
ifaceName,
|
||||||
method,
|
method,
|
||||||
data,
|
data,
|
||||||
NULL,
|
replyType,
|
||||||
G_DBUS_CALL_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
VIR_DBUS_METHOD_CALL_TIMEOUT_MILIS,
|
VIR_DBUS_METHOD_CALL_TIMEOUT_MILIS,
|
||||||
NULL,
|
NULL,
|
||||||
@ -250,6 +252,7 @@ virGDBusCallMethod(GDBusConnection *conn,
|
|||||||
int
|
int
|
||||||
virGDBusCallMethodWithFD(GDBusConnection *conn,
|
virGDBusCallMethodWithFD(GDBusConnection *conn,
|
||||||
GVariant **reply,
|
GVariant **reply,
|
||||||
|
const GVariantType *replyType,
|
||||||
GUnixFDList **replyFD,
|
GUnixFDList **replyFD,
|
||||||
virErrorPtr error,
|
virErrorPtr error,
|
||||||
const char *busName,
|
const char *busName,
|
||||||
@ -274,7 +277,7 @@ virGDBusCallMethodWithFD(GDBusConnection *conn,
|
|||||||
ifaceName,
|
ifaceName,
|
||||||
method,
|
method,
|
||||||
data,
|
data,
|
||||||
NULL,
|
replyType,
|
||||||
G_DBUS_CALL_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
VIR_DBUS_METHOD_CALL_TIMEOUT_MILIS,
|
VIR_DBUS_METHOD_CALL_TIMEOUT_MILIS,
|
||||||
dataFD,
|
dataFD,
|
||||||
@ -342,6 +345,7 @@ virGDBusIsServiceInList(const char *listMethod,
|
|||||||
|
|
||||||
rc = virGDBusCallMethod(conn,
|
rc = virGDBusCallMethod(conn,
|
||||||
&reply,
|
&reply,
|
||||||
|
G_VARIANT_TYPE("(as)"),
|
||||||
NULL,
|
NULL,
|
||||||
"org.freedesktop.DBus",
|
"org.freedesktop.DBus",
|
||||||
"/org/freedesktop/DBus",
|
"/org/freedesktop/DBus",
|
||||||
|
@ -45,6 +45,7 @@ virGDBusCloseSystemBus(void);
|
|||||||
int
|
int
|
||||||
virGDBusCallMethod(GDBusConnection *conn,
|
virGDBusCallMethod(GDBusConnection *conn,
|
||||||
GVariant **reply,
|
GVariant **reply,
|
||||||
|
const GVariantType *replyType,
|
||||||
virErrorPtr error,
|
virErrorPtr error,
|
||||||
const char *busName,
|
const char *busName,
|
||||||
const char *objectPath,
|
const char *objectPath,
|
||||||
@ -55,6 +56,7 @@ virGDBusCallMethod(GDBusConnection *conn,
|
|||||||
int
|
int
|
||||||
virGDBusCallMethodWithFD(GDBusConnection *conn,
|
virGDBusCallMethodWithFD(GDBusConnection *conn,
|
||||||
GVariant **reply,
|
GVariant **reply,
|
||||||
|
const GVariantType *replyType,
|
||||||
GUnixFDList **replyFD,
|
GUnixFDList **replyFD,
|
||||||
virErrorPtr error,
|
virErrorPtr error,
|
||||||
const char *busName,
|
const char *busName,
|
||||||
|
@ -104,6 +104,7 @@ int virPolkitCheckAuth(const char *actionid,
|
|||||||
|
|
||||||
if (virGDBusCallMethod(sysbus,
|
if (virGDBusCallMethod(sysbus,
|
||||||
&reply,
|
&reply,
|
||||||
|
G_VARIANT_TYPE("((bba{ss}))"),
|
||||||
NULL,
|
NULL,
|
||||||
"org.freedesktop.PolicyKit1",
|
"org.freedesktop.PolicyKit1",
|
||||||
"/org/freedesktop/PolicyKit1/Authority",
|
"/org/freedesktop/PolicyKit1/Authority",
|
||||||
|
@ -214,6 +214,7 @@ virSystemdGetMachineNameByPID(pid_t pid)
|
|||||||
|
|
||||||
if (virGDBusCallMethod(conn,
|
if (virGDBusCallMethod(conn,
|
||||||
&reply,
|
&reply,
|
||||||
|
G_VARIANT_TYPE("(o)"),
|
||||||
NULL,
|
NULL,
|
||||||
"org.freedesktop.machine1",
|
"org.freedesktop.machine1",
|
||||||
"/org/freedesktop/machine1",
|
"/org/freedesktop/machine1",
|
||||||
@ -236,6 +237,7 @@ virSystemdGetMachineNameByPID(pid_t pid)
|
|||||||
|
|
||||||
if (virGDBusCallMethod(conn,
|
if (virGDBusCallMethod(conn,
|
||||||
&reply,
|
&reply,
|
||||||
|
G_VARIANT_TYPE("(v)"),
|
||||||
NULL,
|
NULL,
|
||||||
"org.freedesktop.machine1",
|
"org.freedesktop.machine1",
|
||||||
object,
|
object,
|
||||||
@ -384,6 +386,7 @@ int virSystemdCreateMachine(const char *name,
|
|||||||
gprops);
|
gprops);
|
||||||
|
|
||||||
rc = virGDBusCallMethod(conn,
|
rc = virGDBusCallMethod(conn,
|
||||||
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
error,
|
error,
|
||||||
"org.freedesktop.machine1",
|
"org.freedesktop.machine1",
|
||||||
@ -430,6 +433,7 @@ int virSystemdCreateMachine(const char *name,
|
|||||||
gprops);
|
gprops);
|
||||||
|
|
||||||
rc = virGDBusCallMethod(conn,
|
rc = virGDBusCallMethod(conn,
|
||||||
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
"org.freedesktop.machine1",
|
"org.freedesktop.machine1",
|
||||||
@ -457,6 +461,7 @@ int virSystemdCreateMachine(const char *name,
|
|||||||
gprops);
|
gprops);
|
||||||
|
|
||||||
rc = virGDBusCallMethod(conn,
|
rc = virGDBusCallMethod(conn,
|
||||||
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
"org.freedesktop.systemd1",
|
"org.freedesktop.systemd1",
|
||||||
@ -507,6 +512,7 @@ int virSystemdTerminateMachine(const char *name)
|
|||||||
|
|
||||||
VIR_DEBUG("Attempting to terminate machine via systemd");
|
VIR_DEBUG("Attempting to terminate machine via systemd");
|
||||||
if (virGDBusCallMethod(conn,
|
if (virGDBusCallMethod(conn,
|
||||||
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
error,
|
error,
|
||||||
"org.freedesktop.machine1",
|
"org.freedesktop.machine1",
|
||||||
@ -592,6 +598,7 @@ virSystemdPMSupportTarget(const char *methodName, bool *result)
|
|||||||
|
|
||||||
if (virGDBusCallMethod(conn,
|
if (virGDBusCallMethod(conn,
|
||||||
&reply,
|
&reply,
|
||||||
|
G_VARIANT_TYPE("(s)"),
|
||||||
NULL,
|
NULL,
|
||||||
"org.freedesktop.login1",
|
"org.freedesktop.login1",
|
||||||
"/org/freedesktop/login1",
|
"/org/freedesktop/login1",
|
||||||
|
Loading…
Reference in New Issue
Block a user