The Samba-Bugzilla – Attachment 9191 Details for
Bug 10127
smbstatus stopped working as non-root user
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch for v3-6-test
v3-6-test.patch (text/plain), 6.33 KB, created by
Guenther Deschner
on 2013-09-05 11:31:51 UTC
(
hide
)
Description:
patch for v3-6-test
Filename:
MIME Type:
Creator:
Guenther Deschner
Created:
2013-09-05 11:31:51 UTC
Size:
6.33 KB
patch
obsolete
>From dfb088de97bed53187d952836e8c8e521ee38475 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd@samba.org> >Date: Wed, 4 Sep 2013 16:45:32 +0200 >Subject: [PATCH 1/3] s3-sessionid: make sure to call sessionid_init() also > from the cmdline tools. >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Guenther > >Signed-off-by: Günther Deschner <gd@samba.org> >--- > source3/utils/net_serverid.c | 5 +++++ > source3/utils/net_status.c | 6 ++++++ > source3/utils/status.c | 6 ++++++ > 3 files changed, 17 insertions(+) > >diff --git a/source3/utils/net_serverid.c b/source3/utils/net_serverid.c >index 08a1a7f..afd378a 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("faild 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..6b25719 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()) { >+ d_printf("faild 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..34a7730 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()) { >+ fprintf(stderr, "Can't open sessionid.tdb\n"); >+ ret = -1; >+ goto done; >+ } >+ > if (lp_clustering()) { > /* > * This implicitly initializes the global ctdbd >-- >1.8.3.1 > > >From 554022fef6174c1d0eded2017a371544f2645e99 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd@samba.org> >Date: Wed, 4 Sep 2013 16:55:11 +0200 >Subject: [PATCH 2/3] s3-sessionid: change session_db_ctx() to always return > the session_id_ctx pointer. >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Guenther > >Signed-off-by: Günther Deschner <gd@samba.org> >--- > source3/lib/sessionid_tdb.c | 13 +++++++------ > 1 file changed, 7 insertions(+), 6 deletions(-) > >diff --git a/source3/lib/sessionid_tdb.c b/source3/lib/sessionid_tdb.c >index de3ccab..6bd39c4 100644 >--- a/source3/lib/sessionid_tdb.c >+++ b/source3/lib/sessionid_tdb.c >@@ -23,14 +23,15 @@ > #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(void) >+{ > 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); >@@ -39,7 +40,7 @@ static struct db_context *session_db_ctx(void) > > bool sessionid_init(void) > { >- if (session_db_ctx() == NULL) { >+ if (session_db_ctx_init() == NULL) { > DEBUG(1,("session_init: failed to open sessionid tdb\n")); > return False; > } >-- >1.8.3.1 > > >From 6e11bff43cf83d052880ef5a7507f1279b4fdf07 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd@samba.org> >Date: Wed, 4 Sep 2013 16:57:17 +0200 >Subject: [PATCH 3/3] s3-session: use sessionid_init_readonly() from cmdline > tools. >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Guenther > >Signed-off-by: Günther Deschner <gd@samba.org> >--- > source3/include/proto.h | 1 + > source3/lib/sessionid_tdb.c | 16 +++++++++++++--- > source3/utils/net_status.c | 2 +- > source3/utils/status.c | 2 +- > 4 files changed, 16 insertions(+), 5 deletions(-) > >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 6bd39c4..769aac2 100644 >--- a/source3/lib/sessionid_tdb.c >+++ b/source3/lib/sessionid_tdb.c >@@ -30,17 +30,27 @@ static struct db_context *session_db_ctx(void) > return session_db_ctx_ptr; > } > >-static struct db_context *session_db_ctx_init(void) >+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_init() == 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_status.c b/source3/utils/net_status.c >index 6b25719..d0e807d 100644 >--- a/source3/utils/net_status.c >+++ b/source3/utils/net_status.c >@@ -240,7 +240,7 @@ int net_status(struct net_context *c, int argc, const char **argv) > {NULL, NULL, 0, NULL, NULL} > }; > >- if (!sessionid_init()) { >+ if (!sessionid_init_readonly()) { > d_printf("faild to open sessionid.tdb\n"); > return -1; > } >diff --git a/source3/utils/status.c b/source3/utils/status.c >index 34a7730..dc05096 100644 >--- a/source3/utils/status.c >+++ b/source3/utils/status.c >@@ -378,7 +378,7 @@ static int traverse_sessionid(const char *key, struct sessionid *session, > } > > >- if (!sessionid_init()) { >+ if (!sessionid_init_readonly()) { > fprintf(stderr, "Can't open sessionid.tdb\n"); > ret = -1; > goto done; >-- >1.8.3.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
vl
:
review+
asn
:
review+
Actions:
View
Attachments on
bug 10127
:
9191
|
9192
|
9195