The Samba-Bugzilla – Attachment 11551 Details for
Bug 10722
samba-tool crashes with uncaught exception when parsing include = /path/to/%U.conf in smb.conf
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
cosmetics changes
[fixed]_ignore_substitution_variable_in_smb.patch (text/plain), 7.24 KB, created by
Quentin Gibeaux
on 2015-10-29 12:54:48 UTC
(
hide
)
Description:
cosmetics changes
Filename:
MIME Type:
Creator:
Quentin Gibeaux
Created:
2015-10-29 12:54:48 UTC
Size:
7.24 KB
patch
obsolete
>From c511eb0af59ea5066507fcb8e3d63bb8798c3654 Mon Sep 17 00:00:00 2001 >From: Quentin Gibeaux <qgibeaux@iris-tech.fr> >Date: Wed, 9 Sep 2015 12:07:20 +0200 >Subject: [PATCH 1/4] lib/param: handle (ignore) substitution variable in > smb.conf > >Signed-off-by: Quentin Gibeaux <qgibeaux@iris-tech.fr> >--- > lib/param/loadparm.c | 16 +++++++++++++++- > 1 file changed, 15 insertions(+), 1 deletion(-) > >diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c >index a0700a9..72e53f7 100644 >--- a/lib/param/loadparm.c >+++ b/lib/param/loadparm.c >@@ -1101,8 +1101,22 @@ bool handle_include(struct loadparm_context *lp_ctx, struct loadparm_service *se > > lpcfg_string_set(lp_ctx, ptr, fname); > >- if (file_exist(fname)) >+ if (file_exist(fname)) { > return pm_process(fname, do_section, lpcfg_do_parameter, lp_ctx); >+ } else { >+ char *substitution_variable_substring; >+ substitution_variable_substring = strchr(fname, '%'); >+ >+ if (substitution_variable_substring) { >+ char next_char = substitution_variable_substring[1]; >+ if ((next_char >= 'a' && next_char <= 'z') >+ || (next_char >= 'A' && next_char <= 'Z')) { >+ DEBUG(2, ("Tried to load %s but variable in " >+ "filename, ignoring file.\n", fname)); >+ return true; >+ } >+ } >+ } > > DEBUG(2, ("Can't find include file %s\n", fname)); > >-- >2.1.4 > > >From c98f1b333869e7501c85e3d6ee835c3032fcc0d4 Mon Sep 17 00:00:00 2001 >From: Quentin Gibeaux <qgibeaux@iris-tech.fr> >Date: Wed, 9 Sep 2015 12:07:20 +0200 >Subject: [PATCH 2/4] lib/param: handle (ignore) substitution variable in > smb.conf > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=10722 > >The function handle_include returns false when trying to include >files that have a substitution variable in filename (like %U), >this patch makes handle_include to ignore this case, to make >samba-tool work when there is such include in samba's configuration. > >Error was : >Can't find include file %U.conf >ERROR(runtime): uncaught exception - Unable to load default file > >Signed-off-by: Quentin Gibeaux <qgibeaux@iris-tech.fr> >--- > lib/param/loadparm.c | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) > >diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c >index a0700a9..b54d000 100644 >--- a/lib/param/loadparm.c >+++ b/lib/param/loadparm.c >@@ -1090,6 +1090,8 @@ bool handle_include(struct loadparm_context *lp_ctx, struct loadparm_service *se > const char *pszParmValue, char **ptr) > { > char *fname; >+ char *substitution_variable_substring; >+ char next_char; > > if (lp_ctx->s3_fns) { > return lp_ctx->s3_fns->lp_include(lp_ctx, service, pszParmValue, ptr); >@@ -1104,6 +1106,20 @@ bool handle_include(struct loadparm_context *lp_ctx, struct loadparm_service *se > if (file_exist(fname)) > return pm_process(fname, do_section, lpcfg_do_parameter, lp_ctx); > >+ /* If the file doesn't exist, we check that it isn't due to variable >+ substitution */ >+ substitution_variable_substring = strchr(fname, '%'); >+ >+ if (substitution_variable_substring != NULL) { >+ next_char = substitution_variable_substring[1]; >+ if ((next_char >= 'a' && next_char <= 'z') >+ || (next_char >= 'A' && next_char <= 'Z')) { >+ DEBUG(2, ("Tried to load %s but variable substitution in " >+ "filename, ignoring file.\n", fname)); >+ return true; >+ } >+ } >+ > DEBUG(2, ("Can't find include file %s\n", fname)); > > return false; >-- >2.1.4 > > >From 0d37c0cc8a26ea87e0588e60e000b53a257c2107 Mon Sep 17 00:00:00 2001 >From: Quentin Gibeaux <qgibeaux@iris-tech.fr> >Date: Thu, 29 Oct 2015 13:46:42 +0100 >Subject: [PATCH 3/4] cleaning fail > >--- > lib/param/loadparm.c | 32 +------------------------------- > 1 file changed, 1 insertion(+), 31 deletions(-) > >diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c >index c578025..a0700a9 100644 >--- a/lib/param/loadparm.c >+++ b/lib/param/loadparm.c >@@ -1090,8 +1090,6 @@ bool handle_include(struct loadparm_context *lp_ctx, struct loadparm_service *se > const char *pszParmValue, char **ptr) > { > char *fname; >- char *substitution_variable_substring; >- char next_char; > > if (lp_ctx->s3_fns) { > return lp_ctx->s3_fns->lp_include(lp_ctx, service, pszParmValue, ptr); >@@ -1103,36 +1101,8 @@ bool handle_include(struct loadparm_context *lp_ctx, struct loadparm_service *se > > lpcfg_string_set(lp_ctx, ptr, fname); > >- if (file_exist(fname)) { >+ if (file_exist(fname)) > return pm_process(fname, do_section, lpcfg_do_parameter, lp_ctx); >- } else { >- char *substitution_variable_substring; >- substitution_variable_substring = strchr(fname, '%'); >- >- if (substitution_variable_substring) { >- char next_char = substitution_variable_substring[1]; >- if ((next_char >= 'a' && next_char <= 'z') >- || (next_char >= 'A' && next_char <= 'Z')) { >- DEBUG(2, ("Tried to load %s but variable in " >- "filename, ignoring file.\n", fname)); >- return true; >- } >- } >- } >- >- /* If the file doesn't exist, we check that it isn't due to variable >- substitution */ >- substitution_variable_substring = strchr(fname, '%'); >- >- if (substitution_variable_substring != NULL) { >- next_char = substitution_variable_substring[1]; >- if ((next_char >= 'a' && next_char <= 'z') >- || (next_char >= 'A' && next_char <= 'Z')) { >- DEBUG(2, ("Tried to load %s but variable substitution in " >- "filename, ignoring file.\n", fname)); >- return true; >- } >- } > > DEBUG(2, ("Can't find include file %s\n", fname)); > >-- >2.1.4 > > >From 17a80fc6593c7025a297cdcae46e18a3ce4d994c Mon Sep 17 00:00:00 2001 >From: Quentin Gibeaux <qgibeaux@iris-tech.fr> >Date: Thu, 29 Oct 2015 13:48:27 +0100 >Subject: [PATCH 4/4] lib/param: handle (ignore) substitution variable in > smb.conf > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=10722 > >The function handle_include returns false when trying to include >files that have a substitution variable in filename (like %U), >this patch makes handle_include to ignore this case, to make >samba-tool work when there is such include in samba's configuration. > >Error was : >Can't find include file %U.conf >ERROR(runtime): uncaught exception - Unable to load default file > >Signed-off-by: Quentin Gibeaux <qgibeaux@iris-tech.fr> >--- > lib/param/loadparm.c | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) > >diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c >index a0700a9..b54d000 100644 >--- a/lib/param/loadparm.c >+++ b/lib/param/loadparm.c >@@ -1090,6 +1090,8 @@ bool handle_include(struct loadparm_context *lp_ctx, struct loadparm_service *se > const char *pszParmValue, char **ptr) > { > char *fname; >+ char *substitution_variable_substring; >+ char next_char; > > if (lp_ctx->s3_fns) { > return lp_ctx->s3_fns->lp_include(lp_ctx, service, pszParmValue, ptr); >@@ -1104,6 +1106,20 @@ bool handle_include(struct loadparm_context *lp_ctx, struct loadparm_service *se > if (file_exist(fname)) > return pm_process(fname, do_section, lpcfg_do_parameter, lp_ctx); > >+ /* If the file doesn't exist, we check that it isn't due to variable >+ substitution */ >+ substitution_variable_substring = strchr(fname, '%'); >+ >+ if (substitution_variable_substring != NULL) { >+ next_char = substitution_variable_substring[1]; >+ if ((next_char >= 'a' && next_char <= 'z') >+ || (next_char >= 'A' && next_char <= 'Z')) { >+ DEBUG(2, ("Tried to load %s but variable substitution in " >+ "filename, ignoring file.\n", fname)); >+ return true; >+ } >+ } >+ > DEBUG(2, ("Can't find include file %s\n", fname)); > > return false; >-- >2.1.4 >
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 10722
:
10116
|
10170
|
10171
|
10257
|
11420
|
11551
|
11552
|
11553
|
11554
|
11555
|
11702