The Samba-Bugzilla – Attachment 4117 Details for
Bug 6318
registry shares with empty path lead to share with root directory access
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch for the bug
make_registry_shares_without_path_unavailable.v3-3-test.patch (text/plain), 8.54 KB, created by
Michael Adam
on 2009-05-05 07:14:25 UTC
(
hide
)
Description:
patch for the bug
Filename:
MIME Type:
Creator:
Michael Adam
Created:
2009-05-05 07:14:25 UTC
Size:
8.54 KB
patch
obsolete
>From 4b0d20f329cc79a15615b58eb3db3c76629128e9 Mon Sep 17 00:00:00 2001 >From: Michael Adam <obnox@samba.org> >Date: Wed, 24 Sep 2008 20:31:39 +0200 >Subject: [PATCH] loadparm: rename process_registry_service() to process_smbconf_service(). > >There is nothing registry-specific in that function. > >Michael >--- > source/param/loadparm.c | 6 +++--- > 1 files changed, 3 insertions(+), 3 deletions(-) > >diff --git a/source/param/loadparm.c b/source/param/loadparm.c >index 5cb9476..c9e10dd 100644 >--- a/source/param/loadparm.c >+++ b/source/param/loadparm.c >@@ -6564,7 +6564,7 @@ static struct smbconf_ctx *lp_smbconf_ctx(void) > return conf_ctx; > } > >-static bool process_registry_service(struct smbconf_service *service) >+static bool process_smbconf_service(struct smbconf_service *service) > { > uint32_t count; > bool ret; >@@ -6620,7 +6620,7 @@ static bool process_registry_globals(void) > goto done; > } > >- ret = process_registry_service(service); >+ ret = process_smbconf_service(service); > if (!ret) { > goto done; > } >@@ -6658,7 +6658,7 @@ static bool process_registry_shares(void) > if (strequal(service[count]->name, GLOBAL_NAME)) { > continue; > } >- ret = process_registry_service(service[count]); >+ ret = process_smbconf_service(service[count]); > if (!ret) { > goto done; > } >-- >1.6.0.2 > > >From f7562e7bf7a7779b2f0acd90db9e7a89b24693b2 Mon Sep 17 00:00:00 2001 >From: Michael Adam <obnox@samba.org> >Date: Tue, 28 Apr 2009 01:24:27 +0200 >Subject: [PATCH] s3:mark registry shares without path unavailable just as with text config > >This prevents users from getting access to "/" in misconfigured setups. > >Michael >(cherry picked from commit d16e40b5ef9add630d027ff92e440c44bfb88ef0) >--- > source/param/loadparm.c | 3 +++ > 1 files changed, 3 insertions(+), 0 deletions(-) > >diff --git a/source/param/loadparm.c b/source/param/loadparm.c >index c9e10dd..442e599 100644 >--- a/source/param/loadparm.c >+++ b/source/param/loadparm.c >@@ -6585,6 +6585,9 @@ static bool process_smbconf_service(struct smbconf_service *service) > return false; > } > } >+ if (iServiceIndex >= 0) { >+ ret = service_ok(iServiceIndex); >+ } > return true; > } > >-- >1.6.0.2 > > >From 9b46e168f7451d49e1614d4a37ec218fe346e6ef Mon Sep 17 00:00:00 2001 >From: Michael Adam <obnox@samba.org> >Date: Wed, 29 Apr 2009 01:31:03 +0200 >Subject: [PATCH] s3:loadparm: refactor process_registry_service out or process_registry_globals > >Michael >(cherry picked from commit fb3b6576127ce837ac711e87c293d1f4cf97473c) >--- > source/include/proto.h | 1 + > source/param/loadparm.c | 36 +++++++++++++++++++++++++----------- > 2 files changed, 26 insertions(+), 11 deletions(-) > >diff --git a/source/include/proto.h b/source/include/proto.h >index ec8637b..0eaee69 100644 >--- a/source/include/proto.h >+++ b/source/include/proto.h >@@ -5980,6 +5980,7 @@ bool lp_string_is_valid_boolean(const char *parm_value); > bool lp_invert_boolean(const char *str, const char **inverse_str); > bool lp_canonicalize_boolean(const char *str, const char**canon_str); > bool service_ok(int iService); >+bool process_registry_service(const char *service_name); > bool lp_config_backend_is_registry(void); > bool lp_config_backend_is_file(void); > bool lp_file_list_changed(void); >diff --git a/source/param/loadparm.c b/source/param/loadparm.c >index 442e599..fd76c07 100644 >--- a/source/param/loadparm.c >+++ b/source/param/loadparm.c >@@ -6591,10 +6591,10 @@ static bool process_smbconf_service(struct smbconf_service *service) > return true; > } > >-/* >- * process_registry_globals >+/** >+ * load a service from registry and activate it > */ >-static bool process_registry_globals(void) >+bool process_registry_service(const char *service_name) > { > WERROR werr; > struct smbconf_service *service = NULL; >@@ -6606,19 +6606,18 @@ static bool process_registry_globals(void) > goto done; > } > >- ret = do_parameter("registry shares", "yes", NULL); >- if (!ret) { >- goto done; >- } >+ DEBUG(5, ("process_registry_service: service name %s\n", service_name)); > >- if (!smbconf_share_exists(conf_ctx, GLOBAL_NAME)) { >- /* nothing to read from the registry yet but make sure lp_load >- * doesn't return false */ >+ if (!smbconf_share_exists(conf_ctx, service_name)) { >+ /* >+ * Registry does not contain data for this service (yet), >+ * but make sure lp_load doesn't return false. >+ */ > ret = true; > goto done; > } > >- werr = smbconf_get_share(conf_ctx, mem_ctx, GLOBAL_NAME, &service); >+ werr = smbconf_get_share(conf_ctx, mem_ctx, service_name, &service); > if (!W_ERROR_IS_OK(werr)) { > goto done; > } >@@ -6636,6 +6635,21 @@ done: > return ret; > } > >+/* >+ * process_registry_globals >+ */ >+static bool process_registry_globals(void) >+{ >+ bool ret; >+ >+ ret = do_parameter("registry shares", "yes", NULL); >+ if (!ret) { >+ return ret; >+ } >+ >+ return process_registry_service(GLOBAL_NAME); >+} >+ > static bool process_registry_shares(void) > { > WERROR werr; >-- >1.6.0.2 > > >From b7ff3eef441099e6f6850fdea0841956daaf05c6 Mon Sep 17 00:00:00 2001 >From: Michael Adam <obnox@samba.org> >Date: Wed, 29 Apr 2009 01:49:53 +0200 >Subject: [PATCH] s3:smbd/service: switch load_registry_service/shares to use loadparm routines > >instead of reading the registry directly with tdb and activating the >configure options by hand. > >This eliminates the need for repeating checks done in loadparm. >For instance it disables registry shares without path in the server >as is the case with text based shares. > >Michael >(cherry picked from commit 077bcc11257697b243916fbb02cd72b3a122b9ba) >--- > source/include/proto.h | 1 + > source/param/loadparm.c | 2 +- > source/smbd/service.c | 73 ++--------------------------------------------- > 3 files changed, 5 insertions(+), 71 deletions(-) > >diff --git a/source/include/proto.h b/source/include/proto.h >index 0eaee69..f696459 100644 >--- a/source/include/proto.h >+++ b/source/include/proto.h >@@ -5981,6 +5981,7 @@ bool lp_invert_boolean(const char *str, const char **inverse_str); > bool lp_canonicalize_boolean(const char *str, const char**canon_str); > bool service_ok(int iService); > bool process_registry_service(const char *service_name); >+bool process_registry_shares(void); > bool lp_config_backend_is_registry(void); > bool lp_config_backend_is_file(void); > bool lp_file_list_changed(void); >diff --git a/source/param/loadparm.c b/source/param/loadparm.c >index fd76c07..d402087 100644 >--- a/source/param/loadparm.c >+++ b/source/param/loadparm.c >@@ -6650,7 +6650,7 @@ static bool process_registry_globals(void) > return process_registry_service(GLOBAL_NAME); > } > >-static bool process_registry_shares(void) >+bool process_registry_shares(void) > { > WERROR werr; > uint32_t count; >diff --git a/source/smbd/service.c b/source/smbd/service.c >index 5e75fce..e7dcdf8 100644 >--- a/source/smbd/service.c >+++ b/source/smbd/service.c >@@ -221,16 +221,6 @@ bool set_current_service(connection_struct *conn, uint16 flags, bool do_chdir) > > static int load_registry_service(const char *servicename) > { >- struct registry_key *key; >- char *path; >- WERROR err; >- >- uint32 i; >- char *value_name; >- struct registry_value *value; >- >- int res = -1; >- > if (!lp_registry_shares()) { > return -1; > } >@@ -243,79 +233,22 @@ static int load_registry_service(const char *servicename) > return -2; > } > >- if (asprintf(&path, "%s\\%s", KEY_SMBCONF, servicename) == -1) { >- return -1; >- } >- >- err = reg_open_path(NULL, path, REG_KEY_READ, get_root_nt_token(), >- &key); >- SAFE_FREE(path); >- >- if (!W_ERROR_IS_OK(err)) { >+ if (!process_registry_service(servicename)) { > return -1; > } > >- res = lp_add_service(servicename, -1); >- if (res == -1) { >- goto error; >- } >- >- for (i=0; >- W_ERROR_IS_OK(reg_enumvalue(key, key, i, &value_name, &value)); >- i++) { >- switch (value->type) { >- case REG_DWORD: { >- char *tmp; >- if (asprintf(&tmp, "%d", value->v.dword) == -1) { >- continue; >- } >- lp_do_parameter(res, value_name, tmp); >- SAFE_FREE(tmp); >- break; >- } >- case REG_SZ: { >- lp_do_parameter(res, value_name, value->v.sz.str); >- break; >- } >- default: >- /* Ignore all the rest */ >- break; >- } >- >- TALLOC_FREE(value_name); >- TALLOC_FREE(value); >- } >- >- error: >- >- TALLOC_FREE(key); >- return res; >+ return lp_servicenumber(servicename); > } > > void load_registry_shares(void) > { >- struct registry_key *key; >- char *name; >- WERROR err; >- int i; >- > DEBUG(8, ("load_registry_shares()\n")); > if (!lp_registry_shares()) { > return; > } > >- err = reg_open_path(NULL, KEY_SMBCONF, REG_KEY_READ, >- get_root_nt_token(), &key); >- if (!(W_ERROR_IS_OK(err))) { >- return; >- } >- >- for (i=0; W_ERROR_IS_OK(reg_enumkey(key, key, i, &name, NULL)); i++) { >- load_registry_service(name); >- TALLOC_FREE(name); >- } >+ process_registry_shares(); > >- TALLOC_FREE(key); > return; > } > >-- >1.6.0.2 >
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
Actions:
View
Attachments on
bug 6318
:
4117
|
4120