Commit Graph

7740 Commits

Author SHA1 Message Date
Dan Williams
2e2b4373eb core: add ulong data helpers to NMAuthChain
Otherwise callers would have to do the work themselves to ensure that
the top 32 bits of the ulong didn't get chopped off on 32-bit
platorms.
2011-02-11 16:43:03 -06:00
Dan Williams
016c56078d policy: rename HOSTNAME_MODIFY -> MODIFY_HOSTNAME for consistency 2011-02-11 11:32:57 -06:00
Dan Williams
ba8f562836 policy: add a "modify own" permission for single-user-visible connections
This policy will allow users to modify their personal connections (ie
maybe VPN connections, etc) distinctly from system-wide connections that
affect more than just their user.  It makes sense to be more lenient when
making changes to settings that don't affect other users.
2011-02-11 11:31:14 -06:00
Dan Williams
f2c317e3d2 policy: rename "modfiy" permission to "modify system"
Meaning stays the same, but this will allow us to differentiate
in the future between personal connections (ie, just visible to
one user) and system connections (visible to more than one user).
2011-02-11 11:19:02 -06:00
Dan Williams
76467e53e5 libnm-glib-vpn: add some helpers for auth dialogs
The helpers read and return the data items and secrets that the applet
sends to the auth dialog.
2011-02-10 18:48:32 -06:00
Dan Williams
e42e392418 settings: ensure not-saved or not-required VPN secrets don't propagate
We don't want these secrets in the NMSettingsConnection's internal
secrets cache since they shoulnd't ever be read off-disk, and they
should be discarded immedaitely after use.  Similarly, we want to
remove any of these secrets that do come through from a secrets
request that doesn't allow user-interaction, since not-saved secrets
aren't allowed there.
2011-02-10 18:45:13 -06:00
Dan Williams
67051f6445 keyfile: don't write not-saved or not-required VPN secrets
VPN secrets need special handling here since they are in a 3rd
level hash.
2011-02-10 18:43:20 -06:00
Dan Williams
2ec115bb64 vpn: clear secrets after successful activation
We're already connected; shouldn't need secrets again but
if we do, we'll ask for them again.  Fixes an issue where
reconnect would use an old one-time-password.
2011-02-10 18:07:04 -06:00
Dan Williams
ee2c19a64f agents: correctly handle VPN secrets when marking them as not required
We need to iterate through each item in the VPN's 'secrets' property
and mark it as not required, instead of just marking the 'secrets'
property itself as not required.  Yeah, VPN secrets are a bit
annoying.
2011-02-10 11:36:00 -06:00
Dan Williams
9d2889a4a7 agents: send available secrets to the agents
The caller has already taken care of making sure that the
agent is privileged enough to have secrets, so send them along
if the caller gave them to us.
2011-02-10 11:34:35 -06:00
Dan Williams
a6edda0b13 vpn: more logging during secrets requests 2011-02-10 11:34:13 -06:00
Jiří Klimeš
5f6b68862e cli: fix "format not a string literal and no format arguments" cc error
The string could contain printf format sequences.
2011-02-10 16:30:00 +01:00
Jiří Klimeš
83dc4032b7 libnm-glib: fix comment/doc for nm_client_networking_get_enabled() 2011-02-10 15:20:56 +01:00
Jiří Klimeš
f29b709590 cli: improve/add NM running checks
Check whether NetworkManager is running and return new error
NMC_RESULT_ERROR_NM_NOT_RUNNING when appropriate.
2011-02-10 14:39:47 +01:00
Dan Williams
d871512467 ifcfg-rh: handle different connections with the same ID
Since ifcfg-rh uses the connection's ID as the filename by default,
we could run into a situation where two connections with the same
ID are visible to different users.  We don't want one connection
overwriting the other in that case, so we need to pick a new name
for the one we're about to write.
2011-02-09 20:44:27 -06:00
Jiří Klimeš
4242f18fb2 cli: don't poke NetworkManager D-Bus service names when it's not running
When getting status of NetworkManager via 'nmcli nm ...' and NetworkManager
is not running, do not call its D-Bus methods. It prevents NM to be implicitly
executed when configured as D-Bus activated service.
2011-02-10 01:54:04 +01:00
Dan Williams
1f313f36f0 settings: do some basic validate in AddConnection
Like making sure the connection verifies, and making sure the
new connection's UUID is indeed unique.
2011-02-09 18:41:48 -06:00
Dan Williams
db41fe3cf2 settings: add error for already existing UUID 2011-02-09 18:41:17 -06:00
Dan Williams
275e5c5e62 keyfile: handle different connections with the same ID
Since keyfile uses the connection's ID as the filename by default,
we could run into a situation where two connections with the same
ID are visible to different users.  We don't want one connection
overwriting the other in that case, so we need to pick a new name
for one of them.  Append the connection's UUID to the end to
minimize the risk of further conflicts for that name.
2011-02-09 18:09:47 -06:00
Dan Williams
eddc66e36d keyfile: split nm_keyfile_plugin_write_connection()
The non-test function doesn't need to take as many arguments, which
makes the code a lot cleaner to look at in the plugin and connection
subclass.
2011-02-09 17:23:10 -06:00
Dan Williams
f1d0293517 keyfile: trivial code simplification 2011-02-09 17:11:13 -06:00
Dan Williams
d654836c6f keyfile: require a UUID in the connection settings
The connection needs a UUID, period.
2011-02-09 17:07:43 -06:00
Dan Williams
a96b4c5082 keyfile: use nm_connection_get_id() more 2011-02-09 17:07:24 -06:00
Dan Williams
3ea9458016 keyfile: use nm_connection_get_id() and nm_connection_get_uuid() 2011-02-09 16:41:33 -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
Ozan Çağlayan
e9c8ba4e3d trivial: fix RFKILL log domain manpage and help text 2011-02-09 10:56:14 -06:00
Ozan Çağlayan
9049358579 logging: don't print extraneous newline in syslog 2011-02-09 10:52:28 -06:00
Dan Williams
aafe74ee34 vpn: get existing secrets before asking VPN service if we need more
This allows administrators to define VPN connections that use all
or partial system-owned secrets that users aren't allowed to modify.
2011-02-09 00:54:00 -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
b94fb03197 settings: mark secrets as not required if they aren't sent to an agent
If the agent doesn't have privileges for secrets, mark them as not
required to help any UI validation the agent might have to do.
2011-02-07 23:45:19 -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
99766efbdc ifcfg-rh: read and write connection permissions 2011-02-07 18:58:19 -06:00
Dan Williams
007ca5bf1f settings: use new NMSettingConnection permissions helpers 2011-02-07 18:43:08 -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
d8cbecec8b settings: streamline system-owned secret handling during agent requests
Do the check for system-owned secrets once, before kicking off the
request, instead of each time we ask an agent.  As a bonus, this
change ensures priv->secrets doesn't store anything except
system-owned secrets too, simplifying some checks later on.
2011-02-07 13:58:05 -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
382cdfaf1e keyfile: namespace potentially conflicting symbols
Just in case.
2011-02-04 15:59:45 -06:00
Dan Williams
0ba142690a build: make sure nm-secret-agent.xml gets into the tarball 2011-02-02 21:39:03 -06:00
Dan Williams
e2d297e5ff settings: fix loading of keyfile connections
Updating unmanaged specs may cause load_connections() to be called,
and the keyfile plugin needs to be registered before that.
2011-02-02 20:32:15 -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
da47a2add4 ifcfg-rh: recognize WEP connections even if they dont have WEP keys yet
Just because the key isn't saved (ie, the user hasn't entered it yet,
or the user want to type it in every time) doesn't mean the setting isn't
WEP, so recognize it as WEP if DEFAULTKEY or SECURITYMODE is set.
2011-02-02 16:50:58 -06:00
Dan Williams
77239854f4 agents: send system-owned secrets to the agent if it has 'modify' permission
If we can authenticate the agent for 'modify' permission, then send
any existing system secrets to it as the user has permission to change
those secrets.  This means the agent doesn't have to call GetSecrets()
itself, which means simpler code on the agent side for a slight LoC
hit in NM itself.

This also moves the permissions checking into the NMAgentManager to
check each agent, which is sub-optimal since now the agent manager
has to do PolicyKit stuff, but hey that's life.  Agents need secrets,
and we do need to authenticate every agent before we send secrets to
them, and the NMSettingsConnection doesn't know about individual
agents at all.
2011-02-02 16:19:15 -06:00