2 * Unix SMB/CIFS implementation.
3 * RPC Pipe client / server routines
4 * Copyright (C) Andrew Tridgell 1992-2006,
5 * Copyright (C) Jean François Micouleau 1998-2001.
6 * Copyright (C) Volker Lendecke 2006.
7 * Copyright (C) Gerald Carter 2006.
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 3 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, see <http://www.gnu.org/licenses/>.
24 #include "system/filesys.h"
26 #include "groupdb/mapping.h"
27 #include "dbwrap/dbwrap.h"
28 #include "dbwrap/dbwrap_open.h"
30 #include "../libcli/security/security.h"
31 #include "groupdb/mapping_tdb.h"
33 static struct db_context
*db
; /* used for driver files */
35 static bool enum_group_mapping(const struct dom_sid
*domsid
,
36 enum lsa_SidType sid_name_use
,
38 size_t *p_num_entries
,
40 static bool group_map_remove(const struct dom_sid
*sid
);
42 static bool mapping_switch(const char *ldb_path
);
44 /****************************************************************************
45 Open the group mapping tdb.
46 ****************************************************************************/
47 static bool init_group_mapping(void)
55 db
= db_open(NULL
, state_path("group_mapping.tdb"), 0,
56 TDB_DEFAULT
, O_RDWR
|O_CREAT
, 0600);
58 DEBUG(0, ("Failed to open group mapping database: %s\n",
63 ldb_path
= state_path("group_mapping.ldb");
64 if (file_exist(ldb_path
) && !mapping_switch(ldb_path
)) {
65 unlink(state_path("group_mapping.tdb"));
69 /* handle upgrade from old versions of the database */
70 #if 0 /* -- Needs conversion to dbwrap -- */
71 const char *vstring
= "INFO/version";
73 GROUP_MAP
*map_table
= NULL
;
74 size_t num_entries
= 0;
76 /* handle a Samba upgrade */
77 tdb_lock_bystring(tdb
, vstring
);
79 /* Cope with byte-reversed older versions of the db. */
80 vers_id
= tdb_fetch_int32(tdb
, vstring
);
81 if ((vers_id
== DATABASE_VERSION_V1
)
82 || (IREV(vers_id
) == DATABASE_VERSION_V1
)) {
84 * Written on a bigendian machine with old fetch_int
87 tdb_store_int32(tdb
, vstring
, DATABASE_VERSION_V2
);
88 vers_id
= DATABASE_VERSION_V2
;
91 /* if its an unknown version we remove everthing in the db */
93 if (vers_id
!= DATABASE_VERSION_V2
) {
95 tdb_store_int32(tdb
, vstring
, DATABASE_VERSION_V2
);
98 tdb_unlock_bystring(tdb
, vstring
);
100 /* cleanup any map entries with a gid == -1 */
102 if ( enum_group_mapping( NULL
, SID_NAME_UNKNOWN
, &map_table
,
103 &num_entries
, False
) ) {
106 for ( i
=0; i
<num_entries
; i
++ ) {
107 if ( map_table
[i
].gid
== -1 ) {
108 group_map_remove( &map_table
[i
].sid
);
112 SAFE_FREE( map_table
);
119 static char *group_mapping_key(TALLOC_CTX
*mem_ctx
, const struct dom_sid
*sid
)
121 char *sidstr
, *result
;
123 sidstr
= sid_string_talloc(talloc_tos(), sid
);
124 if (sidstr
== NULL
) {
128 result
= talloc_asprintf(mem_ctx
, "%s%s", GROUP_PREFIX
, sidstr
);
134 /****************************************************************************
135 ****************************************************************************/
136 static bool add_mapping_entry(GROUP_MAP
*map
, int flag
)
142 key
= group_mapping_key(talloc_tos(), &map
->sid
);
147 len
= tdb_pack(NULL
, 0, "ddff",
148 map
->gid
, map
->sid_name_use
, map
->nt_name
, map
->comment
);
150 buf
= talloc_array(key
, char, len
);
155 len
= tdb_pack((uint8
*)buf
, len
, "ddff", map
->gid
,
156 map
->sid_name_use
, map
->nt_name
, map
->comment
);
158 status
= dbwrap_trans_store(
159 db
, string_term_tdb_data(key
),
160 make_tdb_data((uint8_t *)buf
, len
), TDB_REPLACE
);
164 return NT_STATUS_IS_OK(status
);
168 /****************************************************************************
169 Return the sid and the type of the unix group.
170 ****************************************************************************/
172 static bool get_group_map_from_sid(struct dom_sid sid
, GROUP_MAP
*map
)
181 /* the key is the SID, retrieving is direct */
183 key
= group_mapping_key(talloc_tos(), &sid
);
188 status
= dbwrap_fetch_bystring(db
, key
, key
, &dbuf
);
189 if (!NT_STATUS_IS_OK(status
)) {
194 ret
= tdb_unpack(dbuf
.dptr
, dbuf
.dsize
, "ddff",
195 &map
->gid
, &map
->sid_name_use
,
201 DEBUG(3,("get_group_map_from_sid: tdb_unpack failure\n"));
205 sid_copy(&map
->sid
, &sid
);
207 map
->nt_name
= talloc_strdup(map
, nt_name
);
211 map
->comment
= talloc_strdup(map
, comment
);
219 static bool dbrec2map(const struct db_record
*rec
, GROUP_MAP
*map
)
221 TDB_DATA key
= dbwrap_record_get_key(rec
);
222 TDB_DATA value
= dbwrap_record_get_value(rec
);
227 if ((key
.dsize
< strlen(GROUP_PREFIX
))
228 || (strncmp((char *)key
.dptr
, GROUP_PREFIX
,
229 GROUP_PREFIX_LEN
) != 0)) {
233 if (!string_to_sid(&map
->sid
, (const char *)key
.dptr
234 + GROUP_PREFIX_LEN
)) {
238 ret
= tdb_unpack(value
.dptr
, value
.dsize
, "ddff",
239 &map
->gid
, &map
->sid_name_use
,
243 DEBUG(3, ("dbrec2map: tdb_unpack failure\n"));
247 map
->nt_name
= talloc_strdup(map
, nt_name
);
251 map
->comment
= talloc_strdup(map
, comment
);
259 struct find_map_state
{
261 const char *name
; /* If != NULL, look for name */
262 gid_t gid
; /* valid iff name == NULL */
266 static int find_map(struct db_record
*rec
, void *private_data
)
268 struct find_map_state
*state
= (struct find_map_state
*)private_data
;
270 if (!dbrec2map(rec
, state
->map
)) {
271 DEBUG(10, ("failed to unpack map\n"));
275 if (state
->name
!= NULL
) {
276 if (strequal(state
->name
, state
->map
->nt_name
)) {
282 if (state
->map
->gid
== state
->gid
) {
291 /****************************************************************************
292 Return the sid and the type of the unix group.
293 ****************************************************************************/
295 static bool get_group_map_from_gid(gid_t gid
, GROUP_MAP
*map
)
297 struct find_map_state state
;
300 state
.name
= NULL
; /* Indicate we're looking for gid */
304 dbwrap_traverse_read(db
, find_map
, (void *)&state
, NULL
);
309 /****************************************************************************
310 Return the sid and the type of the unix group.
311 ****************************************************************************/
313 static bool get_group_map_from_ntname(const char *name
, GROUP_MAP
*map
)
315 struct find_map_state state
;
321 dbwrap_traverse_read(db
, find_map
, (void *)&state
, NULL
);
326 /****************************************************************************
327 Remove a group mapping entry.
328 ****************************************************************************/
330 static bool group_map_remove(const struct dom_sid
*sid
)
335 key
= group_mapping_key(talloc_tos(), sid
);
340 status
= dbwrap_trans_delete(db
, string_term_tdb_data(key
));
343 return NT_STATUS_IS_OK(status
);
346 /****************************************************************************
347 Enumerate the group mapping.
348 ****************************************************************************/
350 struct enum_map_state
{
351 const struct dom_sid
*domsid
;
352 enum lsa_SidType sid_name_use
;
359 static int collect_map(struct db_record
*rec
, void *private_data
)
361 struct enum_map_state
*state
= (struct enum_map_state
*)private_data
;
365 map
= talloc_zero(NULL
, GROUP_MAP
);
367 DEBUG(0, ("Unable to allocate group map!\n"));
371 if (!dbrec2map(rec
, map
)) {
375 /* list only the type or everything if UNKNOWN */
376 if (state
->sid_name_use
!= SID_NAME_UNKNOWN
377 && state
->sid_name_use
!= map
->sid_name_use
) {
378 DEBUG(11,("enum_group_mapping: group %s is not of the "
379 "requested type\n", map
->nt_name
));
384 if ((state
->unix_only
== ENUM_ONLY_MAPPED
) && (map
->gid
== -1)) {
385 DEBUG(11,("enum_group_mapping: group %s is non mapped\n",
391 if ((state
->domsid
!= NULL
) &&
392 (dom_sid_compare_domain(state
->domsid
, &map
->sid
) != 0)) {
393 DEBUG(11,("enum_group_mapping: group %s is not in domain\n",
394 sid_string_dbg(&map
->sid
)));
399 tmp
= talloc_realloc(NULL
, state
->maps
, GROUP_MAP
*,
400 state
->num_maps
+ 1);
402 DEBUG(0,("enum_group_mapping: Unable to enlarge group "
409 state
->maps
[state
->num_maps
] = talloc_move(state
->maps
, &map
);
414 static bool enum_group_mapping(const struct dom_sid
*domsid
,
415 enum lsa_SidType sid_name_use
,
416 GROUP_MAP
***pp_rmap
,
417 size_t *p_num_entries
, bool unix_only
)
419 struct enum_map_state state
;
422 state
.domsid
= domsid
;
423 state
.sid_name_use
= sid_name_use
;
424 state
.unix_only
= unix_only
;
428 status
= dbwrap_traverse_read(db
, collect_map
, (void *)&state
, NULL
);
429 if (!NT_STATUS_IS_OK(status
)) {
430 TALLOC_FREE(state
.maps
);
434 *pp_rmap
= state
.maps
;
435 *p_num_entries
= state
.num_maps
;
440 /* This operation happens on session setup, so it should better be fast. We
441 * store a list of aliases a SID is member of hanging off MEMBEROF/SID. */
443 static NTSTATUS
one_alias_membership(const struct dom_sid
*member
,
444 struct dom_sid
**sids
, size_t *num
)
451 NTSTATUS status
= NT_STATUS_OK
;
452 TALLOC_CTX
*frame
= talloc_stackframe();
454 slprintf(key
, sizeof(key
), "%s%s", MEMBEROF_PREFIX
,
455 sid_to_fstring(tmp
, member
));
457 status
= dbwrap_fetch_bystring(db
, frame
, key
, &dbuf
);
458 if (!NT_STATUS_IS_OK(status
)) {
463 p
= (const char *)dbuf
.dptr
;
465 while (next_token_talloc(frame
, &p
, &string_sid
, " ")) {
466 struct dom_sid alias
;
469 if (!string_to_sid(&alias
, string_sid
))
473 status
= add_sid_to_array_unique(NULL
, &alias
, sids
, &num_sids
);
474 if (!NT_STATUS_IS_OK(status
)) {
485 static NTSTATUS
alias_memberships(const struct dom_sid
*members
, size_t num_members
,
486 struct dom_sid
**sids
, size_t *num
)
493 for (i
=0; i
<num_members
; i
++) {
494 NTSTATUS status
= one_alias_membership(&members
[i
], sids
, num
);
495 if (!NT_STATUS_IS_OK(status
))
501 static bool is_aliasmem(const struct dom_sid
*alias
, const struct dom_sid
*member
)
503 struct dom_sid
*sids
;
507 /* This feels the wrong way round, but the on-disk data structure
508 * dictates it this way. */
509 if (!NT_STATUS_IS_OK(alias_memberships(member
, 1, &sids
, &num
)))
512 for (i
=0; i
<num
; i
++) {
513 if (dom_sid_compare(alias
, &sids
[i
]) == 0) {
523 static NTSTATUS
add_aliasmem(const struct dom_sid
*alias
, const struct dom_sid
*member
)
528 char *new_memberstring
;
529 struct db_record
*rec
;
533 map
= talloc_zero(talloc_tos(), GROUP_MAP
);
535 return NT_STATUS_NO_MEMORY
;
538 if (!get_group_map_from_sid(*alias
, map
)) {
540 return NT_STATUS_NO_SUCH_ALIAS
;
543 if ((map
->sid_name_use
!= SID_NAME_ALIAS
) &&
544 (map
->sid_name_use
!= SID_NAME_WKN_GRP
)) {
546 return NT_STATUS_NO_SUCH_ALIAS
;
551 if (is_aliasmem(alias
, member
))
552 return NT_STATUS_MEMBER_IN_ALIAS
;
554 sid_to_fstring(string_sid
, member
);
556 key
= talloc_asprintf(talloc_tos(), "%s%s", MEMBEROF_PREFIX
,
559 return NT_STATUS_NO_MEMORY
;
562 if (dbwrap_transaction_start(db
) != 0) {
563 DEBUG(0, ("transaction_start failed\n"));
564 return NT_STATUS_INTERNAL_DB_CORRUPTION
;
567 rec
= dbwrap_fetch_locked(db
, key
, string_term_tdb_data(key
));
570 DEBUG(10, ("fetch_lock failed\n"));
572 status
= NT_STATUS_INTERNAL_DB_CORRUPTION
;
576 value
= dbwrap_record_get_value(rec
);
578 sid_to_fstring(string_sid
, alias
);
580 if (value
.dptr
!= NULL
) {
581 new_memberstring
= talloc_asprintf(
582 key
, "%s %s", (char *)(value
.dptr
), string_sid
);
584 new_memberstring
= talloc_strdup(key
, string_sid
);
587 if (new_memberstring
== NULL
) {
589 status
= NT_STATUS_NO_MEMORY
;
593 status
= dbwrap_record_store(rec
, string_term_tdb_data(new_memberstring
), 0);
597 if (!NT_STATUS_IS_OK(status
)) {
598 DEBUG(10, ("Could not store record: %s\n", nt_errstr(status
)));
602 if (dbwrap_transaction_commit(db
) != 0) {
603 DEBUG(0, ("transaction_commit failed\n"));
604 status
= NT_STATUS_INTERNAL_DB_CORRUPTION
;
611 if (dbwrap_transaction_cancel(db
) != 0) {
612 smb_panic("transaction_cancel failed");
618 struct aliasmem_state
{
620 const struct dom_sid
*alias
;
621 struct dom_sid
**sids
;
625 static int collect_aliasmem(struct db_record
*rec
, void *priv
)
627 struct aliasmem_state
*state
= (struct aliasmem_state
*)priv
;
631 TDB_DATA key
= dbwrap_record_get_key(rec
);
632 TDB_DATA value
= dbwrap_record_get_value(rec
);
634 if (strncmp((const char *)key
.dptr
, MEMBEROF_PREFIX
,
635 MEMBEROF_PREFIX_LEN
) != 0)
638 p
= (const char *)value
.dptr
;
640 frame
= talloc_stackframe();
642 while (next_token_talloc(frame
, &p
, &alias_string
, " ")) {
643 struct dom_sid alias
, member
;
644 const char *member_string
;
647 if (!string_to_sid(&alias
, alias_string
))
650 if (dom_sid_compare(state
->alias
, &alias
) != 0)
653 /* Ok, we found the alias we're looking for in the membership
654 * list currently scanned. The key represents the alias
655 * member. Add that. */
657 member_string
= strchr((const char *)key
.dptr
, '/');
659 /* Above we tested for MEMBEROF_PREFIX which includes the
662 SMB_ASSERT(member_string
!= NULL
);
665 if (!string_to_sid(&member
, member_string
))
668 num_sids
= *state
->num
;
669 if (!NT_STATUS_IS_OK(add_sid_to_array(state
->mem_ctx
, &member
,
676 *state
->num
= num_sids
;
683 static NTSTATUS
enum_aliasmem(const struct dom_sid
*alias
, TALLOC_CTX
*mem_ctx
,
684 struct dom_sid
**sids
, size_t *num
)
687 struct aliasmem_state state
;
689 map
= talloc_zero(talloc_tos(), GROUP_MAP
);
691 return NT_STATUS_NO_MEMORY
;
694 if (!get_group_map_from_sid(*alias
, map
)) {
696 return NT_STATUS_NO_SUCH_ALIAS
;
699 if ((map
->sid_name_use
!= SID_NAME_ALIAS
) &&
700 (map
->sid_name_use
!= SID_NAME_WKN_GRP
)) {
702 return NT_STATUS_NO_SUCH_ALIAS
;
713 state
.mem_ctx
= mem_ctx
;
715 dbwrap_traverse_read(db
, collect_aliasmem
, &state
, NULL
);
719 static NTSTATUS
del_aliasmem(const struct dom_sid
*alias
, const struct dom_sid
*member
)
722 struct dom_sid
*sids
;
729 if (dbwrap_transaction_start(db
) != 0) {
730 DEBUG(0, ("transaction_start failed\n"));
731 return NT_STATUS_INTERNAL_DB_CORRUPTION
;
734 status
= alias_memberships(member
, 1, &sids
, &num
);
736 if (!NT_STATUS_IS_OK(status
)) {
740 for (i
=0; i
<num
; i
++) {
741 if (dom_sid_compare(&sids
[i
], alias
) == 0) {
749 status
= NT_STATUS_MEMBER_NOT_IN_ALIAS
;
754 sids
[i
] = sids
[num
-1];
758 sid_to_fstring(sid_string
, member
);
760 key
= talloc_asprintf(sids
, "%s%s", MEMBEROF_PREFIX
, sid_string
);
763 status
= NT_STATUS_NO_MEMORY
;
768 status
= dbwrap_delete_bystring(db
, key
);
772 member_string
= talloc_strdup(sids
, "");
773 if (member_string
== NULL
) {
775 status
= NT_STATUS_NO_MEMORY
;
779 for (i
=0; i
<num
; i
++) {
781 sid_to_fstring(sid_string
, &sids
[i
]);
783 member_string
= talloc_asprintf_append_buffer(
784 member_string
, " %s", sid_string
);
786 if (member_string
== NULL
) {
788 status
= NT_STATUS_NO_MEMORY
;
793 status
= dbwrap_store_bystring(
794 db
, key
, string_term_tdb_data(member_string
), 0);
798 if (!NT_STATUS_IS_OK(status
)) {
799 DEBUG(10, ("dbwrap_store_bystring failed: %s\n",
804 if (dbwrap_transaction_commit(db
) != 0) {
805 DEBUG(0, ("transaction_commit failed\n"));
806 status
= NT_STATUS_INTERNAL_DB_CORRUPTION
;
813 if (dbwrap_transaction_cancel(db
) != 0) {
814 smb_panic("transaction_cancel failed");
820 /* -- ldb->tdb switching code -------------------------------------------- */
822 /* change this if the data format ever changes */
823 #define LTDB_PACKING_FORMAT 0x26011967
825 /* old packing formats (not supported for now,
826 * it was never used for group mapping AFAIK) */
827 #define LTDB_PACKING_FORMAT_NODN 0x26011966
829 static unsigned int pull_uint32(uint8_t *p
, int ofs
)
832 return p
[0] | (p
[1]<<8) | (p
[2]<<16) | (p
[3]<<24);
836 unpack a ldb message from a linear buffer in TDB_DATA
838 static int convert_ldb_record(TDB_CONTEXT
*ltdb
, TDB_DATA key
,
839 TDB_DATA data
, void *ptr
)
841 TALLOC_CTX
*tmp_ctx
= talloc_tos();
842 GROUP_MAP
*map
= NULL
;
846 unsigned int remaining
;
852 uint32_t num_mem
= 0;
853 struct dom_sid
*members
= NULL
;
855 p
= (uint8_t *)data
.dptr
;
856 if (data
.dsize
< 8) {
861 format
= pull_uint32(p
, 0);
862 num_el
= pull_uint32(p
, 4);
865 remaining
= data
.dsize
- 8;
868 case LTDB_PACKING_FORMAT
:
869 len
= strnlen((char *)p
, remaining
);
870 if (len
== remaining
) {
876 /* ignore special LDB attributes */
880 if (strncmp((char *)p
, "rid=", 4)) {
881 /* unknown entry, ignore */
882 DEBUG(3, ("Found unknown entry in group mapping "
883 "database named [%s]\n", (char *)p
));
887 remaining
-= len
+ 1;
891 case LTDB_PACKING_FORMAT_NODN
:
898 /* bad entry, ignore */
902 if (num_el
> remaining
/ 6) {
907 map
= talloc_zero(NULL
, GROUP_MAP
);
913 for (i
= 0; i
< num_el
; i
++) {
916 if (remaining
< 10) {
920 len
= strnlen((char *)p
, remaining
- 6);
921 if (len
== remaining
- 6) {
925 name
= talloc_strndup(tmp_ctx
, (char *)p
, len
);
930 remaining
-= len
+ 1;
933 num_vals
= pull_uint32(p
, 0);
934 if (strcasecmp_m(name
, "member") == 0) {
936 members
= talloc_array(tmp_ctx
, struct dom_sid
, num_mem
);
937 if (members
== NULL
) {
941 } else if (num_vals
!= 1) {
949 for (j
= 0; j
< num_vals
; j
++) {
950 len
= pull_uint32(p
, 0);
951 if (len
> remaining
-5) {
956 val
= talloc_strndup(tmp_ctx
, (char *)(p
+ 4), len
);
962 remaining
-= len
+4+1;
965 /* we ignore unknown or uninteresting attributes
966 * (objectclass, etc.) */
967 if (strcasecmp_m(name
, "gidNumber") == 0) {
968 map
->gid
= strtoul(val
, &q
, 10);
973 } else if (strcasecmp_m(name
, "sid") == 0) {
974 if (!string_to_sid(&map
->sid
, val
)) {
978 } else if (strcasecmp_m(name
, "sidNameUse") == 0) {
979 map
->sid_name_use
= strtoul(val
, &q
, 10);
984 } else if (strcasecmp_m(name
, "ntname") == 0) {
985 map
->nt_name
= talloc_strdup(map
, val
);
990 } else if (strcasecmp_m(name
, "comment") == 0) {
991 map
->comment
= talloc_strdup(map
, val
);
996 } else if (strcasecmp_m(name
, "member") == 0) {
997 if (!string_to_sid(&members
[j
], val
)) {
1009 if (!add_mapping_entry(map
, 0)) {
1015 for (j
= 0; j
< num_mem
; j
++) {
1017 status
= add_aliasmem(&map
->sid
, &members
[j
]);
1018 if (!NT_STATUS_IS_OK(status
)) {
1025 if (remaining
!= 0) {
1026 DEBUG(0, ("Errror: %d bytes unread in ltdb_unpack_data\n",
1038 static bool mapping_switch(const char *ldb_path
)
1045 frame
= talloc_stackframe();
1047 ltdb
= tdb_open_log(ldb_path
, 0, TDB_DEFAULT
, O_RDONLY
, 0600);
1048 if (ltdb
== NULL
) goto failed
;
1050 /* ldb is just a very fancy tdb, read out raw data and perform
1052 ret
= tdb_traverse(ltdb
, convert_ldb_record
, NULL
);
1053 if (ret
< 0) goto failed
;
1060 /* now rename the old db out of the way */
1061 new_path
= state_path("group_mapping.ldb.replaced");
1065 if (rename(ldb_path
, new_path
) != 0) {
1066 DEBUG(0,("Failed to rename old group mapping database\n"));
1073 DEBUG(0, ("Failed to switch to tdb group mapping database\n"));
1074 if (ltdb
) tdb_close(ltdb
);
1079 static const struct mapping_backend tdb_backend
= {
1080 .add_mapping_entry
= add_mapping_entry
,
1081 .get_group_map_from_sid
= get_group_map_from_sid
,
1082 .get_group_map_from_gid
= get_group_map_from_gid
,
1083 .get_group_map_from_ntname
= get_group_map_from_ntname
,
1084 .group_map_remove
= group_map_remove
,
1085 .enum_group_mapping
= enum_group_mapping
,
1086 .one_alias_membership
= one_alias_membership
,
1087 .add_aliasmem
= add_aliasmem
,
1088 .del_aliasmem
= del_aliasmem
,
1089 .enum_aliasmem
= enum_aliasmem
1093 initialise the tdb mapping backend
1095 const struct mapping_backend
*groupdb_tdb_init(void)
1097 if (!init_group_mapping()) {
1098 DEBUG(0,("Failed to initialise tdb mapping backend\n"));
1102 return &tdb_backend
;