2 Unix SMB/CIFS implementation.
4 Copyright (C) Jelmer Vernooij 2004.
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 2 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, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #include "lib/registry/common/registry.h"
25 * Saves the dn as private_data for every key/val
28 static BOOL ldb_open_registry(REG_HANDLE *handle, const char *location, BOOL try_full_load)
30 struct ldb_context *c;
31 c = ldb_connect(location, 0, NULL);
35 handle->backend_data = c;
40 static BOOL ldb_close_registry(REG_HANDLE *h)
46 static BOOL ldb_fetch_subkeys(REG_KEY *k, int *count, REG_KEY ***subkeys)
51 static REG_KEY *ldb_open_key(REG_HANDLE *h, const char *name)
53 struct ldb_context *c = h->backend_data;
55 struct ldb_message **msg;
58 if(ldb_search(c, NULL, LDP_SCOPE_BASE, "", NULL,&msg) > 0) {
59 key = reg_key_new_abs(name, h, base);
62 ldap_search_free(c, msg);
67 static REG_OPS reg_backend_ldb = {
69 .open_registry = ldb_open_registry,
70 .close_registry = ldb_close_registry,
71 .open_key = ldb_open_key,
72 .fetch_subkeys = ldb_fetch_subkeys,
75 NTSTATUS reg_ldb_init(void)
77 return register_backend("registry", ®_backend_ldb);