samba-cvs.cvs
[Top] [All Lists]

svn commit: samba r23443 - in branches/SAMBA_3_0_26/source/smbd: .

Subject: svn commit: samba r23443 - in branches/SAMBA_3_0_26/source/smbd: .
From:
Date: Tue, 12 Jun 2007 16:18:19 +0000 GMT
Author: obnox
Date: 2007-06-12 16:18:19 +0000 (Tue, 12 Jun 2007)
New Revision: 23443

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=23443

Log:
Merge r20006 from 3_0:

Convert the registry shares to use the new API (reg_api.c)

Michael


Modified:
   branches/SAMBA_3_0_26/source/smbd/service.c


Changeset:
Modified: branches/SAMBA_3_0_26/source/smbd/service.c
===================================================================
--- branches/SAMBA_3_0_26/source/smbd/service.c 2007-06-12 16:17:25 UTC (rev 
23442)
+++ branches/SAMBA_3_0_26/source/smbd/service.c 2007-06-12 16:18:19 UTC (rev 
23443)
@@ -256,15 +256,15 @@
 
 static int load_registry_service(const char *servicename)
 {
-       REGISTRY_KEY *key;
+       struct registry_key *key;
        char *path;
        WERROR err;
 
-       uint32 i, num_values;
-       char **value_names;
-       struct registry_value **values = NULL;
+       uint32 i;
+       char *value_name;
+       struct registry_value *value;
 
-       int res;
+       int res = -1;
 
        if (!lp_registry_shares()) {
                return -1;
@@ -274,73 +274,56 @@
                return -1;
        }
 
-       err = regkey_open_internal(NULL, &key, path, get_root_nt_token(),
-                                  REG_KEY_READ);
+       err = reg_open_path(NULL, path, REG_KEY_READ, get_root_nt_token(),
+                           &key);
        SAFE_FREE(path);
 
        if (!W_ERROR_IS_OK(err)) {
                return -1;
        }
 
-       err = registry_fetch_values(NULL, key, &num_values, &value_names,
-                                   &values);
-
-       TALLOC_FREE(key);
-
-       if (!W_ERROR_IS_OK(err)) {
-               goto error;
-       }
-
        res = lp_add_service(servicename, -1);
        if (res == -1) {
                goto error;
        }
 
-       for (i=0; i<num_values; i++) {
-               switch (values[i]->type) {
+       for (i=0;
+            W_ERROR_IS_OK(reg_enumvalue(key, key, i, &value_name, &value));
+            i++) {
+               switch (value->type) {
                case REG_DWORD: { 
-                       char *val;
-                       if (asprintf(&val, "%d", values[i]->v.dword) == -1) {
+                       char *tmp;
+                       if (asprintf(&tmp, "%d", value->v.dword) == -1) {
                                continue;
                        }
-                       lp_do_parameter(res, value_names[i], val);
-                       SAFE_FREE(val);
+                       lp_do_parameter(res, value_name, tmp);
+                       SAFE_FREE(tmp);
                        break;
                }
                case REG_SZ: {
-                       lp_do_parameter(res, value_names[i],
-                                       values[i]->v.sz.str);
+                       lp_do_parameter(res, value_name, value->v.sz.str);
                        break;
                }
                default:
                        /* Ignore all the rest */
                        break;
                }
-       }
 
-       TALLOC_FREE(value_names);
-       TALLOC_FREE(values);
-       return res;
-
-       if (!service_ok(res)) {
-               /* this is actually never reached, since 
-                * service_ok only returns False if the service
-                * entry does not have a service name, and we _know_
-                * we do have a service name here... */
-               res = -1;
+               TALLOC_FREE(value_name);
+               TALLOC_FREE(value);
        }
 
+       res = 0;
  error:
 
-       TALLOC_FREE(value_names);
-       TALLOC_FREE(values);
-       return -1;
+       TALLOC_FREE(key);
+       return res;
 }
 
 void load_registry_shares(void)
 {
-       REGISTRY_KEY *key;
-       REGSUBKEY_CTR *keys;
+       struct registry_key *key;
+       char *name;
        WERROR err;
        int i;
 
@@ -348,26 +331,18 @@
                return;
        }
 
-       if (!(keys = TALLOC_ZERO_P(NULL, REGSUBKEY_CTR))) {
-               goto done;
-       }
-
-       err = regkey_open_internal(keys, &key, KEY_SMBCONF,
-                                  get_root_nt_token(), REG_KEY_READ);
+       err = reg_open_path(NULL, KEY_SMBCONF, REG_KEY_READ,
+                           get_root_nt_token(), &key);
        if (!(W_ERROR_IS_OK(err))) {
-               goto done;
+               return;
        }
 
-       if (fetch_reg_keys(key, keys) == -1) {
-               goto done;
+       for (i=0; W_ERROR_IS_OK(reg_enumkey(key, key, i, &name, NULL)); i++) {
+               load_registry_service(name);
+               TALLOC_FREE(name);
        }
 
-       for (i=0; i<keys->num_subkeys; i++) {
-               load_registry_service(keys->subkeys[i]);
-       }
-
- done:
-       TALLOC_FREE(keys);
+       TALLOC_FREE(key);
        return;
 }
 

<Prev in Thread] Current Thread [Next in Thread>
  • svn commit: samba r23443 - in branches/SAMBA_3_0_26/source/smbd: ., obnox <=