2 * Unix SMB/CIFS implementation.
3 * libsmbconf - Samba configuration library, registry backend
4 * Copyright (C) Michael Adam 2008
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, see <http://www.gnu.org/licenses/>.
21 #include "lib/smbconf/smbconf_private.h"
23 #include "registry/reg_backend_db.h"
24 #include "registry/reg_util_token.h"
25 #include "lib/smbconf/smbconf_init.h"
26 #include "lib/smbconf/smbconf_reg.h"
28 #define INCLUDES_VALNAME "includes"
30 struct reg_private_data {
31 struct registry_key *base_key;
32 bool open; /* did _we_ open the registry? */
35 /**********************************************************************
39 **********************************************************************/
42 * a convenience helper to cast the private data structure
44 static struct reg_private_data *rpd(struct smbconf_ctx *ctx)
46 return (struct reg_private_data *)(ctx->data);
50 * check whether a given value name is forbidden in registry (smbconf)
52 static bool smbconf_reg_valname_forbidden(const char *valname)
54 /* hard code the list of forbidden names here for now */
55 const char *forbidden_valnames[] = {
60 "includes", /* this has a special meaning internally */
63 const char **forbidden = NULL;
65 for (forbidden = forbidden_valnames; *forbidden != NULL; forbidden++) {
66 if (strwicmp(valname, *forbidden) == 0) {
73 static bool smbconf_reg_valname_valid(const char *valname)
75 return (!smbconf_reg_valname_forbidden(valname) &&
76 lp_parameter_is_valid(valname));
80 * Open a subkey of the base key (i.e a service)
82 static WERROR smbconf_reg_open_service_key(TALLOC_CTX *mem_ctx,
83 struct smbconf_ctx *ctx,
84 const char *servicename,
85 uint32 desired_access,
86 struct registry_key **key)
90 if (servicename == NULL) {
91 *key = rpd(ctx)->base_key;
94 werr = reg_openkey(mem_ctx, rpd(ctx)->base_key, servicename,
97 if (W_ERROR_EQUAL(werr, WERR_BADFILE)) {
98 werr = WERR_NO_SUCH_SERVICE;
105 * check if a value exists in a given registry key
107 static bool smbconf_value_exists(struct registry_key *key, const char *param)
110 WERROR werr = WERR_OK;
111 TALLOC_CTX *ctx = talloc_stackframe();
112 struct registry_value *value = NULL;
114 werr = reg_queryvalue(ctx, key, param, &value);
115 if (W_ERROR_IS_OK(werr)) {
124 * create a subkey of the base key (i.e. a service...)
126 static WERROR smbconf_reg_create_service_key(TALLOC_CTX *mem_ctx,
127 struct smbconf_ctx *ctx,
128 const char * subkeyname,
129 struct registry_key **newkey)
131 WERROR werr = WERR_OK;
132 TALLOC_CTX *create_ctx;
133 enum winreg_CreateAction action = REG_ACTION_NONE;
135 /* create a new talloc ctx for creation. it will hold
136 * the intermediate parent key (SMBCONF) for creation
137 * and will be destroyed when leaving this function... */
138 create_ctx = talloc_stackframe();
140 werr = reg_createkey(mem_ctx, rpd(ctx)->base_key, subkeyname,
141 REG_KEY_WRITE, newkey, &action);
142 if (W_ERROR_IS_OK(werr) && (action != REG_CREATED_NEW_KEY)) {
143 DEBUG(10, ("Key '%s' already exists.\n", subkeyname));
144 werr = WERR_FILE_EXISTS;
146 if (!W_ERROR_IS_OK(werr)) {
147 DEBUG(5, ("Error creating key %s: %s\n",
148 subkeyname, win_errstr(werr)));
151 talloc_free(create_ctx);
156 * add a value to a key.
158 static WERROR smbconf_reg_set_value(struct registry_key *key,
162 struct registry_value val;
163 WERROR werr = WERR_OK;
165 const char *canon_valname;
166 const char *canon_valstr;
168 if (!lp_canonicalize_parameter_with_value(valname, valstr,
172 if (canon_valname == NULL) {
173 DEBUG(5, ("invalid parameter '%s' given\n",
176 DEBUG(5, ("invalid value '%s' given for "
177 "parameter '%s'\n", valstr, valname));
179 werr = WERR_INVALID_PARAM;
183 if (smbconf_reg_valname_forbidden(canon_valname)) {
184 DEBUG(5, ("Parameter '%s' not allowed in registry.\n",
186 werr = WERR_INVALID_PARAM;
190 subkeyname = strrchr_m(key->key->name, '\\');
191 if ((subkeyname == NULL) || (*(subkeyname +1) == '\0')) {
192 DEBUG(5, ("Invalid registry key '%s' given as "
193 "smbconf section.\n", key->key->name));
194 werr = WERR_INVALID_PARAM;
198 if (!strequal(subkeyname, GLOBAL_NAME) &&
199 lp_parameter_is_global(valname))
201 DEBUG(5, ("Global parameter '%s' not allowed in "
202 "service definition ('%s').\n", canon_valname,
204 werr = WERR_INVALID_PARAM;
211 val.v.sz.str = CONST_DISCARD(char *, canon_valstr);
212 val.v.sz.len = strlen(canon_valstr) + 1;
214 werr = reg_setvalue(key, canon_valname, &val);
215 if (!W_ERROR_IS_OK(werr)) {
216 DEBUG(5, ("Error adding value '%s' to "
218 canon_valname, key->key->name, win_errstr(werr)));
225 static WERROR smbconf_reg_set_multi_sz_value(struct registry_key *key,
227 const uint32_t num_strings,
228 const char **strings)
231 struct registry_value *value;
233 TALLOC_CTX *tmp_ctx = talloc_stackframe();
235 if (strings == NULL) {
236 werr = WERR_INVALID_PARAM;
240 value = TALLOC_ZERO_P(tmp_ctx, struct registry_value);
242 value->type = REG_MULTI_SZ;
243 value->v.multi_sz.num_strings = num_strings;
244 value->v.multi_sz.strings = TALLOC_ARRAY(tmp_ctx, char *, num_strings);
245 if (value->v.multi_sz.strings == NULL) {
249 for (count = 0; count < num_strings; count++) {
250 value->v.multi_sz.strings[count] =
251 talloc_strdup(value->v.multi_sz.strings,
253 if (value->v.multi_sz.strings[count] == NULL) {
259 werr = reg_setvalue(key, valname, value);
260 if (!W_ERROR_IS_OK(werr)) {
261 DEBUG(5, ("Error adding value '%s' to key '%s': %s\n",
262 valname, key->key->name, win_errstr(werr)));
266 talloc_free(tmp_ctx);
271 * format a registry_value into a string.
273 * This is intended to be used for smbconf registry values,
274 * which are ar stored as REG_SZ values, so the incomplete
275 * handling should be ok.
277 static char *smbconf_format_registry_value(TALLOC_CTX *mem_ctx,
278 struct registry_value *value)
282 /* alternatively, create a new talloc context? */
283 if (mem_ctx == NULL) {
287 switch (value->type) {
289 result = talloc_asprintf(mem_ctx, "%d", value->v.dword);
293 result = talloc_asprintf(mem_ctx, "%s", value->v.sz.str);
297 for (j = 0; j < value->v.multi_sz.num_strings; j++) {
298 result = talloc_asprintf(mem_ctx, "%s\"%s\" ",
299 result ? result : "" ,
300 value->v.multi_sz.strings[j]);
301 if (result == NULL) {
308 result = talloc_asprintf(mem_ctx, "binary (%d bytes)",
309 (int)value->v.binary.length);
312 result = talloc_asprintf(mem_ctx, "<unprintable>");
318 static WERROR smbconf_reg_get_includes_internal(TALLOC_CTX *mem_ctx,
319 struct registry_key *key,
320 uint32_t *num_includes,
325 struct registry_value *value = NULL;
326 char **tmp_includes = NULL;
327 TALLOC_CTX *tmp_ctx = talloc_stackframe();
329 if (!smbconf_value_exists(key, INCLUDES_VALNAME)) {
337 werr = reg_queryvalue(tmp_ctx, key, INCLUDES_VALNAME, &value);
338 if (!W_ERROR_IS_OK(werr)) {
342 if (value->type != REG_MULTI_SZ) {
343 /* wrong type -- ignore */
347 for (count = 0; count < value->v.multi_sz.num_strings; count++)
349 werr = smbconf_add_string_to_array(tmp_ctx,
352 value->v.multi_sz.strings[count]);
353 if (!W_ERROR_IS_OK(werr)) {
359 *includes = talloc_move(mem_ctx, &tmp_includes);
360 if (*includes == NULL) {
364 *num_includes = count;
371 talloc_free(tmp_ctx);
376 * Get the values of a key as a list of value names
377 * and a list of value strings (ordered)
379 static WERROR smbconf_reg_get_values(TALLOC_CTX *mem_ctx,
380 struct registry_key *key,
381 uint32_t *num_values,
383 char ***value_strings)
385 TALLOC_CTX *tmp_ctx = NULL;
386 WERROR werr = WERR_OK;
388 struct registry_value *valvalue = NULL;
389 char *valname = NULL;
390 uint32_t tmp_num_values = 0;
391 char **tmp_valnames = NULL;
392 char **tmp_valstrings = NULL;
393 uint32_t num_includes = 0;
394 char **includes = NULL;
396 if ((num_values == NULL) || (value_names == NULL) ||
397 (value_strings == NULL))
399 werr = WERR_INVALID_PARAM;
403 tmp_ctx = talloc_stackframe();
406 werr = reg_enumvalue(tmp_ctx, key, count, &valname, &valvalue),
412 if (!smbconf_reg_valname_valid(valname)) {
416 werr = smbconf_add_string_to_array(tmp_ctx,
418 tmp_num_values, valname);
419 if (!W_ERROR_IS_OK(werr)) {
423 valstring = smbconf_format_registry_value(tmp_ctx, valvalue);
424 werr = smbconf_add_string_to_array(tmp_ctx, &tmp_valstrings,
425 tmp_num_values, valstring);
426 if (!W_ERROR_IS_OK(werr)) {
431 if (!W_ERROR_EQUAL(WERR_NO_MORE_ITEMS, werr)) {
435 /* now add the includes at the end */
436 werr = smbconf_reg_get_includes_internal(tmp_ctx, key, &num_includes,
438 if (!W_ERROR_IS_OK(werr)) {
441 for (count = 0; count < num_includes; count++) {
442 werr = smbconf_add_string_to_array(tmp_ctx, &tmp_valnames,
443 tmp_num_values, "include");
444 if (!W_ERROR_IS_OK(werr)) {
448 werr = smbconf_add_string_to_array(tmp_ctx, &tmp_valstrings,
451 if (!W_ERROR_IS_OK(werr)) {
458 *num_values = tmp_num_values;
459 if (tmp_num_values > 0) {
460 *value_names = talloc_move(mem_ctx, &tmp_valnames);
461 *value_strings = talloc_move(mem_ctx, &tmp_valstrings);
464 *value_strings = NULL;
468 talloc_free(tmp_ctx);
472 static bool smbconf_reg_key_has_values(struct registry_key *key)
475 uint32_t num_subkeys;
476 uint32_t max_subkeylen;
477 uint32_t max_subkeysize;
479 uint32_t max_valnamelen;
480 uint32_t max_valbufsize;
481 uint32_t secdescsize;
482 NTTIME last_changed_time;
484 werr = reg_queryinfokey(key, &num_subkeys, &max_subkeylen,
485 &max_subkeysize, &num_values, &max_valnamelen,
486 &max_valbufsize, &secdescsize,
488 if (!W_ERROR_IS_OK(werr)) {
492 return (num_values != 0);
496 * delete all values from a key
498 static WERROR smbconf_reg_delete_values(struct registry_key *key)
502 struct registry_value *valvalue;
504 TALLOC_CTX *mem_ctx = talloc_stackframe();
507 werr = reg_enumvalue(mem_ctx, key, count, &valname, &valvalue),
511 werr = reg_deletevalue(key, valname);
512 if (!W_ERROR_IS_OK(werr)) {
516 if (!W_ERROR_EQUAL(WERR_NO_MORE_ITEMS, werr)) {
517 DEBUG(1, ("smbconf_reg_delete_values: "
518 "Error enumerating values of %s: %s\n",
527 talloc_free(mem_ctx);
531 /**********************************************************************
533 * smbconf operations: registry implementations
535 **********************************************************************/
538 * initialize the registry smbconf backend
540 static WERROR smbconf_reg_init(struct smbconf_ctx *ctx, const char *path)
542 WERROR werr = WERR_OK;
543 struct nt_user_token *token;
548 ctx->path = talloc_strdup(ctx, path);
549 if (ctx->path == NULL) {
554 ctx->data = TALLOC_ZERO_P(ctx, struct reg_private_data);
556 werr = ntstatus_to_werror(registry_create_admin_token(ctx, &token));
557 if (!W_ERROR_IS_OK(werr)) {
558 DEBUG(1, ("Error creating admin token\n"));
561 rpd(ctx)->open = false;
563 werr = registry_init_smbconf(path);
564 if (!W_ERROR_IS_OK(werr)) {
568 werr = ctx->ops->open_conf(ctx);
569 if (!W_ERROR_IS_OK(werr)) {
570 DEBUG(1, ("Error opening the registry.\n"));
574 werr = reg_open_path(ctx, ctx->path,
575 KEY_ENUMERATE_SUB_KEYS | REG_KEY_WRITE,
576 token, &rpd(ctx)->base_key);
577 if (!W_ERROR_IS_OK(werr)) {
585 static int smbconf_reg_shutdown(struct smbconf_ctx *ctx)
587 return ctx->ops->close_conf(ctx);
590 static bool smbconf_reg_requires_messaging(struct smbconf_ctx *ctx)
592 #ifdef CLUSTER_SUPPORT
593 if (lp_clustering() && lp_parm_bool(-1, "ctdb", "registry.tdb", true)) {
600 static bool smbconf_reg_is_writeable(struct smbconf_ctx *ctx)
603 * The backend has write support.
605 * TODO: add access checks whether the concrete
606 * config source is really writeable by the calling user.
611 static WERROR smbconf_reg_open(struct smbconf_ctx *ctx)
615 if (rpd(ctx)->open) {
620 if (W_ERROR_IS_OK(werr)) {
621 rpd(ctx)->open = true;
626 static int smbconf_reg_close(struct smbconf_ctx *ctx)
630 if (!rpd(ctx)->open) {
636 rpd(ctx)->open = false;
642 * Get the change sequence number of the given service/parameter.
643 * service and parameter strings may be NULL.
645 static void smbconf_reg_get_csn(struct smbconf_ctx *ctx,
646 struct smbconf_csn *csn,
647 const char *service, const char *param)
653 if (!W_ERROR_IS_OK(ctx->ops->open_conf(ctx))) {
657 csn->csn = (uint64_t)regdb_get_seqnum();
661 * Drop the whole configuration (restarting empty) - registry version
663 static WERROR smbconf_reg_drop(struct smbconf_ctx *ctx)
666 WERROR werr = WERR_OK;
667 struct registry_key *parent_key = NULL;
668 struct registry_key *new_key = NULL;
669 TALLOC_CTX* mem_ctx = talloc_stackframe();
670 enum winreg_CreateAction action;
671 struct nt_user_token *token;
673 werr = ntstatus_to_werror(registry_create_admin_token(ctx, &token));
674 if (!W_ERROR_IS_OK(werr)) {
675 DEBUG(1, ("Error creating admin token\n"));
679 path = talloc_strdup(mem_ctx, ctx->path);
684 p = strrchr(path, '\\');
686 werr = reg_open_path(mem_ctx, path, REG_KEY_WRITE, token,
689 if (!W_ERROR_IS_OK(werr)) {
693 werr = reg_deletekey_recursive(mem_ctx, parent_key, p+1);
695 if (!W_ERROR_IS_OK(werr)) {
699 werr = reg_createkey(mem_ctx, parent_key, p+1, REG_KEY_WRITE,
703 talloc_free(mem_ctx);
708 * get the list of share names defined in the configuration.
711 static WERROR smbconf_reg_get_share_names(struct smbconf_ctx *ctx,
713 uint32_t *num_shares,
717 uint32_t added_count = 0;
718 TALLOC_CTX *tmp_ctx = NULL;
719 WERROR werr = WERR_OK;
720 char *subkey_name = NULL;
721 char **tmp_share_names = NULL;
723 if ((num_shares == NULL) || (share_names == NULL)) {
724 werr = WERR_INVALID_PARAM;
728 tmp_ctx = talloc_stackframe();
730 /* if there are values in the base key, return NULL as share name */
732 if (smbconf_reg_key_has_values(rpd(ctx)->base_key)) {
733 werr = smbconf_add_string_to_array(tmp_ctx, &tmp_share_names,
735 if (!W_ERROR_IS_OK(werr)) {
741 /* make sure "global" is always listed first */
742 if (smbconf_share_exists(ctx, GLOBAL_NAME)) {
743 werr = smbconf_add_string_to_array(tmp_ctx, &tmp_share_names,
744 added_count, GLOBAL_NAME);
745 if (!W_ERROR_IS_OK(werr)) {
752 werr = reg_enumkey(tmp_ctx, rpd(ctx)->base_key, count,
757 if (strequal(subkey_name, GLOBAL_NAME)) {
761 werr = smbconf_add_string_to_array(tmp_ctx,
765 if (!W_ERROR_IS_OK(werr)) {
770 if (!W_ERROR_EQUAL(WERR_NO_MORE_ITEMS, werr)) {
775 *num_shares = added_count;
776 if (added_count > 0) {
777 *share_names = talloc_move(mem_ctx, &tmp_share_names);
783 talloc_free(tmp_ctx);
788 * check if a share/service of a given name exists - registry version
790 static bool smbconf_reg_share_exists(struct smbconf_ctx *ctx,
791 const char *servicename)
794 WERROR werr = WERR_OK;
795 TALLOC_CTX *mem_ctx = talloc_stackframe();
796 struct registry_key *key = NULL;
798 werr = smbconf_reg_open_service_key(mem_ctx, ctx, servicename,
800 if (W_ERROR_IS_OK(werr)) {
804 talloc_free(mem_ctx);
809 * Add a service if it does not already exist - registry version
811 static WERROR smbconf_reg_create_share(struct smbconf_ctx *ctx,
812 const char *servicename)
815 struct registry_key *key = NULL;
817 if (servicename == NULL) {
821 werr = smbconf_reg_create_service_key(talloc_tos(), ctx,
829 * get a definition of a share (service) from configuration.
831 static WERROR smbconf_reg_get_share(struct smbconf_ctx *ctx,
833 const char *servicename,
834 struct smbconf_service **service)
836 WERROR werr = WERR_OK;
837 struct registry_key *key = NULL;
838 struct smbconf_service *tmp_service = NULL;
839 TALLOC_CTX *tmp_ctx = talloc_stackframe();
841 werr = smbconf_reg_open_service_key(tmp_ctx, ctx, servicename,
843 if (!W_ERROR_IS_OK(werr)) {
847 tmp_service = TALLOC_ZERO_P(tmp_ctx, struct smbconf_service);
848 if (tmp_service == NULL) {
853 if (servicename != NULL) {
854 tmp_service->name = talloc_strdup(tmp_service, servicename);
855 if (tmp_service->name == NULL) {
861 werr = smbconf_reg_get_values(tmp_service, key,
862 &(tmp_service->num_params),
863 &(tmp_service->param_names),
864 &(tmp_service->param_values));
866 if (W_ERROR_IS_OK(werr)) {
867 *service = talloc_move(mem_ctx, &tmp_service);
871 talloc_free(tmp_ctx);
876 * delete a service from configuration
878 static WERROR smbconf_reg_delete_share(struct smbconf_ctx *ctx,
879 const char *servicename)
881 WERROR werr = WERR_OK;
882 TALLOC_CTX *mem_ctx = talloc_stackframe();
884 if (servicename != NULL) {
885 werr = reg_deletekey_recursive(mem_ctx, rpd(ctx)->base_key,
888 werr = smbconf_reg_delete_values(rpd(ctx)->base_key);
891 talloc_free(mem_ctx);
896 * set a configuration parameter to the value provided.
898 static WERROR smbconf_reg_set_parameter(struct smbconf_ctx *ctx,
904 struct registry_key *key = NULL;
905 TALLOC_CTX *mem_ctx = talloc_stackframe();
907 werr = smbconf_reg_open_service_key(mem_ctx, ctx, service,
908 REG_KEY_WRITE, &key);
909 if (!W_ERROR_IS_OK(werr)) {
913 werr = smbconf_reg_set_value(key, param, valstr);
916 talloc_free(mem_ctx);
921 * get the value of a configuration parameter as a string
923 static WERROR smbconf_reg_get_parameter(struct smbconf_ctx *ctx,
929 WERROR werr = WERR_OK;
930 struct registry_key *key = NULL;
931 struct registry_value *value = NULL;
933 werr = smbconf_reg_open_service_key(mem_ctx, ctx, service,
935 if (!W_ERROR_IS_OK(werr)) {
939 if (!smbconf_reg_valname_valid(param)) {
940 werr = WERR_INVALID_PARAM;
944 if (!smbconf_value_exists(key, param)) {
945 werr = WERR_INVALID_PARAM;
949 werr = reg_queryvalue(mem_ctx, key, param, &value);
950 if (!W_ERROR_IS_OK(werr)) {
954 *valstr = smbconf_format_registry_value(mem_ctx, value);
956 if (*valstr == NULL) {
967 * delete a parameter from configuration
969 static WERROR smbconf_reg_delete_parameter(struct smbconf_ctx *ctx,
973 struct registry_key *key = NULL;
974 WERROR werr = WERR_OK;
975 TALLOC_CTX *mem_ctx = talloc_stackframe();
977 werr = smbconf_reg_open_service_key(mem_ctx, ctx, service,
979 if (!W_ERROR_IS_OK(werr)) {
983 if (!smbconf_reg_valname_valid(param)) {
984 werr = WERR_INVALID_PARAM;
988 if (!smbconf_value_exists(key, param)) {
989 werr = WERR_INVALID_PARAM;
993 werr = reg_deletevalue(key, param);
996 talloc_free(mem_ctx);
1000 static WERROR smbconf_reg_get_includes(struct smbconf_ctx *ctx,
1001 TALLOC_CTX *mem_ctx,
1002 const char *service,
1003 uint32_t *num_includes,
1007 struct registry_key *key = NULL;
1008 TALLOC_CTX *tmp_ctx = talloc_stackframe();
1010 werr = smbconf_reg_open_service_key(tmp_ctx, ctx, service,
1011 REG_KEY_READ, &key);
1012 if (!W_ERROR_IS_OK(werr)) {
1016 werr = smbconf_reg_get_includes_internal(mem_ctx, key, num_includes,
1020 talloc_free(tmp_ctx);
1024 static WERROR smbconf_reg_set_includes(struct smbconf_ctx *ctx,
1025 const char *service,
1026 uint32_t num_includes,
1027 const char **includes)
1029 WERROR werr = WERR_OK;
1030 struct registry_key *key = NULL;
1031 TALLOC_CTX *tmp_ctx = talloc_stackframe();
1033 werr = smbconf_reg_open_service_key(tmp_ctx, ctx, service,
1035 if (!W_ERROR_IS_OK(werr)) {
1039 if (num_includes == 0) {
1040 if (!smbconf_value_exists(key, INCLUDES_VALNAME)) {
1043 werr = reg_deletevalue(key, INCLUDES_VALNAME);
1045 werr = smbconf_reg_set_multi_sz_value(key, INCLUDES_VALNAME,
1046 num_includes, includes);
1050 talloc_free(tmp_ctx);
1054 static WERROR smbconf_reg_delete_includes(struct smbconf_ctx *ctx,
1055 const char *service)
1057 WERROR werr = WERR_OK;
1058 struct registry_key *key = NULL;
1059 TALLOC_CTX *tmp_ctx = talloc_stackframe();
1061 werr = smbconf_reg_open_service_key(tmp_ctx, ctx, service,
1063 if (!W_ERROR_IS_OK(werr)) {
1067 if (!smbconf_value_exists(key, INCLUDES_VALNAME)) {
1071 werr = reg_deletevalue(key, INCLUDES_VALNAME);
1075 talloc_free(tmp_ctx);
1079 static WERROR smbconf_reg_transaction_start(struct smbconf_ctx *ctx)
1081 return regdb_transaction_start();
1084 static WERROR smbconf_reg_transaction_commit(struct smbconf_ctx *ctx)
1086 return regdb_transaction_commit();
1089 static WERROR smbconf_reg_transaction_cancel(struct smbconf_ctx *ctx)
1091 return regdb_transaction_cancel();
1094 struct smbconf_ops smbconf_ops_reg = {
1095 .init = smbconf_reg_init,
1096 .shutdown = smbconf_reg_shutdown,
1097 .requires_messaging = smbconf_reg_requires_messaging,
1098 .is_writeable = smbconf_reg_is_writeable,
1099 .open_conf = smbconf_reg_open,
1100 .close_conf = smbconf_reg_close,
1101 .get_csn = smbconf_reg_get_csn,
1102 .drop = smbconf_reg_drop,
1103 .get_share_names = smbconf_reg_get_share_names,
1104 .share_exists = smbconf_reg_share_exists,
1105 .create_share = smbconf_reg_create_share,
1106 .get_share = smbconf_reg_get_share,
1107 .delete_share = smbconf_reg_delete_share,
1108 .set_parameter = smbconf_reg_set_parameter,
1109 .get_parameter = smbconf_reg_get_parameter,
1110 .delete_parameter = smbconf_reg_delete_parameter,
1111 .get_includes = smbconf_reg_get_includes,
1112 .set_includes = smbconf_reg_set_includes,
1113 .delete_includes = smbconf_reg_delete_includes,
1114 .transaction_start = smbconf_reg_transaction_start,
1115 .transaction_commit = smbconf_reg_transaction_commit,
1116 .transaction_cancel = smbconf_reg_transaction_cancel,
1121 * initialize the smbconf registry backend
1122 * the only function that is exported from this module
1124 WERROR smbconf_init_reg(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx,
1127 return smbconf_init_internal(mem_ctx, conf_ctx, path, &smbconf_ops_reg);