Commit graph

65 commits

Author SHA1 Message Date
Jiří Klimeš
312c7c952c ifcfg-rh: emit "updated" signal when connection file is changed (rh #727501)
Chain up to parent's commit_changes() even if in-memory and on-disk data are the
same; they are the same when another process changes the on-disk file. Just make
sure not to write out the data needlessly when same.

This fixes a regression caused by 9cba854fa0.
It exhibits e.g. by not auto-activating connection when ONBOOT is changed from
"no" to "yes". Connection "updated" signal was not emitted and listeners like
NMPolicy was not prodded.
2011-08-02 12:18:43 +02:00
Dan Williams
9cdc5021ab keyfile: fix integer list SSID parsing after 30c41a4b80
The regex was capturing integers larger than 3 digits, which aren't
valid SSID integer list items because each byte of the SSID cannot be
larger than 255.  Add an explicit testcase for intlist SSIDs too.
The previous regex was causing a testcase failure with an SSID of
'1337' which it was interpreting as a single element intlist, but
should have been interpreted as a string since it's clear > 255.
2011-07-20 17:44:14 -05:00
Dan Williams
ba390d2430 ifcfg-rh: add testcase for PEAP anonymous identity (rh #708436) 2011-07-18 22:40:45 -05:00
Jiří Klimeš
3c0bf572c4 ifcfg-rh: read IEEE_8021X_ANON_IDENTITY for PEAP too (rh #708436) 2011-07-15 11:28:27 +02:00
Jiří Klimeš
30c41a4b80 keyfile: distinguish better between string x int list formats (bgo #649422)
This commit enhances get_uchar_array() to better differentiate between string
ad integer list formats. This allows using ';' character in SSIDs.
2011-07-07 15:25:11 +02:00
Jiří Klimeš
2f421bc779 keyfile: correct a warning message 2011-07-07 14:50:35 +02:00
Dan Williams
8e929b1e1b ifcfg-rh: fix for three-digit prefixes
The regex only caught prefixes up to 99; anything over that was
truncated to two digits.
2011-07-05 23:27:50 -05:00
Dan Williams
50867cc461 ifcfg-rh: don't try to set a prefix of 0
It's not a valid prefix since NM determines the default routes
automatically, and thus routes and addresses with a prefix of
zero should not be used in config files.
2011-07-05 23:17:14 -05:00
Jiří Klimeš
18b81930ce ifcfg-rh: change MACADDR_BLACKLIST to HWADDR_BLACKLIST (to correspond to HWADDR key) 2011-06-30 17:58:31 +02:00
Jiří Klimeš
b1afd46f65 ifcfg-rh: support "mac-address-blacklist" property in ifcfg-rh plugin
ifcfg-rh plugin now reads/writes the property as MACADDR_BLACKLIST variable.
The variable is space-separated list of MAC addresses in the standard
hex-digits-and-colons notation.
E.g. MACADDR_BLACKLIST="7e:d8:c0:85:58:7f 00:1e:65:30:d5:c7"
2011-06-30 16:46:33 +02:00
Jiří Klimeš
f340c44fed ifcfg-rh: fix an assertion failure and read-after-free error for invalid MACs 2011-06-30 14:52:49 +02:00
Dan Williams
a5850e82bc ifcfg-rh: fix distcheck after c2dbd1f836
IPV6_FAILURE_FATAL is now read and defaults to TRUE for ifcfg files
even if IPv6 is turned off.  That means that if we write a connection
for which NM_SETTING_IP6_CONFIG_MAY_FAIL is FALSE but IPv6 is disabled,
ifcfg-rh won't write out IPV6_FAILURE_FATAL (because IPv6 is disabled
so why bother writing out IPv6-related settings) but on re-read it will
treat the absence of IPV6_FAILURE_FATAL as TRUE/yes.  This leads to
a mismatch between the connection that was written out (which will
have NM_SETTING_IP6_CONFIG_MAY_FAIL=FALSE and no IPV6_FAILURE_FATAL)
and the re-read connection (which will have
NM_SETTING_IP6_CONFIG_MAY_FAIL=TRUE since a missing IPV6_FAILURE_FATAL
is treated as NM_SETTING_IP6_CONFIG_MAY_FAIL=TRUE).
2011-06-20 18:41:56 -05:00
Jiří Klimeš
502548b6ca ifcfg-rh: fix IPV4_FAILURE_FATAL handling and memory leaks, when IPv4 is disabled 2011-06-16 12:30:38 +02:00
Jiří Klimeš
c2dbd1f836 ifcfg-rh: read some more IPv6-related values as well even if IPV6INIT=no
We need to read IPV6_FAILURE_FATAL and other values, even if IPv6 is disabled.
Else the variables would use default values, which may not be right. Then
switching between methods "Ignore" and "Automatic" in a GUI would change value of
IPV6_FAILURE_FATAL property, even if it's not touched explicitly.
2011-06-16 11:14:52 +02:00
Jiří Klimeš
17bc5867dc ifcfg-rh: socket() returns -1 on failure 2011-06-15 10:43:07 +02:00
Jiří Klimeš
6fe22d99f0 ifcfg-rh: fix possible crash when route file creation fails 2011-06-14 17:15:51 +02:00
Dan Williams
9cba854fa0 settings: ensure transient secrets are ignored when rereading connections (rh #703785)
When a connection changes on-disk, the in-memory copy of it may contain
transient secrets (agent-owned or not saved) that dont' get written out
to disk.  When comparing the on-disk copy to the in-memory copy make sure
transient secrets are ignored so that we don't re-read the on-disk copy
needlessly.
2011-06-07 18:39:18 -05:00
Dan Williams
d2ae0bac82 keyfile: better handle cert/key files that don't exist (bgo #649807)
The keyfile code has to handle a few different formats of cert/key values,
and wasn't doing a good enough job of detecting plain paths as values.  By
default the writer will write out a plain path (ie, not prefixed with file://)
and the reader will handle that correctly, *unless* that file does not
exist, at which the reader assumed it was a byte array.  This caused the
read-in keyfile not to match the in-memory connection (since the in-memory
connection though the cert/key held a path, but the read-in one thought it
contained a blob) and this seems to eventually have triggered a write-out
with the new values (as a blob), which would then drop a .pem file into
system-connections/ containing the path that should have been in the
keyfile in the first place.

This all happened because we assumed that the given path for the cert or
key would actually be valid, which doesn't seem to be the case for a lot
of people.  Clearly these connections won't work (since the certificate or
key does not exist) but the keyfile plugin shouldn't be messing up the
connection's settings at the very least.

Fix that by handling the check of whether the cert/key data is a path or
not in a less restrictive manner and add some testcases to make sure that
everything works as we expect.
2011-06-01 16:51:47 -05:00
Dan Williams
0f37efd77b keyfile: write relative cert/key paths too
If the cert/key path is relative to the keyfile then don't
bother writing the absolute path out.  This also prevents the
keyfile plugin from rewriting a relative path to an absolute one,
preventing some annoyance for people that hand-edit keyfiles.
2011-06-01 16:51:47 -05:00
Dan Williams
06ec2a5382 keyfile: convert relative cert/key paths to absolute ones when reading
Passing a relative path to wpa_supplicant does no good since the supplicant
may not have the same working directory as NetworkManager.  Relative paths
used in keyfiles are assumed to be relative to the keyfile itself anyway,
so actually use the absolute path we compute for the cert/key instead of
leaving it relative.
2011-06-01 16:10:58 -05:00
Dan Williams
c1dd530798 keyfile: ignore .pem and .der file changes
Since the keyfile plugin only stores the paths of these files,
we don't really care about what's in them.  We also don't want
to attempt to read them as keyfiles, which produces warnings
in the logs.
2011-06-01 13:26:25 -05:00
Dan Williams
c0387ffbc5 core: treat VPN secrets without flags as system-owned
All non-VPN secrets are considered system-owned if they do not
have any explicitly set secret flags, and this makes VPN secrets
treated the same way.  As part of the import process plugins and
the applet already update secret flags.  This ensures that VPN
secrets are treated consistently throughout the codebase.
2011-05-23 13:45:51 -05:00
Jiří Klimeš
e30287aa84 ifcfg-rh: fix emitting signal for unmanaged specs when removing connection (rh #698202)
The signal was emitted in case the removed connection was managed instead of
for unmanaged connection. Thus the signal had no effect.
That caused incorrect behaviour in case of changing NM_CONTROLLED=no to yes.
That didn't enable the device; only after the file was changed for the second time.
2011-04-20 12:26:20 -04:00
Dan Williams
258912524e ifcfg-rh: fix writing out WPA connection which is changed to open (rh #695604)
We need to remember to clear out keys that aren't getting used since
we're not rewriting the whole ifcfg file.
2011-04-19 15:42:08 -05:00
Jiří Klimeš
0acd1d322b ifcfg-rh: fix some memory leaks in tests (test-ifcfg-rh.c) 2011-04-14 16:57:34 +02:00
Jiří Klimeš
0937b985da ifcfg-rh: fix some memory leaks in ifcfg-rh plugin 2011-04-14 16:56:20 +02:00
Jiří Klimeš
dae8ab9be9 ifcfg-rh: fix memory leaks in tests (test-ifcfg-rh-utils.c) 2011-04-14 12:00:32 +02:00
Jiří Klimeš
92b55e709a ifcfg-rh: fix read-after-free error in reader.c 2011-04-14 11:41:55 +02:00
Jiří Klimeš
b7b5599fb3 ifcfg-rh: add testcases for IPv4 manual addresses 2011-04-14 10:53:26 +02:00
Jiří Klimeš
ccd39a8cb9 ifcfg-rh: adjust handling IPADDRn, PREFIXn (NETMASKn) and GATEWAYn (rh #658907)
Now that initscripts also support IPADDRn syntax, update the implementation
to match the intitscripts' one (see rh #633984)
Basically, writer produces IPADDR0 .. IPADDR255. reader is more tolerant and
supports older configs too: IPADDR, IPADDR0, IPADDR1 could be missing, from
IPADDR2 up the indexes have to be contiguous.
2011-04-14 10:30:51 +02:00
Dan Williams
d90e6423c8 ifcfg-rh: fix up s390 CTC adapter reading and writing (bgo #647578) (rh #641986) 2011-04-12 15:38:47 -05:00
Dan Williams
5af6a4baec ifcfg-rh: add testcase for S390 CTC-type connections (bgo #647578) (rh #641986) 2011-04-12 15:03:09 -05:00
Dan Williams
6cbb44bc97 ifcfg-rh: fix some missing tests in tarball
The tests were missing, and because of the way the test was structured,
the tests passed.
2011-03-21 17:44:47 -05:00
Mu Qiao
8d60cafd18 ifnet: fix tests and distcheck 2011-03-17 11:05:46 -05:00
Mu Qiao
08b2fa5401 ifnet: plugin updates and shared connection support 2011-03-16 15:39:13 -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
af7e26b39a ifcfg-rh: fix reading and writing of Dynamic WEP with EAP-LEAP connections
These are distinct from old-school LEAP (ie, Network EAP) in that
they are standard Dynamic WEP with LEAP as an EAP method and use
open-system authentication.  Old LEAP uses the non-standard LEAP
authentication algorithm.  The config for each is different and thus
we need to make sure we handle both cases.
2011-03-14 00:25:14 -05:00
Dan Williams
eaeb43bfad keyfile: ignore temp files ending with ~ 2011-03-13 23:59:09 -05:00
Michael Biebl
8119ecf6b0 core: depend on stable gudev API 2011-03-10 03:19:27 -06:00
Dan Williams
5c260cfe4a keyfile: trivial whitespace fixes 2011-03-08 10:19:01 -06:00
Jiří Klimeš
c207d020f7 core: use nm_connection_get_id() and nm_connection_get_uuid() to simplify code 2011-03-08 13:41:28 +01:00
Jiří Klimeš
78b1260af4 ifcfg-rh: fix testcases now that timestamps are no longer written
Timestamps are no longer written to the connection file itself, but
are kept in a lookaside file in /var to allow for read-only or
stateless /etc and to ease system administration and deployment.
2011-03-08 11:58:00 +01:00
Jiří Klimeš
2e3e171171 ifcfg-rh: get rid of LAST_CONNECT
timestamps are now kept in /var/log/NetworkManager/timestamps
2011-03-08 11:49:49 +01:00
Michael Biebl
f2f406b316 ifupdown: normalize keys using - or _ (debian #609831) 2011-03-07 09:57:05 -06:00
Daniel Trebbien
96044f7d94 ifupdown: use new logging API 2011-03-05 00:02:43 -06:00
Dan Williams
5bce4adfbb ifcfg-rh: clean up temporary testcase certificates files (fixes distcheck) 2011-03-03 19:15:49 -06:00
Dan Williams
9e45d7c8cb ifcfg-rh: test writing TLS secret flags and reading them back in 2011-03-03 18:37:33 -06:00
Dan Williams
e165511ed8 ifcfg-rh: fix handling of private key password secret flags 2011-03-03 17:32:29 -06:00