1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

param: set the flags on a s3 loadparm context

By setting up the flags when we initialize the context, the flags can be
accessed by lib/param at any time.

Change-Id: I60d4f3a9108560e204cf5f37da9c7d995939e146
Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Nadezhda Ivanova <nivanova@samba.org>
This commit is contained in:
Garming Sam 2014-02-28 13:19:16 +13:00 committed by Andrew Bartlett
parent 090fb5a517
commit 288e29b7a9
5 changed files with 19 additions and 1 deletions

View File

@ -2619,6 +2619,8 @@ struct loadparm_context *loadparm_init_s3(TALLOC_CTX *mem_ctx,
}
loadparm_context->s3_fns = s3_fns;
loadparm_context->globals = s3_fns->globals;
loadparm_context->flags = s3_fns->flags;
return loadparm_context;
}

View File

@ -278,6 +278,7 @@ 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);
unsigned int * get_flags(void);
char * lp_string(TALLOC_CTX *, const char *);
bool lp_string_set(char **, const char *);
int getservicebyname(const char *, struct loadparm_service *);

View File

@ -22,6 +22,7 @@ struct loadparm_s3_helpers
bool (*lp_do_parameter)(int, const char *, const char *);
bool (*do_section)(const char *pszSectionName, void *userdata);
struct loadparm_global *globals;
unsigned int *flags;
};
#endif /* __S3_PARAM_H__ */

View File

@ -660,7 +660,11 @@ static void init_globals(bool reinit_globals)
ZERO_STRUCT(Globals);
Globals.ctx = talloc_pooled_object(NULL, char, 272, 2048);
flags_list = talloc_zero_array(Globals.ctx, unsigned int, num_parameters());
/* Initialize the flags list if necessary */
if (flags_list == NULL) {
get_flags();
}
for (i = 0; parm_table[i].label; i++) {
if ((parm_table[i].type == P_STRING ||
@ -4627,3 +4631,12 @@ struct loadparm_global * get_globals(void)
{
return &Globals;
}
unsigned int * get_flags(void)
{
if (flags_list == NULL) {
flags_list = talloc_zero_array(NULL, unsigned int, num_parameters());
}
return flags_list;
}

View File

@ -83,5 +83,6 @@ const struct loadparm_s3_helpers *loadparm_s3_helpers(void)
struct loadparm_s3_helpers *helpers;
helpers = &s3_fns;
helpers->globals = get_globals();
helpers->flags = get_flags();
return helpers;
}