diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c index 2b8ea237a06..5b89a4f1dba 100644 --- a/lib/param/loadparm.c +++ b/lib/param/loadparm.c @@ -81,7 +81,6 @@ static bool defaults_saved = false; * non-source3 code */ #define handle_netbios_aliases NULL -#define handle_printing NULL #define handle_ldap_debug_level NULL #define handle_idmap_backend NULL #define handle_idmap_uid NULL @@ -1262,6 +1261,34 @@ bool handle_dos_charset(struct loadparm_context *lp_ctx, int snum, return lpcfg_string_set(lp_ctx, ptr, pszParmValue); } +bool handle_printing(struct loadparm_context *lp_ctx, int snum, + const char *pszParmValue, char **ptr) +{ + static int parm_num = -1; + struct loadparm_service *s; + + if (parm_num == -1) { + parm_num = lpcfg_map_parameter("printing"); + } + + if (!lp_set_enum_parm(&parm_table[parm_num], pszParmValue, (int*)ptr)) { + return false; + } + + if (lp_ctx->s3_fns) { + if ( snum < 0 ) { + s = lp_ctx->sDefault; + lp_ctx->s3_fns->init_printer_values(lp_ctx->globals->ctx, s); + } else { + s = lp_ctx->services[snum]; + lp_ctx->s3_fns->init_printer_values(s, s); + } + } + + return true; +} + + /*************************************************************************** Initialise a copymap. ***************************************************************************/ diff --git a/lib/param/loadparm.h b/lib/param/loadparm.h index 3f934139d7d..9be01ef7b96 100644 --- a/lib/param/loadparm.h +++ b/lib/param/loadparm.h @@ -280,6 +280,7 @@ char * lp_string(TALLOC_CTX *, const char *); bool lp_string_set(char **, const char *); int getservicebyname(const char *, struct loadparm_service *); bool lp_include(struct loadparm_context *, int, const char *, char **); +void init_printer_values(TALLOC_CTX *, struct loadparm_service *); /** * Check if two parameters are equal. diff --git a/lib/param/s3_param.h b/lib/param/s3_param.h index e1d68cf04fb..e6996f261be 100644 --- a/lib/param/s3_param.h +++ b/lib/param/s3_param.h @@ -18,6 +18,7 @@ struct loadparm_s3_helpers char * (*lp_string)(TALLOC_CTX *ctx, const char *in); bool (*lp_string_set)(char **dest, const char *src); bool (*lp_include)(struct loadparm_context*, int, const char *, char **); + void (*init_printer_values)(TALLOC_CTX *, struct loadparm_service *); struct loadparm_global *globals; }; diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index ff1f7250cbf..968a87e136f 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -265,7 +265,6 @@ static bool handle_idmap_backend(struct loadparm_context *unused, int snum, cons static bool handle_idmap_uid(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr); static bool handle_idmap_gid(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr); static bool handle_netbios_aliases(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr ); -static bool handle_printing(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr); static bool handle_ldap_debug_level(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr); static void set_allowed_client_auth(void); @@ -321,7 +320,7 @@ bool lp_string_set(char **dest, const char *src) { Initialise the sDefault parameter structure for the printer values. ***************************************************************************/ -static void init_printer_values(TALLOC_CTX *ctx, struct loadparm_service *pService) +void init_printer_values(TALLOC_CTX *ctx, struct loadparm_service *pService) { /* choose defaults depending on the type of printing */ switch (pService->printing) { @@ -2635,32 +2634,6 @@ const char *lp_ldap_idmap_suffix(TALLOC_CTX *ctx) return lp_string(ctx, Globals.ldap_suffix); } -/*************************************************************************** -***************************************************************************/ - -static bool handle_printing(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr) -{ - static int parm_num = -1; - struct loadparm_service *s; - - if ( parm_num == -1 ) - parm_num = lpcfg_map_parameter( "printing" ); - - if (!lp_set_enum_parm(&parm_table[parm_num], pszParmValue, (int*)ptr)) { - return false; - } - - if ( snum < 0 ) { - s = &sDefault; - init_printer_values(Globals.ctx, s); - } else { - s = ServicePtrs[snum]; - init_printer_values(s, s); - } - - return true; -} - /** return the parameter pointer for a parameter */ diff --git a/source3/param/loadparm_ctx.c b/source3/param/loadparm_ctx.c index b6e185e653a..b1e318f6d35 100644 --- a/source3/param/loadparm_ctx.c +++ b/source3/param/loadparm_ctx.c @@ -72,6 +72,7 @@ static struct loadparm_s3_helpers s3_fns = .lp_string = lp_string, .lp_string_set = lp_string_set, .lp_include = lp_include, + .init_printer_values = init_printer_values, }; const struct loadparm_s3_helpers *loadparm_s3_helpers(void)