Rev 5333: Change behind the scenes: globals are now stored in a
subkey in http://samba.sernet.de/ma/bzr/SAMBA_3_0-registry.bzr/
Michael Adam
ma at sernet.de
Wed Apr 4 23:00:52 GMT 2007
At http://samba.sernet.de/ma/bzr/SAMBA_3_0-registry.bzr/
------------------------------------------------------------
revno: 5333
revision-id: ma at sernet.de-20070404230049-c0a9bc8f2a01865a
parent: ma at sernet.de-20070404210735-a7ec9596051e209d
committer: Michael Adam <ma at sernet.de>
branch nick: SAMBA_3_0-registry.bzr
timestamp: Thu 2007-04-05 01:00:49 +0200
message:
Change behind the scenes: globals are now stored in a subkey
named "global" of KEY_SMBCONF instead of as values directly
under KEY_SMBCONF. This makes many things easier and more
consistent.
modified:
source/utils/net_conf.c net_conf.c-20070228210606-uywdn1acd043wgvt-1
=== modified file 'source/utils/net_conf.c'
--- a/source/utils/net_conf.c 2007-04-04 06:08:51 +0000
+++ b/source/utils/net_conf.c 2007-04-04 23:00:49 +0000
@@ -199,7 +199,7 @@
WERROR werr = WERR_OK;
char *path = NULL;
- if ((subkeyname == NULL) || (strequal(subkeyname, GLOBAL_NAME))) {
+ if (subkeyname == NULL) {
path = talloc_strdup(ctx, KEY_SMBCONF);
}
else {
@@ -333,43 +333,6 @@
return ret;
}
-static WERROR delete_globals(TALLOC_CTX *ctx)
-{
- WERROR werr = WERR_OK;
- struct registry_key *key;
- uint32 idx = 0;
- struct registry_value *valvalue = NULL;
- char *valname = NULL;
-
- werr = smbconf_open_basepath(ctx, REG_KEY_WRITE, &key);
- if (!W_ERROR_IS_OK(werr)) {
- goto done;
- }
-
- for (idx = 0;
- W_ERROR_IS_OK(werr = reg_enumvalue(ctx, key, idx, &valname,
- &valvalue));
- idx++)
- {
- DEBUG(3, ("deleting global parameter %s", valname));
- werr = reg_deletevalue(key, valname);
- if (!W_ERROR_IS_OK(werr)) {
- d_fprintf(stderr, "Error deleting value '%s': %s.\n",
- valname, dos_errstr(werr));
- goto done;
- }
- }
- if (!W_ERROR_EQUAL(WERR_NO_MORE_ITEMS, werr)) {
- d_fprintf(stderr, "Error enumerating values: %s\n",
- dos_errstr(werr));
- goto done;
- }
- werr = WERR_OK;
-
-done:
- return werr;
-}
-
static WERROR list_values(TALLOC_CTX *ctx, struct registry_key *key)
{
WERROR werr = WERR_OK;
@@ -414,30 +377,15 @@
d_printf("[%s]\n", servicename);
}
else {
- if (share->service == GLOBAL_SECTION_SNUM) {
- werr = delete_globals(ctx);
- if (!W_ERROR_IS_OK(werr)) {
- d_fprintf(stderr,
- "Error deleting globals: %s\n",
- dos_errstr(werr));
- goto done;
- }
- werr = smbconf_open_basepath(ctx, REG_KEY_WRITE, &key);
+ if (smbconf_key_exists(ctx, servicename)) {
+ werr = reg_delkey_internal(ctx, servicename);
if (!W_ERROR_IS_OK(werr)) {
goto done;
}
}
- else {
- if (smbconf_key_exists(ctx, servicename)) {
- werr = reg_delkey_internal(ctx, servicename);
- if (!W_ERROR_IS_OK(werr)) {
- goto done;
- }
- }
- werr = reg_createkey_internal(ctx, servicename, &key);
- if (!W_ERROR_IS_OK(werr)) {
- goto done;
- }
+ werr = reg_createkey_internal(ctx, servicename, &key);
+ if (!W_ERROR_IS_OK(werr)) {
+ goto done;
}
}
@@ -573,18 +521,29 @@
goto done;
}
- d_printf("\n[global]\n");
- if (!W_ERROR_IS_OK(list_values(ctx, base_key))) {
- goto done;
+ if (smbconf_key_exists(ctx, GLOBAL_NAME)) {
+ werr = reg_openkey(ctx, base_key, GLOBAL_NAME,
+ REG_KEY_READ, &sub_key);
+ if (!W_ERROR_IS_OK(werr)) {
+ d_fprintf(stderr, "Error opening subkey '%s' : %s\n",
+ subkey_name, dos_errstr(werr));
+ goto done;
+ }
+ d_printf("[%s]\n", GLOBAL_NAME);
+ if (!W_ERROR_IS_OK(list_values(ctx, sub_key))) {
+ goto done;
+ }
+ d_printf("\n");
}
-
- d_printf("\n");
for (idx_key = 0;
W_ERROR_IS_OK(werr = reg_enumkey(ctx, base_key, idx_key,
&subkey_name, NULL));
idx_key++)
{
+ if (strequal(subkey_name, GLOBAL_NAME)) {
+ continue;
+ }
d_printf("[%s]\n", subkey_name);
werr = reg_openkey(ctx, base_key, subkey_name,
More information about the samba-cvs
mailing list