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 if (!push_reg_sz(talloc_tos(), &val.data, canon_valstr)) {
216 werr = reg_setvalue(key, canon_valname, &val);
217 if (!W_ERROR_IS_OK(werr)) {
218 DEBUG(5, ("Error adding value '%s' to "
220 canon_valname, key->key->name, win_errstr(werr)));
227 static WERROR smbconf_reg_set_multi_sz_value(struct registry_key *key,
229 const uint32_t num_strings,
230 const char **strings)
233 struct registry_value *value;
235 TALLOC_CTX *tmp_ctx = talloc_stackframe();
238 if (strings == NULL) {
239 werr = WERR_INVALID_PARAM;
243 array = talloc_zero_array(tmp_ctx, const char *, num_strings + 1);
249 value = TALLOC_ZERO_P(tmp_ctx, struct registry_value);
255 value->type = REG_MULTI_SZ;
257 for (count = 0; count < num_strings; count++) {
258 array[count] = talloc_strdup(value, strings[count]);
259 if (array[count] == NULL) {
265 if (!push_reg_multi_sz(value, &value->data, array)) {
270 werr = reg_setvalue(key, valname, value);
271 if (!W_ERROR_IS_OK(werr)) {
272 DEBUG(5, ("Error adding value '%s' to key '%s': %s\n",
273 valname, key->key->name, win_errstr(werr)));
277 talloc_free(tmp_ctx);
282 * format a registry_value into a string.
284 * This is intended to be used for smbconf registry values,
285 * which are ar stored as REG_SZ values, so the incomplete
286 * handling should be ok.
288 static char *smbconf_format_registry_value(TALLOC_CTX *mem_ctx,
289 struct registry_value *value)
293 /* alternatively, create a new talloc context? */
294 if (mem_ctx == NULL) {
298 switch (value->type) {
300 if (value->data.length >= 4) {
301 uint32_t v = IVAL(value->data.data, 0);
302 result = talloc_asprintf(mem_ctx, "%d", v);
306 case REG_EXPAND_SZ: {
308 if (!pull_reg_sz(mem_ctx, &value->data, &s)) {
311 result = talloc_strdup(mem_ctx, s);
316 const char **a = NULL;
317 if (!pull_reg_multi_sz(mem_ctx, &value->data, &a)) {
320 for (j = 0; a[j] != NULL; j++) {
321 result = talloc_asprintf(mem_ctx, "%s\"%s\" ",
322 result ? result : "" ,
324 if (result == NULL) {
331 result = talloc_asprintf(mem_ctx, "binary (%d bytes)",
332 (int)value->data.length);
335 result = talloc_asprintf(mem_ctx, "<unprintable>");
341 static WERROR smbconf_reg_get_includes_internal(TALLOC_CTX *mem_ctx,
342 struct registry_key *key,
343 uint32_t *num_includes,
348 struct registry_value *value = NULL;
349 char **tmp_includes = NULL;
350 const char **array = NULL;
351 TALLOC_CTX *tmp_ctx = talloc_stackframe();
353 if (!smbconf_value_exists(key, INCLUDES_VALNAME)) {
361 werr = reg_queryvalue(tmp_ctx, key, INCLUDES_VALNAME, &value);
362 if (!W_ERROR_IS_OK(werr)) {
366 if (value->type != REG_MULTI_SZ) {
367 /* wrong type -- ignore */
371 if (!pull_reg_multi_sz(tmp_ctx, &value->data, &array)) {
376 for (count = 0; array[count] != NULL; count++) {
377 werr = smbconf_add_string_to_array(tmp_ctx,
381 if (!W_ERROR_IS_OK(werr)) {
387 *includes = talloc_move(mem_ctx, &tmp_includes);
388 if (*includes == NULL) {
392 *num_includes = count;
399 talloc_free(tmp_ctx);
404 * Get the values of a key as a list of value names
405 * and a list of value strings (ordered)
407 static WERROR smbconf_reg_get_values(TALLOC_CTX *mem_ctx,
408 struct registry_key *key,
409 uint32_t *num_values,
411 char ***value_strings)
413 TALLOC_CTX *tmp_ctx = NULL;
414 WERROR werr = WERR_OK;
416 struct registry_value *valvalue = NULL;
417 char *valname = NULL;
418 uint32_t tmp_num_values = 0;
419 char **tmp_valnames = NULL;
420 char **tmp_valstrings = NULL;
421 uint32_t num_includes = 0;
422 char **includes = NULL;
424 if ((num_values == NULL) || (value_names == NULL) ||
425 (value_strings == NULL))
427 werr = WERR_INVALID_PARAM;
431 tmp_ctx = talloc_stackframe();
434 werr = reg_enumvalue(tmp_ctx, key, count, &valname, &valvalue),
440 if (!smbconf_reg_valname_valid(valname)) {
444 werr = smbconf_add_string_to_array(tmp_ctx,
446 tmp_num_values, valname);
447 if (!W_ERROR_IS_OK(werr)) {
451 valstring = smbconf_format_registry_value(tmp_ctx, valvalue);
452 werr = smbconf_add_string_to_array(tmp_ctx, &tmp_valstrings,
453 tmp_num_values, valstring);
454 if (!W_ERROR_IS_OK(werr)) {
459 if (!W_ERROR_EQUAL(WERR_NO_MORE_ITEMS, werr)) {
463 /* now add the includes at the end */
464 werr = smbconf_reg_get_includes_internal(tmp_ctx, key, &num_includes,
466 if (!W_ERROR_IS_OK(werr)) {
469 for (count = 0; count < num_includes; count++) {
470 werr = smbconf_add_string_to_array(tmp_ctx, &tmp_valnames,
471 tmp_num_values, "include");
472 if (!W_ERROR_IS_OK(werr)) {
476 werr = smbconf_add_string_to_array(tmp_ctx, &tmp_valstrings,
479 if (!W_ERROR_IS_OK(werr)) {
486 *num_values = tmp_num_values;
487 if (tmp_num_values > 0) {
488 *value_names = talloc_move(mem_ctx, &tmp_valnames);
489 *value_strings = talloc_move(mem_ctx, &tmp_valstrings);
492 *value_strings = NULL;
496 talloc_free(tmp_ctx);
500 static bool smbconf_reg_key_has_values(struct registry_key *key)
503 uint32_t num_subkeys;
504 uint32_t max_subkeylen;
505 uint32_t max_subkeysize;
507 uint32_t max_valnamelen;
508 uint32_t max_valbufsize;
509 uint32_t secdescsize;
510 NTTIME last_changed_time;
512 werr = reg_queryinfokey(key, &num_subkeys, &max_subkeylen,
513 &max_subkeysize, &num_values, &max_valnamelen,
514 &max_valbufsize, &secdescsize,
516 if (!W_ERROR_IS_OK(werr)) {
520 return (num_values != 0);
524 * delete all values from a key
526 static WERROR smbconf_reg_delete_values(struct registry_key *key)
530 struct registry_value *valvalue;
532 TALLOC_CTX *mem_ctx = talloc_stackframe();
535 werr = reg_enumvalue(mem_ctx, key, count, &valname, &valvalue),
539 werr = reg_deletevalue(key, valname);
540 if (!W_ERROR_IS_OK(werr)) {
544 if (!W_ERROR_EQUAL(WERR_NO_MORE_ITEMS, werr)) {
545 DEBUG(1, ("smbconf_reg_delete_values: "
546 "Error enumerating values of %s: %s\n",
555 talloc_free(mem_ctx);
559 /**********************************************************************
561 * smbconf operations: registry implementations
563 **********************************************************************/
566 * initialize the registry smbconf backend
568 static WERROR smbconf_reg_init(struct smbconf_ctx *ctx, const char *path)
570 WERROR werr = WERR_OK;
571 struct security_token *token;
576 ctx->path = talloc_strdup(ctx, path);
577 if (ctx->path == NULL) {
582 ctx->data = TALLOC_ZERO_P(ctx, struct reg_private_data);
584 werr = ntstatus_to_werror(registry_create_admin_token(ctx, &token));
585 if (!W_ERROR_IS_OK(werr)) {
586 DEBUG(1, ("Error creating admin token\n"));
589 rpd(ctx)->open = false;
591 werr = registry_init_smbconf(path);
592 if (!W_ERROR_IS_OK(werr)) {
596 werr = ctx->ops->open_conf(ctx);
597 if (!W_ERROR_IS_OK(werr)) {
598 DEBUG(1, ("Error opening the registry.\n"));
602 werr = reg_open_path(ctx, ctx->path,
603 KEY_ENUMERATE_SUB_KEYS | REG_KEY_WRITE,
604 token, &rpd(ctx)->base_key);
605 if (!W_ERROR_IS_OK(werr)) {
613 static int smbconf_reg_shutdown(struct smbconf_ctx *ctx)
615 return ctx->ops->close_conf(ctx);
618 static bool smbconf_reg_requires_messaging(struct smbconf_ctx *ctx)
620 #ifdef CLUSTER_SUPPORT
621 if (lp_clustering() && lp_parm_bool(-1, "ctdb", "registry.tdb", true)) {
628 static bool smbconf_reg_is_writeable(struct smbconf_ctx *ctx)
631 * The backend has write support.
633 * TODO: add access checks whether the concrete
634 * config source is really writeable by the calling user.
639 static WERROR smbconf_reg_open(struct smbconf_ctx *ctx)
643 if (rpd(ctx)->open) {
648 if (W_ERROR_IS_OK(werr)) {
649 rpd(ctx)->open = true;
654 static int smbconf_reg_close(struct smbconf_ctx *ctx)
658 if (!rpd(ctx)->open) {
664 rpd(ctx)->open = false;
670 * Get the change sequence number of the given service/parameter.
671 * service and parameter strings may be NULL.
673 static void smbconf_reg_get_csn(struct smbconf_ctx *ctx,
674 struct smbconf_csn *csn,
675 const char *service, const char *param)
681 if (!W_ERROR_IS_OK(ctx->ops->open_conf(ctx))) {
685 csn->csn = (uint64_t)regdb_get_seqnum();
689 * Drop the whole configuration (restarting empty) - registry version
691 static WERROR smbconf_reg_drop(struct smbconf_ctx *ctx)
694 WERROR werr = WERR_OK;
695 struct registry_key *parent_key = NULL;
696 struct registry_key *new_key = NULL;
697 TALLOC_CTX* mem_ctx = talloc_stackframe();
698 enum winreg_CreateAction action;
699 struct security_token *token;
701 werr = ntstatus_to_werror(registry_create_admin_token(ctx, &token));
702 if (!W_ERROR_IS_OK(werr)) {
703 DEBUG(1, ("Error creating admin token\n"));
707 path = talloc_strdup(mem_ctx, ctx->path);
712 p = strrchr(path, '\\');
714 werr = reg_open_path(mem_ctx, path, REG_KEY_WRITE, token,
717 if (!W_ERROR_IS_OK(werr)) {
721 werr = reg_deletekey_recursive(mem_ctx, parent_key, p+1);
723 if (!W_ERROR_IS_OK(werr)) {
727 werr = reg_createkey(mem_ctx, parent_key, p+1, REG_KEY_WRITE,
731 talloc_free(mem_ctx);
736 * get the list of share names defined in the configuration.
739 static WERROR smbconf_reg_get_share_names(struct smbconf_ctx *ctx,
741 uint32_t *num_shares,
745 uint32_t added_count = 0;
746 TALLOC_CTX *tmp_ctx = NULL;
747 WERROR werr = WERR_OK;
748 char *subkey_name = NULL;
749 char **tmp_share_names = NULL;
751 if ((num_shares == NULL) || (share_names == NULL)) {
752 werr = WERR_INVALID_PARAM;
756 tmp_ctx = talloc_stackframe();
758 /* if there are values in the base key, return NULL as share name */
760 if (smbconf_reg_key_has_values(rpd(ctx)->base_key)) {
761 werr = smbconf_add_string_to_array(tmp_ctx, &tmp_share_names,
763 if (!W_ERROR_IS_OK(werr)) {
769 /* make sure "global" is always listed first */
770 if (smbconf_share_exists(ctx, GLOBAL_NAME)) {
771 werr = smbconf_add_string_to_array(tmp_ctx, &tmp_share_names,
772 added_count, GLOBAL_NAME);
773 if (!W_ERROR_IS_OK(werr)) {
780 werr = reg_enumkey(tmp_ctx, rpd(ctx)->base_key, count,
785 if (strequal(subkey_name, GLOBAL_NAME)) {
789 werr = smbconf_add_string_to_array(tmp_ctx,
793 if (!W_ERROR_IS_OK(werr)) {
798 if (!W_ERROR_EQUAL(WERR_NO_MORE_ITEMS, werr)) {
803 *num_shares = added_count;
804 if (added_count > 0) {
805 *share_names = talloc_move(mem_ctx, &tmp_share_names);
811 talloc_free(tmp_ctx);
816 * check if a share/service of a given name exists - registry version
818 static bool smbconf_reg_share_exists(struct smbconf_ctx *ctx,
819 const char *servicename)
822 WERROR werr = WERR_OK;
823 TALLOC_CTX *mem_ctx = talloc_stackframe();
824 struct registry_key *key = NULL;
826 werr = smbconf_reg_open_service_key(mem_ctx, ctx, servicename,
828 if (W_ERROR_IS_OK(werr)) {
832 talloc_free(mem_ctx);
837 * Add a service if it does not already exist - registry version
839 static WERROR smbconf_reg_create_share(struct smbconf_ctx *ctx,
840 const char *servicename)
843 struct registry_key *key = NULL;
845 if (servicename == NULL) {
849 werr = smbconf_reg_create_service_key(talloc_tos(), ctx,
857 * get a definition of a share (service) from configuration.
859 static WERROR smbconf_reg_get_share(struct smbconf_ctx *ctx,
861 const char *servicename,
862 struct smbconf_service **service)
864 WERROR werr = WERR_OK;
865 struct registry_key *key = NULL;
866 struct smbconf_service *tmp_service = NULL;
867 TALLOC_CTX *tmp_ctx = talloc_stackframe();
869 werr = smbconf_reg_open_service_key(tmp_ctx, ctx, servicename,
871 if (!W_ERROR_IS_OK(werr)) {
875 tmp_service = TALLOC_ZERO_P(tmp_ctx, struct smbconf_service);
876 if (tmp_service == NULL) {
881 if (servicename != NULL) {
882 tmp_service->name = talloc_strdup(tmp_service, servicename);
883 if (tmp_service->name == NULL) {
889 werr = smbconf_reg_get_values(tmp_service, key,
890 &(tmp_service->num_params),
891 &(tmp_service->param_names),
892 &(tmp_service->param_values));
894 if (W_ERROR_IS_OK(werr)) {
895 *service = talloc_move(mem_ctx, &tmp_service);
899 talloc_free(tmp_ctx);
904 * delete a service from configuration
906 static WERROR smbconf_reg_delete_share(struct smbconf_ctx *ctx,
907 const char *servicename)
909 WERROR werr = WERR_OK;
910 TALLOC_CTX *mem_ctx = talloc_stackframe();
912 if (servicename != NULL) {
913 werr = reg_deletekey_recursive(mem_ctx, rpd(ctx)->base_key,
916 werr = smbconf_reg_delete_values(rpd(ctx)->base_key);
919 talloc_free(mem_ctx);
924 * set a configuration parameter to the value provided.
926 static WERROR smbconf_reg_set_parameter(struct smbconf_ctx *ctx,
932 struct registry_key *key = NULL;
933 TALLOC_CTX *mem_ctx = talloc_stackframe();
935 werr = smbconf_reg_open_service_key(mem_ctx, ctx, service,
936 REG_KEY_WRITE, &key);
937 if (!W_ERROR_IS_OK(werr)) {
941 werr = smbconf_reg_set_value(key, param, valstr);
944 talloc_free(mem_ctx);
949 * get the value of a configuration parameter as a string
951 static WERROR smbconf_reg_get_parameter(struct smbconf_ctx *ctx,
957 WERROR werr = WERR_OK;
958 struct registry_key *key = NULL;
959 struct registry_value *value = NULL;
961 werr = smbconf_reg_open_service_key(mem_ctx, ctx, service,
963 if (!W_ERROR_IS_OK(werr)) {
967 if (!smbconf_reg_valname_valid(param)) {
968 werr = WERR_INVALID_PARAM;
972 if (!smbconf_value_exists(key, param)) {
973 werr = WERR_INVALID_PARAM;
977 werr = reg_queryvalue(mem_ctx, key, param, &value);
978 if (!W_ERROR_IS_OK(werr)) {
982 *valstr = smbconf_format_registry_value(mem_ctx, value);
984 if (*valstr == NULL) {
995 * delete a parameter from configuration
997 static WERROR smbconf_reg_delete_parameter(struct smbconf_ctx *ctx,
1001 struct registry_key *key = NULL;
1002 WERROR werr = WERR_OK;
1003 TALLOC_CTX *mem_ctx = talloc_stackframe();
1005 werr = smbconf_reg_open_service_key(mem_ctx, ctx, service,
1007 if (!W_ERROR_IS_OK(werr)) {
1011 if (!smbconf_reg_valname_valid(param)) {
1012 werr = WERR_INVALID_PARAM;
1016 if (!smbconf_value_exists(key, param)) {
1017 werr = WERR_INVALID_PARAM;
1021 werr = reg_deletevalue(key, param);
1024 talloc_free(mem_ctx);
1028 static WERROR smbconf_reg_get_includes(struct smbconf_ctx *ctx,
1029 TALLOC_CTX *mem_ctx,
1030 const char *service,
1031 uint32_t *num_includes,
1035 struct registry_key *key = NULL;
1036 TALLOC_CTX *tmp_ctx = talloc_stackframe();
1038 werr = smbconf_reg_open_service_key(tmp_ctx, ctx, service,
1039 REG_KEY_READ, &key);
1040 if (!W_ERROR_IS_OK(werr)) {
1044 werr = smbconf_reg_get_includes_internal(mem_ctx, key, num_includes,
1048 talloc_free(tmp_ctx);
1052 static WERROR smbconf_reg_set_includes(struct smbconf_ctx *ctx,
1053 const char *service,
1054 uint32_t num_includes,
1055 const char **includes)
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 (num_includes == 0) {
1068 if (!smbconf_value_exists(key, INCLUDES_VALNAME)) {
1071 werr = reg_deletevalue(key, INCLUDES_VALNAME);
1073 werr = smbconf_reg_set_multi_sz_value(key, INCLUDES_VALNAME,
1074 num_includes, includes);
1078 talloc_free(tmp_ctx);
1082 static WERROR smbconf_reg_delete_includes(struct smbconf_ctx *ctx,
1083 const char *service)
1085 WERROR werr = WERR_OK;
1086 struct registry_key *key = NULL;
1087 TALLOC_CTX *tmp_ctx = talloc_stackframe();
1089 werr = smbconf_reg_open_service_key(tmp_ctx, ctx, service,
1091 if (!W_ERROR_IS_OK(werr)) {
1095 if (!smbconf_value_exists(key, INCLUDES_VALNAME)) {
1099 werr = reg_deletevalue(key, INCLUDES_VALNAME);
1103 talloc_free(tmp_ctx);
1107 static WERROR smbconf_reg_transaction_start(struct smbconf_ctx *ctx)
1109 return regdb_transaction_start();
1112 static WERROR smbconf_reg_transaction_commit(struct smbconf_ctx *ctx)
1114 return regdb_transaction_commit();
1117 static WERROR smbconf_reg_transaction_cancel(struct smbconf_ctx *ctx)
1119 return regdb_transaction_cancel();
1122 struct smbconf_ops smbconf_ops_reg = {
1123 .init = smbconf_reg_init,
1124 .shutdown = smbconf_reg_shutdown,
1125 .requires_messaging = smbconf_reg_requires_messaging,
1126 .is_writeable = smbconf_reg_is_writeable,
1127 .open_conf = smbconf_reg_open,
1128 .close_conf = smbconf_reg_close,
1129 .get_csn = smbconf_reg_get_csn,
1130 .drop = smbconf_reg_drop,
1131 .get_share_names = smbconf_reg_get_share_names,
1132 .share_exists = smbconf_reg_share_exists,
1133 .create_share = smbconf_reg_create_share,
1134 .get_share = smbconf_reg_get_share,
1135 .delete_share = smbconf_reg_delete_share,
1136 .set_parameter = smbconf_reg_set_parameter,
1137 .get_parameter = smbconf_reg_get_parameter,
1138 .delete_parameter = smbconf_reg_delete_parameter,
1139 .get_includes = smbconf_reg_get_includes,
1140 .set_includes = smbconf_reg_set_includes,
1141 .delete_includes = smbconf_reg_delete_includes,
1142 .transaction_start = smbconf_reg_transaction_start,
1143 .transaction_commit = smbconf_reg_transaction_commit,
1144 .transaction_cancel = smbconf_reg_transaction_cancel,
1149 * initialize the smbconf registry backend
1150 * the only function that is exported from this module
1152 WERROR smbconf_init_reg(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx,
1155 return smbconf_init_internal(mem_ctx, conf_ctx, path, &smbconf_ops_reg);