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"
30 #include "../libcli/registry/util_reg.h"
32 #define INCLUDES_VALNAME "includes"
34 struct reg_private_data {
35 struct registry_key *base_key;
36 bool open; /* did _we_ open the registry? */
39 /**********************************************************************
43 **********************************************************************/
46 * a convenience helper to cast the private data structure
48 static struct reg_private_data *rpd(struct smbconf_ctx *ctx)
50 return (struct reg_private_data *)(ctx->data);
54 * check whether a given value name is forbidden in registry (smbconf)
56 static bool smbconf_reg_valname_forbidden(const char *valname)
58 /* hard code the list of forbidden names here for now */
59 const char *forbidden_valnames[] = {
64 "includes", /* this has a special meaning internally */
67 const char **forbidden = NULL;
69 for (forbidden = forbidden_valnames; *forbidden != NULL; forbidden++) {
70 if (strwicmp(valname, *forbidden) == 0) {
77 static bool smbconf_reg_valname_valid(const char *valname)
79 return (!smbconf_reg_valname_forbidden(valname) &&
80 lp_parameter_is_valid(valname));
84 * Open a subkey of the base key (i.e a service)
86 static WERROR smbconf_reg_open_service_key(TALLOC_CTX *mem_ctx,
87 struct smbconf_ctx *ctx,
88 const char *servicename,
89 uint32 desired_access,
90 struct registry_key **key)
94 if (servicename == NULL) {
95 *key = rpd(ctx)->base_key;
98 werr = reg_openkey(mem_ctx, rpd(ctx)->base_key, servicename,
101 if (W_ERROR_EQUAL(werr, WERR_BADFILE)) {
102 werr = WERR_NO_SUCH_SERVICE;
109 * check if a value exists in a given registry key
111 static bool smbconf_value_exists(struct registry_key *key, const char *param)
114 WERROR werr = WERR_OK;
115 TALLOC_CTX *ctx = talloc_stackframe();
116 struct registry_value *value = NULL;
118 werr = reg_queryvalue(ctx, key, param, &value);
119 if (W_ERROR_IS_OK(werr)) {
128 * create a subkey of the base key (i.e. a service...)
130 static WERROR smbconf_reg_create_service_key(TALLOC_CTX *mem_ctx,
131 struct smbconf_ctx *ctx,
132 const char * subkeyname,
133 struct registry_key **newkey)
135 WERROR werr = WERR_OK;
136 TALLOC_CTX *create_ctx;
137 enum winreg_CreateAction action = REG_ACTION_NONE;
139 /* create a new talloc ctx for creation. it will hold
140 * the intermediate parent key (SMBCONF) for creation
141 * and will be destroyed when leaving this function... */
142 create_ctx = talloc_stackframe();
144 werr = reg_createkey(mem_ctx, rpd(ctx)->base_key, subkeyname,
145 REG_KEY_WRITE, newkey, &action);
146 if (W_ERROR_IS_OK(werr) && (action != REG_CREATED_NEW_KEY)) {
147 DEBUG(10, ("Key '%s' already exists.\n", subkeyname));
148 werr = WERR_FILE_EXISTS;
150 if (!W_ERROR_IS_OK(werr)) {
151 DEBUG(5, ("Error creating key %s: %s\n",
152 subkeyname, win_errstr(werr)));
155 talloc_free(create_ctx);
160 * add a value to a key.
162 static WERROR smbconf_reg_set_value(struct registry_key *key,
166 struct registry_value val;
167 WERROR werr = WERR_OK;
169 const char *canon_valname;
170 const char *canon_valstr;
172 if (!lp_canonicalize_parameter_with_value(valname, valstr,
176 if (canon_valname == NULL) {
177 DEBUG(5, ("invalid parameter '%s' given\n",
180 DEBUG(5, ("invalid value '%s' given for "
181 "parameter '%s'\n", valstr, valname));
183 werr = WERR_INVALID_PARAM;
187 if (smbconf_reg_valname_forbidden(canon_valname)) {
188 DEBUG(5, ("Parameter '%s' not allowed in registry.\n",
190 werr = WERR_INVALID_PARAM;
194 subkeyname = strrchr_m(key->key->name, '\\');
195 if ((subkeyname == NULL) || (*(subkeyname +1) == '\0')) {
196 DEBUG(5, ("Invalid registry key '%s' given as "
197 "smbconf section.\n", key->key->name));
198 werr = WERR_INVALID_PARAM;
202 if (!strequal(subkeyname, GLOBAL_NAME) &&
203 lp_parameter_is_global(valname))
205 DEBUG(5, ("Global parameter '%s' not allowed in "
206 "service definition ('%s').\n", canon_valname,
208 werr = WERR_INVALID_PARAM;
215 if (!push_reg_sz(talloc_tos(), &val.data, canon_valstr)) {
220 werr = reg_setvalue(key, canon_valname, &val);
221 if (!W_ERROR_IS_OK(werr)) {
222 DEBUG(5, ("Error adding value '%s' to "
224 canon_valname, key->key->name, win_errstr(werr)));
231 static WERROR smbconf_reg_set_multi_sz_value(struct registry_key *key,
233 const uint32_t num_strings,
234 const char **strings)
237 struct registry_value *value;
239 TALLOC_CTX *tmp_ctx = talloc_stackframe();
242 if (strings == NULL) {
243 werr = WERR_INVALID_PARAM;
247 array = talloc_zero_array(tmp_ctx, const char *, num_strings + 1);
253 value = TALLOC_ZERO_P(tmp_ctx, struct registry_value);
259 value->type = REG_MULTI_SZ;
261 for (count = 0; count < num_strings; count++) {
262 array[count] = talloc_strdup(value, strings[count]);
263 if (array[count] == NULL) {
269 if (!push_reg_multi_sz(value, &value->data, array)) {
274 werr = reg_setvalue(key, valname, value);
275 if (!W_ERROR_IS_OK(werr)) {
276 DEBUG(5, ("Error adding value '%s' to key '%s': %s\n",
277 valname, key->key->name, win_errstr(werr)));
281 talloc_free(tmp_ctx);
286 * format a registry_value into a string.
288 * This is intended to be used for smbconf registry values,
289 * which are ar stored as REG_SZ values, so the incomplete
290 * handling should be ok.
292 static char *smbconf_format_registry_value(TALLOC_CTX *mem_ctx,
293 struct registry_value *value)
297 /* alternatively, create a new talloc context? */
298 if (mem_ctx == NULL) {
302 switch (value->type) {
304 if (value->data.length >= 4) {
305 uint32_t v = IVAL(value->data.data, 0);
306 result = talloc_asprintf(mem_ctx, "%d", v);
310 case REG_EXPAND_SZ: {
312 if (!pull_reg_sz(mem_ctx, &value->data, &s)) {
315 result = talloc_strdup(mem_ctx, s);
320 const char **a = NULL;
321 if (!pull_reg_multi_sz(mem_ctx, &value->data, &a)) {
324 for (j = 0; a[j] != NULL; j++) {
325 result = talloc_asprintf(mem_ctx, "%s\"%s\" ",
326 result ? result : "" ,
328 if (result == NULL) {
335 result = talloc_asprintf(mem_ctx, "binary (%d bytes)",
336 (int)value->data.length);
339 result = talloc_asprintf(mem_ctx, "<unprintable>");
345 static WERROR smbconf_reg_get_includes_internal(TALLOC_CTX *mem_ctx,
346 struct registry_key *key,
347 uint32_t *num_includes,
352 struct registry_value *value = NULL;
353 char **tmp_includes = NULL;
354 const char **array = NULL;
355 TALLOC_CTX *tmp_ctx = talloc_stackframe();
357 if (!smbconf_value_exists(key, INCLUDES_VALNAME)) {
365 werr = reg_queryvalue(tmp_ctx, key, INCLUDES_VALNAME, &value);
366 if (!W_ERROR_IS_OK(werr)) {
370 if (value->type != REG_MULTI_SZ) {
371 /* wrong type -- ignore */
375 if (!pull_reg_multi_sz(tmp_ctx, &value->data, &array)) {
380 for (count = 0; array[count] != NULL; count++) {
381 werr = smbconf_add_string_to_array(tmp_ctx,
385 if (!W_ERROR_IS_OK(werr)) {
391 *includes = talloc_move(mem_ctx, &tmp_includes);
392 if (*includes == NULL) {
396 *num_includes = count;
403 talloc_free(tmp_ctx);
408 * Get the values of a key as a list of value names
409 * and a list of value strings (ordered)
411 static WERROR smbconf_reg_get_values(TALLOC_CTX *mem_ctx,
412 struct registry_key *key,
413 uint32_t *num_values,
415 char ***value_strings)
417 TALLOC_CTX *tmp_ctx = NULL;
418 WERROR werr = WERR_OK;
420 struct registry_value *valvalue = NULL;
421 char *valname = NULL;
422 uint32_t tmp_num_values = 0;
423 char **tmp_valnames = NULL;
424 char **tmp_valstrings = NULL;
425 uint32_t num_includes = 0;
426 char **includes = NULL;
428 if ((num_values == NULL) || (value_names == NULL) ||
429 (value_strings == NULL))
431 werr = WERR_INVALID_PARAM;
435 tmp_ctx = talloc_stackframe();
438 werr = reg_enumvalue(tmp_ctx, key, count, &valname, &valvalue),
444 if (!smbconf_reg_valname_valid(valname)) {
448 werr = smbconf_add_string_to_array(tmp_ctx,
450 tmp_num_values, valname);
451 if (!W_ERROR_IS_OK(werr)) {
455 valstring = smbconf_format_registry_value(tmp_ctx, valvalue);
456 werr = smbconf_add_string_to_array(tmp_ctx, &tmp_valstrings,
457 tmp_num_values, valstring);
458 if (!W_ERROR_IS_OK(werr)) {
463 if (!W_ERROR_EQUAL(WERR_NO_MORE_ITEMS, werr)) {
467 /* now add the includes at the end */
468 werr = smbconf_reg_get_includes_internal(tmp_ctx, key, &num_includes,
470 if (!W_ERROR_IS_OK(werr)) {
473 for (count = 0; count < num_includes; count++) {
474 werr = smbconf_add_string_to_array(tmp_ctx, &tmp_valnames,
475 tmp_num_values, "include");
476 if (!W_ERROR_IS_OK(werr)) {
480 werr = smbconf_add_string_to_array(tmp_ctx, &tmp_valstrings,
483 if (!W_ERROR_IS_OK(werr)) {
490 *num_values = tmp_num_values;
491 if (tmp_num_values > 0) {
492 *value_names = talloc_move(mem_ctx, &tmp_valnames);
493 *value_strings = talloc_move(mem_ctx, &tmp_valstrings);
496 *value_strings = NULL;
500 talloc_free(tmp_ctx);
504 static bool smbconf_reg_key_has_values(struct registry_key *key)
507 uint32_t num_subkeys;
508 uint32_t max_subkeylen;
509 uint32_t max_subkeysize;
511 uint32_t max_valnamelen;
512 uint32_t max_valbufsize;
513 uint32_t secdescsize;
514 NTTIME last_changed_time;
516 werr = reg_queryinfokey(key, &num_subkeys, &max_subkeylen,
517 &max_subkeysize, &num_values, &max_valnamelen,
518 &max_valbufsize, &secdescsize,
520 if (!W_ERROR_IS_OK(werr)) {
524 return (num_values != 0);
528 * delete all values from a key
530 static WERROR smbconf_reg_delete_values(struct registry_key *key)
534 struct registry_value *valvalue;
536 TALLOC_CTX *mem_ctx = talloc_stackframe();
539 werr = reg_enumvalue(mem_ctx, key, count, &valname, &valvalue),
543 werr = reg_deletevalue(key, valname);
544 if (!W_ERROR_IS_OK(werr)) {
548 if (!W_ERROR_EQUAL(WERR_NO_MORE_ITEMS, werr)) {
549 DEBUG(1, ("smbconf_reg_delete_values: "
550 "Error enumerating values of %s: %s\n",
559 talloc_free(mem_ctx);
563 /**********************************************************************
565 * smbconf operations: registry implementations
567 **********************************************************************/
570 * initialize the registry smbconf backend
572 static WERROR smbconf_reg_init(struct smbconf_ctx *ctx, const char *path)
574 WERROR werr = WERR_OK;
575 struct security_token *token;
580 ctx->path = talloc_strdup(ctx, path);
581 if (ctx->path == NULL) {
586 ctx->data = TALLOC_ZERO_P(ctx, struct reg_private_data);
588 werr = ntstatus_to_werror(registry_create_admin_token(ctx, &token));
589 if (!W_ERROR_IS_OK(werr)) {
590 DEBUG(1, ("Error creating admin token\n"));
593 rpd(ctx)->open = false;
595 werr = registry_init_smbconf(path);
596 if (!W_ERROR_IS_OK(werr)) {
600 werr = ctx->ops->open_conf(ctx);
601 if (!W_ERROR_IS_OK(werr)) {
602 DEBUG(1, ("Error opening the registry.\n"));
606 werr = reg_open_path(ctx, ctx->path,
607 KEY_ENUMERATE_SUB_KEYS | REG_KEY_WRITE,
608 token, &rpd(ctx)->base_key);
609 if (!W_ERROR_IS_OK(werr)) {
617 static int smbconf_reg_shutdown(struct smbconf_ctx *ctx)
619 return ctx->ops->close_conf(ctx);
622 static bool smbconf_reg_requires_messaging(struct smbconf_ctx *ctx)
624 #ifdef CLUSTER_SUPPORT
625 if (lp_clustering() && lp_parm_bool(-1, "ctdb", "registry.tdb", true)) {
632 static bool smbconf_reg_is_writeable(struct smbconf_ctx *ctx)
635 * The backend has write support.
637 * TODO: add access checks whether the concrete
638 * config source is really writeable by the calling user.
643 static WERROR smbconf_reg_open(struct smbconf_ctx *ctx)
647 if (rpd(ctx)->open) {
652 if (W_ERROR_IS_OK(werr)) {
653 rpd(ctx)->open = true;
658 static int smbconf_reg_close(struct smbconf_ctx *ctx)
662 if (!rpd(ctx)->open) {
668 rpd(ctx)->open = false;
674 * Get the change sequence number of the given service/parameter.
675 * service and parameter strings may be NULL.
677 static void smbconf_reg_get_csn(struct smbconf_ctx *ctx,
678 struct smbconf_csn *csn,
679 const char *service, const char *param)
685 if (!W_ERROR_IS_OK(ctx->ops->open_conf(ctx))) {
689 csn->csn = (uint64_t)regdb_get_seqnum();
693 * Drop the whole configuration (restarting empty) - registry version
695 static WERROR smbconf_reg_drop(struct smbconf_ctx *ctx)
698 WERROR werr = WERR_OK;
699 struct registry_key *parent_key = NULL;
700 struct registry_key *new_key = NULL;
701 TALLOC_CTX* mem_ctx = talloc_stackframe();
702 enum winreg_CreateAction action;
703 struct security_token *token;
705 werr = ntstatus_to_werror(registry_create_admin_token(ctx, &token));
706 if (!W_ERROR_IS_OK(werr)) {
707 DEBUG(1, ("Error creating admin token\n"));
711 path = talloc_strdup(mem_ctx, ctx->path);
716 p = strrchr(path, '\\');
718 werr = reg_open_path(mem_ctx, path, REG_KEY_WRITE, token,
721 if (!W_ERROR_IS_OK(werr)) {
725 werr = reg_deletekey_recursive(parent_key, p+1);
727 if (!W_ERROR_IS_OK(werr)) {
731 werr = reg_createkey(mem_ctx, parent_key, p+1, REG_KEY_WRITE,
735 talloc_free(mem_ctx);
740 * get the list of share names defined in the configuration.
743 static WERROR smbconf_reg_get_share_names(struct smbconf_ctx *ctx,
745 uint32_t *num_shares,
749 uint32_t added_count = 0;
750 TALLOC_CTX *tmp_ctx = NULL;
751 WERROR werr = WERR_OK;
752 char *subkey_name = NULL;
753 char **tmp_share_names = NULL;
755 if ((num_shares == NULL) || (share_names == NULL)) {
756 werr = WERR_INVALID_PARAM;
760 tmp_ctx = talloc_stackframe();
762 /* if there are values in the base key, return NULL as share name */
764 if (smbconf_reg_key_has_values(rpd(ctx)->base_key)) {
765 werr = smbconf_add_string_to_array(tmp_ctx, &tmp_share_names,
767 if (!W_ERROR_IS_OK(werr)) {
773 /* make sure "global" is always listed first */
774 if (smbconf_share_exists(ctx, GLOBAL_NAME)) {
775 werr = smbconf_add_string_to_array(tmp_ctx, &tmp_share_names,
776 added_count, GLOBAL_NAME);
777 if (!W_ERROR_IS_OK(werr)) {
784 werr = reg_enumkey(tmp_ctx, rpd(ctx)->base_key, count,
789 if (strequal(subkey_name, GLOBAL_NAME)) {
793 werr = smbconf_add_string_to_array(tmp_ctx,
797 if (!W_ERROR_IS_OK(werr)) {
802 if (!W_ERROR_EQUAL(WERR_NO_MORE_ITEMS, werr)) {
807 *num_shares = added_count;
808 if (added_count > 0) {
809 *share_names = talloc_move(mem_ctx, &tmp_share_names);
815 talloc_free(tmp_ctx);
820 * check if a share/service of a given name exists - registry version
822 static bool smbconf_reg_share_exists(struct smbconf_ctx *ctx,
823 const char *servicename)
826 WERROR werr = WERR_OK;
827 TALLOC_CTX *mem_ctx = talloc_stackframe();
828 struct registry_key *key = NULL;
830 werr = smbconf_reg_open_service_key(mem_ctx, ctx, servicename,
832 if (W_ERROR_IS_OK(werr)) {
836 talloc_free(mem_ctx);
841 * Add a service if it does not already exist - registry version
843 static WERROR smbconf_reg_create_share(struct smbconf_ctx *ctx,
844 const char *servicename)
847 struct registry_key *key = NULL;
849 if (servicename == NULL) {
853 werr = smbconf_reg_create_service_key(talloc_tos(), ctx,
861 * get a definition of a share (service) from configuration.
863 static WERROR smbconf_reg_get_share(struct smbconf_ctx *ctx,
865 const char *servicename,
866 struct smbconf_service **service)
868 WERROR werr = WERR_OK;
869 struct registry_key *key = NULL;
870 struct smbconf_service *tmp_service = NULL;
871 TALLOC_CTX *tmp_ctx = talloc_stackframe();
873 werr = smbconf_reg_open_service_key(tmp_ctx, ctx, servicename,
875 if (!W_ERROR_IS_OK(werr)) {
879 tmp_service = TALLOC_ZERO_P(tmp_ctx, struct smbconf_service);
880 if (tmp_service == NULL) {
885 if (servicename != NULL) {
886 tmp_service->name = talloc_strdup(tmp_service, servicename);
887 if (tmp_service->name == NULL) {
893 werr = smbconf_reg_get_values(tmp_service, key,
894 &(tmp_service->num_params),
895 &(tmp_service->param_names),
896 &(tmp_service->param_values));
898 if (W_ERROR_IS_OK(werr)) {
899 *service = talloc_move(mem_ctx, &tmp_service);
903 talloc_free(tmp_ctx);
908 * delete a service from configuration
910 static WERROR smbconf_reg_delete_share(struct smbconf_ctx *ctx,
911 const char *servicename)
913 WERROR werr = WERR_OK;
914 TALLOC_CTX *mem_ctx = talloc_stackframe();
916 if (servicename != NULL) {
917 werr = reg_deletekey_recursive(rpd(ctx)->base_key, servicename);
919 werr = smbconf_reg_delete_values(rpd(ctx)->base_key);
922 talloc_free(mem_ctx);
927 * set a configuration parameter to the value provided.
929 static WERROR smbconf_reg_set_parameter(struct smbconf_ctx *ctx,
935 struct registry_key *key = NULL;
936 TALLOC_CTX *mem_ctx = talloc_stackframe();
938 werr = smbconf_reg_open_service_key(mem_ctx, ctx, service,
939 REG_KEY_WRITE, &key);
940 if (!W_ERROR_IS_OK(werr)) {
944 werr = smbconf_reg_set_value(key, param, valstr);
947 talloc_free(mem_ctx);
952 * get the value of a configuration parameter as a string
954 static WERROR smbconf_reg_get_parameter(struct smbconf_ctx *ctx,
960 WERROR werr = WERR_OK;
961 struct registry_key *key = NULL;
962 struct registry_value *value = NULL;
964 werr = smbconf_reg_open_service_key(mem_ctx, ctx, service,
966 if (!W_ERROR_IS_OK(werr)) {
970 if (!smbconf_reg_valname_valid(param)) {
971 werr = WERR_INVALID_PARAM;
975 if (!smbconf_value_exists(key, param)) {
976 werr = WERR_INVALID_PARAM;
980 werr = reg_queryvalue(mem_ctx, key, param, &value);
981 if (!W_ERROR_IS_OK(werr)) {
985 *valstr = smbconf_format_registry_value(mem_ctx, value);
987 if (*valstr == NULL) {
998 * delete a parameter from configuration
1000 static WERROR smbconf_reg_delete_parameter(struct smbconf_ctx *ctx,
1001 const char *service,
1004 struct registry_key *key = NULL;
1005 WERROR werr = WERR_OK;
1006 TALLOC_CTX *mem_ctx = talloc_stackframe();
1008 werr = smbconf_reg_open_service_key(mem_ctx, ctx, service,
1010 if (!W_ERROR_IS_OK(werr)) {
1014 if (!smbconf_reg_valname_valid(param)) {
1015 werr = WERR_INVALID_PARAM;
1019 if (!smbconf_value_exists(key, param)) {
1020 werr = WERR_INVALID_PARAM;
1024 werr = reg_deletevalue(key, param);
1027 talloc_free(mem_ctx);
1031 static WERROR smbconf_reg_get_includes(struct smbconf_ctx *ctx,
1032 TALLOC_CTX *mem_ctx,
1033 const char *service,
1034 uint32_t *num_includes,
1038 struct registry_key *key = NULL;
1039 TALLOC_CTX *tmp_ctx = talloc_stackframe();
1041 werr = smbconf_reg_open_service_key(tmp_ctx, ctx, service,
1042 REG_KEY_READ, &key);
1043 if (!W_ERROR_IS_OK(werr)) {
1047 werr = smbconf_reg_get_includes_internal(mem_ctx, key, num_includes,
1051 talloc_free(tmp_ctx);
1055 static WERROR smbconf_reg_set_includes(struct smbconf_ctx *ctx,
1056 const char *service,
1057 uint32_t num_includes,
1058 const char **includes)
1060 WERROR werr = WERR_OK;
1061 struct registry_key *key = NULL;
1062 TALLOC_CTX *tmp_ctx = talloc_stackframe();
1064 werr = smbconf_reg_open_service_key(tmp_ctx, ctx, service,
1066 if (!W_ERROR_IS_OK(werr)) {
1070 if (num_includes == 0) {
1071 if (!smbconf_value_exists(key, INCLUDES_VALNAME)) {
1074 werr = reg_deletevalue(key, INCLUDES_VALNAME);
1076 werr = smbconf_reg_set_multi_sz_value(key, INCLUDES_VALNAME,
1077 num_includes, includes);
1081 talloc_free(tmp_ctx);
1085 static WERROR smbconf_reg_delete_includes(struct smbconf_ctx *ctx,
1086 const char *service)
1088 WERROR werr = WERR_OK;
1089 struct registry_key *key = NULL;
1090 TALLOC_CTX *tmp_ctx = talloc_stackframe();
1092 werr = smbconf_reg_open_service_key(tmp_ctx, ctx, service,
1094 if (!W_ERROR_IS_OK(werr)) {
1098 if (!smbconf_value_exists(key, INCLUDES_VALNAME)) {
1102 werr = reg_deletevalue(key, INCLUDES_VALNAME);
1106 talloc_free(tmp_ctx);
1110 static WERROR smbconf_reg_transaction_start(struct smbconf_ctx *ctx)
1112 return regdb_transaction_start();
1115 static WERROR smbconf_reg_transaction_commit(struct smbconf_ctx *ctx)
1117 return regdb_transaction_commit();
1120 static WERROR smbconf_reg_transaction_cancel(struct smbconf_ctx *ctx)
1122 return regdb_transaction_cancel();
1125 struct smbconf_ops smbconf_ops_reg = {
1126 .init = smbconf_reg_init,
1127 .shutdown = smbconf_reg_shutdown,
1128 .requires_messaging = smbconf_reg_requires_messaging,
1129 .is_writeable = smbconf_reg_is_writeable,
1130 .open_conf = smbconf_reg_open,
1131 .close_conf = smbconf_reg_close,
1132 .get_csn = smbconf_reg_get_csn,
1133 .drop = smbconf_reg_drop,
1134 .get_share_names = smbconf_reg_get_share_names,
1135 .share_exists = smbconf_reg_share_exists,
1136 .create_share = smbconf_reg_create_share,
1137 .get_share = smbconf_reg_get_share,
1138 .delete_share = smbconf_reg_delete_share,
1139 .set_parameter = smbconf_reg_set_parameter,
1140 .get_parameter = smbconf_reg_get_parameter,
1141 .delete_parameter = smbconf_reg_delete_parameter,
1142 .get_includes = smbconf_reg_get_includes,
1143 .set_includes = smbconf_reg_set_includes,
1144 .delete_includes = smbconf_reg_delete_includes,
1145 .transaction_start = smbconf_reg_transaction_start,
1146 .transaction_commit = smbconf_reg_transaction_commit,
1147 .transaction_cancel = smbconf_reg_transaction_cancel,
1152 * initialize the smbconf registry backend
1153 * the only function that is exported from this module
1155 WERROR smbconf_init_reg(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx,
1158 return smbconf_init_internal(mem_ctx, conf_ctx, path, &smbconf_ops_reg);