Re: [SSSD] [PATCH] add store/search/delete interface for custom sysdb objects

2009-10-22 Thread Stephen Gallagher
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 10/22/2009 09:28 AM, Simo Sorce wrote:
 On Thu, 2009-10-22 at 12:22 +0200, Sumit Bose wrote:

 ok, the attached version adds new objects or replaces existing and
 adds
 new attributes to existing objects.
 
 I like this version.
 
 Ack
 
 Simo.
 

Pushed to master.

- -- 
Stephen Gallagher
RHCE 804006346421761

Looking to carve out IT costs?
www.redhat.com/carveoutcosts/
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAkrgngcACgkQeiVVYja6o6PRuwCghACgFWhcTKeLXrflGfwML3Km
9QoAni4rrRCQ7wODQc/JZeTjf+5YCug2
=PzUK
-END PGP SIGNATURE-
___
sssd-devel mailing list
sssd-devel@lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/sssd-devel


Re: [SSSD] [PATCH] add store/search/delete interface for custom sysdb objects

2009-10-21 Thread Simo Sorce
On Mon, 2009-10-19 at 16:42 +0200, Sumit Bose wrote:
 Hi,
 
 this patch adds a store/search/delete sysdb API for data not related
 to
 users of groups. The data is stored in cn=custom,cn=domain,cn=sysdb.
 The
 client must specify a subtree_name and an object_name to save the data
 in cn=object_name,cn=subtree_name,cn=custom,cn=domain,cn=sysdb.
 
 Please have a look at the sysdb_check_handle_* request, too. I think
 it
 makes the code more readable and helps to reduce code duplications.

Why are you deleting and re-adding the entry in custom store ?
Why not just replace the attributes you want to set ?

Simo.

___
sssd-devel mailing list
sssd-devel@lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/sssd-devel


Re: [SSSD] [PATCH] add store/search/delete interface for custom sysdb objects

2009-10-21 Thread Sumit Bose
On Tue, Oct 20, 2009 at 07:46:02PM -0400, Simo Sorce wrote:
 On Mon, 2009-10-19 at 16:42 +0200, Sumit Bose wrote:
  Hi,
  
  this patch adds a store/search/delete sysdb API for data not related
  to
  users of groups. The data is stored in cn=custom,cn=domain,cn=sysdb.
  The
  client must specify a subtree_name and an object_name to save the data
  in cn=object_name,cn=subtree_name,cn=custom,cn=domain,cn=sysdb.
  
  Please have a look at the sysdb_check_handle_* request, too. I think
  it
  makes the code more readable and helps to reduce code duplications.
 
 Why are you deleting and re-adding the entry in custom store ?
 Why not just replace the attributes you want to set ?
 
 Simo.
 

I think it is a typical use case that you want to store a copy of some
LDAP search result and replacing all exiting data. Maybe a update call
can be integrated when needed.

bye,
Sumit
___
sssd-devel mailing list
sssd-devel@lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/sssd-devel


[SSSD] [PATCH] add store/search/delete interface for custom sysdb objects

2009-10-19 Thread Sumit Bose
Hi,

this patch adds a store/search/delete sysdb API for data not related to
users of groups. The data is stored in cn=custom,cn=domain,cn=sysdb. The
client must specify a subtree_name and an object_name to save the data
in cn=object_name,cn=subtree_name,cn=custom,cn=domain,cn=sysdb.

Please have a look at the sysdb_check_handle_* request, too. I think it
makes the code more readable and helps to reduce code duplications.

bye,
Sumit
From 1615be0ba99dd996a58d43d2e6000edae9cc272b Mon Sep 17 00:00:00 2001
From: Sumit Bose sb...@redhat.com
Date: Tue, 6 Oct 2009 09:17:56 +0200
Subject: [PATCH] add store/search/delete interface for custom sysdb objects

---
 server/db/sysdb.c  |8 +
 server/db/sysdb.h  |   35 
 server/db/sysdb_ops.c  |  488 
 server/tests/sysdb-tests.c |  229 +
 4 files changed, 760 insertions(+), 0 deletions(-)

diff --git a/server/db/sysdb.c b/server/db/sysdb.c
index 7a6d616..a0c1338 100644
--- a/server/db/sysdb.c
+++ b/server/db/sysdb.c
@@ -24,6 +24,14 @@
 #include confdb/confdb.h
 #include time.h
 
+struct ldb_dn *sysdb_custom_dn(struct sysdb_ctx *ctx, void *memctx,
+const char *domain, const char *object_name,
+const char *subtree_name)
+{
+return ldb_dn_new_fmt(memctx, ctx-ldb, SYSDB_TMPL_CUSTOM, object_name,
+  subtree_name, domain);
+}
+
 struct ldb_dn *sysdb_user_dn(struct sysdb_ctx *ctx, void *memctx,
  const char *domain, const char *name)
 {
diff --git a/server/db/sysdb.h b/server/db/sysdb.h
index 9afb957..55852c5 100644
--- a/server/db/sysdb.h
+++ b/server/db/sysdb.h
@@ -33,6 +33,7 @@
 #define SYSDB_DOM_BASE cn=%s,cn=sysdb
 #define SYSDB_TMPL_USER_BASE cn=users,cn=%s,SYSDB_BASE
 #define SYSDB_TMPL_GROUP_BASE cn=groups,cn=%s,SYSDB_BASE
+#define SYSDB_TMPL_CUSTOM_BASE cn=custom,cn=%s,SYSDB_BASE
 
 #define SYSDB_USER_CLASS user
 #define SYSDB_GROUP_CLASS group
@@ -132,6 +133,7 @@
 
 #define SYSDB_TMPL_USER SYSDB_NAME=%s,SYSDB_TMPL_USER_BASE
 #define SYSDB_TMPL_GROUP SYSDB_NAME=%s,SYSDB_TMPL_GROUP_BASE
+#define SYSDB_TMPL_CUSTOM SYSDB_NAME=%s,cn=%s,SYSDB_TMPL_CUSTOM_BASE
 
 #define SYSDB_MOD_ADD LDB_FLAG_MOD_ADD
 #define SYSDB_MOD_DEL LDB_FLAG_MOD_DELETE
@@ -176,6 +178,11 @@ struct ldb_dn *sysdb_group_dn(struct sysdb_ctx *ctx, void 
*memctx,
   const char *domain, const char *name);
 struct ldb_dn *sysdb_domain_dn(struct sysdb_ctx *ctx, void *memctx,
const char *domain);
+struct ldb_dn *sysdb_custom_dn(struct sysdb_ctx *ctx, void *memctx,
+const char *domain, const char *object_name,
+const char *subtree_name);
+
+
 
 struct ldb_context *sysdb_ctx_get_ldb(struct sysdb_ctx *ctx);
 struct ldb_context *sysdb_handle_get_ldb(struct sysdb_handle *handle);
@@ -515,4 +522,32 @@ struct tevent_req *sysdb_cache_password_send(TALLOC_CTX 
*mem_ctx,
  const char *password);
 int sysdb_cache_password_recv(struct tevent_req *req);
 
+struct tevent_req *sysdb_store_custom_send(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct sysdb_handle *handle,
+ struct sss_domain_info *domain,
+ const char *object_name,
+ const char *subtree_name,
+ struct sysdb_attrs *attrs);
+int sysdb_store_custom_recv(struct tevent_req *req);
+
+struct tevent_req *sysdb_search_custom_by_name_send(TALLOC_CTX *mem_ctx,
+struct tevent_context *ev,
+struct sysdb_ctx *sysdb,
+struct sysdb_handle 
*handle,
+struct sss_domain_info 
*domain,
+const char *object_name,
+const char *subtree_name,
+const char **attrs);
+int sysdb_search_custom_recv(struct tevent_req *req,
+  TALLOC_CTX *mem_ctx,
+  struct ldb_message **msg);
+
+struct tevent_req *sysdb_delete_custom_send(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct sysdb_handle *handle,
+ struct sss_domain_info *domain,
+ const char *object_name,
+ const char *subtree_name);
+int sysdb_delete_custom_recv(struct tevent_req *req);