[SCM] Samba Shared Repository - branch v3-4-test updated -
release-4-0-0alpha7-828-gcaa1f05
Michael Adam
obnox at samba.org
Tue Apr 28 12:41:52 GMT 2009
The branch, v3-4-test has been updated
via caa1f05420191d934c2ea1c2acaa75702c8e5c2e (commit)
via bfd10fd322fe1721b8b45256cd988ed83b18a8a6 (commit)
from 0c5f19fbea7a6419a84ac0137a9a09995ef7a933 (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-4-test
- Log -----------------------------------------------------------------
commit caa1f05420191d934c2ea1c2acaa75702c8e5c2e
Author: Michael Adam <obnox at samba.org>
Date: Tue Apr 28 12:18:23 2009 +0200
pm_process():raise level of debug message
Michael
(cherry picked from commit 664da577f931dfd47573d3d77a95afb573fba855)
commit bfd10fd322fe1721b8b45256cd988ed83b18a8a6
Author: Michael Adam <obnox at samba.org>
Date: Mon Apr 27 18:10:14 2009 +0200
s3:loadparm: prevent infinite include nesting.
This introduces a hard coded MAX_INCLUDE_DEPTH of 100.
When this is exceeded, handle_include (and hence lp_load) fails.
One could of course implement a more intelligent loop detection
in the include-tree, but this would require some restructuring
of the internal loadparm housekeeping. Maybe as a second improvement
step.
Michael
(cherry picked from commit d5f2bbdc489b751331e86afae58b0d80c5fedb9c)
-----------------------------------------------------------------------
Summary of changes:
lib/util/params.c | 2 +-
source3/param/loadparm.c | 21 +++++++++++++++++++--
2 files changed, 20 insertions(+), 3 deletions(-)
Changeset truncated at 500 lines:
diff --git a/lib/util/params.c b/lib/util/params.c
index 7af7ac7..80adc71 100644
--- a/lib/util/params.c
+++ b/lib/util/params.c
@@ -572,7 +572,7 @@ bool pm_process( const char *FileName,
if( !result ) /* Generic failure. */
{
- DEBUG(0,("%s Failed. Error returned from params.c:parse().\n", func));
+ DEBUG(3,("%s Failed. Error returned from params.c:parse().\n", func));
return( false );
}
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index c7bb47d..68a6ca2 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -6874,6 +6874,10 @@ done:
return ret;
}
+#define MAX_INCLUDE_DEPTH 100
+
+static uint8_t include_depth;
+
static struct file_lists {
struct file_lists *next;
char *name;
@@ -7061,12 +7065,22 @@ static bool handle_include(int snum, const char *pszParmValue, char **ptr)
{
char *fname;
+ if (include_depth >= MAX_INCLUDE_DEPTH) {
+ DEBUG(0, ("Error: Maximum include depth (%u) exceeded!\n",
+ include_depth));
+ return false;
+ }
+
if (strequal(pszParmValue, INCLUDE_REGISTRY_NAME)) {
if (!bAllowIncludeRegistry) {
return true;
}
if (bInGlobalSection) {
- return process_registry_globals();
+ bool ret;
+ include_depth++;
+ ret = process_registry_globals();
+ include_depth--;
+ return ret;
} else {
DEBUG(1, ("\"include = registry\" only effective "
"in %s section\n", GLOBAL_NAME));
@@ -7083,7 +7097,10 @@ static bool handle_include(int snum, const char *pszParmValue, char **ptr)
string_set(ptr, fname);
if (file_exist(fname)) {
- bool ret = pm_process(fname, do_section, do_parameter, NULL);
+ bool ret;
+ include_depth++;
+ ret = pm_process(fname, do_section, do_parameter, NULL);
+ include_depth--;
SAFE_FREE(fname);
return ret;
}
--
Samba Shared Repository
More information about the samba-cvs
mailing list