From ccb0bf6ad34beb532176a49731537f09fe01875c Mon Sep 17 00:00:00 2001 From: Max Krasnyansky Date: Mon, 24 Jun 2002 02:52:27 +0000 Subject: Reload PIN code on SIGHUP. More cleanups. --- hcid/security.c | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) (limited to 'hcid/security.c') diff --git a/hcid/security.c b/hcid/security.c index a980b500..75e44421 100644 --- a/hcid/security.c +++ b/hcid/security.c @@ -352,24 +352,6 @@ gboolean io_security_event(GIOChannel *chan, GIOCondition cond, gpointer data) return TRUE; } -static void init_security_data(void) -{ - static int initialized = 0; - - if (initialized) - return; - initialized = 1; - - /* Set local PIN code */ - if (hcid.security == HCID_SEC_AUTO) { - if (read_pin_code() < 0) { - strcpy(hcid.pin_code, "bluez"); - hcid.pin_len = 5; - } - } - return; -} - void start_security_manager(int hdev) { GIOChannel *chan = io_chan[hdev]; @@ -382,8 +364,6 @@ void start_security_manager(int hdev) syslog(LOG_INFO, "Starting security manager %d", hdev); - init_security_data(); - if ((dev = hci_open_dev(hdev)) < 0) { syslog(LOG_ERR, "Can't open device hci%d. %s(%d)", hdev, strerror(errno), errno); @@ -438,3 +418,13 @@ void stop_security_manager(int hdev) close(g_io_channel_unix_get_fd(chan)); io_chan[hdev] = NULL; } + +void init_security_data(void) +{ + /* Set local PIN code */ + if (read_pin_code() < 0) { + strcpy(hcid.pin_code, "BlueZ"); + hcid.pin_len = 5; + } + return; +} -- cgit