diff options
author | Olivier Blin <oblin@mandriva.org> | 2005-11-04 15:31:55 +0000 |
---|---|---|
committer | Olivier Blin <oblin@mandriva.org> | 2005-11-04 15:31:55 +0000 |
commit | 738ba6940abcd7182079344907c07fb3912035be (patch) | |
tree | 101e7c755f56beb44e67f3c9c7fa6d0118bce706 | |
parent | 71df55012608fb17097e89630545e0d667aede8d (diff) | |
download | mandi-738ba6940abcd7182079344907c07fb3912035be.tar mandi-738ba6940abcd7182079344907c07fb3912035be.tar.gz mandi-738ba6940abcd7182079344907c07fb3912035be.tar.bz2 mandi-738ba6940abcd7182079344907c07fb3912035be.tar.xz mandi-738ba6940abcd7182079344907c07fb3912035be.zip |
port to DBus-0.50, dbus_message_append_args wants pointers now
(beware, given char array[], &array == array)
-rw-r--r-- | src/plugins/ifw/ifw_dbus.c | 97 | ||||
-rw-r--r-- | src/plugins/wireless/plugin.c | 5 |
2 files changed, 61 insertions, 41 deletions
diff --git a/src/plugins/ifw/ifw_dbus.c b/src/plugins/ifw/ifw_dbus.c index caf6753..9a9a841 100644 --- a/src/plugins/ifw/ifw_dbus.c +++ b/src/plugins/ifw/ifw_dbus.c @@ -36,28 +36,33 @@ void ifw_dbus_notify_attack(DBusConnection *bus, report_list_cell_t *report) { IFW_DBUS_INTERFACE, "Attack"); + /* DBus wants a char** for strings, and &char[] == char*, so use temporary variables */ + char *dev = report->info.indev_name; + char *prefix = report->info.prefix; + dbus_message_append_args(message, DBUS_TYPE_UINT32, - report->info.timestamp_sec, + &report->info.timestamp_sec, DBUS_TYPE_STRING, - report->info.indev_name, + &dev, DBUS_TYPE_STRING, - report->info.prefix, + &prefix, DBUS_TYPE_UINT32, - report->info.sensor, + &report->info.sensor, DBUS_TYPE_UINT32, - report->info.protocol, + &report->info.protocol, DBUS_TYPE_UINT32, - report->info.s_addr, + &report->info.s_addr, DBUS_TYPE_UINT32, - report->info.d_port, + &report->info.d_port, DBUS_TYPE_UINT32, - report->info.icmp_type, + &report->info.icmp_type, DBUS_TYPE_UINT32, - report->seq, + &report->seq, DBUS_TYPE_UINT32, - report->processed, + &report->processed, DBUS_TYPE_INVALID); + dbus_connection_send(bus, message, NULL); dbus_connection_flush(bus); dbus_message_unref(message); @@ -67,27 +72,31 @@ void ifw_dbus_notify_attack(DBusConnection *bus, report_list_cell_t *report) { void ifw_dbus_notify_blacklist(DBusConnection *bus, msg_usr_t *attack) { DBusMessage *message; + /* DBus wants a char** for strings, and &char[] == char*, so use temporary variables */ + char *dev = attack->indev_name; + char *prefix = attack->prefix; + message = dbus_message_new_signal(IFW_DBUS_PATH, IFW_DBUS_INTERFACE, "Blacklist"); dbus_message_append_args(message, DBUS_TYPE_UINT32, - attack->timestamp_sec, + &attack->timestamp_sec, DBUS_TYPE_STRING, - attack->indev_name, + &dev, DBUS_TYPE_STRING, - attack->prefix, + &prefix, DBUS_TYPE_UINT32, - attack->sensor, + &attack->sensor, DBUS_TYPE_UINT32, - attack->protocol, + &attack->protocol, DBUS_TYPE_UINT32, - attack->s_addr, + &attack->s_addr, DBUS_TYPE_UINT32, - attack->d_port, + &attack->d_port, DBUS_TYPE_UINT32, - attack->icmp_type, + &attack->icmp_type, DBUS_TYPE_INVALID); dbus_connection_send(bus, message, NULL); dbus_connection_flush(bus); @@ -103,7 +112,7 @@ void ifw_dbus_notify_whitelist(DBusConnection *bus, u_int32_t addr) { "Whitelist"); dbus_message_append_args(message, DBUS_TYPE_UINT32, - addr, + &addr, DBUS_TYPE_INVALID); dbus_connection_send(bus, message, NULL); dbus_connection_flush(bus); @@ -136,7 +145,7 @@ DBusHandlerResult ifw_dbus_get_mode(DBusConnection *connection, DBusMessage *mes reply = dbus_message_new_method_return(message); dbus_message_append_args(reply, DBUS_TYPE_UINT32, - ifw->mode, + &ifw->mode, DBUS_TYPE_INVALID); dbus_connection_send(connection, reply, NULL); dbus_connection_flush(connection); @@ -168,7 +177,7 @@ DBusHandlerResult ifw_dbus_set_mode(DBusConnection *connection, DBusMessage *mes reply = dbus_message_new_method_return(message); dbus_message_append_args(reply, DBUS_TYPE_UINT32, - ifw->mode, + &ifw->mode, DBUS_TYPE_INVALID); dbus_connection_send(connection, reply, NULL); dbus_connection_flush(connection); @@ -198,31 +207,35 @@ DBusHandlerResult ifw_dbus_get_reports(DBusConnection *connection, DBusMessage * reply = dbus_message_new_method_return(message); __list_for_each(entry, &ifw->reports) { report_list_cell_t *cell; + /* DBus wants a char** for strings, and &char[] == char*, so use temporary variables */ + char *dev, *prefix; cell = list_entry(entry, report_list_cell_t, list); if (cell->processed && !include_processed) { continue; } + dev = cell->info.indev_name; + prefix = cell->info.prefix; dbus_message_append_args(reply, DBUS_TYPE_UINT32, - cell->info.timestamp_sec, + &cell->info.timestamp_sec, DBUS_TYPE_STRING, - cell->info.indev_name, + &dev, DBUS_TYPE_STRING, - cell->info.prefix, + &prefix, DBUS_TYPE_UINT32, - cell->info.sensor, + &cell->info.sensor, DBUS_TYPE_UINT32, - cell->info.protocol, + &cell->info.protocol, DBUS_TYPE_UINT32, - cell->info.s_addr, + &cell->info.s_addr, DBUS_TYPE_UINT32, - cell->info.d_port, + &cell->info.d_port, DBUS_TYPE_UINT32, - cell->info.icmp_type, + &cell->info.icmp_type, DBUS_TYPE_UINT32, - cell->seq, + &cell->seq, DBUS_TYPE_UINT32, - cell->processed, + &cell->processed, DBUS_TYPE_INVALID); } dbus_connection_send(connection, reply, NULL); @@ -239,24 +252,28 @@ DBusHandlerResult ifw_dbus_get_blacklist(DBusConnection *connection, DBusMessage reply = dbus_message_new_method_return(message); __list_for_each(entry, &ifw->blacklist) { black_list_cell_t *cell; + /* DBus wants a char** for strings, and &char[] == char*, so use temporary variables */ + char *dev, *prefix; cell = list_entry(entry, black_list_cell_t, list); + dev = cell->info.indev_name; + prefix = cell->info.prefix; dbus_message_append_args(reply, DBUS_TYPE_UINT32, - cell->info.timestamp_sec, + &cell->info.timestamp_sec, DBUS_TYPE_STRING, - cell->info.indev_name, + &dev, DBUS_TYPE_STRING, - cell->info.prefix, + &prefix, DBUS_TYPE_UINT32, - cell->info.sensor, + &cell->info.sensor, DBUS_TYPE_UINT32, - cell->info.protocol, + &cell->info.protocol, DBUS_TYPE_UINT32, - cell->info.s_addr, + &cell->info.s_addr, DBUS_TYPE_UINT32, - cell->info.d_port, + &cell->info.d_port, DBUS_TYPE_UINT32, - cell->info.icmp_type, + &cell->info.icmp_type, DBUS_TYPE_INVALID); } dbus_connection_send(connection, reply, NULL); @@ -341,7 +358,7 @@ DBusHandlerResult ifw_dbus_get_whitelist(DBusConnection *connection, DBusMessage cell = list_entry(entry, white_list_cell_t, list); dbus_message_append_args(reply, DBUS_TYPE_UINT32, - cell->addr, + &cell->addr, DBUS_TYPE_INVALID); } dbus_connection_send(connection, reply, NULL); diff --git a/src/plugins/wireless/plugin.c b/src/plugins/wireless/plugin.c index 1ddeb95..feb12de 100644 --- a/src/plugins/wireless/plugin.c +++ b/src/plugins/wireless/plugin.c @@ -107,6 +107,8 @@ static DBusHandlerResult wpa_supplicant_request(DBusConnection *connection, DBus char buf[2048]; size_t len; int ret = -1; + /* DBus wants a char** for strings, and &char[] == char*, so use temporary variables */ + char *tmp_buf; len = sizeof(buf) - 1; if (ctrl_conn) { @@ -127,9 +129,10 @@ static DBusHandlerResult wpa_supplicant_request(DBusConnection *connection, DBus buf[len] = '\0'; reply = dbus_message_new_method_return(message); + tmp_buf = buf; dbus_message_append_args(reply, DBUS_TYPE_STRING, - buf, + &tmp_buf, DBUS_TYPE_INVALID); dbus_connection_send(connection, reply, NULL); dbus_connection_flush(connection); |