From 670418c1165f0a149bfdd4bcdc5bde575df43ef2 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 17 Mar 2008 17:29:44 +0100 Subject: Move libnet_conf to a library lib/smbconf/ of its own, fixing the api. The libnet_conf code to access the registry based configuration has become more of a library used in several places in samba (e.g. loadparm) than an abstraction of "net conf". So I move it to a location lib/smbconf/. In the same breath, the api is fixed (not generated by make proto anymore). Michael (This used to be commit 5315ef41f403b96715dd68b512e9e74662e2910a) --- source3/lib/smbconf/smbconf.h | 75 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 source3/lib/smbconf/smbconf.h (limited to 'source3/lib/smbconf/smbconf.h') diff --git a/source3/lib/smbconf/smbconf.h b/source3/lib/smbconf/smbconf.h new file mode 100644 index 0000000000..0b04bdd4ec --- /dev/null +++ b/source3/lib/smbconf/smbconf.h @@ -0,0 +1,75 @@ +/* + * Unix SMB/CIFS implementation. + * libsmbconf - Samba configuration library + * Copyright (C) Michael Adam 2008 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#ifndef __LIBSMBCONF_H__ +#define __LIBSMBCONF_H__ + +struct libnet_conf_ctx { + NT_USER_TOKEN *token; +}; + +/* + * WARNING: + * Of this API, at least the open function is still subject to change. + * (Backends and possibly remote support being added ...) + */ + +WERROR libnet_conf_open(TALLOC_CTX *mem_ctx, struct libnet_conf_ctx **conf_ctx); +void libnet_conf_close(struct libnet_conf_ctx *ctx); +uint64_t libnet_conf_get_seqnum(struct libnet_conf_ctx *ctx, + const char *service, const char *param); +WERROR libnet_conf_drop(struct libnet_conf_ctx *ctx); +WERROR libnet_conf_get_config(TALLOC_CTX *mem_ctx, + struct libnet_conf_ctx *ctx, uint32_t *num_shares, + char ***share_names, uint32_t **num_params, + char ****param_names, char ****param_values); +WERROR libnet_conf_get_share_names(TALLOC_CTX *mem_ctx, + struct libnet_conf_ctx *ctx, + uint32_t *num_shares, + char ***share_names); +bool libnet_conf_share_exists(struct libnet_conf_ctx *ctx, + const char *servicename); +WERROR libnet_conf_create_share(struct libnet_conf_ctx *ctx, + const char *servicename); +WERROR libnet_conf_get_share(TALLOC_CTX *mem_ctx, struct libnet_conf_ctx *ctx, + const char *servicename, uint32_t *num_params, + char ***param_names, char ***param_values); +WERROR libnet_conf_delete_share(struct libnet_conf_ctx *ctx, + const char *servicename); +WERROR libnet_conf_set_parameter(struct libnet_conf_ctx *ctx, + const char *service, + const char *param, + const char *valstr); +WERROR libnet_conf_set_global_parameter(struct libnet_conf_ctx *ctx, + const char *param, const char *val); +WERROR libnet_conf_get_parameter(TALLOC_CTX *mem_ctx, + struct libnet_conf_ctx *ctx, + const char *service, + const char *param, + char **valstr); +WERROR libnet_conf_get_global_parameter(TALLOC_CTX *mem_ctx, + struct libnet_conf_ctx *ctx, + const char *param, + char **valstr); +WERROR libnet_conf_delete_parameter(struct libnet_conf_ctx *ctx, + const char *service, const char *param); +WERROR libnet_conf_delete_global_parameter(struct libnet_conf_ctx *ctx, + const char *param); + +#endif /* _LIBSMBCONF_H_ */ -- cgit From 6274929b1e1ddf89f4c5e93414121eaf06b6ab14 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 17 Mar 2008 18:01:33 +0100 Subject: libsmbconf: rename all occurrences of libnet_conf_ to smbconf_ . Michael (This used to be commit 097af0309d7c3e9342058ba5266667293b23c80d) --- source3/lib/smbconf/smbconf.h | 80 +++++++++++++++++++++---------------------- 1 file changed, 39 insertions(+), 41 deletions(-) (limited to 'source3/lib/smbconf/smbconf.h') diff --git a/source3/lib/smbconf/smbconf.h b/source3/lib/smbconf/smbconf.h index 0b04bdd4ec..d2e05045f7 100644 --- a/source3/lib/smbconf/smbconf.h +++ b/source3/lib/smbconf/smbconf.h @@ -20,7 +20,7 @@ #ifndef __LIBSMBCONF_H__ #define __LIBSMBCONF_H__ -struct libnet_conf_ctx { +struct smbconf_ctx { NT_USER_TOKEN *token; }; @@ -30,46 +30,44 @@ struct libnet_conf_ctx { * (Backends and possibly remote support being added ...) */ -WERROR libnet_conf_open(TALLOC_CTX *mem_ctx, struct libnet_conf_ctx **conf_ctx); -void libnet_conf_close(struct libnet_conf_ctx *ctx); -uint64_t libnet_conf_get_seqnum(struct libnet_conf_ctx *ctx, +WERROR smbconf_open(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx); +void smbconf_close(struct smbconf_ctx *ctx); +uint64_t smbconf_get_seqnum(struct smbconf_ctx *ctx, + const char *service, const char *param); +WERROR smbconf_drop(struct smbconf_ctx *ctx); +WERROR smbconf_get_config(TALLOC_CTX *mem_ctx, + struct smbconf_ctx *ctx, uint32_t *num_shares, + char ***share_names, uint32_t **num_params, + char ****param_names, char ****param_values); +WERROR smbconf_get_share_names(TALLOC_CTX *mem_ctx, + struct smbconf_ctx *ctx, + uint32_t *num_shares, + char ***share_names); +bool smbconf_share_exists(struct smbconf_ctx *ctx, const char *servicename); +WERROR smbconf_create_share(struct smbconf_ctx *ctx, const char *servicename); +WERROR smbconf_get_share(TALLOC_CTX *mem_ctx, struct smbconf_ctx *ctx, + const char *servicename, uint32_t *num_params, + char ***param_names, char ***param_values); +WERROR smbconf_delete_share(struct smbconf_ctx *ctx, + const char *servicename); +WERROR smbconf_set_parameter(struct smbconf_ctx *ctx, + const char *service, + const char *param, + const char *valstr); +WERROR smbconf_set_global_parameter(struct smbconf_ctx *ctx, + const char *param, const char *val); +WERROR smbconf_get_parameter(TALLOC_CTX *mem_ctx, + struct smbconf_ctx *ctx, + const char *service, + const char *param, + char **valstr); +WERROR smbconf_get_global_parameter(TALLOC_CTX *mem_ctx, + struct smbconf_ctx *ctx, + const char *param, + char **valstr); +WERROR smbconf_delete_parameter(struct smbconf_ctx *ctx, const char *service, const char *param); -WERROR libnet_conf_drop(struct libnet_conf_ctx *ctx); -WERROR libnet_conf_get_config(TALLOC_CTX *mem_ctx, - struct libnet_conf_ctx *ctx, uint32_t *num_shares, - char ***share_names, uint32_t **num_params, - char ****param_names, char ****param_values); -WERROR libnet_conf_get_share_names(TALLOC_CTX *mem_ctx, - struct libnet_conf_ctx *ctx, - uint32_t *num_shares, - char ***share_names); -bool libnet_conf_share_exists(struct libnet_conf_ctx *ctx, - const char *servicename); -WERROR libnet_conf_create_share(struct libnet_conf_ctx *ctx, - const char *servicename); -WERROR libnet_conf_get_share(TALLOC_CTX *mem_ctx, struct libnet_conf_ctx *ctx, - const char *servicename, uint32_t *num_params, - char ***param_names, char ***param_values); -WERROR libnet_conf_delete_share(struct libnet_conf_ctx *ctx, - const char *servicename); -WERROR libnet_conf_set_parameter(struct libnet_conf_ctx *ctx, - const char *service, - const char *param, - const char *valstr); -WERROR libnet_conf_set_global_parameter(struct libnet_conf_ctx *ctx, - const char *param, const char *val); -WERROR libnet_conf_get_parameter(TALLOC_CTX *mem_ctx, - struct libnet_conf_ctx *ctx, - const char *service, - const char *param, - char **valstr); -WERROR libnet_conf_get_global_parameter(TALLOC_CTX *mem_ctx, - struct libnet_conf_ctx *ctx, - const char *param, - char **valstr); -WERROR libnet_conf_delete_parameter(struct libnet_conf_ctx *ctx, - const char *service, const char *param); -WERROR libnet_conf_delete_global_parameter(struct libnet_conf_ctx *ctx, - const char *param); +WERROR smbconf_delete_global_parameter(struct smbconf_ctx *ctx, + const char *param); #endif /* _LIBSMBCONF_H_ */ -- cgit From 7621b4c3d80f411aac6e40ea5cce787cec108af5 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 18 Mar 2008 23:29:11 +0100 Subject: libsmbconf: change smbconf_get_seqnum() to smbconf_changed(). The former seqnum is hidden inside a struct smbconf_csn. And the get_seqnum is united with a changed function that stores the seqnum inside the given csn. Michael (This used to be commit 5b6b90900a1a3eab24cb5612d78f9678a363cf73) --- source3/lib/smbconf/smbconf.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'source3/lib/smbconf/smbconf.h') diff --git a/source3/lib/smbconf/smbconf.h b/source3/lib/smbconf/smbconf.h index d2e05045f7..134dc29c09 100644 --- a/source3/lib/smbconf/smbconf.h +++ b/source3/lib/smbconf/smbconf.h @@ -24,6 +24,11 @@ struct smbconf_ctx { NT_USER_TOKEN *token; }; +/* the change sequence number */ +struct smbconf_csn { + uint64_t csn; +}; + /* * WARNING: * Of this API, at least the open function is still subject to change. @@ -32,8 +37,8 @@ struct smbconf_ctx { WERROR smbconf_open(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx); void smbconf_close(struct smbconf_ctx *ctx); -uint64_t smbconf_get_seqnum(struct smbconf_ctx *ctx, - const char *service, const char *param); +bool smbconf_changed(struct smbconf_ctx *ctx, struct smbconf_csn *csn, + const char *service, const char *param); WERROR smbconf_drop(struct smbconf_ctx *ctx); WERROR smbconf_get_config(TALLOC_CTX *mem_ctx, struct smbconf_ctx *ctx, uint32_t *num_shares, -- cgit From 153ed797e61db7feef32af0d256818e66460d064 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 19 Mar 2008 10:47:23 +0100 Subject: libsmbconf: change the API to always take the smbconf_ctx parameter first. ..for consistency. Exception: the open/init function, where the smbconf_ctx is created from the given talloc context. Michael (This used to be commit 304dba6cb2184437f3edad065a530d03fb704036) --- source3/lib/smbconf/smbconf.h | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'source3/lib/smbconf/smbconf.h') diff --git a/source3/lib/smbconf/smbconf.h b/source3/lib/smbconf/smbconf.h index 134dc29c09..9679b2777d 100644 --- a/source3/lib/smbconf/smbconf.h +++ b/source3/lib/smbconf/smbconf.h @@ -40,17 +40,19 @@ void smbconf_close(struct smbconf_ctx *ctx); bool smbconf_changed(struct smbconf_ctx *ctx, struct smbconf_csn *csn, const char *service, const char *param); WERROR smbconf_drop(struct smbconf_ctx *ctx); -WERROR smbconf_get_config(TALLOC_CTX *mem_ctx, - struct smbconf_ctx *ctx, uint32_t *num_shares, +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); -WERROR smbconf_get_share_names(TALLOC_CTX *mem_ctx, - struct smbconf_ctx *ctx, +WERROR smbconf_get_share_names(struct smbconf_ctx *ctx, + TALLOC_CTX *mem_ctx, uint32_t *num_shares, char ***share_names); bool smbconf_share_exists(struct smbconf_ctx *ctx, const char *servicename); WERROR smbconf_create_share(struct smbconf_ctx *ctx, const char *servicename); -WERROR smbconf_get_share(TALLOC_CTX *mem_ctx, 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); WERROR smbconf_delete_share(struct smbconf_ctx *ctx, @@ -61,13 +63,13 @@ WERROR smbconf_set_parameter(struct smbconf_ctx *ctx, const char *valstr); WERROR smbconf_set_global_parameter(struct smbconf_ctx *ctx, const char *param, const char *val); -WERROR smbconf_get_parameter(TALLOC_CTX *mem_ctx, - struct smbconf_ctx *ctx, +WERROR smbconf_get_parameter(struct smbconf_ctx *ctx, + TALLOC_CTX *mem_ctx, const char *service, const char *param, char **valstr); -WERROR smbconf_get_global_parameter(TALLOC_CTX *mem_ctx, - struct smbconf_ctx *ctx, +WERROR smbconf_get_global_parameter(struct smbconf_ctx *ctx, + TALLOC_CTX *mem_ctx, const char *param, char **valstr); WERROR smbconf_delete_parameter(struct smbconf_ctx *ctx, -- cgit From 7b53c84fe1c8ec0cb5e1d7a977eca6197a4c36c6 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 19 Mar 2008 12:37:17 +0100 Subject: libsmbconf: put the smbconf context struct into a private header. Michael (This used to be commit a99ee5e536eee1563c90e5d7f251bfe9f5d1ffbb) --- source3/lib/smbconf/smbconf.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'source3/lib/smbconf/smbconf.h') diff --git a/source3/lib/smbconf/smbconf.h b/source3/lib/smbconf/smbconf.h index 9679b2777d..c15caf4ea9 100644 --- a/source3/lib/smbconf/smbconf.h +++ b/source3/lib/smbconf/smbconf.h @@ -20,9 +20,7 @@ #ifndef __LIBSMBCONF_H__ #define __LIBSMBCONF_H__ -struct smbconf_ctx { - NT_USER_TOKEN *token; -}; +struct smbconf_ctx; /* the change sequence number */ struct smbconf_csn { -- cgit From adf5bf554cd6bfdc5c6e7b1ed54f7f9329b15c50 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 20 Mar 2008 23:41:39 +0100 Subject: libsmbconf: rename smbconf_open() to smbconf_init(). That's more appropriate. Michael (This used to be commit d7bd9bb8aa2003ec0a9860df26857f67255febe2) --- source3/lib/smbconf/smbconf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/lib/smbconf/smbconf.h') diff --git a/source3/lib/smbconf/smbconf.h b/source3/lib/smbconf/smbconf.h index c15caf4ea9..caa0240a14 100644 --- a/source3/lib/smbconf/smbconf.h +++ b/source3/lib/smbconf/smbconf.h @@ -33,7 +33,7 @@ struct smbconf_csn { * (Backends and possibly remote support being added ...) */ -WERROR smbconf_open(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx); +WERROR smbconf_init(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx); void smbconf_close(struct smbconf_ctx *ctx); bool smbconf_changed(struct smbconf_ctx *ctx, struct smbconf_csn *csn, const char *service, const char *param); -- cgit From 23b1d721b8262f69cb7e28348c8e5cdf3483d4ea Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 21 Mar 2008 01:04:57 +0100 Subject: libsmbconf: rename smbconf_close() to smbconf_shutdown(). Michael (This used to be commit 797b26ad3fad27e085827efb61f6b4d8b37e93f0) --- source3/lib/smbconf/smbconf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/lib/smbconf/smbconf.h') diff --git a/source3/lib/smbconf/smbconf.h b/source3/lib/smbconf/smbconf.h index caa0240a14..33fa82e898 100644 --- a/source3/lib/smbconf/smbconf.h +++ b/source3/lib/smbconf/smbconf.h @@ -34,7 +34,7 @@ struct smbconf_csn { */ WERROR smbconf_init(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx); -void smbconf_close(struct smbconf_ctx *ctx); +void smbconf_shutdown(struct smbconf_ctx *ctx); bool smbconf_changed(struct smbconf_ctx *ctx, struct smbconf_csn *csn, const char *service, const char *param); WERROR smbconf_drop(struct smbconf_ctx *ctx); -- cgit From fececde1815bf0469bb56e07cf23f54011c9b4ae Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 21 Mar 2008 02:20:16 +0100 Subject: libsmbconf: add backend specific init function. Hide generic init function taking smbconf_ops argument from public api. Michael (This used to be commit b3f6920ccb9a27fde26e889a7f1f3afaf56b784f) --- source3/lib/smbconf/smbconf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/lib/smbconf/smbconf.h') diff --git a/source3/lib/smbconf/smbconf.h b/source3/lib/smbconf/smbconf.h index 33fa82e898..207d5797bd 100644 --- a/source3/lib/smbconf/smbconf.h +++ b/source3/lib/smbconf/smbconf.h @@ -33,7 +33,7 @@ struct smbconf_csn { * (Backends and possibly remote support being added ...) */ -WERROR smbconf_init(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx); +WERROR smbconf_init_reg(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx); void smbconf_shutdown(struct smbconf_ctx *ctx); bool smbconf_changed(struct smbconf_ctx *ctx, struct smbconf_csn *csn, const char *service, const char *param); -- cgit From e62cae6638417323461b89dbde8635890f90e37e Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 21 Mar 2008 16:42:42 +0100 Subject: libsmbconf: adapt a comment to new circumstances Michael (This used to be commit 83b9453c88bfdf615cc2b547645b0a71a870f473) --- source3/lib/smbconf/smbconf.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'source3/lib/smbconf/smbconf.h') diff --git a/source3/lib/smbconf/smbconf.h b/source3/lib/smbconf/smbconf.h index 207d5797bd..28be729224 100644 --- a/source3/lib/smbconf/smbconf.h +++ b/source3/lib/smbconf/smbconf.h @@ -28,9 +28,7 @@ struct smbconf_csn { }; /* - * WARNING: - * Of this API, at least the open function is still subject to change. - * (Backends and possibly remote support being added ...) + * WARNING: this api is still subject to change. */ WERROR smbconf_init_reg(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx); -- cgit From 40ea88db5e9e5dd8fd6a924bfcd1afefa538404d Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 21 Mar 2008 16:45:25 +0100 Subject: libsmbconf: add structuring comments to the prototypes in the public header. Michael (This used to be commit 4f816df27670c3b6aabea9f26ef2d26f3e882e78) --- source3/lib/smbconf/smbconf.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'source3/lib/smbconf/smbconf.h') diff --git a/source3/lib/smbconf/smbconf.h b/source3/lib/smbconf/smbconf.h index 28be729224..35da36795e 100644 --- a/source3/lib/smbconf/smbconf.h +++ b/source3/lib/smbconf/smbconf.h @@ -31,7 +31,15 @@ struct smbconf_csn { * WARNING: this api is still subject to change. */ +/* + * initialization functions for the available modules + * (a dispatcher might be added in the future) + */ WERROR smbconf_init_reg(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx); + +/* + * the smbconf API functions + */ void smbconf_shutdown(struct smbconf_ctx *ctx); bool smbconf_changed(struct smbconf_ctx *ctx, struct smbconf_csn *csn, const char *service, const char *param); -- cgit From 6f7cfeddd61f728e2452a7b89f5ee2ff36ca394f Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 21 Mar 2008 17:55:31 +0100 Subject: libsmbconf: add a "path" variable to the conf context. This is passed to the module init routines. In case of the registry, this is the path of the basekey in registry, that is to be used, defaulting to KEY_SMBCONF (HKLM\software\samba\smbconf), when NULL is given. This is the only case currently used. In order to support other keys, registry initialization for smbconf has to be changed to support different keys. Michael (This used to be commit 96434d9dc7a66773e313cc128af57493dee245a1) --- source3/lib/smbconf/smbconf.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source3/lib/smbconf/smbconf.h') diff --git a/source3/lib/smbconf/smbconf.h b/source3/lib/smbconf/smbconf.h index 35da36795e..23b9504971 100644 --- a/source3/lib/smbconf/smbconf.h +++ b/source3/lib/smbconf/smbconf.h @@ -35,7 +35,8 @@ struct smbconf_csn { * initialization functions for the available modules * (a dispatcher might be added in the future) */ -WERROR smbconf_init_reg(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx); +WERROR smbconf_init_reg(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx, + const char *path); /* * the smbconf API functions -- cgit From 2e83818b3b7f0f102685a535c11cbd0dc9c902a6 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 26 Mar 2008 14:30:36 +0100 Subject: libsmbconf: add a text backend to libsmbconf based on the params.c parser. This is a simple implementation of text backend for libsmbconf. It is read only. It uses the parser from params.c. It loads the given config file and holds the parsed lists of strings in memory. Config is only re-read if the time stamp of the config file has changed. Brilliant performance on large files is not to be expected since the string lists are not hashed. This might be added in the future. Michael (This used to be commit 4ea50843852b335a9bd4c0535a5b684134ad8326) --- source3/lib/smbconf/smbconf.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source3/lib/smbconf/smbconf.h') diff --git a/source3/lib/smbconf/smbconf.h b/source3/lib/smbconf/smbconf.h index 23b9504971..72729b9df8 100644 --- a/source3/lib/smbconf/smbconf.h +++ b/source3/lib/smbconf/smbconf.h @@ -38,6 +38,10 @@ struct smbconf_csn { WERROR smbconf_init_reg(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx, const char *path); +WERROR smbconf_init_txt_simple(TALLOC_CTX *mem_ctx, + struct smbconf_ctx **conf_ctx, + const char *path); + /* * the smbconf API functions */ -- cgit From 3d38f143df70d9e55d7112bf3b70b6c029d9397d Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 7 Apr 2008 22:33:01 +0200 Subject: libsmbconf: add a "verbatim" parameter to smbconf_init_txt_simple(). Michael (This used to be commit b9e72b402de412c23702715ead96c20e9b3248cc) --- source3/lib/smbconf/smbconf.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source3/lib/smbconf/smbconf.h') diff --git a/source3/lib/smbconf/smbconf.h b/source3/lib/smbconf/smbconf.h index 72729b9df8..15c2a3b7c9 100644 --- a/source3/lib/smbconf/smbconf.h +++ b/source3/lib/smbconf/smbconf.h @@ -40,7 +40,8 @@ WERROR smbconf_init_reg(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx, WERROR smbconf_init_txt_simple(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx, - const char *path); + const char *path + bool verbatim); /* * the smbconf API functions -- cgit From 101587eb6e52ac41821c18a931a5b2aee49f3af5 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 7 Apr 2008 22:43:33 +0200 Subject: libsmbconf: pass txt_private_data instead of only cache to do_parameter/section in preparation of using the verbatim flag. Michael (This used to be commit c68cd2477c65d5521a713ae0f37cf2994d2c339e) --- source3/lib/smbconf/smbconf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/lib/smbconf/smbconf.h') diff --git a/source3/lib/smbconf/smbconf.h b/source3/lib/smbconf/smbconf.h index 15c2a3b7c9..d333f6c88c 100644 --- a/source3/lib/smbconf/smbconf.h +++ b/source3/lib/smbconf/smbconf.h @@ -40,7 +40,7 @@ WERROR smbconf_init_reg(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx, WERROR smbconf_init_txt_simple(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx, - const char *path + const char *path, bool verbatim); /* -- cgit From 8e9766289972ecf3f4bcaa1a9ed118bba5fea208 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 8 Apr 2008 01:56:32 +0200 Subject: libsmbconf: add get_includes() and set_includes() to the API. Includes have to get a special treatment, at least for registry. Includes are not like other smbconf parameters: they are some kind of metainformation. "include" has two effects when stated twice so it can not be stored boldly into registry, since there can only be one value named "include" in registry per key. I will provide special handling for includes for the registry backend. This patch provides the necessary methods in the smbconf API. Michael (This used to be commit e86eb375d9f83f73aeea0a16c8b43e2ef21a6e20) --- source3/lib/smbconf/smbconf.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'source3/lib/smbconf/smbconf.h') diff --git a/source3/lib/smbconf/smbconf.h b/source3/lib/smbconf/smbconf.h index d333f6c88c..626d48e962 100644 --- a/source3/lib/smbconf/smbconf.h +++ b/source3/lib/smbconf/smbconf.h @@ -86,5 +86,11 @@ WERROR smbconf_delete_parameter(struct smbconf_ctx *ctx, const char *service, const char *param); WERROR smbconf_delete_global_parameter(struct smbconf_ctx *ctx, const char *param); +WERROR smbconf_get_includes(struct smbconf_ctx *ctx, + const char *service, + uint32_t *num_includes, char ***includes); +WERROR smbconf_set_includes(struct smbconf_ctx *ctx, + const char *service, + uint32_t num_includes, const char **includes); #endif /* _LIBSMBCONF_H_ */ -- cgit From f5aac0a8d01885d06594c4bbe0ff815bb9339a0c Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 8 Apr 2008 10:16:03 +0200 Subject: libsmbconf: add talloc context to the get_includes methods. Michael (This used to be commit ed535b6b30b5c9412803f6373eadc704de6de2f9) --- source3/lib/smbconf/smbconf.h | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/lib/smbconf/smbconf.h') diff --git a/source3/lib/smbconf/smbconf.h b/source3/lib/smbconf/smbconf.h index 626d48e962..cd39758d3e 100644 --- a/source3/lib/smbconf/smbconf.h +++ b/source3/lib/smbconf/smbconf.h @@ -87,6 +87,7 @@ WERROR smbconf_delete_parameter(struct smbconf_ctx *ctx, WERROR smbconf_delete_global_parameter(struct smbconf_ctx *ctx, const char *param); WERROR smbconf_get_includes(struct smbconf_ctx *ctx, + TALLOC_CTX *mem_ctx, const char *service, uint32_t *num_includes, char ***includes); WERROR smbconf_set_includes(struct smbconf_ctx *ctx, -- cgit From d399778accf0bef382b657a834f9d2a80d05fe77 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 8 Apr 2008 14:24:42 +0200 Subject: libsmbconf: add "_global_" wrappers for get/set_includes. These use the usual global_check like the other global wrappers. Michael (This used to be commit ce1b2f550860cb3a566db09f7c7eac39c195a5b7) --- source3/lib/smbconf/smbconf.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'source3/lib/smbconf/smbconf.h') diff --git a/source3/lib/smbconf/smbconf.h b/source3/lib/smbconf/smbconf.h index cd39758d3e..a18b88f4e5 100644 --- a/source3/lib/smbconf/smbconf.h +++ b/source3/lib/smbconf/smbconf.h @@ -90,8 +90,14 @@ WERROR smbconf_get_includes(struct smbconf_ctx *ctx, TALLOC_CTX *mem_ctx, const char *service, uint32_t *num_includes, char ***includes); +WERROR smbconf_get_global_includes(struct smbconf_ctx *ctx, + TALLOC_CTX *mem_ctx, + uint32_t *num_includes, char ***includes); WERROR smbconf_set_includes(struct smbconf_ctx *ctx, const char *service, uint32_t num_includes, const char **includes); +WERROR smbconf_set_global_includes(struct smbconf_ctx *ctx, + uint32_t num_includes, + const char **includes); #endif /* _LIBSMBCONF_H_ */ -- cgit From 87ca44723181900799985d7c3c1d02863fb8da71 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 9 Apr 2008 22:21:15 +0200 Subject: libsmbconf: add delete_includes mehtod to the api (and backend implementations) Michael (This used to be commit daef50e54d58a6684b6a890ebf523ca6245f0290) --- source3/lib/smbconf/smbconf.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source3/lib/smbconf/smbconf.h') diff --git a/source3/lib/smbconf/smbconf.h b/source3/lib/smbconf/smbconf.h index a18b88f4e5..ee7549ac74 100644 --- a/source3/lib/smbconf/smbconf.h +++ b/source3/lib/smbconf/smbconf.h @@ -99,5 +99,7 @@ WERROR smbconf_set_includes(struct smbconf_ctx *ctx, WERROR smbconf_set_global_includes(struct smbconf_ctx *ctx, uint32_t num_includes, const char **includes); +WERROR smbconf_delete_includes(struct smbconf_ctx *ctx, const char *service); +WERROR smbconf_delete_global_includes(struct smbconf_ctx *ctx); #endif /* _LIBSMBCONF_H_ */ -- cgit From a3f1b5f150a5cfee74485382cbc5d9debcf342d1 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 11 Apr 2008 15:36:44 +0200 Subject: libsmbconf: don't mark the API as "subject to change" any longer. At least I hope it won't need many changes anymore... Michael (This used to be commit c4e1439eded7bb4df60b9d4b457e5b7898928c9e) --- source3/lib/smbconf/smbconf.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'source3/lib/smbconf/smbconf.h') diff --git a/source3/lib/smbconf/smbconf.h b/source3/lib/smbconf/smbconf.h index ee7549ac74..c04be7f981 100644 --- a/source3/lib/smbconf/smbconf.h +++ b/source3/lib/smbconf/smbconf.h @@ -27,10 +27,6 @@ struct smbconf_csn { uint64_t csn; }; -/* - * WARNING: this api is still subject to change. - */ - /* * initialization functions for the available modules * (a dispatcher might be added in the future) -- cgit From 35d6068f2504cc76728c3187c3e16171112dabca Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 13 Apr 2008 16:32:05 +0200 Subject: libsmbconf: remove the bool verbatim parameter from txt backend init function. Always be verbatim for now. Backend config options may be added later via some private data pointer. Michael (This used to be commit e8bafcfbf4a7ab1dc1ce4f2acd24b0eb74933256) --- source3/lib/smbconf/smbconf.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source3/lib/smbconf/smbconf.h') diff --git a/source3/lib/smbconf/smbconf.h b/source3/lib/smbconf/smbconf.h index c04be7f981..e48a0cce97 100644 --- a/source3/lib/smbconf/smbconf.h +++ b/source3/lib/smbconf/smbconf.h @@ -36,8 +36,7 @@ WERROR smbconf_init_reg(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx, WERROR smbconf_init_txt_simple(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx, - const char *path, - bool verbatim); + const char *path); /* * the smbconf API functions -- cgit From 4eab3d3cf0d0fc111d0566089d902750be634759 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 13 Apr 2008 17:13:16 +0200 Subject: libsmbconf: add a smbconf init dispatcher smbconf_init(). The dispatcher takes a config source argument in the form of "backend:path" where backend can (currently) be one of "txt" (aka "file") or "reg" (aka "registry"). When the path is omitted, it is up to the backend to provide a default path. When there is no separator ":" and the string is not a recognized backend, then file backend is assumed and the string is passed in as the path argument. Michael (This used to be commit cc613a60eb0f6b92cae98e8669e5e569a1eb9324) --- source3/lib/smbconf/smbconf.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'source3/lib/smbconf/smbconf.h') diff --git a/source3/lib/smbconf/smbconf.h b/source3/lib/smbconf/smbconf.h index e48a0cce97..481c2b1693 100644 --- a/source3/lib/smbconf/smbconf.h +++ b/source3/lib/smbconf/smbconf.h @@ -29,8 +29,11 @@ struct smbconf_csn { /* * initialization functions for the available modules - * (a dispatcher might be added in the future) */ + +WERROR smbconf_init(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx, + const char *source); + WERROR smbconf_init_reg(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx, const char *path); -- cgit From b2425f88fafb7077534d043afa5cffe0307e968c Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 22 Apr 2008 15:50:42 +0200 Subject: libsmbconf: rename smbconf_init_txt_simple() to smbconf_init_txt(). ...for consistency. Michael (This used to be commit 3d1da73f66b8452693262e2d03f986eec438451d) --- source3/lib/smbconf/smbconf.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/lib/smbconf/smbconf.h') diff --git a/source3/lib/smbconf/smbconf.h b/source3/lib/smbconf/smbconf.h index 481c2b1693..5ea8f36d84 100644 --- a/source3/lib/smbconf/smbconf.h +++ b/source3/lib/smbconf/smbconf.h @@ -37,9 +37,9 @@ WERROR smbconf_init(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx, WERROR smbconf_init_reg(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx, const char *path); -WERROR smbconf_init_txt_simple(TALLOC_CTX *mem_ctx, - struct smbconf_ctx **conf_ctx, - const char *path); +WERROR smbconf_init_txt(TALLOC_CTX *mem_ctx, + struct smbconf_ctx **conf_ctx, + const char *path); /* * the smbconf API functions -- cgit From a376e2bf49d35ca2bdb0ebdc436de10019103136 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 22 Apr 2008 16:13:29 +0200 Subject: libsmbconf: fix comment headers in smbconf.h Michael (This used to be commit 54c0461679642b38653f803e7b21d865472f3f91) --- source3/lib/smbconf/smbconf.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'source3/lib/smbconf/smbconf.h') diff --git a/source3/lib/smbconf/smbconf.h b/source3/lib/smbconf/smbconf.h index 5ea8f36d84..589d14ec64 100644 --- a/source3/lib/smbconf/smbconf.h +++ b/source3/lib/smbconf/smbconf.h @@ -27,13 +27,18 @@ struct smbconf_csn { uint64_t csn; }; -/* - * initialization functions for the available modules - */ +/** + * intialization dispatcher function. + * takes source string in the form of "backend:path" + */ WERROR smbconf_init(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx, const char *source); +/** + * initialization functions for the available modules + */ + WERROR smbconf_init_reg(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx, const char *path); -- cgit From 5dd54c58b4d65b28751fda3ba2acbfe71ea7a75f Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 22 Apr 2008 16:16:28 +0200 Subject: libsmbconf: add a struct smbconf_service to hold the parameter names + values. Michael (This used to be commit 8118a8348f36b28fa4d46b42a104097cefa33a4d) --- source3/lib/smbconf/smbconf.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'source3/lib/smbconf/smbconf.h') diff --git a/source3/lib/smbconf/smbconf.h b/source3/lib/smbconf/smbconf.h index 589d14ec64..86ee3ed231 100644 --- a/source3/lib/smbconf/smbconf.h +++ b/source3/lib/smbconf/smbconf.h @@ -27,6 +27,13 @@ struct smbconf_csn { uint64_t csn; }; +struct smbconf_service { + char *name; + uint32_t num_params; + char **param_names; + char **param_values; +}; + /** * intialization dispatcher function. -- cgit 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.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'source3/lib/smbconf/smbconf.h') diff --git a/source3/lib/smbconf/smbconf.h b/source3/lib/smbconf/smbconf.h index 86ee3ed231..e337476665 100644 --- a/source3/lib/smbconf/smbconf.h +++ b/source3/lib/smbconf/smbconf.h @@ -63,8 +63,7 @@ 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 smbconf_get_share_names(struct smbconf_ctx *ctx, TALLOC_CTX *mem_ctx, uint32_t *num_shares, @@ -73,8 +72,8 @@ bool smbconf_share_exists(struct smbconf_ctx *ctx, const char *servicename); WERROR smbconf_create_share(struct smbconf_ctx *ctx, const char *servicename); 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); WERROR smbconf_delete_share(struct smbconf_ctx *ctx, const char *servicename); WERROR smbconf_set_parameter(struct smbconf_ctx *ctx, -- cgit