[SCM] Samba Shared Repository - branch v3-6-test updated
Karolin Seeger
kseeger at samba.org
Fri Sep 6 03:22:46 MDT 2013
The branch, v3-6-test has been updated
via 5978eab s3-sessionid: use sessionid_init_readonly() from cmdline tools.
via d135201 s3-sessionid: change session_db_ctx() to always return the session_id_ctx pointer.
via 039171a s3-sessionid: make sure to call sessionid_init() also from the cmdline tools.
from 66b9ebd Optimization. Don't do the retry logic if sitename_fetch() returned NULL, we already did a NULL query.
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-6-test
- Log -----------------------------------------------------------------
commit 5978eab3cdbbc8971ed7f0fd9f0aadb02c98aba7
Author: Günther Deschner <gd at samba.org>
Date: Wed Sep 4 16:57:17 2013 +0200
s3-sessionid: use sessionid_init_readonly() from cmdline tools.
Guenther
Signed-off-by: Günther Deschner <gd at samba.org>
The last 3 patches address bug #10127 - smbstatus stopped working as non-root
user.
commit d1352013bb694a30480282e398e29238470b0768
Author: Günther Deschner <gd at samba.org>
Date: Wed Sep 4 16:55:11 2013 +0200
s3-sessionid: change session_db_ctx() to always return the session_id_ctx pointer.
Guenther
Signed-off-by: Günther Deschner <gd at samba.org>
commit 039171a9d1fc72de39ee8aa51830a37221988859
Author: Günther Deschner <gd at samba.org>
Date: Wed Sep 4 16:45:32 2013 +0200
s3-sessionid: make sure to call sessionid_init() also from the cmdline tools.
Guenther
Signed-off-by: Günther Deschner <gd at samba.org>
-----------------------------------------------------------------------
Summary of changes:
source3/include/proto.h | 1 +
source3/lib/sessionid_tdb.c | 25 ++++++++++++++++++-------
source3/utils/net_serverid.c | 5 +++++
source3/utils/net_status.c | 6 ++++++
source3/utils/status.c | 6 ++++++
5 files changed, 36 insertions(+), 7 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 189b286..7303e76 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -1846,6 +1846,7 @@ void server_messaging_context_free(void);
/* The following definitions come from lib/sessionid_tdb.c */
struct sessionid;
bool sessionid_init(void);
+bool sessionid_init_readonly(void);
struct db_record *sessionid_fetch_record(TALLOC_CTX *mem_ctx, const char *key);
int sessionid_traverse(int (*fn)(struct db_record *rec, const char *key,
struct sessionid *session,
diff --git a/source3/lib/sessionid_tdb.c b/source3/lib/sessionid_tdb.c
index de3ccab..769aac2 100644
--- a/source3/lib/sessionid_tdb.c
+++ b/source3/lib/sessionid_tdb.c
@@ -23,23 +23,34 @@
#include "session.h"
#include "util_tdb.h"
+static struct db_context *session_db_ctx_ptr = NULL;
+
static struct db_context *session_db_ctx(void)
{
- static struct db_context *session_db_ctx_ptr;
-
- if (session_db_ctx_ptr != NULL) {
- return session_db_ctx_ptr;
- }
+ return session_db_ctx_ptr;
+}
+static struct db_context *session_db_ctx_init(bool readonly)
+{
session_db_ctx_ptr = db_open(NULL, lock_path("sessionid.tdb"), 0,
TDB_CLEAR_IF_FIRST|TDB_DEFAULT|TDB_INCOMPATIBLE_HASH,
- O_RDWR | O_CREAT, 0644);
+ readonly ? O_RDONLY : O_RDWR | O_CREAT, 0644);
return session_db_ctx_ptr;
}
bool sessionid_init(void)
{
- if (session_db_ctx() == NULL) {
+ if (session_db_ctx_init(false) == NULL) {
+ DEBUG(1,("session_init: failed to open sessionid tdb\n"));
+ return False;
+ }
+
+ return True;
+}
+
+bool sessionid_init_readonly(void)
+{
+ if (session_db_ctx_init(true) == NULL) {
DEBUG(1,("session_init: failed to open sessionid tdb\n"));
return False;
}
diff --git a/source3/utils/net_serverid.c b/source3/utils/net_serverid.c
index 08a1a7f..01109b9 100644
--- a/source3/utils/net_serverid.c
+++ b/source3/utils/net_serverid.c
@@ -150,5 +150,10 @@ int net_serverid(struct net_context *c, int argc, const char **argv)
{NULL, NULL, 0, NULL, NULL}
};
+ if (!sessionid_init()) {
+ d_printf("failed to open sessionid.tdb\n");
+ return -1;
+ };
+
return net_run_function(c, argc, argv, "net serverid", func);
}
diff --git a/source3/utils/net_status.c b/source3/utils/net_status.c
index d602743..857b184 100644
--- a/source3/utils/net_status.c
+++ b/source3/utils/net_status.c
@@ -239,5 +239,11 @@ int net_status(struct net_context *c, int argc, const char **argv)
},
{NULL, NULL, 0, NULL, NULL}
};
+
+ if (!sessionid_init_readonly()) {
+ d_printf("failed to open sessionid.tdb\n");
+ return -1;
+ }
+
return net_run_function(c, argc, argv, "net status", func);
}
diff --git a/source3/utils/status.c b/source3/utils/status.c
index cf625fb..dc05096 100644
--- a/source3/utils/status.c
+++ b/source3/utils/status.c
@@ -378,6 +378,12 @@ static int traverse_sessionid(const char *key, struct sessionid *session,
}
+ if (!sessionid_init_readonly()) {
+ fprintf(stderr, "Can't open sessionid.tdb\n");
+ ret = -1;
+ goto done;
+ }
+
if (lp_clustering()) {
/*
* This implicitly initializes the global ctdbd
--
Samba Shared Repository
More information about the samba-cvs
mailing list