Commit graph

33 commits

Author SHA1 Message Date
Jiří Klimeš bf610255a1 libnm-util: move verify_wep_key() and verify_wpa_psk() to nm-utils.c
and rename them to nm_utils_wep_key_valid(), nm_utils_wpa_psk_valid().
They are general functions and can also be used elsewere usefully.
2013-02-06 13:29:58 +01:00
Dan Williams 38e3819b4e libnm-util: clean up setting registration
Make setting type registration less icky; instead of having the
connection register all the settings, have the settings themselves
register that information at library load time.  Putting this sort
of thing in G_DEFINE_TYPE_WITH_CODE is apparently more standard
than the home-rolled stuff we had before.  Also document the
priority stuff so when adding new settings, people know what
priority to use.

(cleanups by jklimes)
2012-10-29 15:12:58 -05:00
Dan Winship 6878d20ac4 all: Don't use ctype.h macros
The ctype macros (eg, isalnum(), tolower()) are locale-dependent. Use
glib's ASCII-only versions instead.

Also, replace isascii() with g_ascii_isprint(), since isascii()
accepts control characters, which isn't what the code wanted in any of
the places where it was using it.
2012-09-26 12:14:37 -04:00
Colin Walters c9aa5f76cf Fix various bits of broken gtk-doc
There was some duplication, syntax errors, etc.
2012-06-14 13:56:48 -04:00
Dan Winship 839eab5564 Use glib-mkenums to generate enum types
Rather than generating enum classes by hand (and complaining in each
file that "this should really be standard"), use glib-mkenums.

Unfortunately, we need a very new version of glib-mkenums in order to
deal with NM's naming conventions and to fix a few other bugs, so just
import that into the source tree temporarily.

Also, to simplify the use of glib-mkenums, import Makefile.glib from
https://bugzilla.gnome.org/654395.

To avoid having to run glib-mkenums for every subdirectory of src/,
add a new "generated" directory, and put the generated enums files
there.

Finally, use Makefile.glib for marshallers too, and generate separate
ones for libnm-glib and NetworkManager.
2012-02-15 11:42:15 -05:00
Dan Williams 2de340ab7a docs: fix some Wireless Security setting documentation 2011-07-05 18:13:51 -05:00
Dan Williams af1b556ee1 docs: update Wireless Security setting documentation 2011-07-05 18:09:14 -05:00
Dan Williams 899b8a40dc libnm-util: NM_SETTING_SECRET_FLAG_SYSTEM_OWNED -> NM_SETTING_SECRET_FLAG_NONE
Make it a bit clearer that this value is not actually a value that
can be used as a flag, since its 0x00.
2011-02-06 23:37:39 -06:00
Dan Williams 93cbc77154 libnm-util: handle get_secret_flags/set_secret_flags for WirelessSecurity setting
Becuase there's only one 'flags' property for WEP keys (because it's pretty
dumb to have different flags for all 4 WEP keys) we need to do some tap dancing
with the secret name, so that requests for "wep-keyX" look up the "wep-key-flags"
property.
2011-01-31 19:57:48 -06:00
Dan Williams 562246cb80 libnm-util: fix handling of secrets flags
It's a bitfield, not a single value.  Update GObject property
max accordingly.
2011-01-31 12:36:53 -06:00
Dan Williams 5a7cf39a62 libnm-util: add secret flags for each secret describing how the secret is stored
This allows the necessary flexibility when handling secrets; otherwise
it wouldn't be known when NM should save secrets returned from agents
to backing storage, or when the agents should store the secrets. We
can't simply use lack of a secret in persistent storage as the indicator
of this, as (for example) when creating a new connection without
secrets the storage method would be abmiguous.

At the same time, fold in "always ask" functionality for OTP tokens
so user agents don't have to store that attribute themselves out-of-band.
2011-01-29 13:34:24 -06:00
Dan Williams be97e7f104 build: include <config.h> for kill(2), isblank(3), and isascii(3)
config.h defines _GNU_SOURCE, which in turn defines the bits necessary
for kill, isblank, and isascii.  So wherever we use those, we need
to make sure config.h is included.
2010-10-08 22:46:55 -05:00
Dan Williams 54775f6a64 doc: document wireless-security setting properties 2009-11-11 14:08:15 -08:00
Dan Williams 07cc26d5fc wifi: handle WEP & WPA passphrases (bgo #513820) (rh #441070)
Instead of requiring applets to hash passphrases, just do it in NM instead.
This should fix confusion where people don't understand that they are seeing
their hashed passphrase.
2009-05-09 23:09:42 -04:00
Dan Williams c4a1c49539 libnm-util: don't lowercase LEAP username 2009-03-26 16:58:33 -04:00
Dan Williams b61b199776 libnm-util: flag properties with G_PARAM_CONSTRUCT so default values get set
This caused the 'autoconnect' property of NMSettingConnection to not
get updated in some cases (as when a system setting plugin noticed a
change to autoconnect=true and emitted the Updated signal, which wouldn't
contain the new value).  Add a testcase for setting default values too.
2009-02-01 20:18:21 -05:00
Dan Williams 6bd0fce1c9 libnm-util: validate PSK and LEAP passwords
If they exist, they shouldn't be zero-length.
2009-01-12 10:31:00 -05:00
Dan Williams 3bc8b0ca57 2008-11-20 Dan Williams <dcbw@redhat.com>
* libnm-util/Makefile.am
	  libnm-util/nm-utils-private.h
		- New header for internal utils private functions

	* libnm-util/libnm-util.ver
	  libnm-util/nm-utils.c
	  libnm-util/nm-utils.h
		- Document some functions
		- (nm_utils_string_in_list, nm_utils_string_list_contains,
		   nm_utils_string_slist_validate): un-export, only used within
			libnm-util or of limited use in general, and very easy to
			re-implement by apps if needed

	* libnm-util/nm-setting-8021x.c
	  libnm-util/nm-setting-wired.c
	  libnm-util/nm-setting-wireless-security.c
	  libnm-util/nm-setting-wireless.c
		- Update for private nm_utils_string_* functions



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4319 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-11-20 20:17:01 +00:00
Dan Williams 0d7b805152 2008-10-30 Dan Williams <dcbw@redhat.com>
* libnm-util/libnm-util.ver
	  libnm-util/nm-setting-wireless-security.c
	  libnm-util/nm-setting-wireless-security.h
		- Make properties private and add accessor functions

	* libnm-util/nm-setting-wireless.c
	  src/NetworkManagerAP.c
	  src/nm-device-wifi.c
	  src/supplicant-manager/nm-supplicant-config.c
	  system-settings/plugins/ifcfg-fedora/reader.c
	  system-settings/plugins/ifcfg-suse/parser.c
		- Use wireless security accessors



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4237 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-10-30 14:45:55 +00:00
Dan Williams c438326110 2008-10-27 Dan Williams <dcbw@redhat.com>
Patch from Tambet Ingo <tambet@gmail.com>

	* libnm-util/nm-setting.h
	  libnm-util/nm-setting.c
		- Make properties private and add accessor functions

	* libnm-util/nm-connection.c
	  libnm-util/nm-setting-8021x.c
	  libnm-util/nm-setting-cdma.c
	  libnm-util/nm-setting-connection.c
	  libnm-util/nm-setting-gsm.c
	  libnm-util/nm-setting-ip4-config.c
	  libnm-util/nm-setting-ip6-config.c
	  libnm-util/nm-setting-ppp.c
	  libnm-util/nm-setting-pppoe.c
	  libnm-util/nm-setting-serial.c
	  libnm-util/nm-setting-template.c
	  libnm-util/nm-setting-vpn.c
	  libnm-util/nm-setting-wired.c
	  libnm-util/nm-setting-wireless-security.c
	  libnm-util/nm-setting-wireless.c
	  system-settings/plugins/keyfile/reader.c
	  system-settings/plugins/keyfile/writer.c
		- Use setting accessors



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4228 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-10-27 17:36:18 +00:00
Dan Williams 07541a1eb8 2008-10-20 Dan Williams <dcbw@redhat.com>
* libnm-util/nm-setting-wireless-security.c
		- (verify): accept 'none' as a pairwise cipher with Ad-Hoc WPA connections



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4198 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-10-20 21:39:56 +00:00
Michael Biebl d7940bcb9b Rename private nm_* functions to _nm_*
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4012 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-08-26 09:34:31 +00:00
Dan Williams 281791ac77 2008-07-27 Dan Williams <dcbw@redhat.com>
* libnm-util/*
		- Relicense to LGPLv2+



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3859 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-07-27 20:03:46 +00:00
Dan Williams 05e9de9402 2008-06-12 Dan Williams <dcbw@redhat.com>
Add a GError argument to nm_connection_verify() and nm_setting_verify(),
	and add error enums to each NMSetting subclass.  Each NMSetting subclass now
	returns a descriptive GError when verification fails.



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3751 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-06-12 23:58:08 +00:00
Dan Williams 62cebd438f 2008-03-30 Dan Williams <dcbw@redhat.com>
* libnm-util/nm-setting-wireless-security.c
		- (need_secrets): only require key0 if the transmit key index is also
			0
		- (verify): reject non-NULL but zero-length WEP keys; these are invalid



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3515 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-03-30 14:25:54 +00:00
Dan Williams 6fc5e8143f 2008-03-29 Dan Williams <dcbw@redhat.com>
* libnm-util/nm-setting-8021x.c
	  libnm-util/nm-setting-ip4-config.c
	  libnm-util/nm-setting-vpn-properties.c
	  libnm-util/nm-setting-vpn.c
	  libnm-util/nm-setting-wireless-security.c
	  libnm-util/nm-setting-wireless.c
	  libnm-util/nm-utils.c
	  src/dhcp-manager/nm-dhcp-manager.c
	  src/nm-activation-request.c
	  src/nm-ip4-config.c
	  src/nm-manager.c
	  src/nm-properties-changed-signal.c
	  src/ppp-manager/nm-pppd-plugin.c
	  src/supplicant-manager/nm-supplicant-interface.c
	  src/vpn-manager/nm-vpn-connection.c
		- consistently use nm-dbus-glib-types.h



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3514 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-03-29 21:35:41 +00:00
Dan Williams 70e79d60dd 2008-03-17 Dan Williams <dcbw@redhat.com>
Split the 802.1x bits out of the wireless-security setting so they are
	generalized enough for wired 802.1x to use too.

	* introspection/nm-exported-connection.xml
		- GetSecrets now returns 'a{sa{sv}}' (a hash of settings hashes) instead
			of just a hash of the secrets for one setting

	* libnm-util/nm-setting-wireless-security.c
	  libnm-util/nm-setting-wireless-security.h
		- Remove 802.1x-specific stuff
		- Added leap-username and leap-password properties for old-school LEAP

	* src/nm-device.c
	  src/nm-device.h
		- (connection_secrets_updated_cb): take a list of updated settings names,
			not just one

	* src/supplicant-manager/nm-supplicant-config.c
	  src/supplicant-manager/nm-supplicant-config.h
		- (nm_supplicant_config_add_setting_wireless_security): remove 802.1x
			specific stuff; fix for updated LEAP bits; punt 802.1x stuff
			to nm_supplicant_config_add_setting_8021x()
		- (nm_supplicant_config_add_setting_8021x): add an 802-1x setting to
			the supplicant config

	* src/nm-device-802-11-wireless.c
		- (build_supplicant_config): pass in the 802.1x setting too, if any
		- (real_connection_secrets_updated): take a list of updated settings
			names, not just one

	* src/nm-device-802-3-ethernet.c
	  src/nm-cdma-device.c
	  src/nm-gsm-device.c
		- (real_connection_secrets_updated_cb): take a list of updated settings
			names, not just one

	* src/nm-activation-request.c
	  src/nm-activation-request.h
		- (nm_act_request_class_init): the 'connection-secrets-updated' signal
			now passes a list of updated settings names, not just one
		- (update_one_setting): new function; handle one updated setting
		- (get_secrets_cb): handle multiple settings returned from the
			settings service; have to be careful of ordering here as there are
			some dependencies between settings (ex. wireless-security and 802.1x
			in some cases)

	* src/marshallers/nm-marshal.list
		- new marshaller for connection-secrets-updated signal

	* libnm-util/nm-setting-8021x.c
		- Add back the 'pin' and 'psk' settings, for EAP-SIM and EAP-PSK auth
			methods
		- (verify): a valid 'eap' property is now required

	* libnm-util/nm-connection.c
		- (register_default_settings): add priorities to settings; there are
			some dependencies between settings, and during the need_secrets
			calls this priority needs to be respected.  For example, only the
			wireless-security setting knows whether or not the connection is
			going to use 802.1x or now, so it must be asked for secrets before
			any existing 802.1x setting is
		- (nm_connection_lookup_setting_type): expose

	* libnm-util/nm-setting-wireless.c
		- (verify): should verify even if all_settings is NULL; otherwise won't
			catch the case where there is missing security

	* libnm-util/nm-setting-wireless-security.c
		- Remove everything to do with 802.1x
		- Add old-school LEAP specific properties for username and password
		- (need_secrets): rework LEAP secrets checking
		- (verify): rework for LEAP and 802.1x verification



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3470 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-03-17 19:37:23 +00:00
Dan Williams ba4da641b5 Fix c&p error
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3333 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-02-20 19:32:29 +00:00
Dan Williams 954b5569a8 2007-11-16 Dan Williams <dcbw@redhat.com>
* libnm-util/nm-setting-wireless-security.c
		- (verify_tls, verify_ttls, verify_identity, verify_nai): do some
			minimal verification of EAP methods too
		- (verify): verify phase1 eap methods too



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3096 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2007-11-19 18:13:48 +00:00
Dan Williams 40360167c6 2007-11-12 Dan Williams <dcbw@redhat.com>
Make certs actually work.  The private key is now a secret, and should be
	decrypted when requested by NM.  The private key and phase2 private key
	passwords are no longer interesting to NM because they should be used by
	the settings service to decrypt the private key itself before passing it
	to NM, and hence have been removed as fields.

	* libnm-util/nm-setting-wireless-security.h
	  libnm-util/nm-setting-wireless-security.c
		- Remove private-key-passwd and phase2-private-key-passwd from
			properties
		- (need_secrets_password, need_secrets_eappsk, need_secrets_sim,
		   need_secrets): use property #defines instead strings to keep things
			consistent
		- (need_secrets_tls): if a client certificate is present but no
			private key, request the private key
		- (set_property, get_property, nm_setting_wireless_security_class_init):
			remove private key password stuff, mark private keys as secret

	* src/supplicant-manager/nm-supplicant-settings-verify.c
		- Remove private_key_passwd and private_key2_passwd from opt_table



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3080 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2007-11-13 02:16:00 +00:00
Dan Williams de6ab3b7c7 Group phase2 private key with phase1 private key; handle pre-decrypted private keys
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3074 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2007-11-09 16:18:19 +00:00
Dan Williams 46cac7cfaf 2007-11-08 Dan Williams <dcbw@redhat.com>
* libnm-util/nm-setting-wireless-security.h
	  libnm-util/nm-setting-wireless-security.c
		- Add 'private-key-decrypted' and 'phase2-private-key-decrypted'
			members to 802-11-wireless-security structure.  This should be used
			to indicate that the values in private-key and phase2-private-key
			are already decrypted by the user agent, and that no
			private-key-passwd or phase2-private-key-passwd should be expected.
			It is not meant to be a stored configuration value, but meant to
			be set when the conneciton is sent to NM over dbus.



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3073 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2007-11-08 19:27:28 +00:00
Tambet Ingo 6b79d40a76 2007-11-07 Tambet Ingo <tambet@gmail.com>
Rework NMSetting structures: Move each setting to it's own file.
        Convert to GObject. Remove home grown setting types and use
GTypes.
        Use GObject property introspection for hash conversion,
enumerating
        properties, etc.

        * libnm-util/nm-setting-connection.[ch]
        * libnm-util/nm-setting-ip4-config.[ch]
        * libnm-util/nm-setting-ppp.[ch]
        * libnm-util/nm-setting-vpn.[ch]
        * libnm-util/nm-setting-vpn-properties.[ch]
        * libnm-util/nm-setting-wired.[ch]
        * libnm-util/nm-setting-wireless.[ch]
        * libnm-util/nm-setting-wireless-security.[ch]

        New files, each containing a setting.

        * libnm-util/nm-setting-template.[ch]: A template for creating
        * new
        settings. To use it, just replace 'template' with the new
setting
        name, and you're half-way done.

        * libnm-util/nm-setting.c: Convert to GObject and use GObject
        introspection instead of internal types and tables.

        * libnm-util/nm-connection.c: Adapt the new NMSetting work.

        * libnm-util/nm-param-spec-specialized.[ch]: Implement. Handles
        GValue types defined by dbus-glib for composed types like
collections,
        structures and maps.

        * src/*: The API of NMSetting and NMConnection changed a bit:
        * Getting
        a setting from connection takes the setting type now. Also,
since
        the settings are in multiple files, include relevant settings.



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3068 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2007-11-07 16:06:43 +00:00