param: Add smb.conf loading support to s3/s4 loadparm bridge
authorAndrew Bartlett <abartlet@samba.org>
Fri, 12 Aug 2011 01:26:42 +0000 (11:26 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Sat, 13 Aug 2011 02:30:49 +0000 (12:30 +1000)
source3/param/loadparm_ctx.c
source4/param/loadparm.c
source4/script/mks3param.pl

index 7c59ca709a3b6d9a376953dee233a14c231a4a33..2289f6bc29bb1b318baf4d26d9e9e84ef349852e 100644 (file)
 #include "includes.h"
 #include "../source4/param/s3_param.h"
 
+static bool lp_load_for_s4_ctx(const char *filename)
+{
+       return lp_load(filename, false, false, false, false);
+}
+
 /* These are in the order that they appear in the s4 loadparm file.
  * All of the s4 loadparm functions should be here eventually, once
  * they are implemented in the s3 loadparm, have the same format (enum
@@ -33,6 +38,7 @@ static const struct loadparm_s3_context s3_fns =
        .get_servicebynum = lp_servicebynum,
        .get_default_loadparm_service = lp_default_loadparm_service,
        .get_numservices = lp_numservices,
+       .load = lp_load_for_s4_ctx,
        .set_cmdline = lp_set_cmdline,
 
        .server_role = lp_server_role,
index 3b0eefe603bb629c0780122a0980f3a786554e6b..c1fd5f22a249eb213d1c251b0390ce44355bd29e 100644 (file)
@@ -3514,6 +3514,10 @@ bool lpcfg_load(struct loadparm_context *lp_ctx, const char *filename)
        char *n2;
        bool bRetval;
 
+       if (lp_ctx->s3_fns) {
+               return lp_ctx->s3_fns->load(filename);
+       }
+
        filename = talloc_strdup(lp_ctx, filename);
 
        lp_ctx->szConfigFile = filename;
index 761cd6980f20add8b17bd2aa8aab7e39f30c6eaa..37277c20b145ec540067ddb3c8ea4f01498c738d 100644 (file)
@@ -92,6 +92,7 @@ sub print_header($$)
        $file->("\tstruct loadparm_service * (*get_default_loadparm_service)(void);\n");
        $file->("\tstruct loadparm_service * (*get_servicebynum)(int snum);\n");
        $file->("\tint (*get_numservices)(void);\n");
+       $file->("\tbool (*load)(const char *filename);\n");
        $file->("\tbool (*set_cmdline)(const char *pszParmName, const char *pszParmValue);\n");
 }