diff --git a/ChangeLog b/ChangeLog index b5a49f6ac..8901e596c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-12-09 Dan Williams + + * libnm-util/* + - More fixups + - Remove cipher-manager.* because we don't need it + - Forgot to add gnome-keyring-md5 files to compile list + 2005-12-09 Dan Williams * libnm-util/* diff --git a/libnm-util/Makefile.am b/libnm-util/Makefile.am index 15500c339..dac93559f 100644 --- a/libnm-util/Makefile.am +++ b/libnm-util/Makefile.am @@ -11,8 +11,6 @@ endif libnm_util_la_SOURCES= \ cipher.c \ cipher.h \ - cipher-manager.c \ - cipher-manager.h \ cipher-wep-hex.c \ cipher-wep-hex.h \ cipher-wep-passphrase.c \ @@ -23,6 +21,8 @@ libnm_util_la_SOURCES= \ cipher-wpa-psk-hex.h \ cipher-wpa-psk-passphrase.c \ cipher-wpa-psk-passphrase.h \ + gnome-keyring-md5.c \ + gnome-keyring-md5.h \ sha1.c \ sha1.h @@ -38,7 +38,13 @@ endif libnm_util_includedir=$(includedir)/NetworkManager -libnm_util_include_HEADERS = cipher-manager.h cipher.h +libnm_util_include_HEADERS = \ + cipher.h \ + cipher-wep-hex.h \ + cipher-wep-passphrase.h \ + cipher-wep-ascii.h \ + cipher-wpa-psk-hex.h \ + cipher-wpa-psk-passphrase.h pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libnm-util.pc diff --git a/libnm-util/cipher-manager.c b/libnm-util/cipher-manager.c deleted file mode 100644 index 8df98b9a5..000000000 --- a/libnm-util/cipher-manager.c +++ /dev/null @@ -1,59 +0,0 @@ -/* NetworkManager Wireless Applet -- Display wireless access points and allow user control - * - * Dan Williams - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * (C) Copyright 2005 Red Hat, Inc. - */ - -#include -#include - -#include "cipher-manager.h" -#include "cipher.h" - -struct CipherManager -{ - GSList * ciphers; -}; - - -/* Singleton instance of the Cipher Manager */ -static CipherManager * cipher_manager = NULL; - - -CipherManager * cipher_manager_get_instance (void) -{ - static GStaticMutex mutex = G_STATIC_MUTEX_INIT; - - g_static_mutex_lock (&mutex); - if (!cipher_manager) - cipher_manager = g_malloc0 (sizeof (CipherManager)); - g_static_mutex_unlock (&mutex); - - return cipher_manager; -} - -int cipher_manager_register_cipher (CipherManager *cm, IEEE_802_11_Cipher *cipher) -{ - g_return_val_if_fail (cm != NULL, -1); - g_return_val_if_fail (cipher != NULL, -1); - - ieee_802_11_cipher_ref (cipher); - cm->ciphers = g_slist_prepend (cm->ciphers, cipher); - - return 0; -} diff --git a/libnm-util/cipher-manager.h b/libnm-util/cipher-manager.h deleted file mode 100644 index 0be8b95df..000000000 --- a/libnm-util/cipher-manager.h +++ /dev/null @@ -1,35 +0,0 @@ -/* NetworkManager Wireless Applet -- Display wireless access points and allow user control - * - * Dan Williams - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * (C) Copyright 2005 Red Hat, Inc. - */ - -#ifndef CIPHER_MANAGER_H -#define CIPHER_MANAGER_H - -#include "cipher.h" - -typedef struct CipherManager CipherManager; - - -CipherManager * cipher_manager_get_instance (void); - -int cipher_manager_register_cipher (CipherManager *cm, IEEE_802_11_Cipher *cipher); - - -#endif /* CIPHER_MANAGER_H */ diff --git a/libnm-util/cipher-wep-ascii.c b/libnm-util/cipher-wep-ascii.c index 84d0b1d5e..f556c0857 100644 --- a/libnm-util/cipher-wep-ascii.c +++ b/libnm-util/cipher-wep-ascii.c @@ -22,15 +22,9 @@ #include #include -#include "cipher-wep-ascii.h" #include "cipher.h" #include "cipher-private.h" -#include "cipher-manager.h" -#ifdef HAVE_GCRYPT -#include -#else -#include "gnome-keyring-md5.h" -#endif +#include "cipher-wep-ascii.h" static char * cipher_wep128_ascii_hash_func (IEEE_802_11_Cipher *cipher, const char *ssid, const char *input); @@ -60,9 +54,8 @@ static char * cipher_wep_ascii_hash_func (IEEE_802_11_Cipher *cipher, const char #define WEP128_ASCII_INPUT_SIZE 13 -int cipher_wep128_ascii_register (void) +IEEE_802_11_Cipher * cipher_wep128_ascii_new (void) { - CipherManager * cm = cipher_manager_get_instance (); IEEE_802_11_Cipher * cipher = g_malloc0 (sizeof (IEEE_802_11_Cipher)); cipher->we_cipher = IW_AUTH_CIPHER_WEP104; @@ -70,8 +63,9 @@ int cipher_wep128_ascii_register (void) cipher->input_max = WEP128_ASCII_INPUT_SIZE; cipher->cipher_hash_func = cipher_wep128_ascii_hash_func; cipher->cipher_input_validate_func = cipher_default_validate_func; + ieee_802_11_cipher_ref (cipher); - return cipher_manager_register_cipher (cm, cipher); + return cipher; } static char * cipher_wep128_ascii_hash_func (IEEE_802_11_Cipher *cipher, const char *ssid, const char *input) @@ -84,9 +78,8 @@ static char * cipher_wep128_ascii_hash_func (IEEE_802_11_Cipher *cipher, const c #define WEP64_ASCII_INPUT_SIZE 5 -int cipher_wep64_ascii_register (void) +IEEE_802_11_Cipher * cipher_wep64_ascii_new (void) { - CipherManager * cm = cipher_manager_get_instance (); IEEE_802_11_Cipher * cipher = g_malloc0 (sizeof (IEEE_802_11_Cipher)); cipher->we_cipher = IW_AUTH_CIPHER_WEP40; @@ -94,8 +87,9 @@ int cipher_wep64_ascii_register (void) cipher->input_max = WEP64_ASCII_INPUT_SIZE; cipher->cipher_hash_func = cipher_wep64_ascii_hash_func; cipher->cipher_input_validate_func = cipher_default_validate_func; + ieee_802_11_cipher_ref (cipher); - return cipher_manager_register_cipher (cm, cipher); + return cipher; } static char * cipher_wep64_ascii_hash_func (IEEE_802_11_Cipher *cipher, const char *ssid, const char *input) diff --git a/libnm-util/cipher-wep-ascii.h b/libnm-util/cipher-wep-ascii.h index a67cbaf31..bddd5668c 100644 --- a/libnm-util/cipher-wep-ascii.h +++ b/libnm-util/cipher-wep-ascii.h @@ -22,7 +22,7 @@ #ifndef CIPHER_WEP_ASCII_H #define CIPHER_WEP_ASCII_H -int cipher_wep128_ascii_register (void); -int cipher_wep64_ascii_register (void); +IEEE_802_11_Cipher * cipher_wep128_ascii_new (void); +IEEE_802_11_Cipher * cipher_wep64_ascii_new (void); #endif /* CIPHER_WEP_ASCII_H */ diff --git a/libnm-util/cipher-wep-hex.c b/libnm-util/cipher-wep-hex.c index 0a4c505d1..b1ba37011 100644 --- a/libnm-util/cipher-wep-hex.c +++ b/libnm-util/cipher-wep-hex.c @@ -22,10 +22,9 @@ #include #include -#include "cipher-wep-hex.h" #include "cipher.h" #include "cipher-private.h" -#include "cipher-manager.h" +#include "cipher-wep-hex.h" static char * cipher_wep128_hex_hash_func (IEEE_802_11_Cipher *cipher, const char *ssid, const char *input); @@ -117,9 +116,8 @@ static char * cipher_wep_hex_convert_func (IEEE_802_11_Cipher *cipher, const cha #define WEP128_HEX_INPUT_SIZE 26 -int cipher_wep128_hex_register (void) +IEEE_802_11_Cipher * cipher_wep128_hex_new (void) { - CipherManager * cm = cipher_manager_get_instance (); IEEE_802_11_Cipher * cipher = g_malloc0 (sizeof (IEEE_802_11_Cipher)); cipher->we_cipher = IW_AUTH_CIPHER_WEP104; @@ -127,8 +125,9 @@ int cipher_wep128_hex_register (void) cipher->input_max = WEP128_HEX_INPUT_SIZE; cipher->cipher_hash_func = cipher_wep128_hex_hash_func; cipher->cipher_input_validate_func = cipher_default_validate_func; + ieee_802_11_cipher_ref (cipher); - return cipher_manager_register_cipher (cm, cipher); + return cipher; } static char * cipher_wep128_hex_hash_func (IEEE_802_11_Cipher *cipher, const char *ssid, const char *input) @@ -141,9 +140,8 @@ static char * cipher_wep128_hex_hash_func (IEEE_802_11_Cipher *cipher, const cha #define WEP64_HEX_INPUT_SIZE 10 -int cipher_wep64_hex_register (void) +IEEE_802_11_Cipher * cipher_wep64_hex_new (void) { - CipherManager * cm = cipher_manager_get_instance (); IEEE_802_11_Cipher * cipher = g_malloc0 (sizeof (IEEE_802_11_Cipher)); cipher->we_cipher = IW_AUTH_CIPHER_WEP40; @@ -151,8 +149,9 @@ int cipher_wep64_hex_register (void) cipher->input_max = WEP64_HEX_INPUT_SIZE; cipher->cipher_hash_func = cipher_wep64_hex_hash_func; cipher->cipher_input_validate_func = cipher_default_validate_func; + ieee_802_11_cipher_ref (cipher); - return cipher_manager_register_cipher (cm, cipher); + return cipher; } static char * cipher_wep64_hex_hash_func (IEEE_802_11_Cipher *cipher, const char *ssid, const char *input) diff --git a/libnm-util/cipher-wep-hex.h b/libnm-util/cipher-wep-hex.h index c9d79ac30..eb9cdf044 100644 --- a/libnm-util/cipher-wep-hex.h +++ b/libnm-util/cipher-wep-hex.h @@ -22,7 +22,7 @@ #ifndef CIPHER_WEP_HEX_H #define CIPHER_WEP_HEX_H -int cipher_wep128_hex_register (void); -int cipher_wep64_hex_register (void); +IEEE_802_11_Cipher * cipher_wep128_hex_new (void); +IEEE_802_11_Cipher * cipher_wep64_hex_new (void); #endif /* CIPHER_WEP_HEX_H */ diff --git a/libnm-util/cipher-wep-passphrase.c b/libnm-util/cipher-wep-passphrase.c index 43c7a2060..ca4d5d7f1 100644 --- a/libnm-util/cipher-wep-passphrase.c +++ b/libnm-util/cipher-wep-passphrase.c @@ -22,10 +22,10 @@ #include #include -#include "cipher-wep-passphrase.h" #include "cipher.h" #include "cipher-private.h" -#include "cipher-manager.h" +#include "cipher-wep-passphrase.h" + #ifdef HAVE_GCRYPT #include #else @@ -98,18 +98,18 @@ static char * cipher_wep_passphrase_hash_func (IEEE_802_11_Cipher *cipher, const } -int cipher_wep128_passphrase_register (void) +IEEE_802_11_Cipher * cipher_wep128_passphrase_new (void) { - CipherManager * cm = cipher_manager_get_instance (); IEEE_802_11_Cipher * cipher = g_malloc0 (sizeof (IEEE_802_11_Cipher)); cipher->we_cipher = IW_AUTH_CIPHER_WEP104; - cipher->input_min = 0; /* What _is_ the min, really? */ + cipher->input_min = 1; /* What _is_ the min, really? */ cipher->input_max = 64; cipher->cipher_hash_func = cipher_wep128_passphrase_hash_func; cipher->cipher_input_validate_func = cipher_default_validate_func; + ieee_802_11_cipher_ref (cipher); - return cipher_manager_register_cipher (cm, cipher); + return cipher; } static char * cipher_wep128_passphrase_hash_func (IEEE_802_11_Cipher *cipher, const char *ssid, const char *input) @@ -120,9 +120,8 @@ static char * cipher_wep128_passphrase_hash_func (IEEE_802_11_Cipher *cipher, co return cipher_wep_passphrase_hash_func (cipher, input, 26); } -int cipher_wep64_passphrase_register (void) +IEEE_802_11_Cipher * cipher_wep64_passphrase_new (void) { - CipherManager * cm = cipher_manager_get_instance (); IEEE_802_11_Cipher * cipher = g_malloc0 (sizeof (IEEE_802_11_Cipher)); cipher->we_cipher = IW_AUTH_CIPHER_WEP40; @@ -130,8 +129,9 @@ int cipher_wep64_passphrase_register (void) cipher->input_max = 64; cipher->cipher_hash_func = cipher_wep64_passphrase_hash_func; cipher->cipher_input_validate_func = cipher_default_validate_func; + ieee_802_11_cipher_ref (cipher); - return cipher_manager_register_cipher (cm, cipher); + return cipher; } static char * cipher_wep64_passphrase_hash_func (IEEE_802_11_Cipher *cipher, const char *ssid, const char *input) diff --git a/libnm-util/cipher-wep-passphrase.h b/libnm-util/cipher-wep-passphrase.h index 083203bb6..67145291e 100644 --- a/libnm-util/cipher-wep-passphrase.h +++ b/libnm-util/cipher-wep-passphrase.h @@ -22,7 +22,7 @@ #ifndef CIPHER_WEP_PASSPHRASE_H #define CIPHER_WEP_PASSPHRASE_H -int cipher_wep128_passphrase_register (void); -int cipher_wep64_passphrase_register (void); +IEEE_802_11_Cipher * cipher_wep128_passphrase_new (void); +IEEE_802_11_Cipher * cipher_wep64_passphrase_new (void); #endif /* CIPHER_WEP_PASSPHRASE_H */ diff --git a/libnm-util/cipher-wpa-psk-hex.c b/libnm-util/cipher-wpa-psk-hex.c index fa0caf789..f9e13acd6 100644 --- a/libnm-util/cipher-wpa-psk-hex.c +++ b/libnm-util/cipher-wpa-psk-hex.c @@ -22,10 +22,9 @@ #include #include -#include "cipher-wpa-psk-hex.h" #include "cipher.h" #include "cipher-private.h" -#include "cipher-manager.h" +#include "cipher-wpa-psk-hex.h" static char * cipher_wpa_psk_hex_hash_func (IEEE_802_11_Cipher *cipher, const char *ssid, const char *input); @@ -75,9 +74,8 @@ static int hexstr2bin(const char *hex, char *buf, size_t len) /* End from hostap */ -int cipher_wpa_psk_hex_register (void) +IEEE_802_11_Cipher * cipher_wpa_psk_hex_new (void) { - CipherManager * cm = cipher_manager_get_instance (); IEEE_802_11_Cipher * cipher = g_malloc0 (sizeof (IEEE_802_11_Cipher)); cipher->we_cipher = IW_AUTH_CIPHER_TKIP; @@ -85,8 +83,9 @@ int cipher_wpa_psk_hex_register (void) cipher->input_max = WPA_PMK_LEN * 2; cipher->cipher_hash_func = cipher_wpa_psk_hex_hash_func; cipher->cipher_input_validate_func = cipher_default_validate_func; + ieee_802_11_cipher_ref (cipher); - return cipher_manager_register_cipher (cm, cipher); + return cipher; } static char * cipher_wpa_psk_hex_hash_func (IEEE_802_11_Cipher *cipher, const char *ssid, const char *input) diff --git a/libnm-util/cipher-wpa-psk-hex.h b/libnm-util/cipher-wpa-psk-hex.h index e3350bafd..6052c6107 100644 --- a/libnm-util/cipher-wpa-psk-hex.h +++ b/libnm-util/cipher-wpa-psk-hex.h @@ -24,6 +24,6 @@ #define WPA_PMK_LEN 32 -int cipher_wpa_psk_hex_register (void); +IEEE_802_11_Cipher * cipher_wpa_psk_hex_new (void); #endif /* CIPHER_WPA_PSK_HEX_H */ diff --git a/libnm-util/cipher-wpa-psk-passphrase.c b/libnm-util/cipher-wpa-psk-passphrase.c index 3f373177c..1d2b6f72b 100644 --- a/libnm-util/cipher-wpa-psk-passphrase.c +++ b/libnm-util/cipher-wpa-psk-passphrase.c @@ -22,24 +22,18 @@ #include #include -#include "cipher-wpa-psk-passphrase.h" -#include "cipher-wpa-psk-hex.h" #include "cipher.h" #include "cipher-private.h" -#include "cipher-manager.h" +#include "cipher-wpa-psk-hex.h" +#include "cipher-wpa-psk-passphrase.h" #include "sha1.h" static char * cipher_wpa_psk_passphrase_hash_func (IEEE_802_11_Cipher *cipher, const char *ssid, const char *input); -/* From hostap, Copyright (c) 2002-2005, Jouni Malinen */ - -/* End from hostap */ - -int cipher_wpa_psk_passphrase_register (void) +IEEE_802_11_Cipher * cipher_wpa_psk_passphrase_new (void) { - CipherManager * cm = cipher_manager_get_instance (); IEEE_802_11_Cipher * cipher = g_malloc0 (sizeof (IEEE_802_11_Cipher)); cipher->we_cipher = IW_AUTH_CIPHER_TKIP; @@ -47,8 +41,9 @@ int cipher_wpa_psk_passphrase_register (void) cipher->input_max = WPA_PMK_LEN * 2; cipher->cipher_hash_func = cipher_wpa_psk_passphrase_hash_func; cipher->cipher_input_validate_func = cipher_default_validate_func; + ieee_802_11_cipher_ref (cipher); - return cipher_manager_register_cipher (cm, cipher); + return cipher; } static char * cipher_wpa_psk_passphrase_hash_func (IEEE_802_11_Cipher *cipher, const char *ssid, const char *input) diff --git a/libnm-util/cipher-wpa-psk-passphrase.h b/libnm-util/cipher-wpa-psk-passphrase.h index 64076360f..668e012e3 100644 --- a/libnm-util/cipher-wpa-psk-passphrase.h +++ b/libnm-util/cipher-wpa-psk-passphrase.h @@ -22,6 +22,6 @@ #ifndef CIPHER_WPA_PSK_PASSPHRASE_H #define CIPHER_WPA_PSK_PASSPHRASE_H -int cipher_wpa_psk_passphrase_register (void); +IEEE_802_11_Cipher * cipher_wpa_psk_passphrase_new (void); #endif /* CIPHER_WPA_PSK_PASSPHRASE_H */