The branch, master has been updated
       via  e77cbe2 tdb: return ENOSYS if the tdb was created with spinlocks.
       via  ff2b896 pytdb: avoid const warnings by using discard_const_p()
       via  74e2d6e s3:lib: always use db_open(serverid.tdb)
      from  360ca8e auth: avoid overwriting the auth_sam_reply.h header all the 
time.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit e77cbe252f68880b940722ef1291802c4677a435
Author: Stefan Metzmacher <me...@samba.org>
Date:   Tue May 6 11:52:49 2014 +0200

    tdb: return ENOSYS if the tdb was created with spinlocks.
    
    Signed-off-by: Stefan Metzmacher <me...@samba.org>
    Reviewed-by: Michael Adam <ob...@samba.org>
    
    Autobuild-User(master): Stefan Metzmacher <me...@samba.org>
    Autobuild-Date(master): Mon May 12 21:07:04 CEST 2014 on sn-devel-104

commit ff2b896edd9df9ce04e572e6bd569f51cc4b500e
Author: Stefan Metzmacher <me...@samba.org>
Date:   Mon Feb 3 11:29:38 2014 +0100

    pytdb: avoid const warnings by using discard_const_p()
    
    Signed-off-by: Stefan Metzmacher <me...@samba.org>
    Reviewed-by: Michael Adam <ob...@samba.org>

commit 74e2d6e786974e161949bf49a60404c358d1ecd7
Author: Stefan Metzmacher <me...@samba.org>
Date:   Mon May 12 10:21:12 2014 +0200

    s3:lib: always use db_open(serverid.tdb)
    
    We should not create an empty local serverid.tdb in a cluster setup...
    
    Signed-off-by: Stefan Metzmacher <me...@samba.org>
    Reviewed-by: Michael Adam <ob...@samba.org>

-----------------------------------------------------------------------

Summary of changes:
 lib/tdb/common/open.c  |    1 +
 lib/tdb/pytdb.c        |   27 +++++++++++++++++--------
 source3/lib/serverid.c |   49 +++++++++++++----------------------------------
 3 files changed, 33 insertions(+), 44 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/tdb/common/open.c b/lib/tdb/common/open.c
index 789bc73..d5c0432 100644
--- a/lib/tdb/common/open.c
+++ b/lib/tdb/common/open.c
@@ -392,6 +392,7 @@ _PUBLIC_ struct tdb_context *tdb_open_ex(const char *name, 
int hash_size, int td
        if (header.rwlocks != 0 &&
            header.rwlocks != TDB_HASH_RWLOCK_MAGIC) {
                TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_open_ex: spinlocks no 
longer supported\n"));
+               errno = ENOSYS;
                goto fail;
        }
        tdb->hash_size = header.hash_size;
diff --git a/lib/tdb/pytdb.c b/lib/tdb/pytdb.c
index bf0fed6..9320799 100644
--- a/lib/tdb/pytdb.c
+++ b/lib/tdb/pytdb.c
@@ -91,9 +91,10 @@ static PyObject *py_tdb_open(PyTypeObject *type, PyObject 
*args, PyObject *kwarg
        int hash_size = 0, tdb_flags = TDB_DEFAULT, flags = O_RDWR, mode = 0600;
        TDB_CONTEXT *ctx;
        PyTdbObject *ret;
-       const char *kwnames[] = { "name", "hash_size", "tdb_flags", "flags", 
"mode", NULL };
+       const char *_kwnames[] = { "name", "hash_size", "tdb_flags", "flags", 
"mode", NULL };
+       char **kwnames = discard_const_p(char *, _kwnames);
 
-       if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|siiii", (char 
**)kwnames, &name, &hash_size, &tdb_flags, &flags, &mode))
+       if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|siiii", kwnames, 
&name, &hash_size, &tdb_flags, &flags, &mode))
                return NULL;
 
        if (name == NULL) {
@@ -548,13 +549,21 @@ static PyObject *obj_get_seqnum(PyTdbObject *self, void 
*closure)
 
 
 static PyGetSetDef tdb_object_getsetters[] = {
-       { (char *)"hash_size", (getter)obj_get_hash_size, NULL, NULL },
-       { (char *)"map_size", (getter)obj_get_map_size, NULL, NULL },
-       { (char *)"freelist_size", (getter)obj_get_freelist_size, NULL, NULL },
-       { (char *)"flags", (getter)obj_get_flags, NULL, NULL },
-       { (char *)"max_dead", NULL, (setter)obj_set_max_dead, NULL },
-       { (char *)"filename", (getter)obj_get_filename, NULL, (char *)"The 
filename of this TDB file."},
-       { (char *)"seqnum", (getter)obj_get_seqnum, NULL, NULL },
+       { discard_const_p(char, "hash_size"),
+         (getter)obj_get_hash_size, NULL, NULL },
+       { discard_const_p(char, "map_size"),
+         (getter)obj_get_map_size, NULL, NULL },
+       { discard_const_p(char, "freelist_size"),
+         (getter)obj_get_freelist_size, NULL, NULL },
+       { discard_const_p(char, "flags"),
+         (getter)obj_get_flags, NULL, NULL },
+       { discard_const_p(char, "max_dead"),
+         NULL, (setter)obj_set_max_dead, NULL },
+       { discard_const_p(char, "filename"),
+         (getter)obj_get_filename, NULL,
+         discard_const_p(char, "The filename of this TDB file.") },
+       { discard_const_p(char, "seqnum"),
+         (getter)obj_get_seqnum, NULL, NULL },
        { NULL }
 };
 
diff --git a/source3/lib/serverid.c b/source3/lib/serverid.c
index 48b09f7..1a7e1ed 100644
--- a/source3/lib/serverid.c
+++ b/source3/lib/serverid.c
@@ -39,41 +39,6 @@ struct serverid_data {
        uint32_t msg_flags;
 };
 
-bool serverid_parent_init(TALLOC_CTX *mem_ctx)
-{
-       struct tdb_wrap *db;
-       struct loadparm_context *lp_ctx;
-       const char *fname;
-
-       lp_ctx = loadparm_init_s3(mem_ctx, loadparm_s3_helpers());
-       if (lp_ctx == NULL) {
-               DEBUG(0, ("loadparm_init_s3 failed\n"));
-               return false;
-       }
-
-       /*
-        * Open the tdb in the parent process (smbd) so that our
-        * CLEAR_IF_FIRST optimization in tdb_reopen_all can properly
-        * work.
-        */
-
-       fname = lock_path("serverid.tdb");
-
-       db = tdb_wrap_open(mem_ctx, fname,
-                          lpcfg_tdb_hash_size(lp_ctx, fname),
-                          lpcfg_tdb_flags(lp_ctx,
-                                          TDB_DEFAULT|TDB_CLEAR_IF_FIRST|
-                                          TDB_INCOMPATIBLE_HASH),
-                          O_RDWR|O_CREAT, 0644);
-       talloc_unlink(mem_ctx, lp_ctx);
-       if (db == NULL) {
-               DEBUG(1, ("could not open serverid.tdb: %s\n",
-                         strerror(errno)));
-               return false;
-       }
-       return true;
-}
-
 static struct db_context *serverid_db(void)
 {
        static struct db_context *db;
@@ -88,6 +53,20 @@ static struct db_context *serverid_db(void)
        return db;
 }
 
+bool serverid_parent_init(TALLOC_CTX *mem_ctx)
+{
+       struct tdb_wrap *db;
+
+       db = serverid_db();
+       if (db == NULL) {
+               DEBUG(1, ("could not open serverid.tdb: %s\n",
+                         strerror(errno)));
+               return false;
+       }
+
+       return true;
+}
+
 static void serverid_fill_key(const struct server_id *id,
                              struct serverid_key *key)
 {


-- 
Samba Shared Repository

Reply via email to