[SCM] Samba Shared Repository - branch v3-2-test updated - release-3-2-0pre2-3278-g776c7ce

Stefan Metzmacher metze at samba.org
Tue Dec 16 09:41:15 GMT 2008


The branch, v3-2-test has been updated
       via  776c7ce0c1e73efc4f3d24a297bb3b2f3dd3892a (commit)
      from  e504256f84927c9b22df3945a3e95baaa9bf7063 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -----------------------------------------------------------------
commit 776c7ce0c1e73efc4f3d24a297bb3b2f3dd3892a
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Dec 16 10:40:32 2008 +0100

    s3:net_status: use dbwrap to open sessionid.tdb
    
    metze
    (cherry picked from commit 8891b2b0215a3609fcc8c5f9aa3e2fbcf05c6290)
    (cherry picked from commit 598bf8fbe38d76adca2e067c90987d9cd31e8a3e)

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

Summary of changes:
 source/utils/net_status.c |   44 ++++++++++++++++++++------------------------
 1 files changed, 20 insertions(+), 24 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/utils/net_status.c b/source/utils/net_status.c
index 4a3c589..3e6d3fd 100644
--- a/source/utils/net_status.c
+++ b/source/utils/net_status.c
@@ -19,16 +19,15 @@
 #include "includes.h"
 #include "utils/net.h"
 
-static int show_session(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf,
-			void *state)
+static int show_session(struct db_record *rec, void *private_data)
 {
-	bool *parseable = (bool *)state;
+	bool *parseable = (bool *)private_data;
 	struct sessionid sessionid;
 
-	if (dbuf.dsize != sizeof(sessionid))
+	if (rec->value.dsize != sizeof(sessionid))
 		return 0;
 
-	memcpy(&sessionid, dbuf.dptr, sizeof(sessionid));
+	memcpy(&sessionid, rec->value.dptr, sizeof(sessionid));
 
 	if (!process_exists(sessionid.pid)) {
 		return 0;
@@ -51,7 +50,7 @@ static int show_session(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf,
 
 static int net_status_sessions(int argc, const char **argv)
 {
-	TDB_CONTEXT *tdb;
+	struct db_context *db;
 	bool parseable;
 
 	if (argc == 0) {
@@ -69,16 +68,15 @@ static int net_status_sessions(int argc, const char **argv)
 			 "------------------------\n");
 	}
 
-	tdb = tdb_open_log(lock_path("sessionid.tdb"), 0,
-			   TDB_DEFAULT, O_RDONLY, 0);
-
-	if (tdb == NULL) {
+	db = db_open(NULL, lock_path("sessionid.tdb"), 0,
+		     TDB_CLEAR_IF_FIRST, O_RDONLY, 0644);
+	if (db == NULL) {
 		d_fprintf(stderr, "%s not initialised\n", lock_path("sessionid.tdb"));
 		return -1;
 	}
 
-	tdb_traverse(tdb, show_session, &parseable);
-	tdb_close(tdb);
+	db->traverse_read(db, show_session, &parseable);
+	TALLOC_FREE(db);
 
 	return 0;
 }
@@ -108,16 +106,15 @@ struct sessionids {
 	struct sessionid *entries;
 };
 
-static int collect_pid(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf,
-		       void *state)
+static int collect_pid(struct db_record *rec, void *private_data)
 {
-	struct sessionids *ids = (struct sessionids *)state;
+	struct sessionids *ids = (struct sessionids *)private_data;
 	struct sessionid sessionid;
 
-	if (dbuf.dsize != sizeof(sessionid))
+	if (rec->value.dsize != sizeof(sessionid))
 		return 0;
 
-	memcpy(&sessionid, dbuf.dptr, sizeof(sessionid));
+	memcpy(&sessionid, rec->value.dptr, sizeof(sessionid));
 
 	if (!process_exists(sessionid.pid)) 
 		return 0;
@@ -171,21 +168,20 @@ static int show_share_parseable(struct db_record *rec,
 static int net_status_shares_parseable(int argc, const char **argv)
 {
 	struct sessionids ids;
-	TDB_CONTEXT *tdb;
+	struct db_context *db;
 
 	ids.num_entries = 0;
 	ids.entries = NULL;
 
-	tdb = tdb_open_log(lock_path("sessionid.tdb"), 0,
-			   TDB_DEFAULT, O_RDONLY, 0);
-
-	if (tdb == NULL) {
+	db = db_open(NULL, lock_path("sessionid.tdb"), 0,
+		     TDB_CLEAR_IF_FIRST, O_RDONLY, 0644);
+	if (db == NULL) {
 		d_fprintf(stderr, "%s not initialised\n", lock_path("sessionid.tdb"));
 		return -1;
 	}
 
-	tdb_traverse(tdb, collect_pid, &ids);
-	tdb_close(tdb);
+	db->traverse_read(db, collect_pid, &ids);
+	TALLOC_FREE(db);
 
 	connections_forall(show_share_parseable, &ids);
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list