Deleted Added
full compact
dbus_old.c (214501) dbus_old.c (252190)
1/*
2 * WPA Supplicant / dbus-based control interface
3 * Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc.
4 *
1/*
2 * WPA Supplicant / dbus-based control interface
3 * Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 * Alternatively, this software may be distributed under the terms of BSD
10 * license.
11 *
12 * See README and COPYING for more details.
5 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
13 */
14
15#include "includes.h"
16#include <dbus/dbus.h>
17
18#include "common.h"
19#include "eloop.h"
20#include "wps/wps.h"
21#include "../config.h"
22#include "../wpa_supplicant_i.h"
23#include "../bss.h"
24#include "dbus_old.h"
25#include "dbus_old_handlers.h"
7 */
8
9#include "includes.h"
10#include <dbus/dbus.h>
11
12#include "common.h"
13#include "eloop.h"
14#include "wps/wps.h"
15#include "../config.h"
16#include "../wpa_supplicant_i.h"
17#include "../bss.h"
18#include "dbus_old.h"
19#include "dbus_old_handlers.h"
26#include "dbus_common.h"
27#include "dbus_common_i.h"
28
29
30/**
31 * wpas_dbus_decompose_object_path - Decompose an interface object path into parts
32 * @path: The dbus object path
33 * @network: (out) the configured network this object path refers to, if any
34 * @bssid: (out) the scanned bssid this object path refers to, if any

--- 247 unchanged lines hidden (view full) ---

282#ifdef CONFIG_WPS
283 else if (!os_strcmp(method, "wpsPbc"))
284 reply = wpas_dbus_iface_wps_pbc(message, wpa_s);
285 else if (!os_strcmp(method, "wpsPin"))
286 reply = wpas_dbus_iface_wps_pin(message, wpa_s);
287 else if (!os_strcmp(method, "wpsReg"))
288 reply = wpas_dbus_iface_wps_reg(message, wpa_s);
289#endif /* CONFIG_WPS */
20#include "dbus_common_i.h"
21
22
23/**
24 * wpas_dbus_decompose_object_path - Decompose an interface object path into parts
25 * @path: The dbus object path
26 * @network: (out) the configured network this object path refers to, if any
27 * @bssid: (out) the scanned bssid this object path refers to, if any

--- 247 unchanged lines hidden (view full) ---

275#ifdef CONFIG_WPS
276 else if (!os_strcmp(method, "wpsPbc"))
277 reply = wpas_dbus_iface_wps_pbc(message, wpa_s);
278 else if (!os_strcmp(method, "wpsPin"))
279 reply = wpas_dbus_iface_wps_pin(message, wpa_s);
280 else if (!os_strcmp(method, "wpsReg"))
281 reply = wpas_dbus_iface_wps_reg(message, wpa_s);
282#endif /* CONFIG_WPS */
283 else if (!os_strcmp(method, "flush"))
284 reply = wpas_dbus_iface_flush(message, wpa_s);
290 }
291
292 /* If the message was handled, send back the reply */
293 if (reply) {
294 if (!dbus_message_get_no_reply(message))
295 dbus_connection_send(connection, reply, NULL);
296 dbus_message_unref(reply);
297 }

--- 244 unchanged lines hidden (view full) ---

542}
543#else /* CONFIG_WPS */
544void wpa_supplicant_dbus_notify_wps_cred(struct wpa_supplicant *wpa_s,
545 const struct wps_credential *cred)
546{
547}
548#endif /* CONFIG_WPS */
549
285 }
286
287 /* If the message was handled, send back the reply */
288 if (reply) {
289 if (!dbus_message_get_no_reply(message))
290 dbus_connection_send(connection, reply, NULL);
291 dbus_message_unref(reply);
292 }

--- 244 unchanged lines hidden (view full) ---

537}
538#else /* CONFIG_WPS */
539void wpa_supplicant_dbus_notify_wps_cred(struct wpa_supplicant *wpa_s,
540 const struct wps_credential *cred)
541{
542}
543#endif /* CONFIG_WPS */
544
545void wpa_supplicant_dbus_notify_certification(struct wpa_supplicant *wpa_s,
546 int depth, const char *subject,
547 const char *cert_hash,
548 const struct wpabuf *cert)
549{
550 struct wpas_dbus_priv *iface;
551 DBusMessage *_signal = NULL;
552 const char *hash;
553 const char *cert_hex;
554 int cert_hex_len;
550
555
556 /* Do nothing if the control interface is not turned on */
557 if (wpa_s->global == NULL)
558 return;
559 iface = wpa_s->global->dbus;
560 if (iface == NULL)
561 return;
562
563 _signal = dbus_message_new_signal(wpa_s->dbus_path,
564 WPAS_DBUS_IFACE_INTERFACE,
565 "Certification");
566 if (_signal == NULL) {
567 wpa_printf(MSG_ERROR,
568 "dbus: wpa_supplicant_dbus_notify_certification: "
569 "Could not create dbus signal; likely out of "
570 "memory");
571 return;
572 }
573
574 hash = cert_hash ? cert_hash : "";
575 cert_hex = cert ? wpabuf_head(cert) : "";
576 cert_hex_len = cert ? wpabuf_len(cert) : 0;
577
578 if (!dbus_message_append_args(_signal,
579 DBUS_TYPE_INT32,&depth,
580 DBUS_TYPE_STRING, &subject,
581 DBUS_TYPE_STRING, &hash,
582 DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE,
583 &cert_hex, cert_hex_len,
584 DBUS_TYPE_INVALID)) {
585 wpa_printf(MSG_ERROR,
586 "dbus: wpa_supplicant_dbus_notify_certification: "
587 "Not enough memory to construct signal");
588 goto out;
589 }
590
591 dbus_connection_send(iface->con, _signal, NULL);
592
593out:
594 dbus_message_unref(_signal);
595
596}
597
598
551/**
552 * wpa_supplicant_dbus_ctrl_iface_init - Initialize dbus control interface
553 * @global: Pointer to global data from wpa_supplicant_init()
554 * Returns: 0 on success, -1 on failure
555 *
556 * Initialize the dbus control interface and start receiving commands from
557 * external programs over the bus.
558 */

--- 137 unchanged lines hidden ---
599/**
600 * wpa_supplicant_dbus_ctrl_iface_init - Initialize dbus control interface
601 * @global: Pointer to global data from wpa_supplicant_init()
602 * Returns: 0 on success, -1 on failure
603 *
604 * Initialize the dbus control interface and start receiving commands from
605 * external programs over the bus.
606 */

--- 137 unchanged lines hidden ---