s3:conn_tdb: add a function connections_fetch_entry_ext() that also takes the cnum
authorGregor Beck <gbeck@sernet.de>
Thu, 7 Jun 2012 11:25:17 +0000 (13:25 +0200)
committerMichael Adam <obnox@samba.org>
Wed, 27 Jun 2012 06:18:18 +0000 (08:18 +0200)
and have connections_fetch_entry() call connections_fetch_entry_ext().

Signed-off-by: Michael Adam <obnox@samba.org>
source3/lib/conn_tdb.c
source3/lib/conn_tdb.h

index 776f53ca79e6ee77e312078eb252d8f5ebf35ba5..fb605e12ba11fb100faf731a9ffcf8850f6eaa73 100644 (file)
@@ -54,16 +54,17 @@ static struct db_record *connections_fetch_record(TALLOC_CTX *mem_ctx,
        return dbwrap_fetch_locked(ctx, mem_ctx, key);
 }
 
-struct db_record *connections_fetch_entry(TALLOC_CTX *mem_ctx,
-                                         connection_struct *conn,
-                                         const char *name)
+struct db_record *connections_fetch_entry_ext(TALLOC_CTX *mem_ctx,
+                                             struct server_id id,
+                                             int cnum,
+                                             const char *name)
 {
        struct connections_key ckey;
        TDB_DATA key;
 
        ZERO_STRUCT(ckey);
-       ckey.pid = messaging_server_id(conn->sconn->msg_ctx);
-       ckey.cnum = conn->cnum;
+       ckey.pid = id;
+       ckey.cnum = cnum;
        strlcpy(ckey.name, name, sizeof(ckey.name));
 
        key.dsize = sizeof(ckey);
@@ -72,6 +73,15 @@ struct db_record *connections_fetch_entry(TALLOC_CTX *mem_ctx,
        return connections_fetch_record(mem_ctx, key);
 }
 
+struct db_record *connections_fetch_entry(TALLOC_CTX *mem_ctx,
+                                         connection_struct *conn,
+                                         const char *name)
+{
+       struct server_id id = messaging_server_id(conn->sconn->msg_ctx);
+       return connections_fetch_entry_ext(mem_ctx, id, conn->cnum, name);
+}
+
+
 struct conn_traverse_state {
        int (*fn)(struct db_record *rec,
                  const struct connections_key *key,
index ee4befed1682990b60cca4331c981ccd9147ffd5..9b63364d440307bf00b9e68deda0f34ed3667da1 100644 (file)
@@ -47,6 +47,10 @@ struct connections_data {
 struct db_record *connections_fetch_entry(TALLOC_CTX *mem_ctx,
                                          connection_struct *conn,
                                          const char *name);
+struct db_record *connections_fetch_entry_ext(TALLOC_CTX *mem_ctx,
+                                             struct server_id id,
+                                             int cnum,
+                                             const char *name);
 int connections_traverse(int (*fn)(struct db_record *rec,
                                   void *private_data),
                         void *private_data);