Commit Graph

33 Commits

Author SHA1 Message Date
Dan Williams
04cb58eacd core: convert the DBus manager to a single-ref object
It's created very, very early and never needs to be unrefed
by anything except the main() function.
2013-05-20 16:38:33 -03:00
Dan Williams
72bdb5707e auth: move common nm_dbus_manager_get_caller_info() functionality into nm_auth_chain_new()
Most callers of nm_auth_chain_new() call nm_dbus_manager_get_caller_info()
right before that, so just fold the get_caller_info() call into
nm_auth_chain_new() to reduce code complexity in callers.  Yes, this
means sometimes we call nm_dbus_manager_get_caller_info() twice,
but that's not really a problem.
2013-04-08 10:55:38 -05:00
Dan Williams
b389ad3141 core: remove unused argument to nm_auth_chain_new() 2013-04-08 10:55:38 -05:00
Dan Williams
050f4b761e core: assume root always has a session for connection visibility
Normally, users which are not part of a login session can't access
connections.  Root won't always be part of a login session, so
allow root to bypass visibility checks.  The code already bypassed
the ACL checks for root, but in multiple places.  Consolidate those
checks into one function.
2013-04-08 10:55:38 -05:00
Dan Williams
80f8fce675 core: remove unused auth functions
Functionality moved to NMDBusManager.
2013-04-08 10:55:37 -05:00
Dan Williams
0621de7d48 core: use same codepaths for root and non-root during authentication
Instead of doing something like

<get caller UID>
if (root) {
   perform_operation()
   other boilerplate stuff
   return;
}

nm_auth_chain_new(perform_operation)
...

just have root also go through the auth chain, which is now
short circuited for root.  This ensures we always use the same
code paths for root and non-root, and that fixes made in one path
are also executed for the other.
2013-04-08 10:55:37 -05:00
Dan Williams
1fec50cc1e core: push PolicyKit unavailable error to callers instead of logging it
The error is now pushed to things that request PK auth so that we don't
lose it, because we don't want to unconditionally log it from NM, but
still want things to know that their request couldn't be fulfilled
because PK wasn't running.
2013-04-08 10:55:37 -05:00
Dan Williams
da79a01b12 core: simplify auth chain early exit
Don't create a GError with a domain of 0, which causes a glib warning,
and make it clearer when we're early-finishing with an error and when
we're not.
2013-04-08 10:55:37 -05:00
Thomas Graf
5b7503e95e core: use nm_connection_get_setting_<type>() whenever possible
Leads to shorter, easier to read code and improves type casting safety.

Signed-off-by: Thomas Graf <tgraf@redhat.com>
2011-12-06 16:06:43 -06:00
Dan Williams
c08279dff4 core: add nm_auth_chain_steal_data()
New function for removing data from the auth chain without
destroying it.
2011-07-01 15:38:38 -05:00
Dan Williams
937970f60c core: allow multiple authority changed callbacks
We'll need this later; just keep all registered callbacks
in a list and track them by func/data.
2011-07-01 15:38:38 -05:00
Dan Williams
db6638623b core: don't schedule authentication requests twice
If an error occurred, or PolicyKit is disabled, we don't want to
schedule two idle handlers to return the result of an authentication
request.  We'll soon be queuing up multiple requests at the same
time so we don't want this to happen.
2011-07-01 15:38:38 -05:00
Dan Williams
987a132c12 core: clean up auth handling after polkit enable/disable changes
Slash and burn the #ifdef jungle so that the flow and blocks are
cleaner and less confusing to follow.
2011-05-20 11:35:24 -05:00
Dan Williams
82d83af5ae core: rename PolkitCall to AuthCall 2011-05-20 10:55:24 -05:00
Dan Williams
b6a63ff025 core: allow build-time enable/disable of PolicyKit
When PK is turned off, everything is authorized.
2011-05-18 22:38:39 -05:00
Dan Williams
f79dcb9560 core: consolidate PolicyKit code
Use one global PolkitAuthority object; we only really need to use it
in one place anyway.  So consolidate the code that uses polkit into
nm-manager-auth.c.
2011-05-18 22:20:24 -05:00
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
4ff0b5f0b7 core: add method to start authentication with a D-Bus sender 2011-02-02 12:17:26 -06:00
Dan Williams
ffb808f4c4 core: fix possible leak in error path 2010-12-10 10:46:09 -06:00
Dan Williams
47eaf97d67 core: add nm_auth_uid_in_acl()
For checking whether a specific user ID is:
  1) in a known session
  2) allowed by the connection's permissions ACL
2010-11-18 13:49:47 -06:00
Dan Williams
eccca738aa core: make nm_auth_get_caller_uid() error description non-const
For consistency with the next commit, so we don't need to remember
when to free the description or not.
2010-11-18 13:47:04 -06:00
Dan Williams
1064397904 core: add helper to access authentication result 2010-11-17 16:56:34 -06:00
Dan Williams
39ed9c2956 core: get D-Bus manager during auth if not provided 2010-10-26 11:00:30 -05:00
Dan Williams
022d8e665c Merge remote branch 'origin/master' into gsoc 2010-08-26 09:18:37 -05:00
Dan Williams
f917852de3 core: validate Enable/Disable WiFi and WWAN requests (rh #626337)
Since these were properties they are harder to validate the caller as
dbus-glib doesn't have any hooks before the property is set.  So we
install a low-level dbus filter function to catch property Set
requests before they get to dbus-glib and handle the property access
there.
2010-08-25 15:12:32 -05:00
Daniel Gnoutcheff
5fda5283b9 core: remove internal API refs. to user settings
Remove all references to connection scope and user-settings services
from the various internal APIs of the daemon. The external DBus API
remains unchanged, albeit in stub form for scope stuff.
2010-08-06 13:05:46 -04:00
Dan Williams
6cbe50ffbd core: add nm_auth_uid_authorized() to check user permissions
Basically cleaned up is_user_request_authorized() from nm-manager.c.
2010-06-03 23:04:10 -07:00
Dan Williams
78c4e0798e core: check permissions on the user settings service too
And if the permissions change, make sure we allow or deny user
settings connections as appropriate.
2010-06-03 13:03:07 -07:00
Dan Williams
a08227525c core: simplify auth chain permission callback handling 2010-06-02 02:16:14 -07:00
Dan Williams
3b6917f74b core: make nm_auth_is_caller_root() more generic 2010-05-31 09:45:26 -07:00
Dan Williams
41faf87b0e core: root can always enable/disable and sleep/wake 2010-05-30 08:30:37 -07:00
Dan Williams
c013490ba3 core: PolicyKit-protect enable/disable networking method 2010-05-29 23:00:46 -07:00
Dan Williams
716a9c6c0d core: add permissions framework for various operations (rh #585182) (bgo #619323) 2010-05-28 18:23:00 -07:00