Commit Graph

716 Commits

Author SHA1 Message Date
Dan Williams
864db9f9e8 libnm-util: add new compare flags for ignoring various types of secrets
It turns out we need a way to ignore transient (agent-owned or unsaved)
secrets during connection comparison.  For example, if the user is
connecting to a network where the password is not saved, other
changes could trigger a writeout of that connection to disk when
connecting, which would the connection back in due to inotify, and the
re-read connection would then no longer be recognized as the same as
the in-memory connection due to the transient secret which obviously
wasn't read in from disk.

Adding these compare flags allows the code to not bother writing the
connection out to disk when the only difference between the on-disk
and in-memory connections are secrets that shouldn't get written to
disk anyway.
2011-06-07 18:22:48 -05:00
Jiří Klimeš
a70d87d84e trivial: put all prototypes inside G_BEGIN_DECLS and G_END_DECLS 2011-05-31 14:06:13 +02:00
Dan Williams
78ce088843 libnm-util: remove some left-over debugging code 2011-05-26 22:19:35 -05:00
Dan Williams
ef71c5cca1 libnm-util: make VPN secret and data iterators change-safe
Let callbacks add/remove data items and secrets during iteration.
2011-05-20 18:58:35 -05:00
Dan Williams
487cd8a301 libnm-util: fix possible crash passing in NULL secret flags 2011-05-18 17:47:03 -05:00
Dan Williams
7b41be489c libnm-util: allow _ as a valid character for GSM APNs
The ETSI specs state that valid characters are only ASCII alphanumeric
characters, but then state that APNs should generally follow DNS
naming rules.  Well, that means a lot more characters are allowed,
but modems don't like many of them.  So let's slowly allow more
characters as people find ones that actually are used.  The restriction
was originally put in place to disallow spaces, because they
certainly aren't allowed APN characters and modems and the
network puke when they see spaces.
2011-05-17 10:49:44 -05:00
Dan Williams
5deb993ff6 libnm-util: recognize PKCS#8 private keys and check passwords (bgo #649326)
Neither gnutls nor NSS fully support PKCS#8 so we don't have complete
support here, but at least recognize the keys and make an attempt to
check the private key if we can.
2011-05-13 14:22:06 -05:00
Dan Williams
9ff4914ccc libnm-util: fix some GObject Introspection annotations
Unfortunately, GObject Introspection can no longer describe deeper
types, like those inside nested hash tables, which NM uses extensively
for the NMConnection type and other places.  So we have to remove
those descriptions.  But this moves us back into compliance with
GOI annotation formats.
2011-05-10 13:24:07 -05:00
Dan Williams
ab56b8e925 libnm-util: clarify certificate and key argument names
Clarify that these are supposed to be paths in the argument name;
this shouldn't break API as it's just an argument rename.  Helps
users figure out what the argument should be without as much trouble
as 'value', which is what it was before.
2011-05-10 12:44:01 -05:00
Dan Williams
4ae83f2d93 libnm-util: remove unused #include 2011-05-09 13:34:21 -05:00
Dan Williams
07c9de48df libnm-util: fix symbol export checks to catch un-exported ones too
The current check caught stuff in the .ver file that was outdated, but
didn't quite get stuff that was supposed to be exported but wasn't,
in some cases.  Update the regex to ensure that symbols that are
not exported, but that start with "nm_" (and aren't GObject
boilerplate) get flagged during the check.

Update internal code to return to a previous pattern of treating symbols
that start with "_" internal, and expecting symbols that start with
"nm_" to be exported.

Also fixes cases where random glibc symbols would get flagged:

00040ff4 l     O *ABS*  00000000              .hidden _GLOBAL_OFFSET_TABLE_
00041380 l     O .data  00000000              .hidden __dso_handle
000406e8 l     O .dtors 00000000              .hidden __DTOR_END__
0000fbe4 l     F .text  00000000              .hidden __i686.get_pc_thunk.cx
0002f980 l     F .text  00000014              .hidden __stack_chk_fail_local
0000b1e7 l     F .text  00000000              .hidden __i686.get_pc_thunk.bx
00040e60 l     O *ABS*  00000000              .hidden _DYNAMIC
2011-05-05 12:26:17 -05:00
Dan Williams
a2fc80b0ea libnm-util: document nm_utils_ip6_dns_to_gvalue() 2011-05-02 22:54:28 -05:00
Dan Williams
6115ef9f71 libnm-util: add IPv6 DNS <-> GValue functions to symbol filter
Not sure how these weren't there in the first place...
2011-05-02 22:54:28 -05:00
Jiří Klimeš
08fda12858 libnm-util: fix loading/verifying certificates to allow DER format (rh #699591)
The start and end tags '-----BEGIN/END CERTIFICATE-----' was checked first,
which ruled out DER format. This is fixed now and a test is added.
2011-04-28 05:31:15 -04:00
Dan Williams
df511f74f7 build: use -Wundef and fix up cases where stuff wasn't defined (bgo #647157) 2011-04-14 13:19:12 -05:00
Dan Williams
53ed3ab41f libnm-util: constify a variable 2011-04-13 15:52:30 -05:00
Karsten Hopp
38d3f0b181 libnm-util: fix s390 CTC nettype and whitelist ctcprot option (bgo #647578) (rh #641986) 2011-04-12 15:38:08 -05:00
Dan Williams
bc991b8ff2 libnm-util: fix introspection annotation (bgo #646335) 2011-04-02 08:53:43 -05:00
Dan Williams
5b0ef4c201 libnm-util: don't ever deinit crypto methods (bgo #646300)
Because we can't ever know if we're the last user of NSS or gnutls
when nm_utils_deinit() is called, just don't bother deiniting
the crypto providers.  And atexit handlers are generally frowned
upon for the exact same reason.  You never know what library linked
into your process might be also using NSS or gnutls, so basically
if these libraries suck enough to use global data and not reference
count it, just let the data leak.  If we do clean stuff up that
can lead to crashes when other libraries might try to use NSS or
gnutls after the atexit handler or nm_utils_deinit() has been run.

See also:  https://bugzilla.mozilla.org/show_bug.cgi?id=54189#c1
2011-03-31 13:29:19 -05:00
Dan Williams
74a0b1d9d1 libnm-util: verify connection's 'type' setting is actually a base type
By 'base type' I mean a hardware-related type that can actually be used
to activate the connection, like wifi, wired, gsm, cdma, wimax, bluetooth,
etc, but not ipv4, ipv6, 8021x, etc.
2011-03-28 10:40:38 -05:00
Dan Williams
14204ce462 libnm-util: test symbol exports against .ver file 2011-03-21 13:36:43 -05:00
Giovanni Campagna
4480365db7 libnm-glib: introspection annotation fixes (bgo #643011) 2011-03-16 15:25:37 -05:00
Dan Williams
27e7177ec4 libnm-util: add setting accessor helpers (bgo #644746)
Makes code cleaner.
2011-03-15 10:32:42 -05:00
Kjartan Maraas
b224ab8e56 trivial: let g_free and g_strdup handle NULL (bgo #644763) 2011-03-15 00:08:58 -05:00
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