<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/NetworkManager.git/src/nm-auth-utils.c, branch lr/python3</title>
<subtitle>gitlab.freedesktop.org: NetworkManager/NetworkManager.git
</subtitle>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/NetworkManager.git/'/>
<entry>
<title>core: add nm_auth_is_subject_in_acl_set_error() helper</title>
<updated>2018-04-18T05:55:15+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2018-04-12T07:34:40+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/NetworkManager.git/commit/?id=f94167d8b1f94e59fb04f711cb999f380b083314'/>
<id>f94167d8b1f94e59fb04f711cb999f380b083314</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>auth-chain: create data-hash hashtable only when needed</title>
<updated>2018-04-13T07:09:46+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2018-04-10T12:38:14+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/NetworkManager.git/commit/?id=04a42e2748478a6f6c204f94c7c83fa2c9b8dbd9'/>
<id>04a42e2748478a6f6c204f94c7c83fa2c9b8dbd9</id>
<content type='text'>
It makes sense to use NMAuthChain also when not attaching any user-data to
the chain. The main reason would be, the ability to schedule multiple permission
checks in parallel, and wait for them to complete together.

Only allocate the hash-table, when we really need it.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
It makes sense to use NMAuthChain also when not attaching any user-data to
the chain. The main reason would be, the ability to schedule multiple permission
checks in parallel, and wait for them to complete together.

Only allocate the hash-table, when we really need it.
</pre>
</div>
</content>
</entry>
<entry>
<title>auth-chain/trivial: rename data field in NMAuthChain</title>
<updated>2018-04-13T07:09:46+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2018-04-10T12:34:30+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/NetworkManager.git/commit/?id=457b08bbb6a0b19ecc05af57f8cb29ee974c8fe9'/>
<id>457b08bbb6a0b19ecc05af57f8cb29ee974c8fe9</id>
<content type='text'>
We already use "data" for other places. Let's use unique names
that can be searched within one file.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We already use "data" for other places. Let's use unique names
that can be searched within one file.
</pre>
</div>
</content>
</entry>
<entry>
<title>auth-chain: drop logging in NMAuthChain when request fails</title>
<updated>2018-04-13T07:09:46+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2018-04-09T16:48:05+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/NetworkManager.git/commit/?id=87227038924ecce336f8605eaed034b5b22d1b7c'/>
<id>87227038924ecce336f8605eaed034b5b22d1b7c</id>
<content type='text'>
For one, we already do &lt;trace&gt; level logging inside NMAuthManager.
So, at trace level we have everything.

If a request fails, it's not up to NMAuthChain to log a warning.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
For one, we already do &lt;trace&gt; level logging inside NMAuthManager.
So, at trace level we have everything.

If a request fails, it's not up to NMAuthChain to log a warning.
</pre>
</div>
</content>
</entry>
<entry>
<title>auth-manager: add helper function nm_auth_call_result_eval()</title>
<updated>2018-04-13T07:09:46+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2018-04-09T15:03:58+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/NetworkManager.git/commit/?id=f0bddb44e03aed9d9ca8be0bf63d46dd7ebda15c'/>
<id>f0bddb44e03aed9d9ca8be0bf63d46dd7ebda15c</id>
<content type='text'>
This makes NMAuthCallResult not only usable from within a NMAuthChain.
It makes sense to just call nm-auth-manager directly, but then we need
a way to convert the more detailed result into an NMAuthCallResult
value.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This makes NMAuthCallResult not only usable from within a NMAuthChain.
It makes sense to just call nm-auth-manager directly, but then we need
a way to convert the more detailed result into an NMAuthCallResult
value.
</pre>
</div>
</content>
</entry>
<entry>
<title>auth-manager: let NMAuthChain always call to NMAuthManager for dummy requests</title>
<updated>2018-04-13T07:09:46+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2018-04-09T14:04:46+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/NetworkManager.git/commit/?id=798b2a7527bddadcec37b48183da313fbc961e45'/>
<id>798b2a7527bddadcec37b48183da313fbc961e45</id>
<content type='text'>
NMAuthChain's nm_auth_chain_add_call() used to add special handling for
the NMAuthSubject. This handling really belongs to NMAuthManager for two
reasons:
 - NMAuthManager already goes through the effort of scheduling an idle
   handler to handle the case where no GDBusProxy is present. It can
   just as well handle the special cases where polkit-auth is disabled
   or when we have internal requests.
 - by NMAuthChain doing special handling, it makes it more complicated
   to call nm_auth_manager_check_authorization() directly. Previously,
   the NMAuthChain had additional logic, which means you either were
   forced to create an NMAuthChain, or you had to reimplement special
   handling like nm_auth_chain_add_call().
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
NMAuthChain's nm_auth_chain_add_call() used to add special handling for
the NMAuthSubject. This handling really belongs to NMAuthManager for two
reasons:
 - NMAuthManager already goes through the effort of scheduling an idle
   handler to handle the case where no GDBusProxy is present. It can
   just as well handle the special cases where polkit-auth is disabled
   or when we have internal requests.
 - by NMAuthChain doing special handling, it makes it more complicated
   to call nm_auth_manager_check_authorization() directly. Previously,
   the NMAuthChain had additional logic, which means you either were
   forced to create an NMAuthChain, or you had to reimplement special
   handling like nm_auth_chain_add_call().
</pre>
</div>
</content>
</entry>
<entry>
<title>auth-manager: always compile D-Bus calls to polkit</title>
<updated>2018-04-13T07:09:46+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2018-04-09T16:13:28+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/NetworkManager.git/commit/?id=41abf9f8e81423eff0ef888d17a5454d0b5750bf'/>
<id>41abf9f8e81423eff0ef888d17a5454d0b5750bf</id>
<content type='text'>
Supporting PolicyKit required no additional library, just extra code
to handle the D-Bus calls. For that, there was a compile time option
to even stip out that code. Note, that you could (and still can)
configure the system not to use policy-kit. The point was to reduce
the binary size in case you don't need it.

Remove this. I guess, we we aim for such aggressive optimization of
the binary size, we should instead make all device types disablable
at configuration time. We don't do that either and other low hanging
fruits, because it's better to always enable features, unless they
require external dependencies.

Also, the next commit will make more use of NMAuthManager. So, having
it disabled at compile time, makes even less sense.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Supporting PolicyKit required no additional library, just extra code
to handle the D-Bus calls. For that, there was a compile time option
to even stip out that code. Note, that you could (and still can)
configure the system not to use policy-kit. The point was to reduce
the binary size in case you don't need it.

Remove this. I guess, we we aim for such aggressive optimization of
the binary size, we should instead make all device types disablable
at configuration time. We don't do that either and other low hanging
fruits, because it's better to always enable features, unless they
require external dependencies.

Also, the next commit will make more use of NMAuthManager. So, having
it disabled at compile time, makes even less sense.
</pre>
</div>
</content>
</entry>
<entry>
<title>auth-manager: rework auth-manager's API</title>
<updated>2018-04-13T07:09:46+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2018-04-09T11:27:03+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/NetworkManager.git/commit/?id=2ea2df3184d45567fa9c44f5ef90634a779bfb75'/>
<id>2ea2df3184d45567fa9c44f5ef90634a779bfb75</id>
<content type='text'>
Don't use the GAsyncResult pattern for internal API of auth-manager. Instead,
use a simpler API that has a more strict API and simpler use.

- return a call-id handle when scheduling the authorization request.
  The request is always scheduled asynchronsously and thus call-id
  is never %NULL.
- the call-id can be used to cancel the request. It can be used exactly
  once, and only before the callback is invoked.
- the async keeps the auth-manager alive. It needs to do so, because
  when cancelling the request we might not yet be done: instead we
  might still need to issue a CancelCheckAuthorization call (which
  we need to handle as well).
- the callback is always invoked exactly once.

Currently NMAuthManager's API effectivly is only called by NMAuthChain.
The point of this is to make NMAuthManager's API more consumable, and
thus let users use it directly (instead of using the NMAuthChain layer).

As well known, we don't do a good job during shutdown of NetworkManager
to release all resources and cancel pending requests. This rework also
makes it possible to actually get this right. See the comment in
nm_auth_manager_force_shutdown(). But yes, it is still a bit complicated
to do a controlled shutdown, because we cannot just synchronously
complete. We need to issue CancelCheckAuthorization D-Bus calls, and
give these requests time to complete. The new API introduced by this patch
would make that easier.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Don't use the GAsyncResult pattern for internal API of auth-manager. Instead,
use a simpler API that has a more strict API and simpler use.

- return a call-id handle when scheduling the authorization request.
  The request is always scheduled asynchronsously and thus call-id
  is never %NULL.
- the call-id can be used to cancel the request. It can be used exactly
  once, and only before the callback is invoked.
- the async keeps the auth-manager alive. It needs to do so, because
  when cancelling the request we might not yet be done: instead we
  might still need to issue a CancelCheckAuthorization call (which
  we need to handle as well).
- the callback is always invoked exactly once.

Currently NMAuthManager's API effectivly is only called by NMAuthChain.
The point of this is to make NMAuthManager's API more consumable, and
thus let users use it directly (instead of using the NMAuthChain layer).

As well known, we don't do a good job during shutdown of NetworkManager
to release all resources and cancel pending requests. This rework also
makes it possible to actually get this right. See the comment in
nm_auth_manager_force_shutdown(). But yes, it is still a bit complicated
to do a controlled shutdown, because we cannot just synchronously
complete. We need to issue CancelCheckAuthorization D-Bus calls, and
give these requests time to complete. The new API introduced by this patch
would make that easier.
</pre>
</div>
</content>
</entry>
<entry>
<title>auth-chain: avoid another idle-call when auth-request completes</title>
<updated>2018-04-13T07:09:46+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2018-04-09T10:36:06+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/NetworkManager.git/commit/?id=290d02536c237cd14f187611e72e5fc0b52c81a7'/>
<id>290d02536c237cd14f187611e72e5fc0b52c81a7</id>
<content type='text'>
NMAuthChain schedules (possibly) multiple authentication requests.
When they all complete, it will once invoke the result-callback.

There is no need to schedule this result-callback on another idle-handler,
because nm_auth_manager_polkit_authority_check_authorization() should guarantee
to invoke the callback never-synchronously and on a clean call-stack (to avoid
problems with re-entrancy). At that point, NMAuthChain does not need to
delay this further.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
NMAuthChain schedules (possibly) multiple authentication requests.
When they all complete, it will once invoke the result-callback.

There is no need to schedule this result-callback on another idle-handler,
because nm_auth_manager_polkit_authority_check_authorization() should guarantee
to invoke the callback never-synchronously and on a clean call-stack (to avoid
problems with re-entrancy). At that point, NMAuthChain does not need to
delay this further.
</pre>
</div>
</content>
</entry>
<entry>
<title>auth-chain/trivial: rename nm_auth_chain_unref() to nm_auth_chain_destroy()</title>
<updated>2018-04-13T07:09:46+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2018-04-09T09:52:55+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/NetworkManager.git/commit/?id=50b74731f668067d445a28d7e545a169bf9d25c8'/>
<id>50b74731f668067d445a28d7e545a169bf9d25c8</id>
<content type='text'>
NMAuthChain is not really ref-counted. True, we have an internal ref-counter
to ensure that the instance stays alive while the callback is invoked. However,
the user cannot take additional references as there is no nm_auth_chain_ref().

When the user wants to get rid of the auth-chain, with the current API it
is important that the callback won't be called after that point. From the
name nm_auth_chain_unref(), it sounds like that there could be multiple references
to the auth-chain, and merely unreferencing the object might not guarantee that
the callback is canceled. However, that is luckily not the case, because
there is no real ref-counting involved here.

Just rename the destroy function to make this clearer.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
NMAuthChain is not really ref-counted. True, we have an internal ref-counter
to ensure that the instance stays alive while the callback is invoked. However,
the user cannot take additional references as there is no nm_auth_chain_ref().

When the user wants to get rid of the auth-chain, with the current API it
is important that the callback won't be called after that point. From the
name nm_auth_chain_unref(), it sounds like that there could be multiple references
to the auth-chain, and merely unreferencing the object might not guarantee that
the callback is canceled. However, that is luckily not the case, because
there is no real ref-counting involved here.

Just rename the destroy function to make this clearer.
</pre>
</div>
</content>
</entry>
</feed>
