From fb9232c0a98d9ce600e379dd03ee6fa3cd73cba5 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 22 Apr 2008 16:31:16 +0200 Subject: libsmbconf: rewrite API to use smbconf_service struct instead of lists of strings and counters directly... Michael (This used to be commit 17415e2dc457ce41793a7e28e71f72c538c19c61) --- source3/lib/smbconf/smbconf.c | 44 +++++++++++++------------------------------ 1 file changed, 13 insertions(+), 31 deletions(-) (limited to 'source3/lib/smbconf/smbconf.c') diff --git a/source3/lib/smbconf/smbconf.c b/source3/lib/smbconf/smbconf.c index 9565540df4..00b9ba3e07 100644 --- a/source3/lib/smbconf/smbconf.c +++ b/source3/lib/smbconf/smbconf.c @@ -91,22 +91,16 @@ WERROR smbconf_drop(struct smbconf_ctx *ctx) WERROR smbconf_get_config(struct smbconf_ctx *ctx, TALLOC_CTX *mem_ctx, uint32_t *num_shares, - char ***share_names, uint32_t **num_params, - char ****param_names, char ****param_values) + struct smbconf_service ***services) { WERROR werr = WERR_OK; TALLOC_CTX *tmp_ctx = NULL; uint32_t tmp_num_shares; char **tmp_share_names; - uint32_t *tmp_num_params; - char ***tmp_param_names; - char ***tmp_param_values; + struct smbconf_service **tmp_services; uint32_t count; - if ((num_shares == NULL) || (share_names == NULL) || - (num_params == NULL) || (param_names == NULL) || - (param_values == NULL)) - { + if ((num_shares == NULL) || (services == NULL)) { werr = WERR_INVALID_PARAM; goto done; } @@ -123,23 +117,18 @@ WERROR smbconf_get_config(struct smbconf_ctx *ctx, goto done; } - tmp_num_params = TALLOC_ARRAY(tmp_ctx, uint32_t, tmp_num_shares); - tmp_param_names = TALLOC_ARRAY(tmp_ctx, char **, tmp_num_shares); - tmp_param_values = TALLOC_ARRAY(tmp_ctx, char **, tmp_num_shares); + tmp_services = TALLOC_ARRAY(tmp_ctx, struct smbconf_service *, + tmp_num_shares); - if ((tmp_num_params == NULL) || (tmp_param_names == NULL) || - (tmp_param_values == NULL)) - { + if (tmp_services == NULL) { werr = WERR_NOMEM; goto done; } for (count = 0; count < tmp_num_shares; count++) { - werr = smbconf_get_share(ctx, mem_ctx, + werr = smbconf_get_share(ctx, tmp_services, tmp_share_names[count], - &tmp_num_params[count], - &tmp_param_names[count], - &tmp_param_values[count]); + &tmp_services[count]); if (!W_ERROR_IS_OK(werr)) { goto done; } @@ -149,15 +138,9 @@ WERROR smbconf_get_config(struct smbconf_ctx *ctx, *num_shares = tmp_num_shares; if (tmp_num_shares > 0) { - *share_names = talloc_move(mem_ctx, &tmp_share_names); - *num_params = talloc_move(mem_ctx, &tmp_num_params); - *param_names = talloc_move(mem_ctx, &tmp_param_names); - *param_values = talloc_move(mem_ctx, &tmp_param_values); + *services = talloc_move(mem_ctx, &tmp_services); } else { - *share_names = NULL; - *num_params = NULL; - *param_names = NULL; - *param_values = NULL; + *services = NULL; } done: @@ -204,15 +187,14 @@ WERROR smbconf_create_share(struct smbconf_ctx *ctx, */ WERROR smbconf_get_share(struct smbconf_ctx *ctx, TALLOC_CTX *mem_ctx, - const char *servicename, uint32_t *num_params, - char ***param_names, char ***param_values) + const char *servicename, + struct smbconf_service **service) { if (!smbconf_share_exists(ctx, servicename)) { return WERR_NO_SUCH_SERVICE; } - return ctx->ops->get_share(ctx, mem_ctx, servicename, num_params, - param_names, param_values); + return ctx->ops->get_share(ctx, mem_ctx, servicename, service); } /** -- cgit