Deleted Added
full compact
driver_privsep.c (214501) driver_privsep.c (252190)
1/*
2 * WPA Supplicant - privilege separated driver interface
3 * Copyright (c) 2007-2009, Jouni Malinen <j@w1.fi>
4 *
1/*
2 * WPA Supplicant - privilege separated driver interface
3 * Copyright (c) 2007-2009, Jouni Malinen <j@w1.fi>
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 <sys/un.h>
17
18#include "common.h"
19#include "driver.h"
20#include "eloop.h"

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

153 pos += sizeof(int);
154
155 results = os_zalloc(sizeof(*results));
156 if (results == NULL) {
157 os_free(buf);
158 return NULL;
159 }
160
7 */
8
9#include "includes.h"
10#include <sys/un.h>
11
12#include "common.h"
13#include "driver.h"
14#include "eloop.h"

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

147 pos += sizeof(int);
148
149 results = os_zalloc(sizeof(*results));
150 if (results == NULL) {
151 os_free(buf);
152 return NULL;
153 }
154
161 results->res = os_zalloc(num * sizeof(struct wpa_scan_res *));
155 results->res = os_calloc(num, sizeof(struct wpa_scan_res *));
162 if (results->res == NULL) {
163 os_free(results);
164 os_free(buf);
165 return NULL;
166 }
167
168 while (results->num < (size_t) num && pos + sizeof(int) < end) {
169 int len;

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

305 //struct wpa_driver_privsep_data *drv = priv;
306 wpa_printf(MSG_DEBUG, "%s addr=" MACSTR " reason_code=%d",
307 __func__, MAC2STR(addr), reason_code);
308 wpa_printf(MSG_DEBUG, "%s - TODO", __func__);
309 return 0;
310}
311
312
156 if (results->res == NULL) {
157 os_free(results);
158 os_free(buf);
159 return NULL;
160 }
161
162 while (results->num < (size_t) num && pos + sizeof(int) < end) {
163 int len;

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

299 //struct wpa_driver_privsep_data *drv = priv;
300 wpa_printf(MSG_DEBUG, "%s addr=" MACSTR " reason_code=%d",
301 __func__, MAC2STR(addr), reason_code);
302 wpa_printf(MSG_DEBUG, "%s - TODO", __func__);
303 return 0;
304}
305
306
313static int wpa_driver_privsep_disassociate(void *priv, const u8 *addr,
314 int reason_code)
315{
316 //struct wpa_driver_privsep_data *drv = priv;
317 wpa_printf(MSG_DEBUG, "%s addr=" MACSTR " reason_code=%d",
318 __func__, MAC2STR(addr), reason_code);
319 wpa_printf(MSG_DEBUG, "%s - TODO", __func__);
320 return 0;
321}
322
323
324static void wpa_driver_privsep_event_assoc(void *ctx,
325 enum wpa_event_type event,
326 u8 *buf, size_t len)
327{
328 union wpa_event_data data;
329 int inc_data = 0;
330 u8 *pos, *end;
331 int ie_len;

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

652 return -1;
653 }
654
655 os_memset(&addr, 0, sizeof(addr));
656 addr.sun_family = AF_UNIX;
657 os_strlcpy(addr.sun_path, drv->own_socket_path, sizeof(addr.sun_path));
658 if (bind(drv->priv_socket, (struct sockaddr *) &addr, sizeof(addr)) <
659 0) {
307static void wpa_driver_privsep_event_assoc(void *ctx,
308 enum wpa_event_type event,
309 u8 *buf, size_t len)
310{
311 union wpa_event_data data;
312 int inc_data = 0;
313 u8 *pos, *end;
314 int ie_len;

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

635 return -1;
636 }
637
638 os_memset(&addr, 0, sizeof(addr));
639 addr.sun_family = AF_UNIX;
640 os_strlcpy(addr.sun_path, drv->own_socket_path, sizeof(addr.sun_path));
641 if (bind(drv->priv_socket, (struct sockaddr *) &addr, sizeof(addr)) <
642 0) {
660 perror("bind(PF_UNIX)");
643 perror("privsep-set-params priv-sock: bind(PF_UNIX)");
661 close(drv->priv_socket);
662 drv->priv_socket = -1;
663 unlink(drv->own_socket_path);
664 os_free(drv->own_socket_path);
665 drv->own_socket_path = NULL;
666 return -1;
667 }
668

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

677 return -1;
678 }
679
680 os_memset(&addr, 0, sizeof(addr));
681 addr.sun_family = AF_UNIX;
682 os_strlcpy(addr.sun_path, drv->own_cmd_path, sizeof(addr.sun_path));
683 if (bind(drv->cmd_socket, (struct sockaddr *) &addr, sizeof(addr)) < 0)
684 {
644 close(drv->priv_socket);
645 drv->priv_socket = -1;
646 unlink(drv->own_socket_path);
647 os_free(drv->own_socket_path);
648 drv->own_socket_path = NULL;
649 return -1;
650 }
651

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

660 return -1;
661 }
662
663 os_memset(&addr, 0, sizeof(addr));
664 addr.sun_family = AF_UNIX;
665 os_strlcpy(addr.sun_path, drv->own_cmd_path, sizeof(addr.sun_path));
666 if (bind(drv->cmd_socket, (struct sockaddr *) &addr, sizeof(addr)) < 0)
667 {
685 perror("bind(PF_UNIX)");
668 perror("privsep-set-params cmd-sock: bind(PF_UNIX)");
686 close(drv->cmd_socket);
687 drv->cmd_socket = -1;
688 unlink(drv->own_cmd_path);
689 os_free(drv->own_cmd_path);
690 drv->own_cmd_path = NULL;
691 return -1;
692 }
693

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

737 .get_bssid = wpa_driver_privsep_get_bssid,
738 .get_ssid = wpa_driver_privsep_get_ssid,
739 .set_key = wpa_driver_privsep_set_key,
740 .init = wpa_driver_privsep_init,
741 .deinit = wpa_driver_privsep_deinit,
742 .set_param = wpa_driver_privsep_set_param,
743 .scan2 = wpa_driver_privsep_scan,
744 .deauthenticate = wpa_driver_privsep_deauthenticate,
669 close(drv->cmd_socket);
670 drv->cmd_socket = -1;
671 unlink(drv->own_cmd_path);
672 os_free(drv->own_cmd_path);
673 drv->own_cmd_path = NULL;
674 return -1;
675 }
676

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

720 .get_bssid = wpa_driver_privsep_get_bssid,
721 .get_ssid = wpa_driver_privsep_get_ssid,
722 .set_key = wpa_driver_privsep_set_key,
723 .init = wpa_driver_privsep_init,
724 .deinit = wpa_driver_privsep_deinit,
725 .set_param = wpa_driver_privsep_set_param,
726 .scan2 = wpa_driver_privsep_scan,
727 .deauthenticate = wpa_driver_privsep_deauthenticate,
745 .disassociate = wpa_driver_privsep_disassociate,
746 .associate = wpa_driver_privsep_associate,
747 .get_capa = wpa_driver_privsep_get_capa,
748 .get_mac_addr = wpa_driver_privsep_get_mac_addr,
749 .get_scan_results2 = wpa_driver_privsep_get_scan_results2,
750 .set_country = wpa_driver_privsep_set_country,
751};
752
753
754struct wpa_driver_ops *wpa_drivers[] =
755{
756 &wpa_driver_privsep_ops,
757 NULL
758};
728 .associate = wpa_driver_privsep_associate,
729 .get_capa = wpa_driver_privsep_get_capa,
730 .get_mac_addr = wpa_driver_privsep_get_mac_addr,
731 .get_scan_results2 = wpa_driver_privsep_get_scan_results2,
732 .set_country = wpa_driver_privsep_set_country,
733};
734
735
736struct wpa_driver_ops *wpa_drivers[] =
737{
738 &wpa_driver_privsep_ops,
739 NULL
740};