mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
param: move handle printing into lib/param
Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
parent
74e0a37fd3
commit
dce3bcd00f
@ -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.
|
||||
***************************************************************************/
|
||||
|
@ -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.
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
|
@ -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
|
||||
*/
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user