Commit graph

30 commits

Author SHA1 Message Date
Jiří Klimeš 5110fa7811 libnm-{util|glib}: fix headers to be C++ compatible - C_BEGIN_DECLS/C_END_DECLS (rh #592783) 2010-05-18 10:14:59 +02:00
Jirka Klimes 0f0daf7852 core: determine classful IPv4 prefix if no DHCP netmask is provided (bgo #603098) 2010-02-25 16:52:10 -08:00
Dan Williams 8c35e96b60 libnm-util: add nm_utils_rsa_key_encrypt() and fix crypto padding mixups
To be backwards compatible clients need to handle both paths to private
keys and the decrypted private key data, which is what used to get passed
in the private-key and phase2-private-key attributes of the 802.1x setting.
When moving a connection around between system-settings and user-settings,
if the private key is decrypted data, the settings service needs to store
that decrypted data somewhere so that the key can be sent to NM during
the connection process.

But we don't want to store the decrypted private key data, so we have to
re-encrypt it (possibly generating a private key password if one wasn't
sent with the decrypted data) and save it to disk, then send NM a path
to that private key during connection.

To help clients do this, and so that they don't have to carry around
multiple crypto implementations depending on whether they want to use
NSS or gnutls/gcrypt, add a helper to libnm-util.

Furthermore, I misunderstood a bunch of stuff with crypto padding when
writing the encrypt/decrypt functions long ago, so fix that up.  Don't
return padding as part of the decrypted data, and make sure to verify
the padding's expected lengths and values when decrypting.  Many thanks
to Nalin Dahyabhai for pointing me in the right direction.
2009-09-15 16:01:50 -07:00
Dan Winship 90bd1ad5cd Install and fix up libnm-util IPv6 config stuff 2009-07-29 21:34:19 -04:00
Dan Williams ad4d2baec9 Documentation updates
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4333 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-11-24 16:55:37 +00:00
Dan Williams 2328650d2e Documentation fixes
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4328 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-11-23 22:55:03 +00:00
Dan Williams 1f5394567d 2008-11-20 Dan Williams <dcbw@redhat.com>
* libnm-util/nm-utils.c
	  libnm-util/nm-utils.h
		- More documentation updates



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4321 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-11-20 21:07:03 +00: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 567396ad6d 2008-10-30 Dan Williams <dcbw@redhat.com>
* libnm-util/libnm-util.ver
	  libnm-util/nm-setting-ip6-config.c
	  libnm-util/nm-setting-ip6-config.h
	  libnm-util/Makefile.am
		- Make properties private and add accessor functions
		- Hide IPv6 stuff from public API, it's incomplete and completely unused

	* libnm-util/nm-connection.c
	  libnm-util/nm-utils.c
	  libnm-util/nm-utils.h
		- Ignore IPv6 stuff for now



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4240 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-10-30 19:39:51 +00:00
Dan Williams 796829ce62 2008-09-08 Dan Williams <dcbw@redhat.com>
Patch from Alexander Sack <asac@ubuntu.com>

	* libnm-util/crypto_gnutls.c
	  libnm-util/crypto_nss.c
		- (crypto_init, crypto_deinit): just use a boolean instead of a refcount

	* libnm-util/nm-utils.c
	  libnm-util/nm-utils.h
	  libnm-util/libnm-util.ver
		- (nm_utils_init): initialize libnm-util
		- (nm_utils_deinit): de-initialize libnm-util and clean up resources

	* libnm-util/nm-setting-8021x.c
		- (nm_setting_802_1x_class_init): init libnm-util when needed



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4047 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-09-08 18:35:21 +00:00
Dan Williams 81f8f39920 2008-08-26 Dan Williams <dcbw@redhat.com>
Add connection UUIDs, since connection names can be changed, and since
	old-style connection IDs could change over the life of the connection.  The
	UUID should be assigned at connection creation time, be stable for a given
	connection, and should be unique among all connections for a given settings
	service.

	* configure.in
	  libnm-util/Makefile.am
		- Require libuuid

	* introspection/nm-exported-connection.xml
		- Remove "GetID" method

	* libnm-glib/nm-dbus-connection.c
	  libnm-glib/nm-settings.c
	  libnm-glib/nm-settings.h
		- Remove id-related stuff

	* libnm-util/nm-utils.c
	  libnm-util/nm-utils.h
	  libnm-util/libnm-util.ver
		- (nm_utils_uuid_generate, nm_utils_uuid_generate_from_string): Add
			utility functions to generate UUIDs

	* libnm-util/nm-setting-connection.c
	  libnm-util/nm-setting-connection.h
		- Add 'uuid' member to the connection setting
		- (verify): require valid 'uuid' for a valid connection

	* system-settings/plugins/ifcfg-fedora/nm-ifcfg-connection.c
	  system-settings/plugins/ifcfg-fedora/reader.c
	  system-settings/plugins/ifcfg-suse/nm-suse-connection.c
	  system-settings/plugins/ifcfg-suse/parser.c
	  system-settings/plugins/keyfile/nm-keyfile-connection.c
	  system-settings/src/main.c
		- Remove id-related stuff
		- Give connections UUIDs where needed



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4013 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-08-27 02:57:21 +00:00
Dan Williams 0b4d557319 2008-08-18 Dan Williams <dcbw@redhat.com>
* libnm-util/nm-utils.c
	  libnm-util/nm-utils.h
		- (nm_utils_garray_to_string): remove; NM was the only user and doesn't
			export anything that needs to be converted with this function

	* src/dhcp-manager/nm-dhcp-manager.c
		- (garray_to_string): convert a byte array to a UTF-8 string with
			minimal validation; the DHCP client sends it in ASCII anyway
		- (get_option, copy_option): use garray_to_string()



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3985 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-08-18 21:24:31 +00:00
Dan Williams 2c31b5499b 2008-08-06 Dan Williams <dcbw@redhat.com>
* libnm-glib/nm-ip4-config.c
	  libnm-glib/nm-ip4-config.h
		- Add 'routes' property

	* libnm-util/nm-setting-vpn.c
	  libnm-util/nm-setting-vpn.h
		- Remove 'routes' property

	* libnm-util/nm-setting-ip4-config.c
	  libnm-util/nm-setting-ip4-config.h
		- 'ignore-dhcp-dns' renamed to 'ignore-auto-dns'
		- Add 'ignore-auto-routes' property
		- 'routes' exposed over D-Bus is now an array of array of uint (4) to 
			accomodate route metrics
		- 'routes' exposed in C is now a list of NMSettingIP4Route structures

	* libnm-util/nm-utils.c
	  libnm-util/nm-utils.h
		- Add helpers for marshalling IP4 routes

	* src/NetworkManagerUtils.c
		- (nm_utils_merge_ip4_config): handle property renames and new route
			structure

	* src/NetworkManagerSystem.c
		- (nm_system_device_set_ip4_route, nm_system_device_set_from_ip4_config,
		   nm_system_vpn_device_set_from_ip4_config): respect route metrics

	* src/dhcp-manager/nm-dhcp-manager.c
		- (nm_dhcp_manager_get_ip4_config): handle new route structure

	* system-settings/plugins/ifcfg-fedora/reader.c
	  system-settings/plugins/ifcfg-fedora/writer.c
		- Handle routes separately from addresses now that routes have a different
			format

	* introspection/nm-ip4-config.xml
	  src/nm-ip4-config.c
	  src/nm-ip4-config.h
		- Rename internal routing functions
		- 'static-routes' renamed to 'routes'



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3898 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-08-06 22:23:48 +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 06efa3f7b1 2008-07-17 Dan Williams <dcbw@redhat.com>
* libnm-util/nm-utils.c
		- (string_to_utf8): general function for conversion to UTF-8 assisted
			by locale
		- (nm_utils_ssid_to_utf8): use string_to_utf8()
		- (nm_utils_garray_to_string): ensure returned string is UTF-8 safe



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3830 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-07-17 17:15:38 +00:00
Dan Williams e1e4100f76 2008-07-07 Dan Williams <dcbw@redhat.com>
Convert to using IPv4 prefixes instead of netmasks.



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3812 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-07-07 18:57:37 +00:00
Dan Williams 5a516abc4b 2008-06-26 Dan Williams <dcbw@redhat.com>
Patch from David Cantrell <dcantrell@redhat.com> and me

	* include/nm-dbus-glib-types.h
		- Add IP6 address types

	* libnm-util/Makefile.am
	  libnm-util/nm-setting-ip6-config.c
	  libnm-util/nm-setting-ip6-config.h
		- Add IP6 settings object

	* libnm-util/nm-connection.c
		- (register_default_settings): register ip6 settings object

	* libnm-util/nm-utils.c
	  libnm-util/nm-utils.h
		- (nm_utils_ip6_addresses_from_gvalue, nm_utils_ip6_addresses_to_gvalue,
		   nm_utils_ip6_dns_from_gvalue, nm_utils_ip6_dns_to_gvalue): add
			ip6 address conversion functions



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3778 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-06-26 21:30:33 +00:00
Dan Williams b0cf66eda8 2008-06-26 Dan Williams <dcbw@redhat.com>
* Update FSF address in license headers (Michael Biebl <biebl@debian.org>)



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3775 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-06-26 18:31:52 +00:00
Dan Williams 4f421ef874 Fix syntax errors with enums in pedantic mode (Will Stephenson)
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3664 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-05-13 16:57:01 +00:00
Dan Williams 3cbc245395 2008-05-06 Dan Williams <dcbw@redhat.com>
* libnm-util/nm-utils.c
	  libnm-util/nm-utils.h
		- (nm_utils_ip4_addresses_from_gvalue,
		   nm_utils_ip4_addresses_to_gvalue): new functions



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3636 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-05-06 21:41:08 +00:00
Dan Williams 529a246913 2008-03-04 Dan Williams <dcbw@redhat.com>
Patch from Michael Biebl <biebl@debian.org>

	* NetworkManager.pc.in
		- doesn't actually depend on dbus-1

	* libnm-util/nm-utils.h
		- remove unused #include <dbus/dbus.h>

	* libnm-glib/libnm_glib.pc.in
		- depends on glib and dbus-glib



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3374 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-03-04 21:59:24 +00:00
Dan Williams 43395ebab6 Remove old prototype
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3240 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-01-18 02:53:09 +00:00
Dan Williams 773c82f9d1 2007-12-27 Dan Williams <dcbw@redhat.com>
* libnm-util/nm-utils.c
	  libnm-util/nm-utils.h
		- (nm_utils_security_valid): add 'adhoc' argument and handle security
			for adhoc networks



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3195 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2007-12-27 07:17:50 +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
Dan Williams f1409ba595 2007-10-23 Dan Williams <dcbw@redhat.com>
* libnm-util/nm-utils.c
	  libnm-util/nm-utils.h
		- (nm_utils_ap_security_compatible): common function for checking
			whether a specific AP is compatible with an NMConnection



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3001 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2007-10-23 10:54:37 +00:00
Dan Williams 2017cd5c2c 2007-10-17 Dan Williams <dcbw@redhat.com>
* libnm-util/nm-utils.h
	  libnm-util/nm-utils.c
		- (nm_utils_security_valid): common function to help find the intersection
			of capabilities of devices and (optionally) access points



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2987 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2007-10-17 21:40:17 +00:00
Tambet Ingo 83bd445e2e 2007-10-09 Tambet Ingo <tambet@gmail.com>
* libnm-util/nm-utils.c (nm_utils_is_empty_ssid): Convert the
        * ssid type to
        "guint8 *" since it's usually used with GByteArray->data.
        (nm_utils_ssid_to_utf8): Add it back, the applet needs it.




git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2961 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2007-10-09 10:04:07 +00:00
Tambet Ingo 24adbe3fa4 2007-10-09 Tambet Ingo <tambet@gmail.com>
* src/NetworkManagerUtils.c
        (nm_utils_is_empty_ssid):
        (nm_utils_escape_ssid):
        (nm_utils_same_ssid): Remove. These functions are copied and
pasted in a 
        lot of places, so they belong to libnm-utils instead.

        Now with 100% less compiler warnings:

        * libnm-util/nm-utils.c (nm_dbus_escape_object_path): Remove,
        * unused.
        (nm_dbus_unescape_object_path): Ditto.
        (nm_utils_ssid_to_utf8): Ditto.
        (nm_utils_is_empty_ssid): Move here from
src/NetworkManagerUtils.c
        (nm_utils_escape_ssid): Ditto.
        (nm_utils_same_ssid): Ditto.

        * src/nm-manager.c: Include 'netinet/ether.h' for ether_aton_r.
        (add_one_connection_element): Remove an unused variable.
        (impl_manager_get_active_connections): Ditto.

        * src/NetworkManagerPolicy.c (get_device_connection): Remove an
        * unused
        variable.

        * src/nm-dbus-manager.c (nm_dbus_manager_start_service): Remove
        * a leftover
        from the previous commit.

        * src/nm-device-802-11-wireless.c (set_current_ap): Remove
        * unused variable.
        (real_act_stage1_prepare): Ditto.
        (activation_success_handler): Ditto.
        (get_property): Ditto.

        * src/nm-device-802-3-ethernet.c (real_get_best_connection):
        * Remove unused
        variable.

        * src/ppp-manager/nm-pppd-plugin.c (nm_ip_up): Remove the check
        * for 'ifname',
        it's always set.

        * src/supplicant-manager/nm-supplicant-config.c 
        (nm_supplicant_config_add_setting_wireless): Cast the
GByteArray's 'guint8 *'
        to expected "char *".
        (nm_supplicant_config_add_setting_wireless): Ditto.
        (nm_supplicant_config_remove_option): Remove, not used.

        * libnm-glib/libnm-glib-test.c (dump_access_point): Frequency is
        * a guint32,
        not double.
        (test_wireless_enabled): Ifdef out unused function.
        (device_deactivate): Ditto.
        (device_state_changed): Ditto.
        (nm_utils_is_empty_ssid): Remove, it's now in libnm-utils.
        (nm_utils_escape_ssid): Ditto.

        * test/nm-tool.c (nm_utils_escape_ssid): Remove, it's now in
        * libnm-utils.
        (nm_utils_is_empty_ssid): Ditto.

        * libnm-glib/nm-client.c
        * (nm_client_free_active_connection_element): Remove
        unused variable.

        * libnm-util/nm-setting.c (setting_wireless_destroy): Remove
        * unused variable.
        (setting_vpn_properties_update_secrets): Ditto.
        (int_to_gvalue): Ifdef out for now, not used.
        (byte_to_gvalue): Ditto.

        * libnm-util/dbus-dict-helpers.c
        * (_nmu_dbus_add_dict_entry_string_array): 
        Unused, remove.




git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2960 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2007-10-09 08:57:35 +00:00
Dan Williams 336def9492 2007-09-24 Dan Williams <dcbw@redhat.com>
* libnm-util/nm-utils.h
	  libnm-util/nm-utils.c
		- (nm_dbus_send_with_callback_replied, nm_dbus_send_with_callback):
			remove, unused



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2862 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2007-09-24 14:46:05 +00:00
Tambet Ingo 326d1e8679 2007-09-12 Tambet Ingo <tambet@gmail.com>
* src/vpn-manager/nm-vpn-connection.[ch]: 
        * src/vpn-manager/nm-vpn-manager.[ch]:
        * src/vpn-manager/nm-vpn-service.[ch]: Rewrite the vpn handling
        * code. Using 
        dbus-glib, GObjects, signals etc.

        * libnm-glib/nm-vpn-manager.[ch]: 
        * libnm-glib/nm-vpn-connection.[ch]: Now that the NM
        * implementation changed
        so much, rewrite these too.

        * libnm-glib/Makefile.am: Add new files to build, build new
        * binding files for
        the new introspection files.

        * libnm-glib/nm-client.[ch]: Remove all VPN related stuff from
        * here.

        * libnm-glib/nm-dbus-utils.[ch]: Renamed from nm-utils.[ch] that
        * was shadowing
        the header with the same name from libnm-utils.

        * libnm-glib/nm-vpn-plugin.[ch]: Implement.

        * libnm-util/Makefile.am: Add nm-utils.[ch] to build.

        * introspection/nm-vpn-plugin.xml: Implement.

        * introspection/nm-vpn-connection.xml: Implement.

        * introspection/nm-vpn-manager.xml: Implement.

        * src/NetworkManagerSystem.c
        * (nm_system_vpn_device_set_from_ip4_config): Remove
        the named manager argument, it can just as easily get it as the
caller.
        (nm_system_vpn_device_unset_from_ip4_config): Ditto.

        * src/vpn-manager/nm-dbus-vpn.[ch]: Remove.

        * src/nm-dbus-manager.h: Fix up the name_owner signal signature.

        * src/dhcp-manager/nm-dhcp-manager.c (garray_to_string): Remove,
        * use one from
        libnm-utils.

        * libnm-util/nm-connection.c: Ditto.

        * src/NetworkManagerMain.h: Remove, it's finally empty.

        * configure.in: Remove utils/ from build.

        * include/NetworkManagerVPN.h: Add some more defines to reduce
        * the amount
        of hard-coded strings.

        * utils/: Move it over to libnm-util.

        * test/Makefile.am: Link against libnm-util now that util/ is
        * gone.

        * dispatcher-daemon/Makefile.am: Ditto.

        * src/Makefile.am: Ditto.



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2798 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2007-09-12 16:23:53 +00:00