[SCM] Samba Shared Repository - branch master updated

Andrew Bartlett abartlet at samba.org
Wed Feb 19 17:29:04 MST 2014


The branch, master has been updated
       via  8f0d06f heimdal_build: only enable libintl functions if everything was found
       via  0c8e9cc param: add const to a local variable to prevent a warning about lp_fstype
       via  8246e53 param: remove lp_dnsdomain from s3
       via  a7d2f9a param: change s3_param.h from a generated file to a static one
       via  0941789 param: remove generated loadparm ctx table file and include it directly
       via  9780113 param: use loadparm_globals struct instead of lp function pointers in s3_helpers
       via  12aa85a lib/param: rename lp_string to lpcfg_string
       via  1fb1f6b lib/param: handle non-constant strings properly by passing in a memory context
       via  bce62e6 s4: pass down a memory context when performing share_string_option, to allow substitutions
      from  497f032 build: check for libarchive version via pkgconfig

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 8f0d06fa5e654f647664727db6f12901579ec2c7
Author: Christian Ambach <ambi at samba.org>
Date:   Wed Feb 19 22:17:01 2014 +0100

    heimdal_build: only enable libintl functions if everything was found
    
    do not rely on intl.h being available but also on the functions being usable
    This should fix the build on HP-UX
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=9911
    Signed-off-by: Christian Ambach <ambi at samba.org>
    
    Change-Id: I5dd88d2d5216b778624778455cca99b32d0be58f
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    
    Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
    Autobuild-Date(master): Thu Feb 20 01:28:24 CET 2014 on sn-devel-104

commit 0c8e9cc7570f7498b4ea533325a1d324c3e75be9
Author: Garming Sam <garming at catalyst.net.nz>
Date:   Fri Feb 14 10:38:55 2014 +1300

    param: add const to a local variable to prevent a warning about lp_fstype
    
    Signed-off-by: Garming Sam <garming at catalyst.net.nz>
    Change-Id: Idc9217eb812b018fed933f84c2c4f1818f8f9372
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Nadezhda Ivanova <nivanova at samba.org>

commit 8246e53bb693231213d5f9586ff4baefbc3ec6a8
Author: Garming Sam <garming at catalyst.net.nz>
Date:   Fri Jan 24 17:39:41 2014 +1300

    param: remove lp_dnsdomain from s3
    
    With the use of the shared globals structure, lp_dnsdomain is no longer used in the code and removing it would remove a notable special case
    
    Signed-off-by: Garming Sam <garming at catalyst.net.nz>
    Change-Id: I59526c40c58e132a134d67fa7944dfeacd05f4c6
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Nadezhda Ivanova <nivanova at samba.org>

commit a7d2f9a08ed11dba157d6fe5c03581114478e3d3
Author: Garming Sam <garming at catalyst.net.nz>
Date:   Fri Jan 24 16:45:31 2014 +1300

    param: change s3_param.h from a generated file to a static one
    
    Signed-off-by: Garming Sam <garming at catalyst.net.nz>
    Change-Id: I131e37ec92f7a826caec382023915c5e4b4c52be
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Nadezhda Ivanova <nivanova at samba.org>

commit 09417890635423a3a0cdae1617595a7af9a96808
Author: Garming Sam <garming at catalyst.net.nz>
Date:   Fri Jan 24 15:52:15 2014 +1300

    param: remove generated loadparm ctx table file and include it directly
    
    Signed-off-by: Garming Sam <garming at catalyst.net.nz>
    Change-Id: I5f1d42e3ae6495accf7a711938cc28c03ab2cd62
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Nadezhda Ivanova <nivanova at samba.org>

commit 9780113846760dd1cafd11e4091aad28f82639d4
Author: Garming Sam <garming at catalyst.net.nz>
Date:   Fri Jan 24 15:38:59 2014 +1300

    param: use loadparm_globals struct instead of lp function pointers in s3_helpers
    
    Signed-off-by: Garming Sam <garming at catalyst.net.nz>
    Change-Id: I4507cdbf111b7f9dca3ca18ee2bf242ffdfeb4e7
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Nadezhda Ivanova <nivanova at samba.org>

commit 12aa85a90c5f06e1d585918d8e44ebc45137f89e
Author: Garming Sam <garming at catalyst.net.nz>
Date:   Fri Feb 14 10:23:36 2014 +1300

    lib/param: rename lp_string to lpcfg_string
    
    This avoids the confusion with lp_string in source3.
    
    Signed-off-by: Garming Sam <garming at catalyst.net.nz>
    Change-Id: Ic6df23b9e5986f7d1fd6253e30ebfdc1a3a45a41
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Nadezhda Ivanova <nivanova at samba.org>

commit 1fb1f6bc0dad00d1eb2d1e2aff34e9d3b2714421
Author: Garming Sam <garming at catalyst.net.nz>
Date:   Fri Jan 17 10:30:37 2014 +1300

    lib/param: handle non-constant strings properly by passing in a memory context
    
    Signed-off-by: Garming Sam <garming at catalyst.net.nz>
    Change-Id: Ic6bb1c709defd2b0f35fc7b877da0badca385776
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Nadezhda Ivanova <nivanova at samba.org>

commit bce62e600085270f26053882c5a4e35f5fe4fb5e
Author: Garming Sam <garming at catalyst.net.nz>
Date:   Fri Jan 17 10:16:12 2014 +1300

    s4: pass down a memory context when performing share_string_option, to allow substitutions
    
    Signed-off-by: Garming Sam <garming at catalyst.net.nz>
    Change-Id: I24b36db3ac11834c3268b2da929e214c10268b16
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Nadezhda Ivanova <nivanova at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 lib/param/loadparm.c                          |   60 +++++++-------
 lib/param/loadparm.h                          |    3 +
 lib/param/s3_param.h                          |   20 +++++
 lib/param/wscript_build                       |    6 --
 script/generate_param.py                      |  112 ++++---------------------
 source3/include/proto.h                       |    1 -
 source3/param/loadparm.c                      |    8 ++-
 source3/param/loadparm_ctx.c                  |   20 ++++-
 source3/param/wscript_build                   |    8 +--
 source3/smbd/trans2.c                         |    2 +-
 source4/heimdal_build/config.h                |    3 +-
 source4/nbt_server/wins/winsdb.c              |    2 +-
 source4/ntvfs/cifs/vfs_cifs.c                 |   38 +++++++--
 source4/ntvfs/cifs_posix_cli/vfs_cifs_posix.c |    2 +-
 source4/ntvfs/ipc/rap_server.c                |    2 +-
 source4/ntvfs/posix/vfs_posix.c               |   12 ++-
 source4/ntvfs/simple/vfs_simple.c             |    2 +-
 source4/ntvfs/smb2/vfs_smb2.c                 |   44 ++++++++--
 source4/ntvfs/sysdep/sys_lease.c              |    9 ++-
 source4/ntvfs/sysdep/sys_notify.c             |    2 +-
 source4/param/share.c                         |    4 +-
 source4/param/share.h                         |    4 +-
 source4/param/share_classic.c                 |   27 +++---
 source4/param/share_ldb.c                     |   24 ++++--
 source4/rpc_server/common/share_info.c        |   23 ++++--
 source4/rpc_server/srvsvc/dcesrv_srvsvc.c     |   22 +++---
 source4/rpc_server/srvsvc/srvsvc_ntvfs.c      |    6 +-
 source4/smb_server/smb/service.c              |    5 +-
 source4/smb_server/smb2/tcon.c                |    5 +-
 29 files changed, 252 insertions(+), 224 deletions(-)
 create mode 100644 lib/param/s3_param.h


Changeset truncated at 500 lines:

diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c
index 1d5ae9e..51053ba 100644
--- a/lib/param/loadparm.c
+++ b/lib/param/loadparm.c
@@ -149,7 +149,7 @@ struct loadparm_service *lpcfg_default_service(struct loadparm_context *lp_ctx)
  * callers without affecting the source string.
  */
 
-static const char *lp_string(const char *s)
+static const char *lpcfg_string(const char *s)
 {
 #if 0  /* until REWRITE done to make thread-safe */
 	size_t len = s ? strlen(s) : 0;
@@ -162,7 +162,7 @@ static const char *lp_string(const char *s)
 	   present all the time? */
 
 #if 0
-	DEBUG(10, ("lp_string(%s)\n", s));
+	DEBUG(10, ("lpcfg_string(%s)\n", s));
 #endif
 
 #if 0  /* until REWRITE done to make thread-safe */
@@ -207,50 +207,34 @@ static struct loadparm_context *global_loadparm_context;
 #define lpcfg_global_service(i) global_loadparm_context->services[i]
 
 #define FN_GLOBAL_STRING(fn_name,var_name) \
- _PUBLIC_ const char *lpcfg_ ## fn_name(struct loadparm_context *lp_ctx) {\
+ _PUBLIC_ char *lpcfg_ ## fn_name(struct loadparm_context *lp_ctx, TALLOC_CTX *ctx) {\
 	 if (lp_ctx == NULL) return NULL;				\
 	 if (lp_ctx->s3_fns) {						\
-	         smb_panic( __location__ ": " #fn_name " not implemented because it is an allocated and substiuted string"); \
+		 return lp_ctx->globals->var_name ? lp_ctx->s3_fns->lp_string(ctx, lp_ctx->globals->var_name) : talloc_strdup(ctx, ""); \
 	 }								\
-	 return lp_ctx->globals->var_name ? lp_string(lp_ctx->globals->var_name) : ""; \
+	 return lp_ctx->globals->var_name ? talloc_strdup(ctx, lpcfg_string(lp_ctx->globals->var_name)) : talloc_strdup(ctx, ""); \
 }
 
 #define FN_GLOBAL_CONST_STRING(fn_name,var_name)				\
  _PUBLIC_ const char *lpcfg_ ## fn_name(struct loadparm_context *lp_ctx) { \
 	if (lp_ctx == NULL) return NULL;				\
-	if (lp_ctx->s3_fns) {						\
-		SMB_ASSERT(lp_ctx->s3_fns->fn_name);			\
-		return lp_ctx->s3_fns->fn_name();			\
-	}								\
-	return lp_ctx->globals->var_name ? lp_string(lp_ctx->globals->var_name) : ""; \
+	return lp_ctx->globals->var_name ? lpcfg_string(lp_ctx->globals->var_name) : ""; \
 }
 
 #define FN_GLOBAL_LIST(fn_name,var_name)				\
  _PUBLIC_ const char **lpcfg_ ## fn_name(struct loadparm_context *lp_ctx) { \
 	 if (lp_ctx == NULL) return NULL;				\
-	 if (lp_ctx->s3_fns) {						\
-		 SMB_ASSERT(lp_ctx->s3_fns->fn_name);			\
-		 return lp_ctx->s3_fns->fn_name();			\
-	 }								\
 	 return lp_ctx->globals->var_name;				\
  }
 
 #define FN_GLOBAL_BOOL(fn_name,var_name) \
  _PUBLIC_ bool lpcfg_ ## fn_name(struct loadparm_context *lp_ctx) {\
 	 if (lp_ctx == NULL) return false;				\
-	 if (lp_ctx->s3_fns) {						\
-		 SMB_ASSERT(lp_ctx->s3_fns->fn_name);			\
-		 return lp_ctx->s3_fns->fn_name();			\
-	 }								\
 	 return lp_ctx->globals->var_name;				\
 }
 
 #define FN_GLOBAL_INTEGER(fn_name,var_name) \
  _PUBLIC_ int lpcfg_ ## fn_name(struct loadparm_context *lp_ctx) { \
-	 if (lp_ctx->s3_fns) {						\
-		 SMB_ASSERT(lp_ctx->s3_fns->fn_name);			\
-		 return lp_ctx->s3_fns->fn_name();			\
-	 }								\
 	 return lp_ctx->globals->var_name;				\
  }
 
@@ -258,13 +242,17 @@ static struct loadparm_context *global_loadparm_context;
  * loadparm_service is shared and lpcfg_service() checks the ->s3_fns
  * hook */
 #define FN_LOCAL_STRING(fn_name,val) \
+ _PUBLIC_ char *lpcfg_ ## fn_name(struct loadparm_service *service, \
+					struct loadparm_service *sDefault, TALLOC_CTX *ctx) { \
+	 return(talloc_strdup(ctx, lpcfg_string((const char *)((service != NULL && service->val != NULL) ? service->val : sDefault->val)))); \
+ }
+
+#define FN_LOCAL_CONST_STRING(fn_name,val) \
  _PUBLIC_ const char *lpcfg_ ## fn_name(struct loadparm_service *service, \
 					struct loadparm_service *sDefault) { \
-	 return(lp_string((const char *)((service != NULL && service->val != NULL) ? service->val : sDefault->val))); \
+	 return((const char *)((service != NULL && service->val != NULL) ? service->val : sDefault->val)); \
  }
 
-#define FN_LOCAL_CONST_STRING(fn_name,val) FN_LOCAL_STRING(fn_name, val)
-
 #define FN_LOCAL_LIST(fn_name,val) \
  _PUBLIC_ const char **lpcfg_ ## fn_name(struct loadparm_service *service, \
 					 struct loadparm_service *sDefault) {\
@@ -450,7 +438,7 @@ const char *lpcfg_parm_string(struct loadparm_context *lp_ctx,
 	const char *value = lpcfg_get_parametric(lp_ctx, service, type, option);
 
 	if (value)
-		return lp_string(value);
+		return lpcfg_string(value);
 
 	return NULL;
 }
@@ -720,7 +708,7 @@ bool lpcfg_add_home(struct loadparm_context *lp_ctx,
 	    || strequal(default_service->path, lp_ctx->sDefault->path)) {
 		service->path = talloc_strdup(service, pszHomedir);
 	} else {
-		service->path = string_sub_talloc(service, lpcfg_path(default_service, lp_ctx->sDefault), "%H", pszHomedir);
+		service->path = string_sub_talloc(service, lpcfg_path(default_service, lp_ctx->sDefault, service), "%H", pszHomedir);
 	}
 
 	if (!(*(service->comment))) {
@@ -2398,6 +2386,7 @@ struct loadparm_context *loadparm_init_s3(TALLOC_CTX *mem_ctx,
 		return NULL;
 	}
 	loadparm_context->s3_fns = s3_fns;
+	loadparm_context->globals = s3_fns->globals;
 	return loadparm_context;
 }
 
@@ -2421,13 +2410,21 @@ const char *lp_default_path(void)
 static bool lpcfg_update(struct loadparm_context *lp_ctx)
 {
 	struct debug_settings settings;
-	lpcfg_add_auto_services(lp_ctx, lpcfg_auto_services(lp_ctx));
+	TALLOC_CTX *tmp_ctx;
+
+	tmp_ctx = talloc_new(lp_ctx);
+	if (tmp_ctx == NULL) {
+		return false;
+	}
+
+	lpcfg_add_auto_services(lp_ctx, lpcfg_auto_services(lp_ctx, tmp_ctx));
 
 	if (!lp_ctx->globals->wins_server_list && lp_ctx->globals->we_are_a_wins_server) {
 		lpcfg_do_global_parameter(lp_ctx, "wins server", "127.0.0.1");
 	}
 
 	if (!lp_ctx->global) {
+		TALLOC_FREE(tmp_ctx);
 		return true;
 	}
 
@@ -2456,6 +2453,7 @@ static bool lpcfg_update(struct loadparm_context *lp_ctx)
 		unsetenv("SOCKET_TESTNONBLOCK");
 	}
 
+	TALLOC_FREE(tmp_ctx);
 	return true;
 }
 
@@ -2621,7 +2619,7 @@ struct loadparm_service *lpcfg_service(struct loadparm_context *lp_ctx,
 
 const char *lpcfg_servicename(const struct loadparm_service *service)
 {
-	return lp_string((const char *)service->szService);
+	return lpcfg_string((const char *)service->szService);
 }
 
 /**
@@ -2630,7 +2628,7 @@ const char *lpcfg_servicename(const struct loadparm_service *service)
 const char *lpcfg_volume_label(struct loadparm_service *service, struct loadparm_service *sDefault)
 {
 	const char *ret;
-	ret = lp_string((const char *)((service != NULL && service->volume != NULL) ?
+	ret = lpcfg_string((const char *)((service != NULL && service->volume != NULL) ?
 				       service->volume : sDefault->volume));
 	if (!*ret)
 		return lpcfg_servicename(service);
@@ -2643,7 +2641,7 @@ const char *lpcfg_volume_label(struct loadparm_service *service, struct loadparm
 const char *lpcfg_printername(struct loadparm_service *service, struct loadparm_service *sDefault)
 {
 	const char *ret;
-	ret = lp_string((const char *)((service != NULL && service->_printername != NULL) ?
+	ret = lpcfg_string((const char *)((service != NULL && service->_printername != NULL) ?
 				       service->_printername : sDefault->_printername));
 	if (ret == NULL || (ret != NULL && *ret == '\0'))
 		ret = lpcfg_servicename(service);
diff --git a/lib/param/loadparm.h b/lib/param/loadparm.h
index 8a04b3f..60b76c4 100644
--- a/lib/param/loadparm.h
+++ b/lib/param/loadparm.h
@@ -252,6 +252,9 @@ int lp_find_server_role(int server_role, int security, int domain_logons, int do
 int lp_find_security(int server_role, int security);
 bool lp_is_security_and_server_role_valid(int server_role, int security);
 
+struct loadparm_global * get_globals(void);
+char * lp_string(TALLOC_CTX *, const char *);
+
 /**
  * Check if two parameters are equal.
  */
diff --git a/lib/param/s3_param.h b/lib/param/s3_param.h
new file mode 100644
index 0000000..106c480
--- /dev/null
+++ b/lib/param/s3_param.h
@@ -0,0 +1,20 @@
+#ifndef __S3_PARAM_H__
+#define __S3_PARAM_H__
+
+struct loadparm_s3_helpers
+{
+	const char * (*get_parametric)(struct loadparm_service *, const char *type, const char *option);
+	struct parm_struct * (*get_parm_struct)(const char *param_name);
+	void * (*get_parm_ptr)(struct loadparm_service *service, struct parm_struct *parm);
+	struct loadparm_service * (*get_service)(const char *service_name);
+	struct loadparm_service * (*get_default_loadparm_service)(void);
+	struct loadparm_service * (*get_servicebynum)(int snum);
+	int (*get_numservices)(void);
+	bool (*load)(const char *filename);
+	bool (*set_cmdline)(const char *pszParmName, const char *pszParmValue);
+	void (*dump)(FILE *f, bool show_defaults, int maxtoprint);
+	char * (*lp_string)(TALLOC_CTX *ctx, const char *in);
+	struct loadparm_global *globals;
+};
+
+#endif /* __S3_PARAM_H__ */
diff --git a/lib/param/wscript_build b/lib/param/wscript_build
index 256dfcb..8fe751c 100644
--- a/lib/param/wscript_build
+++ b/lib/param/wscript_build
@@ -18,12 +18,6 @@ bld.SAMBA_GENERATOR('param_local.h',
                     group='build_source',
                     rule='${PYTHON} ${SRC[0].abspath(env)} --file ${SRC[1].abspath(env)} --output ${TGT} --mode=PARAMDEFS --scope=LOCAL')
 
-bld.SAMBA_GENERATOR('s3_param.h',
-                    source= '../../script/generate_param.py ../../docs-xml/smbdotconf/parameters.all.xml',
-                    target='s3_param.h',
-                    group='build_source',
-                    rule='${PYTHON} ${SRC[0].abspath(env)} --file ${SRC[1].abspath(env)} --output ${TGT} --mode=S3PARAM')
-
 bld.SAMBA_GENERATOR('param_global.h',
                     source= '../../script/generate_param.py ../../docs-xml/smbdotconf/parameters.all.xml',
                     target='param_global.h',
diff --git a/script/generate_param.py b/script/generate_param.py
index 4e04b3a..d79c13c 100644
--- a/script/generate_param.py
+++ b/script/generate_param.py
@@ -35,8 +35,8 @@ parser.add_option("-f", "--file", dest="filename",
                   help="input file", metavar="FILE")
 parser.add_option("-o", "--output", dest="output",
                   help='output file', metavar="FILE")
-parser.add_option("--mode", type="choice", metavar="<FUNCTIONS|S3PROTO|LIBPROTO|PARAMDEFS|S3PARAM|S3TABLE>",
-                 choices=["FUNCTIONS", "S3PROTO", "LIBPROTO", "PARAMDEFS", "S3PARAM", "S3TABLE"], default="FUNCTIONS")
+parser.add_option("--mode", type="choice", metavar="<FUNCTIONS|S3PROTO|LIBPROTO|PARAMDEFS>",
+                 choices=["FUNCTIONS", "S3PROTO", "LIBPROTO", "PARAMDEFS"], default="FUNCTIONS")
 parser.add_option("--scope", metavar="<GLOBAL|LOCAL>",
                   choices = ["GLOBAL", "LOCAL"], default="GLOBAL")
 
@@ -177,7 +177,7 @@ def make_lib_proto(path_in, path_out):
                 continue
 
             output_string = ""
-            if parameter['constant'] or parameter['type'] == 'string':
+            if parameter['constant']:
                 output_string += 'const '
             param_type = mapping.get(parameter['type'])
             if param_type is None:
@@ -186,12 +186,20 @@ def make_lib_proto(path_in, path_out):
 
             output_string += "lpcfg_%s" % parameter['function']
 
-            if parameter['context'] == 'G':
-                output_string += '(struct loadparm_context *);\n'
-            elif parameter['context'] == 'S':
-                output_string += '(struct loadparm_service *, struct loadparm_service *);\n'
+            if parameter['type'] == 'string' and not parameter['constant']:
+                if parameter['context'] == 'G':
+                    output_string += '(struct loadparm_context *, TALLOC_CTX *ctx);\n'
+                elif parameter['context'] == 'S':
+                    output_string += '(struct loadparm_service *, struct loadparm_service *, TALLOC_CTX *ctx);\n'
+                else:
+                    raise Exception(parameter['name'] + " has an invalid param type " + parameter['type'])
             else:
-                raise Exception(parameter['name'] + " has an invalid param type " + parameter['type'])
+                if parameter['context'] == 'G':
+                    output_string += '(struct loadparm_context *);\n'
+                elif parameter['context'] == 'S':
+                    output_string += '(struct loadparm_service *, struct loadparm_service *);\n'
+                else:
+                    raise Exception(parameter['name'] + " has an invalid param type " + parameter['type'])
 
             
             file_out.write(output_string)
@@ -250,90 +258,6 @@ def make_param_defs(path_in, path_out, scope):
     finally:
         file_out.close()
 
-def make_s3_param(path_in, path_out):
-    file_out = open(path_out, 'w')
-    try:
-        file_out.write('/* This file was automatically generated by generate_param.py. DO NOT EDIT */\n\n')
-        header = get_header(path_out)
-        file_out.write("#ifndef %s\n" % header)
-        file_out.write("#define %s\n\n" % header)
-        file_out.write("struct loadparm_s3_helpers\n")
-        file_out.write("{\n")
-        file_out.write("\tconst char * (*get_parametric)(struct loadparm_service *, const char *type, const char *option);\n")
-        file_out.write("\tstruct parm_struct * (*get_parm_struct)(const char *param_name);\n")
-        file_out.write("\tvoid * (*get_parm_ptr)(struct loadparm_service *service, struct parm_struct *parm);\n")
-        file_out.write("\tstruct loadparm_service * (*get_service)(const char *service_name);\n")
-        file_out.write("\tstruct loadparm_service * (*get_default_loadparm_service)(void);\n")
-        file_out.write("\tstruct loadparm_service * (*get_servicebynum)(int snum);\n")
-        file_out.write("\tint (*get_numservices)(void);\n")
-        file_out.write("\tbool (*load)(const char *filename);\n")
-        file_out.write("\tbool (*set_cmdline)(const char *pszParmName, const char *pszParmValue);\n")
-        file_out.write("\tvoid (*dump)(FILE *f, bool show_defaults, int maxtoprint);\n")
-        file_out.write("\tconst char * (*dnsdomain)(void);\n")
- 
-        for parameter in iterate_all(path_in):
-            # filter out parameteric options
-            if ':' in parameter['name']:
-                continue
-            if parameter['context'] != 'G':
-                continue
-            # STRING isn't handle yet properly
-            if parameter['type'] == 'string' and not parameter['constant']:
-                continue
-            output_string = "\t"
-            if parameter['constant'] or parameter['type'] == 'string':
-                output_string += 'const '
-            param_type = mapping.get(parameter['type'])
-            if param_type is None:
-               raise Exception(parameter['name'] + " has an invalid context " + parameter['context'])
-            output_string += param_type
-
-            output_string += " (*%s)(void);\n" % parameter['function']
-            file_out.write(output_string)
-
-        file_out.write("};\n")
-        file_out.write("\n#endif /* %s */\n\n" % header)
-    finally:
-        file_out.close()
-
-def make_s3_param_ctx_table(path_in, path_out):
-    file_out = open(path_out, 'w')
-    try:
-        file_out.write('/* This file was automatically generated by generate_param.py. DO NOT EDIT */\n\n')
-        file_out.write("static const struct loadparm_s3_helpers s3_fns =\n")
-        file_out.write("{\n")
-        file_out.write("\t.get_parametric = lp_parm_const_string_service,\n")
-        file_out.write("\t.get_parm_struct = lp_get_parameter,\n")
-        file_out.write("\t.get_parm_ptr = lp_parm_ptr,\n")
-        file_out.write("\t.get_service = lp_service_for_s4_ctx,\n")
-        file_out.write("\t.get_servicebynum = lp_servicebynum_for_s4_ctx,\n")
-        file_out.write("\t.get_default_loadparm_service = lp_default_loadparm_service,\n")
-        file_out.write("\t.get_numservices = lp_numservices,\n")
-        file_out.write("\t.load = lp_load_for_s4_ctx,\n")
-        file_out.write("\t.set_cmdline = lp_set_cmdline,\n")
-        file_out.write("\t.dump = lp_dump,\n")
-        file_out.write("\t.dnsdomain = lp_dnsdomain,\n")
-        header = get_header(path_out)
- 
-        for parameter in iterate_all(path_in):
-            # filter out parameteric options
-            if ':' in parameter['name']:
-                continue
-            if parameter['context'] != 'G':
-                continue
-            # STRING isn't handle yet properly
-            if parameter['type'] == 'string' and not parameter['constant']:
-                continue
-            output_string = "\t.%s" % parameter['function']
-            output_string += " = lp_%s,\n" % parameter['function']
-            file_out.write(output_string)
-
-        file_out.write("};")
-    finally:
-        file_out.close()
-
-
-
 if options.mode == 'FUNCTIONS':
     generate_functions(options.filename, options.output)
 elif options.mode == 'S3PROTO':
@@ -342,7 +266,3 @@ elif options.mode == 'LIBPROTO':
     make_lib_proto(options.filename, options.output)
 elif options.mode == 'PARAMDEFS':
     make_param_defs(options.filename, options.output, options.scope)
-elif options.mode == 'S3PARAM':
-    make_s3_param(options.filename, options.output)
-elif options.mode == 'S3TABLE':
-    make_s3_param_ctx_table(options.filename, options.output)
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 28c26a9..a6a6815 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -989,7 +989,6 @@ NTSTATUS trust_pw_change(struct netlogon_creds_cli_context *context,
 char *lp_servicename(TALLOC_CTX *ctx, int);
 const char *lp_const_servicename(int);
 bool lp_autoloaded(int);
-const char *lp_dnsdomain(void);
 int lp_winbind_max_domain_connections(void);
 bool lp_idmap_range(const char *domain_name, uint32_t *low, uint32_t *high);
 bool lp_idmap_default_range(uint32_t *low, uint32_t *high);
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index f2d1e6b..2114fa3 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -1072,7 +1072,7 @@ static void init_globals(bool reinit_globals)
  callers without affecting the source string.
 ********************************************************************/
 
-static char *lp_string(TALLOC_CTX *ctx, const char *s)
+char *lp_string(TALLOC_CTX *ctx, const char *s)
 {
 	char *ret;
 
@@ -1189,7 +1189,6 @@ FN_LOCAL_CONST_STRING(const_servicename, szService)
 
 /* These functions cannot be auto-generated */
 FN_LOCAL_BOOL(autoloaded, autoloaded)
-FN_GLOBAL_CONST_STRING(dnsdomain, dnsdomain)
 
 /* local prototypes */
 
@@ -5263,3 +5262,8 @@ int lp_security(void)
 	return lp_find_security(lp__server_role(),
 				lp__security());
 }
+
+struct loadparm_global * get_globals(void)
+{
+	return &Globals;
+}
diff --git a/source3/param/loadparm_ctx.c b/source3/param/loadparm_ctx.c
index 5cbc920..efae8cb 100644
--- a/source3/param/loadparm_ctx.c
+++ b/source3/param/loadparm_ctx.c
@@ -56,9 +56,25 @@ static bool lp_load_for_s4_ctx(const char *filename)
 	return status;
 }
 
-#include "loadparm_ctx_table.c"
+static struct loadparm_s3_helpers s3_fns =
+{
+	.get_parametric = lp_parm_const_string_service,
+	.get_parm_struct = lp_get_parameter,
+	.get_parm_ptr = lp_parm_ptr,
+	.get_service = lp_service_for_s4_ctx,
+	.get_servicebynum = lp_servicebynum_for_s4_ctx,
+	.get_default_loadparm_service = lp_default_loadparm_service,
+	.get_numservices = lp_numservices,
+	.load = lp_load_for_s4_ctx,
+	.set_cmdline = lp_set_cmdline,
+	.dump = lp_dump,
+};
 
 const struct loadparm_s3_helpers *loadparm_s3_helpers(void)
 {
-	return &s3_fns;
+	struct loadparm_s3_helpers *helpers;
+	helpers = &s3_fns;
+	helpers->globals = get_globals();
+	helpers->lp_string = lp_string;
+	return helpers;
 }
diff --git a/source3/param/wscript_build b/source3/param/wscript_build
index 34a906e..6c440f1 100644
--- a/source3/param/wscript_build
+++ b/source3/param/wscript_build
@@ -6,7 +6,7 @@ bld.SAMBA3_SUBSYSTEM('PARAM_UTIL',
 
 bld.SAMBA3_SUBSYSTEM('LOADPARM_CTX',
                      source='loadparm_ctx.c',
-                     deps='''talloc s3_param.h param''')
+                     deps='''talloc param''')
 
 bld.SAMBA_GENERATOR('s3_param_proto_h',
                     source= '../../script/generate_param.py ../../docs-xml/smbdotconf/parameters.all.xml',
@@ -14,12 +14,6 @@ bld.SAMBA_GENERATOR('s3_param_proto_h',
                     group='build_source',
                     rule='${PYTHON} ${SRC[0].abspath(env)} --file ${SRC[1].abspath(env)} --output ${TGT} --mode=S3PROTO')
 
-bld.SAMBA_GENERATOR('s3_loadparm_ctx_table_c',
-                    source= '../../script/generate_param.py ../../docs-xml/smbdotconf/parameters.all.xml',
-                    target='loadparm_ctx_table.c',
-                    group='build_source',
-                    rule='${PYTHON} ${SRC[0].abspath(env)} --file ${SRC[1].abspath(env)} --output ${TGT} --mode=S3TABLE')
-
 bld.SAMBA3_PYTHON('pys3param',
                   source='pyparam.c',
                   deps='param',
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index aebb58a..4afb27e 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -3077,7 +3077,7 @@ NTSTATUS smbd_do_qfsinfo(connection_struct *conn,
 	int data_len = 0, len;
 	const char *vname = volume_label(talloc_tos(), SNUM(conn));
 	int snum = SNUM(conn);
-	char *fstype = lp_fstype(SNUM(conn));
+	const char *fstype = lp_fstype(SNUM(conn));
 	const char *filename = NULL;
 	uint32 additional_flags = 0;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list