[systemd-devel] [PATCH] policy: clean up headers and code documentation

2014-06-07 Thread Djalal Harouni
Signed-off-by: Djalal Harouni tix...@opendz.org
---
 policy.c | 9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/policy.c b/policy.c
index 5a9770d..6f2bb1f 100644
--- a/policy.c
+++ b/policy.c
@@ -10,11 +10,8 @@
  * your option) any later version.
  */
 
-#include linux/device.h
 #include linux/fs.h
-#include linux/idr.h
 #include linux/init.h
-#include linux/module.h
 #include linux/mutex.h
 #include linux/sched.h
 #include linux/sizes.h
@@ -129,7 +126,7 @@ exit_free:
 }
 
 /**
- * kdbus_policy_free - drop a policy database reference
+ * kdbus_policy_db_free - drop a policy database reference
  * @db:The policy database
  */
 void kdbus_policy_db_free(struct kdbus_policy_db *db)
@@ -162,7 +159,7 @@ void kdbus_policy_db_free(struct kdbus_policy_db *db)
 }
 
 /**
- * kdbus_policy_new() - create a new policy database
+ * kdbus_policy_db_new() - create a new policy database
  * @db:The location where to store the new database
  *
  * Return: 0 on success, negative errno on failure
@@ -294,7 +291,7 @@ kdbus_policy_cache_entry_new(struct kdbus_conn *conn_a,
 }
 
 /**
- * kdbus_policy_check_send_access() - check if one connection is allowed
+ * kdbus_policy_check_talk_access() - check if one connection is allowed
  *to send a message to another connection
  * @db:The policy database
  * @conn_src:  The source connection
-- 
1.9.0

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] policy: clean up headers and code documentation

2014-06-07 Thread Daniel Mack
On 06/07/2014 06:26 PM, Djalal Harouni wrote:
 Signed-off-by: Djalal Harouni tix...@opendz.org

Applied, thanks!

 ---
  policy.c | 9 +++--
  1 file changed, 3 insertions(+), 6 deletions(-)
 
 diff --git a/policy.c b/policy.c
 index 5a9770d..6f2bb1f 100644
 --- a/policy.c
 +++ b/policy.c
 @@ -10,11 +10,8 @@
   * your option) any later version.
   */
  
 -#include linux/device.h
  #include linux/fs.h
 -#include linux/idr.h
  #include linux/init.h
 -#include linux/module.h
  #include linux/mutex.h
  #include linux/sched.h
  #include linux/sizes.h
 @@ -129,7 +126,7 @@ exit_free:
  }
  
  /**
 - * kdbus_policy_free - drop a policy database reference
 + * kdbus_policy_db_free - drop a policy database reference
   * @db:  The policy database
   */
  void kdbus_policy_db_free(struct kdbus_policy_db *db)
 @@ -162,7 +159,7 @@ void kdbus_policy_db_free(struct kdbus_policy_db *db)
  }
  
  /**
 - * kdbus_policy_new() - create a new policy database
 + * kdbus_policy_db_new() - create a new policy database
   * @db:  The location where to store the new database
   *
   * Return: 0 on success, negative errno on failure
 @@ -294,7 +291,7 @@ kdbus_policy_cache_entry_new(struct kdbus_conn *conn_a,
  }
  
  /**
 - * kdbus_policy_check_send_access() - check if one connection is allowed
 + * kdbus_policy_check_talk_access() - check if one connection is allowed
   *  to send a message to another connection
   * @db:  The policy database
   * @conn_src:The source connection
 

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] policy: clean up headers and code documentation

2014-06-07 Thread Djalal Harouni
Hi,

I'm sending this to have some updates on the policy!

I did notice some issues and others still *to confirm*, so first I'm
writing some policy tests to make sure we don't break. I'll clean what
I've and get get back to you.


For the moment can you please confirm:

1) I assume the policy.c on the master branch is the correct one to
work on?

2) So buses and custom endpoints can have their own policy db.
From reading the sources, I assume:

* The two *share* the same internal format!

* The two are unrelated, and the endpoint policy takes precedence over
  the bus policy when doing the talk check!

Thanks!


On Sat, Jun 07, 2014 at 05:26:55PM +0100, Djalal Harouni wrote:
 Signed-off-by: Djalal Harouni tix...@opendz.org
 ---
  policy.c | 9 +++--
  1 file changed, 3 insertions(+), 6 deletions(-)
 
 diff --git a/policy.c b/policy.c
 index 5a9770d..6f2bb1f 100644
 --- a/policy.c
 +++ b/policy.c
 @@ -10,11 +10,8 @@
   * your option) any later version.
   */
  
 -#include linux/device.h
  #include linux/fs.h
 -#include linux/idr.h
  #include linux/init.h
 -#include linux/module.h
  #include linux/mutex.h
  #include linux/sched.h
  #include linux/sizes.h
 @@ -129,7 +126,7 @@ exit_free:
  }
  
  /**
 - * kdbus_policy_free - drop a policy database reference
 + * kdbus_policy_db_free - drop a policy database reference
   * @db:  The policy database
   */
  void kdbus_policy_db_free(struct kdbus_policy_db *db)
 @@ -162,7 +159,7 @@ void kdbus_policy_db_free(struct kdbus_policy_db *db)
  }
  
  /**
 - * kdbus_policy_new() - create a new policy database
 + * kdbus_policy_db_new() - create a new policy database
   * @db:  The location where to store the new database
   *
   * Return: 0 on success, negative errno on failure
 @@ -294,7 +291,7 @@ kdbus_policy_cache_entry_new(struct kdbus_conn *conn_a,
  }
  
  /**
 - * kdbus_policy_check_send_access() - check if one connection is allowed
 + * kdbus_policy_check_talk_access() - check if one connection is allowed
   *  to send a message to another connection
   * @db:  The policy database
   * @conn_src:The source connection
 -- 
 1.9.0
 

-- 
Djalal Harouni
http://opendz.org
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] policy: clean up headers and code documentation

2014-06-07 Thread Djalal Harouni
On Sat, Jun 07, 2014 at 06:29:21PM +0200, Daniel Mack wrote:
 On 06/07/2014 06:26 PM, Djalal Harouni wrote:
  Signed-off-by: Djalal Harouni tix...@opendz.org
 
 Applied, thanks!
Oh that was quick!

This answers my first question of the other email!

Thanks Daniel!

  ---
   policy.c | 9 +++--
   1 file changed, 3 insertions(+), 6 deletions(-)
  
  diff --git a/policy.c b/policy.c
  index 5a9770d..6f2bb1f 100644
  --- a/policy.c
  +++ b/policy.c
  @@ -10,11 +10,8 @@
* your option) any later version.
*/
   
  -#include linux/device.h
   #include linux/fs.h
  -#include linux/idr.h
   #include linux/init.h
  -#include linux/module.h
   #include linux/mutex.h
   #include linux/sched.h
   #include linux/sizes.h
  @@ -129,7 +126,7 @@ exit_free:
   }
   
   /**
  - * kdbus_policy_free - drop a policy database reference
  + * kdbus_policy_db_free - drop a policy database reference
* @db:The policy database
*/
   void kdbus_policy_db_free(struct kdbus_policy_db *db)
  @@ -162,7 +159,7 @@ void kdbus_policy_db_free(struct kdbus_policy_db *db)
   }
   
   /**
  - * kdbus_policy_new() - create a new policy database
  + * kdbus_policy_db_new() - create a new policy database
* @db:The location where to store the new database
*
* Return: 0 on success, negative errno on failure
  @@ -294,7 +291,7 @@ kdbus_policy_cache_entry_new(struct kdbus_conn *conn_a,
   }
   
   /**
  - * kdbus_policy_check_send_access() - check if one connection is allowed
  + * kdbus_policy_check_talk_access() - check if one connection is allowed
*to send a message to another connection
* @db:The policy database
* @conn_src:  The source connection
  
 

-- 
Djalal Harouni
http://opendz.org
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] policy: clean up headers and code documentation

2014-06-07 Thread Daniel Mack
Hi Djalal,

On 06/07/2014 06:47 PM, Djalal Harouni wrote:
 I'm sending this to have some updates on the policy!
 
 I did notice some issues and others still *to confirm*, so first I'm
 writing some policy tests to make sure we don't break. I'll clean what
 I've and get get back to you.

Sure, thanks for having a look. Note that the endpoint policy is
currently not well tested, as we lack support for custom endpoints in
userland. This will change soon, and it might be that kernel-side corner
cases went unnoticed.

 For the moment can you please confirm:
 
 1) I assume the policy.c on the master branch is the correct one to
 work on?

Yes.

 2) So buses and custom endpoints can have their own policy db.
 From reading the sources, I assume:
 
 * The two *share* the same internal format!

Not only that, they also kind of share the same external interface. And
internally, they're exactly the same thing, yes. They are talked to
through different ioctls though, but the layout of items is the same,
and the code is written so that we can share as much as possible for
both APIs.

 * The two are unrelated, and the endpoint policy takes precedence over
   the bus policy when doing the talk check!

Well, there no such thing as precedence really, they are simply checked
both. For example, when sending a message, both the endpoint and the bus
policy have to give TALK permission for the connections involved,
otherwise the message is rejected.

But as I said, some of that code has not been in production yet, so
there might be minor updates in that area.


Thanks,
Daniel

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] policy: clean up headers and code documentation

2014-06-07 Thread Djalal Harouni
On Sat, Jun 07, 2014 at 06:58:50PM +0200, Daniel Mack wrote:
 Hi Djalal,
 
 On 06/07/2014 06:47 PM, Djalal Harouni wrote:
  I'm sending this to have some updates on the policy!
  
  I did notice some issues and others still *to confirm*, so first I'm
  writing some policy tests to make sure we don't break. I'll clean what
  I've and get get back to you.
 
 Sure, thanks for having a look. Note that the endpoint policy is
 currently not well tested, as we lack support for custom endpoints in
 userland. This will change soon, and it might be that kernel-side corner
 cases went unnoticed.
Yes I noticed the custom endpoint part, I did write a test which didn't
work, Ok!

So first, I'll try to help and test the bus policy.

  For the moment can you please confirm:
  
  1) I assume the policy.c on the master branch is the correct one to
  work on?
 
 Yes.
 
  2) So buses and custom endpoints can have their own policy db.
  From reading the sources, I assume:
  
  * The two *share* the same internal format!
 
 Not only that, they also kind of share the same external interface. And
 internally, they're exactly the same thing, yes. They are talked to
 through different ioctls though, but the layout of items is the same,
 and the code is written so that we can share as much as possible for
 both APIs.
Ok.

  * The two are unrelated, and the endpoint policy takes precedence over
the bus policy when doing the talk check!
 
 Well, there no such thing as precedence really, they are simply checked
 both. For example, when sending a message, both the endpoint and the bus
 policy have to give TALK permission for the connections involved,
 otherwise the message is rejected.
I misread the code, indeed we check both of them.

 But as I said, some of that code has not been in production yet, so
 there might be minor updates in that area.
Ok, many thanks Daniel!

I'll clean what I've and get back to you.

 Thanks,
 Daniel
 

-- 
Djalal Harouni
http://opendz.org
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel