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_api.h"
24 #include "registry/reg_backend_db.h"
25 #include "registry/reg_util_token.h"
26 #include "registry/reg_api_util.h"
27 #include "registry/reg_init_smbconf.h"
28 #include "lib/smbconf/smbconf_init.h"
29 #include "lib/smbconf/smbconf_reg.h"
31 #define INCLUDES_VALNAME "includes"
33 struct reg_private_data {
34 struct registry_key *base_key;
35 bool open; /* did _we_ open the registry? */
38 /**********************************************************************
42 **********************************************************************/
45 * a convenience helper to cast the private data structure
47 static struct reg_private_data *rpd(struct smbconf_ctx *ctx)
49 return (struct reg_private_data *)(ctx->data);
53 * check whether a given value name is forbidden in registry (smbconf)
55 static bool smbconf_reg_valname_forbidden(const char *valname)
57 /* hard code the list of forbidden names here for now */
58 const char *forbidden_valnames[] = {
63 "includes", /* this has a special meaning internally */
66 const char **forbidden = NULL;
68 for (forbidden = forbidden_valnames; *forbidden != NULL; forbidden++) {
69 if (strwicmp(valname, *forbidden) == 0) {
76 static bool smbconf_reg_valname_valid(const char *valname)
78 return (!smbconf_reg_valname_forbidden(valname) &&
79 lp_parameter_is_valid(valname));
83 * Open a subkey of the base key (i.e a service)
85 static WERROR smbconf_reg_open_service_key(TALLOC_CTX *mem_ctx,
86 struct smbconf_ctx *ctx,
87 const char *servicename,
88 uint32 desired_access,
89 struct registry_key **key)
93 if (servicename == NULL) {
94 *key = rpd(ctx)->base_key;
97 werr = reg_openkey(mem_ctx, rpd(ctx)->base_key, servicename,
100 if (W_ERROR_EQUAL(werr, WERR_BADFILE)) {
101 werr = WERR_NO_SUCH_SERVICE;
108 * check if a value exists in a given registry key
110 static bool smbconf_value_exists(struct registry_key *key, const char *param)
113 WERROR werr = WERR_OK;
114 TALLOC_CTX *ctx = talloc_stackframe();
115 struct registry_value *value = NULL;
117 werr = reg_queryvalue(ctx, key, param, &value);
118 if (W_ERROR_IS_OK(werr)) {
127 * create a subkey of the base key (i.e. a service...)
129 static WERROR smbconf_reg_create_service_key(TALLOC_CTX *mem_ctx,
130 struct smbconf_ctx *ctx,
131 const char * subkeyname,
132 struct registry_key **newkey)
134 WERROR werr = WERR_OK;
135 TALLOC_CTX *create_ctx;
136 enum winreg_CreateAction action = REG_ACTION_NONE;
138 /* create a new talloc ctx for creation. it will hold
139 * the intermediate parent key (SMBCONF) for creation
140 * and will be destroyed when leaving this function... */
141 create_ctx = talloc_stackframe();
143 werr = reg_createkey(mem_ctx, rpd(ctx)->base_key, subkeyname,
144 REG_KEY_WRITE, newkey, &action);
145 if (W_ERROR_IS_OK(werr) && (action != REG_CREATED_NEW_KEY)) {
146 DEBUG(10, ("Key '%s' already exists.\n", subkeyname));
147 werr = WERR_FILE_EXISTS;
149 if (!W_ERROR_IS_OK(werr)) {
150 DEBUG(5, ("Error creating key %s: %s\n",
151 subkeyname, win_errstr(werr)));
154 talloc_free(create_ctx);
159 * add a value to a key.
161 static WERROR smbconf_reg_set_value(struct registry_key *key,
165 struct registry_value val;
166 WERROR werr = WERR_OK;
168 const char *canon_valname;
169 const char *canon_valstr;
171 if (!lp_canonicalize_parameter_with_value(valname, valstr,
175 if (canon_valname == NULL) {
176 DEBUG(5, ("invalid parameter '%s' given\n",
179 DEBUG(5, ("invalid value '%s' given for "
180 "parameter '%s'\n", valstr, valname));
182 werr = WERR_INVALID_PARAM;
186 if (smbconf_reg_valname_forbidden(canon_valname)) {
187 DEBUG(5, ("Parameter '%s' not allowed in registry.\n",
189 werr = WERR_INVALID_PARAM;
193 subkeyname = strrchr_m(key->key->name, '\\');
194 if ((subkeyname == NULL) || (*(subkeyname +1) == '\0')) {
195 DEBUG(5, ("Invalid registry key '%s' given as "
196 "smbconf section.\n", key->key->name));
197 werr = WERR_INVALID_PARAM;
201 if (!strequal(subkeyname, GLOBAL_NAME) &&
202 lp_parameter_is_global(valname))
204 DEBUG(5, ("Global parameter '%s' not allowed in "
205 "service definition ('%s').\n", canon_valname,
207 werr = WERR_INVALID_PARAM;
214 if (!push_reg_sz(talloc_tos(), &val.data, canon_valstr)) {
219 werr = reg_setvalue(key, canon_valname, &val);
220 if (!W_ERROR_IS_OK(werr)) {
221 DEBUG(5, ("Error adding value '%s' to "
223 canon_valname, key->key->name, win_errstr(werr)));
230 static WERROR smbconf_reg_set_multi_sz_value(struct registry_key *key,
232 const uint32_t num_strings,
233 const char **strings)
236 struct registry_value *value;
238 TALLOC_CTX *tmp_ctx = talloc_stackframe();
241 if (strings == NULL) {
242 werr = WERR_INVALID_PARAM;
246 array = talloc_zero_array(tmp_ctx, const char *, num_strings + 1);
252 value = TALLOC_ZERO_P(tmp_ctx, struct registry_value);
258 value->type = REG_MULTI_SZ;
260 for (count = 0; count < num_strings; count++) {
261 array[count] = talloc_strdup(value, strings[count]);
262 if (array[count] == NULL) {
268 if (!push_reg_multi_sz(value, &value->data, array)) {
273 werr = reg_setvalue(key, valname, value);
274 if (!W_ERROR_IS_OK(werr)) {
275 DEBUG(5, ("Error adding value '%s' to key '%s': %s\n",
276 valname, key->key->name, win_errstr(werr)));
280 talloc_free(tmp_ctx);
285 * format a registry_value into a string.
287 * This is intended to be used for smbconf registry values,
288 * which are ar stored as REG_SZ values, so the incomplete
289 * handling should be ok.
291 static char *smbconf_format_registry_value(TALLOC_CTX *mem_ctx,
292 struct registry_value *value)
296 /* alternatively, create a new talloc context? */
297 if (mem_ctx == NULL) {
301 switch (value->type) {
303 if (value->data.length >= 4) {
304 uint32_t v = IVAL(value->data.data, 0);
305 result = talloc_asprintf(mem_ctx, "%d", v);
309 case REG_EXPAND_SZ: {
311 if (!pull_reg_sz(mem_ctx, &value->data, &s)) {
314 result = talloc_strdup(mem_ctx, s);
319 const char **a = NULL;
320 if (!pull_reg_multi_sz(mem_ctx, &value->data, &a)) {
323 for (j = 0; a[j] != NULL; j++) {
324 result = talloc_asprintf(mem_ctx, "%s\"%s\" ",
325 result ? result : "" ,
327 if (result == NULL) {
334 result = talloc_asprintf(mem_ctx, "binary (%d bytes)",
335 (int)value->data.length);
338 result = talloc_asprintf(mem_ctx, "<unprintable>");
344 static WERROR smbconf_reg_get_includes_internal(TALLOC_CTX *mem_ctx,
345 struct registry_key *key,
346 uint32_t *num_includes,
351 struct registry_value *value = NULL;
352 char **tmp_includes = NULL;
353 const char **array = NULL;
354 TALLOC_CTX *tmp_ctx = talloc_stackframe();
356 if (!smbconf_value_exists(key, INCLUDES_VALNAME)) {
364 werr = reg_queryvalue(tmp_ctx, key, INCLUDES_VALNAME, &value);
365 if (!W_ERROR_IS_OK(werr)) {
369 if (value->type != REG_MULTI_SZ) {
370 /* wrong type -- ignore */
374 if (!pull_reg_multi_sz(tmp_ctx, &value->data, &array)) {
379 for (count = 0; array[count] != NULL; count++) {
380 werr = smbconf_add_string_to_array(tmp_ctx,
384 if (!W_ERROR_IS_OK(werr)) {
390 *includes = talloc_move(mem_ctx, &tmp_includes);
391 if (*includes == NULL) {
395 *num_includes = count;
402 talloc_free(tmp_ctx);
407 * Get the values of a key as a list of value names
408 * and a list of value strings (ordered)
410 static WERROR smbconf_reg_get_values(TALLOC_CTX *mem_ctx,
411 struct registry_key *key,
412 uint32_t *num_values,
414 char ***value_strings)
416 TALLOC_CTX *tmp_ctx = NULL;
417 WERROR werr = WERR_OK;
419 struct registry_value *valvalue = NULL;
420 char *valname = NULL;
421 uint32_t tmp_num_values = 0;
422 char **tmp_valnames = NULL;
423 char **tmp_valstrings = NULL;
424 uint32_t num_includes = 0;
425 char **includes = NULL;
427 if ((num_values == NULL) || (value_names == NULL) ||
428 (value_strings == NULL))
430 werr = WERR_INVALID_PARAM;
434 tmp_ctx = talloc_stackframe();
437 werr = reg_enumvalue(tmp_ctx, key, count, &valname, &valvalue),
443 if (!smbconf_reg_valname_valid(valname)) {
447 werr = smbconf_add_string_to_array(tmp_ctx,
449 tmp_num_values, valname);
450 if (!W_ERROR_IS_OK(werr)) {
454 valstring = smbconf_format_registry_value(tmp_ctx, valvalue);
455 werr = smbconf_add_string_to_array(tmp_ctx, &tmp_valstrings,
456 tmp_num_values, valstring);
457 if (!W_ERROR_IS_OK(werr)) {
462 if (!W_ERROR_EQUAL(WERR_NO_MORE_ITEMS, werr)) {
466 /* now add the includes at the end */
467 werr = smbconf_reg_get_includes_internal(tmp_ctx, key, &num_includes,
469 if (!W_ERROR_IS_OK(werr)) {
472 for (count = 0; count < num_includes; count++) {
473 werr = smbconf_add_string_to_array(tmp_ctx, &tmp_valnames,
474 tmp_num_values, "include");
475 if (!W_ERROR_IS_OK(werr)) {
479 werr = smbconf_add_string_to_array(tmp_ctx, &tmp_valstrings,
482 if (!W_ERROR_IS_OK(werr)) {
489 *num_values = tmp_num_values;
490 if (tmp_num_values > 0) {
491 *value_names = talloc_move(mem_ctx, &tmp_valnames);
492 *value_strings = talloc_move(mem_ctx, &tmp_valstrings);
495 *value_strings = NULL;
499 talloc_free(tmp_ctx);
503 static bool smbconf_reg_key_has_values(struct registry_key *key)
506 uint32_t num_subkeys;
507 uint32_t max_subkeylen;
508 uint32_t max_subkeysize;
510 uint32_t max_valnamelen;
511 uint32_t max_valbufsize;
512 uint32_t secdescsize;
513 NTTIME last_changed_time;
515 werr = reg_queryinfokey(key, &num_subkeys, &max_subkeylen,
516 &max_subkeysize, &num_values, &max_valnamelen,
517 &max_valbufsize, &secdescsize,
519 if (!W_ERROR_IS_OK(werr)) {
523 return (num_values != 0);
527 * delete all values from a key
529 static WERROR smbconf_reg_delete_values(struct registry_key *key)
533 struct registry_value *valvalue;
535 TALLOC_CTX *mem_ctx = talloc_stackframe();
538 werr = reg_enumvalue(mem_ctx, key, count, &valname, &valvalue),
542 werr = reg_deletevalue(key, valname);
543 if (!W_ERROR_IS_OK(werr)) {
547 if (!W_ERROR_EQUAL(WERR_NO_MORE_ITEMS, werr)) {
548 DEBUG(1, ("smbconf_reg_delete_values: "
549 "Error enumerating values of %s: %s\n",
558 talloc_free(mem_ctx);
562 /**********************************************************************
564 * smbconf operations: registry implementations
566 **********************************************************************/
569 * initialize the registry smbconf backend
571 static WERROR smbconf_reg_init(struct smbconf_ctx *ctx, const char *path)
573 WERROR werr = WERR_OK;
574 struct security_token *token;
579 ctx->path = talloc_strdup(ctx, path);
580 if (ctx->path == NULL) {
585 ctx->data = TALLOC_ZERO_P(ctx, struct reg_private_data);
587 werr = ntstatus_to_werror(registry_create_admin_token(ctx, &token));
588 if (!W_ERROR_IS_OK(werr)) {
589 DEBUG(1, ("Error creating admin token\n"));
592 rpd(ctx)->open = false;
594 werr = registry_init_smbconf(path);
595 if (!W_ERROR_IS_OK(werr)) {
599 werr = ctx->ops->open_conf(ctx);
600 if (!W_ERROR_IS_OK(werr)) {
601 DEBUG(1, ("Error opening the registry.\n"));
605 werr = reg_open_path(ctx, ctx->path,
606 KEY_ENUMERATE_SUB_KEYS | REG_KEY_WRITE,
607 token, &rpd(ctx)->base_key);
608 if (!W_ERROR_IS_OK(werr)) {
616 static int smbconf_reg_shutdown(struct smbconf_ctx *ctx)
618 return ctx->ops->close_conf(ctx);
621 static bool smbconf_reg_requires_messaging(struct smbconf_ctx *ctx)
623 #ifdef CLUSTER_SUPPORT
624 if (lp_clustering() && lp_parm_bool(-1, "ctdb", "registry.tdb", true)) {
631 static bool smbconf_reg_is_writeable(struct smbconf_ctx *ctx)
634 * The backend has write support.
636 * TODO: add access checks whether the concrete
637 * config source is really writeable by the calling user.
642 static WERROR smbconf_reg_open(struct smbconf_ctx *ctx)
646 if (rpd(ctx)->open) {
651 if (W_ERROR_IS_OK(werr)) {
652 rpd(ctx)->open = true;
657 static int smbconf_reg_close(struct smbconf_ctx *ctx)
661 if (!rpd(ctx)->open) {
667 rpd(ctx)->open = false;
673 * Get the change sequence number of the given service/parameter.
674 * service and parameter strings may be NULL.
676 static void smbconf_reg_get_csn(struct smbconf_ctx *ctx,
677 struct smbconf_csn *csn,
678 const char *service, const char *param)
684 if (!W_ERROR_IS_OK(ctx->ops->open_conf(ctx))) {
688 csn->csn = (uint64_t)regdb_get_seqnum();
692 * Drop the whole configuration (restarting empty) - registry version
694 static WERROR smbconf_reg_drop(struct smbconf_ctx *ctx)
697 WERROR werr = WERR_OK;
698 struct registry_key *parent_key = NULL;
699 struct registry_key *new_key = NULL;
700 TALLOC_CTX* mem_ctx = talloc_stackframe();
701 enum winreg_CreateAction action;
702 struct security_token *token;
704 werr = ntstatus_to_werror(registry_create_admin_token(ctx, &token));
705 if (!W_ERROR_IS_OK(werr)) {
706 DEBUG(1, ("Error creating admin token\n"));
710 path = talloc_strdup(mem_ctx, ctx->path);
715 p = strrchr(path, '\\');
717 werr = reg_open_path(mem_ctx, path, REG_KEY_WRITE, token,
720 if (!W_ERROR_IS_OK(werr)) {
724 werr = reg_deletekey_recursive(parent_key, p+1);
726 if (!W_ERROR_IS_OK(werr)) {
730 werr = reg_createkey(mem_ctx, parent_key, p+1, REG_KEY_WRITE,
734 talloc_free(mem_ctx);
739 * get the list of share names defined in the configuration.
742 static WERROR smbconf_reg_get_share_names(struct smbconf_ctx *ctx,
744 uint32_t *num_shares,
748 uint32_t added_count = 0;
749 TALLOC_CTX *tmp_ctx = NULL;
750 WERROR werr = WERR_OK;
751 char *subkey_name = NULL;
752 char **tmp_share_names = NULL;
754 if ((num_shares == NULL) || (share_names == NULL)) {
755 werr = WERR_INVALID_PARAM;
759 tmp_ctx = talloc_stackframe();
761 /* if there are values in the base key, return NULL as share name */
763 if (smbconf_reg_key_has_values(rpd(ctx)->base_key)) {
764 werr = smbconf_add_string_to_array(tmp_ctx, &tmp_share_names,
766 if (!W_ERROR_IS_OK(werr)) {
772 /* make sure "global" is always listed first */
773 if (smbconf_share_exists(ctx, GLOBAL_NAME)) {
774 werr = smbconf_add_string_to_array(tmp_ctx, &tmp_share_names,
775 added_count, GLOBAL_NAME);
776 if (!W_ERROR_IS_OK(werr)) {
783 werr = reg_enumkey(tmp_ctx, rpd(ctx)->base_key, count,
788 if (strequal(subkey_name, GLOBAL_NAME)) {
792 werr = smbconf_add_string_to_array(tmp_ctx,
796 if (!W_ERROR_IS_OK(werr)) {
801 if (!W_ERROR_EQUAL(WERR_NO_MORE_ITEMS, werr)) {
806 *num_shares = added_count;
807 if (added_count > 0) {
808 *share_names = talloc_move(mem_ctx, &tmp_share_names);
814 talloc_free(tmp_ctx);
819 * check if a share/service of a given name exists - registry version
821 static bool smbconf_reg_share_exists(struct smbconf_ctx *ctx,
822 const char *servicename)
825 WERROR werr = WERR_OK;
826 TALLOC_CTX *mem_ctx = talloc_stackframe();
827 struct registry_key *key = NULL;
829 werr = smbconf_reg_open_service_key(mem_ctx, ctx, servicename,
831 if (W_ERROR_IS_OK(werr)) {
835 talloc_free(mem_ctx);
840 * Add a service if it does not already exist - registry version
842 static WERROR smbconf_reg_create_share(struct smbconf_ctx *ctx,
843 const char *servicename)
846 struct registry_key *key = NULL;
848 if (servicename == NULL) {
852 werr = smbconf_reg_create_service_key(talloc_tos(), ctx,
860 * get a definition of a share (service) from configuration.
862 static WERROR smbconf_reg_get_share(struct smbconf_ctx *ctx,
864 const char *servicename,
865 struct smbconf_service **service)
867 WERROR werr = WERR_OK;
868 struct registry_key *key = NULL;
869 struct smbconf_service *tmp_service = NULL;
870 TALLOC_CTX *tmp_ctx = talloc_stackframe();
872 werr = smbconf_reg_open_service_key(tmp_ctx, ctx, servicename,
874 if (!W_ERROR_IS_OK(werr)) {
878 tmp_service = TALLOC_ZERO_P(tmp_ctx, struct smbconf_service);
879 if (tmp_service == NULL) {
884 if (servicename != NULL) {
885 tmp_service->name = talloc_strdup(tmp_service, servicename);
886 if (tmp_service->name == NULL) {
892 werr = smbconf_reg_get_values(tmp_service, key,
893 &(tmp_service->num_params),
894 &(tmp_service->param_names),
895 &(tmp_service->param_values));
897 if (W_ERROR_IS_OK(werr)) {
898 *service = talloc_move(mem_ctx, &tmp_service);
902 talloc_free(tmp_ctx);
907 * delete a service from configuration
909 static WERROR smbconf_reg_delete_share(struct smbconf_ctx *ctx,
910 const char *servicename)
912 WERROR werr = WERR_OK;
913 TALLOC_CTX *mem_ctx = talloc_stackframe();
915 if (servicename != NULL) {
916 werr = reg_deletekey_recursive(rpd(ctx)->base_key, servicename);
918 werr = smbconf_reg_delete_values(rpd(ctx)->base_key);
921 talloc_free(mem_ctx);
926 * set a configuration parameter to the value provided.
928 static WERROR smbconf_reg_set_parameter(struct smbconf_ctx *ctx,
934 struct registry_key *key = NULL;
935 TALLOC_CTX *mem_ctx = talloc_stackframe();
937 werr = smbconf_reg_open_service_key(mem_ctx, ctx, service,
938 REG_KEY_WRITE, &key);
939 if (!W_ERROR_IS_OK(werr)) {
943 werr = smbconf_reg_set_value(key, param, valstr);
946 talloc_free(mem_ctx);
951 * get the value of a configuration parameter as a string
953 static WERROR smbconf_reg_get_parameter(struct smbconf_ctx *ctx,
959 WERROR werr = WERR_OK;
960 struct registry_key *key = NULL;
961 struct registry_value *value = NULL;
963 werr = smbconf_reg_open_service_key(mem_ctx, ctx, service,
965 if (!W_ERROR_IS_OK(werr)) {
969 if (!smbconf_reg_valname_valid(param)) {
970 werr = WERR_INVALID_PARAM;
974 if (!smbconf_value_exists(key, param)) {
975 werr = WERR_INVALID_PARAM;
979 werr = reg_queryvalue(mem_ctx, key, param, &value);
980 if (!W_ERROR_IS_OK(werr)) {
984 *valstr = smbconf_format_registry_value(mem_ctx, value);
986 if (*valstr == NULL) {
997 * delete a parameter from configuration
999 static WERROR smbconf_reg_delete_parameter(struct smbconf_ctx *ctx,
1000 const char *service,
1003 struct registry_key *key = NULL;
1004 WERROR werr = WERR_OK;
1005 TALLOC_CTX *mem_ctx = talloc_stackframe();
1007 werr = smbconf_reg_open_service_key(mem_ctx, ctx, service,
1009 if (!W_ERROR_IS_OK(werr)) {
1013 if (!smbconf_reg_valname_valid(param)) {
1014 werr = WERR_INVALID_PARAM;
1018 if (!smbconf_value_exists(key, param)) {
1019 werr = WERR_INVALID_PARAM;
1023 werr = reg_deletevalue(key, param);
1026 talloc_free(mem_ctx);
1030 static WERROR smbconf_reg_get_includes(struct smbconf_ctx *ctx,
1031 TALLOC_CTX *mem_ctx,
1032 const char *service,
1033 uint32_t *num_includes,
1037 struct registry_key *key = NULL;
1038 TALLOC_CTX *tmp_ctx = talloc_stackframe();
1040 werr = smbconf_reg_open_service_key(tmp_ctx, ctx, service,
1041 REG_KEY_READ, &key);
1042 if (!W_ERROR_IS_OK(werr)) {
1046 werr = smbconf_reg_get_includes_internal(mem_ctx, key, num_includes,
1050 talloc_free(tmp_ctx);
1054 static WERROR smbconf_reg_set_includes(struct smbconf_ctx *ctx,
1055 const char *service,
1056 uint32_t num_includes,
1057 const char **includes)
1059 WERROR werr = WERR_OK;
1060 struct registry_key *key = NULL;
1061 TALLOC_CTX *tmp_ctx = talloc_stackframe();
1063 werr = smbconf_reg_open_service_key(tmp_ctx, ctx, service,
1065 if (!W_ERROR_IS_OK(werr)) {
1069 if (num_includes == 0) {
1070 if (!smbconf_value_exists(key, INCLUDES_VALNAME)) {
1073 werr = reg_deletevalue(key, INCLUDES_VALNAME);
1075 werr = smbconf_reg_set_multi_sz_value(key, INCLUDES_VALNAME,
1076 num_includes, includes);
1080 talloc_free(tmp_ctx);
1084 static WERROR smbconf_reg_delete_includes(struct smbconf_ctx *ctx,
1085 const char *service)
1087 WERROR werr = WERR_OK;
1088 struct registry_key *key = NULL;
1089 TALLOC_CTX *tmp_ctx = talloc_stackframe();
1091 werr = smbconf_reg_open_service_key(tmp_ctx, ctx, service,
1093 if (!W_ERROR_IS_OK(werr)) {
1097 if (!smbconf_value_exists(key, INCLUDES_VALNAME)) {
1101 werr = reg_deletevalue(key, INCLUDES_VALNAME);
1105 talloc_free(tmp_ctx);
1109 static WERROR smbconf_reg_transaction_start(struct smbconf_ctx *ctx)
1111 return regdb_transaction_start();
1114 static WERROR smbconf_reg_transaction_commit(struct smbconf_ctx *ctx)
1116 return regdb_transaction_commit();
1119 static WERROR smbconf_reg_transaction_cancel(struct smbconf_ctx *ctx)
1121 return regdb_transaction_cancel();
1124 struct smbconf_ops smbconf_ops_reg = {
1125 .init = smbconf_reg_init,
1126 .shutdown = smbconf_reg_shutdown,
1127 .requires_messaging = smbconf_reg_requires_messaging,
1128 .is_writeable = smbconf_reg_is_writeable,
1129 .open_conf = smbconf_reg_open,
1130 .close_conf = smbconf_reg_close,
1131 .get_csn = smbconf_reg_get_csn,
1132 .drop = smbconf_reg_drop,
1133 .get_share_names = smbconf_reg_get_share_names,
1134 .share_exists = smbconf_reg_share_exists,
1135 .create_share = smbconf_reg_create_share,
1136 .get_share = smbconf_reg_get_share,
1137 .delete_share = smbconf_reg_delete_share,
1138 .set_parameter = smbconf_reg_set_parameter,
1139 .get_parameter = smbconf_reg_get_parameter,
1140 .delete_parameter = smbconf_reg_delete_parameter,
1141 .get_includes = smbconf_reg_get_includes,
1142 .set_includes = smbconf_reg_set_includes,
1143 .delete_includes = smbconf_reg_delete_includes,
1144 .transaction_start = smbconf_reg_transaction_start,
1145 .transaction_commit = smbconf_reg_transaction_commit,
1146 .transaction_cancel = smbconf_reg_transaction_cancel,
1151 * initialize the smbconf registry backend
1152 * the only function that is exported from this module
1154 WERROR smbconf_init_reg(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx,
1157 return smbconf_init_internal(mem_ctx, conf_ctx, path, &smbconf_ops_reg);