Commit Graph

992 Commits

Author SHA1 Message Date
Kjartan Maraas
c2b4b9c1d7 build: fix return types (bgo #644665)
Some functions were returning FALSE or 0 instead of NULL.
2011-03-14 01:05:51 -05:00
Kjartan Maraas
6d0d302916 build: do the right thing with config.h (bgo #644664)
1) it shouldn't be included in headers
2) it should be the first thing included in source files
3) it's needed for getting translation right
2011-03-14 01:01:22 -05:00
Dan Williams
368fb861f8 libnm-util: use WiFi enums more consistently 2011-03-11 09:26:21 -06:00
Dan Williams
0a24c81151 libnm-util: fix some documentation issues 2011-03-10 12:28:59 -06:00
Dan Williams
72dac886a7 libnm-util: allow setting-only hashes with nm_connection_update_secrets()
It's easier to be able to pass both a whole hashed connection, or just
a hashed setting to the function, and have it figure out what needs
to be updated based on the given setting_name.

Add some testcases to make sure that all works correctly too.
2011-03-09 09:31:44 -06:00
Jiří Klimeš
28cf83fe94 trivial: fix description of nm_connection_get_id() 2011-03-08 13:50:36 +01:00
Dan Williams
8b8e3fa605 libnm-util: conditionalize code that requires glib 2.26 or later 2011-03-07 10:30:09 -06:00
Dan Williams
8bcb053153 libnm-util: fix misspelling in property documentation 2011-03-04 13:49:34 -06:00
Dan Williams
28e6523b8d libnm-util: rework certificate and private key handling
First, it was not easily possible to set a private key without
also providing a password.  This used to be OK, but now with
secret flags it may be the case that when the connection is read,
there's no private key password.  So functions that set the
private key must account for NULL passwords.

Unfortunately, the crytpo code did not handle this case well.
We need to be able to independently (a) verify that a file looks
like a certificate or private key and (b) that a given password
decrypts a private key.  Previously the crypto code would fail
to verify the file when the password was NULL.

So this change fixes up the crytpo code for a more distinct
split between these two operations, such that if no password is
given, the file is still checked to ensure that it's a private
key or a certificate.  If a password is given, the password is
checked against the private key file.

This commit also changes how private keys and certificates were
handled with the BLOB scheme.  Previously only the first certificate
or first private key was included in the property data, while now
the entire file is encoded in the data.  This is intended to fix
cases where multiple private keys or certificates are present in
a PEM file.  It also allows clients to push certificate data to
NetworkManager for storage in system settings locations, which was
not as flexible before when only part of the certificate or key
was sent as the data.
2011-03-02 12:00:47 -06:00
Dan Williams
8a5916afdb libnm-util: fix parameter name for docs generator 2011-02-28 11:29:50 -06:00
Dan Williams
125540471b core: don't require serial and PPP settings for mobile broadband
If they are there, use them.  If not, make them up on the fly.
2011-02-25 11:24:20 -06:00
Dan Williams
07b9660263 libnm-util: simplify nm_setting_update_secrets()
Don't touch tmp_error after we've freed it; it's not actually
a problem since we're not dereferencing tmp_error, but it's
cleaner this way.
2011-02-23 19:36:17 -06:00
Dan Williams
eab5851145 libnm-util: remove nm_warning/nm_info/nm_error macros
Clients need to do their own logging using glib or whatever; these
macros while somewhat helpful were not flexible and are not a
substitute for actual logging in the client.  g_warning, g_message,
and g_error are more suitable anyway.
2011-02-23 11:42:04 -06:00
Dan Williams
7ef0f0fc64 trivial: fix up spacing in nm-utils.h 2011-02-23 11:31:25 -06:00
Dan Williams
b599e3e5dc libnm-util: simplify nm_utils_ssid_to_utf8()
It's always used with a GByteArray anyway, as are most
functions in nm-utils.h.  Even better, we can skip the
memcpy since it turns out to be pointless.
2011-02-23 11:24:58 -06:00
Dan Williams
54918e32e4 libnm-util: add nm_connection_diff()
Returns a list of keys that differ between the settings in each
connection.  nm_connection_compare() can't do that.
2011-02-22 23:36:43 -06:00
Giovanni Campagna
e77acd43b6 libnm-glib: more GObject introspection fixes (bgo #181415)
Fix some annotations and add the necessary ones for new functions.
2011-02-21 18:11:21 -06:00
Dan Williams
8bc774fe16 libnm-util: remove VPNIterFunc backwards compat define 2011-02-21 18:04:49 -06:00
Dan Williams
65e6f27276 libnm-util: fix description of bluetooth setting type property
DUN certainly is supported these days...
2011-02-18 11:23:21 -06:00
Dan Williams
1574112e62 libnm-util: clarify WiMAX network-name property description 2011-02-16 22:39:38 -06:00
Dan Williams
b6c436d8d7 libnm-util: reject detail in permissions for now
Already did this in the permissions accessors, this mirrors that
behavior in the GObject property setters.
2011-02-13 00:21:41 -06:00
Dan Williams
4475c79b00 libnm-util: bump soname to indicate ABI break 2011-02-12 23:24:30 -06:00
Dan Williams
6d344a43e9 Merge remote-tracking branch 'origin/rm-userset'
There; it's merged.  Yay!
2011-02-12 22:51:12 -06:00
Dan Williams
e08db5cae5 libnm-util: warn if trying to set NULL VPN secrets 2011-02-12 22:37:33 -06:00
Dan Williams
d61a312ca2 libnm-util: make sure NULL secrets don't slip in via g_object_set()
We already do this for nm_setting_vpn_add_secret()
2011-02-12 22:26:48 -06:00
Dan Williams
2ef55166c8 libnm-util: fix parsing permission if it includes detail 2011-02-11 23:05:53 -06:00
Dan Williams
c5235f87db libnm-util: add connection helpers for ID and UUID
Shortcuts.  Getting the ID and UUID is used in a ton of places
and this helps cut down on code.
2011-02-09 16:34:42 -06:00
Dan Williams
09d608b99c trivial: more spacing cleanups 2011-02-09 16:30:30 -06:00
Dan Williams
be628d9f9b trivial: spacing cleanups 2011-02-09 16:28:57 -06:00
Dan Williams
b04d9e4675 libnm-util: assume VPN connections need secrets
Because most of the time they will.  They need special handling all
around anyway because only the VPN plugin itself knows whether the
connection needs secrets.
2011-02-09 00:52:47 -06:00
Dan Williams
d7a86ffd04 libnm-util: fix VPN update_one_secret()
The old function took a string value, which wasn't really correct as
the property type is a GHashTable of string:string.  For whatever
reason this is how nm-applet passed VPN secrets back to NM in the return
from the GetSecrets() D-Bus call.  This was probably easier or
something but it was a special case that's magic and quite unclear.

Since we use nm_connection_update_secrets() more these days, and we
depend on the GValue types we pass into it matching the property
types of the setting property the secret is for, we need to fix that
up for VPN connections.  But keep the old code for backwards
compatibility.

In the future secret agents should pass back VPN secrets in the same
form as the VPN setting specifies them for the "secrets" property:
a GHashTable of string:string.  But the old mechanism of just dumping
the key/value pairs into the returned VPN hash as string:string will
still work.
2011-02-08 20:12:55 -06:00
Dan Williams
bad3377131 libnm-util: update CDMA, GSM, and PPPoE settings for NOT_REQUIRED secrets 2011-02-07 19:16:54 -06:00
Dan Williams
1c97de837a libnm-util: rework permissions helpers to be more useful
Add add/remove helpers, and make get more useful by actually breaking
down the specifics for us.
2011-02-07 18:35:48 -06:00
Dan Williams
75a1ab9a43 libnm-util: add utility functions for adding/removing permissions 2011-02-07 17:24:50 -06:00
Dan Williams
ac208cafbd libnm-util: add NM_SETTING_SECRET_FLAG_NOT_REQUIRED
Not all connections will require every secret, and sometimes we
can't automatically figure out whether we need the secret.  For
vpnc sometimes the group password isn't used, and sometimes PPP
providers require a username but don't want a password, etc.
2011-02-07 13:50:40 -06:00
Dan Williams
ad56cfa914 libnm-util: don't return empty hashes from nm_setting_to_hash() 2011-02-07 13:44:28 -06: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
2e0fb2ae4e libnm-util: private keys are now required for TLS connections to verify
Since private keys are no longer secret, they must be given in the
connection itself.
2011-02-02 19:32:30 -06:00
Dan Williams
a5103bf234 libnm-util: silently ignore non-secrets when updating connection secrets 2011-02-02 17:25:56 -06:00
Dan Williams
c36c81e2b9 libnm-util: fix updating secrets
Broken by 5dd4f1ea01
2011-02-02 17:18:50 -06:00
Dan Williams
fb033b0f05 libnm-util: fix setting property iteration when getting secret flags
g_object_class_find_property() needs the object's class, not the
object itself.
2011-02-02 11:58:19 -06:00
Jiří Klimeš
9f28308460 libnm-util: make NM_SETTING_IP4_CONFIG_DHCP_SEND_HOSTNAME property TRUE by default (rh #488975)
That lets NM send a hostname to DHCP server without requiring the user
editing the parameter manually (there no GUI for this either).
2011-02-01 16:47:04 +01:00
Dan Williams
c4ada67108 libnm-util: simplify nm_connection_for_each_setting_value()
And use less memory as a bonus.
2011-01-31 21:53:16 -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
092a6535e0 libnm-util: add generic functions for getting/setting secret flags
And remove the VPN-specific ones.  It's useful to have this stuff be
generic and the functionality wasn't really VPN-specific anyway.
2011-01-31 12:41:54 -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
5a14d17792 libnm-util: remove 802.1x PSK functions and defines
There was never a property for it anyway, so it never got serialized
across D-Bus, because it was folded into the "password" property in
wpa_supplicant between 0.5 and 0.6.
2011-01-28 13:48:54 -06:00
Dan Williams
d2329ef5f7 libnm-util: remove deprecated 802.1x cert blob functions 2011-01-27 18:45:21 -06:00
Dan Williams
89fcc757a4 libnm-util: remove deprecated GSM bits 2011-01-27 18:38:45 -06:00