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"
32 #include "lib/util/smb_strtox.h"
34 static struct db_context
*db
; /* used for driver files */
36 static bool enum_group_mapping(const struct dom_sid
*domsid
,
37 enum lsa_SidType sid_name_use
,
39 size_t *p_num_entries
,
41 static bool group_map_remove(const struct dom_sid
*sid
);
43 static bool mapping_switch(const char *ldb_path
);
45 /****************************************************************************
46 Open the group mapping tdb.
47 ****************************************************************************/
48 static bool init_group_mapping(void)
57 tdb_path
= state_path(talloc_tos(), "group_mapping.tdb");
58 if (tdb_path
== NULL
) {
61 db
= db_open(NULL
, tdb_path
, 0,
62 TDB_DEFAULT
, O_RDWR
|O_CREAT
, 0600,
63 DBWRAP_LOCK_ORDER_1
, DBWRAP_FLAG_NONE
);
65 DEBUG(0, ("Failed to open group mapping database: %s\n",
67 talloc_free(tdb_path
);
71 ldb_path
= state_path(talloc_tos(), "group_mapping.ldb");
72 if (ldb_path
== NULL
) {
73 talloc_free(tdb_path
);
76 if (file_exist(ldb_path
) && !mapping_switch(ldb_path
)) {
78 talloc_free(tdb_path
);
79 talloc_free(ldb_path
);
83 /* handle upgrade from old versions of the database */
84 #if 0 /* -- Needs conversion to dbwrap -- */
85 const char *vstring
= "INFO/version";
87 GROUP_MAP
*map_table
= NULL
;
88 size_t num_entries
= 0;
90 /* handle a Samba upgrade */
91 tdb_lock_bystring(tdb
, vstring
);
93 /* Cope with byte-reversed older versions of the db. */
94 vers_id
= tdb_fetch_int32(tdb
, vstring
);
95 if ((vers_id
== DATABASE_VERSION_V1
)
96 || (IREV(vers_id
) == DATABASE_VERSION_V1
)) {
98 * Written on a bigendian machine with old fetch_int
101 tdb_store_int32(tdb
, vstring
, DATABASE_VERSION_V2
);
102 vers_id
= DATABASE_VERSION_V2
;
105 /* if its an unknown version we remove everything in the db */
107 if (vers_id
!= DATABASE_VERSION_V2
) {
109 tdb_store_int32(tdb
, vstring
, DATABASE_VERSION_V2
);
112 tdb_unlock_bystring(tdb
, vstring
);
114 /* cleanup any map entries with a gid == -1 */
116 if ( enum_group_mapping( NULL
, SID_NAME_UNKNOWN
, &map_table
,
117 &num_entries
, False
) ) {
120 for ( i
=0; i
<num_entries
; i
++ ) {
121 if ( map_table
[i
].gid
== -1 ) {
122 group_map_remove( &map_table
[i
].sid
);
126 SAFE_FREE( map_table
);
130 talloc_free(tdb_path
);
131 talloc_free(ldb_path
);
135 static char *group_mapping_key(TALLOC_CTX
*mem_ctx
, const struct dom_sid
*sid
)
137 struct dom_sid_buf sidstr
;
139 return talloc_asprintf(
140 mem_ctx
, "%s%s", GROUP_PREFIX
, dom_sid_str_buf(sid
, &sidstr
));
143 /****************************************************************************
144 ****************************************************************************/
145 static bool add_mapping_entry(GROUP_MAP
*map
, int flag
)
151 key
= group_mapping_key(talloc_tos(), &map
->sid
);
156 len
= tdb_pack(NULL
, 0, "ddff",
157 map
->gid
, map
->sid_name_use
, map
->nt_name
, map
->comment
);
159 buf
= talloc_array(key
, char, len
);
164 len
= tdb_pack((uint8_t *)buf
, len
, "ddff", map
->gid
,
165 map
->sid_name_use
, map
->nt_name
, map
->comment
);
167 status
= dbwrap_trans_store(
168 db
, string_term_tdb_data(key
),
169 make_tdb_data((uint8_t *)buf
, len
), TDB_REPLACE
);
173 return NT_STATUS_IS_OK(status
);
177 /****************************************************************************
178 Return the sid and the type of the unix group.
179 ****************************************************************************/
181 static bool get_group_map_from_sid(struct dom_sid sid
, GROUP_MAP
*map
)
190 /* the key is the SID, retrieving is direct */
192 key
= group_mapping_key(talloc_tos(), &sid
);
197 status
= dbwrap_fetch_bystring(db
, key
, key
, &dbuf
);
198 if (!NT_STATUS_IS_OK(status
)) {
203 ret
= tdb_unpack(dbuf
.dptr
, dbuf
.dsize
, "ddff",
204 &map
->gid
, &map
->sid_name_use
,
210 DEBUG(3,("get_group_map_from_sid: tdb_unpack failure\n"));
214 sid_copy(&map
->sid
, &sid
);
216 map
->nt_name
= talloc_strdup(map
, nt_name
);
220 map
->comment
= talloc_strdup(map
, comment
);
228 static bool dbrec2map(const struct db_record
*rec
, GROUP_MAP
*map
)
230 TDB_DATA key
= dbwrap_record_get_key(rec
);
231 TDB_DATA value
= dbwrap_record_get_value(rec
);
236 if ((key
.dsize
< strlen(GROUP_PREFIX
))
237 || (strncmp((char *)key
.dptr
, GROUP_PREFIX
,
238 GROUP_PREFIX_LEN
) != 0)) {
242 if (!string_to_sid(&map
->sid
, (const char *)key
.dptr
243 + GROUP_PREFIX_LEN
)) {
247 ret
= tdb_unpack(value
.dptr
, value
.dsize
, "ddff",
248 &map
->gid
, &map
->sid_name_use
,
252 DEBUG(3, ("dbrec2map: tdb_unpack failure\n"));
256 map
->nt_name
= talloc_strdup(map
, nt_name
);
260 map
->comment
= talloc_strdup(map
, comment
);
268 struct find_map_state
{
270 const char *name
; /* If != NULL, look for name */
271 gid_t gid
; /* valid iff name == NULL */
275 static int find_map(struct db_record
*rec
, void *private_data
)
277 struct find_map_state
*state
= (struct find_map_state
*)private_data
;
279 if (!dbrec2map(rec
, state
->map
)) {
280 DEBUG(10, ("failed to unpack map\n"));
284 if (state
->name
!= NULL
) {
285 if (strequal(state
->name
, state
->map
->nt_name
)) {
291 if (state
->map
->gid
== state
->gid
) {
300 /****************************************************************************
301 Return the sid and the type of the unix group.
302 ****************************************************************************/
304 static bool get_group_map_from_gid(gid_t gid
, GROUP_MAP
*map
)
306 struct find_map_state state
;
309 state
.name
= NULL
; /* Indicate we're looking for gid */
313 dbwrap_traverse_read(db
, find_map
, (void *)&state
, NULL
);
318 /****************************************************************************
319 Return the sid and the type of the unix group.
320 ****************************************************************************/
322 static bool get_group_map_from_ntname(const char *name
, GROUP_MAP
*map
)
324 struct find_map_state state
;
330 dbwrap_traverse_read(db
, find_map
, (void *)&state
, NULL
);
335 /****************************************************************************
336 Remove a group mapping entry.
337 ****************************************************************************/
339 static bool group_map_remove(const struct dom_sid
*sid
)
344 key
= group_mapping_key(talloc_tos(), sid
);
349 status
= dbwrap_trans_delete(db
, string_term_tdb_data(key
));
352 return NT_STATUS_IS_OK(status
);
355 /****************************************************************************
356 Enumerate the group mapping.
357 ****************************************************************************/
359 struct enum_map_state
{
360 const struct dom_sid
*domsid
;
361 enum lsa_SidType sid_name_use
;
368 static int collect_map(struct db_record
*rec
, void *private_data
)
370 struct enum_map_state
*state
= (struct enum_map_state
*)private_data
;
374 map
= talloc_zero(NULL
, GROUP_MAP
);
376 DEBUG(0, ("Unable to allocate group map!\n"));
380 if (!dbrec2map(rec
, map
)) {
384 /* list only the type or everything if UNKNOWN */
385 if (state
->sid_name_use
!= SID_NAME_UNKNOWN
386 && state
->sid_name_use
!= map
->sid_name_use
) {
387 DEBUG(11,("enum_group_mapping: group %s is not of the "
388 "requested type\n", map
->nt_name
));
393 if ((state
->unix_only
== ENUM_ONLY_MAPPED
) && (map
->gid
== -1)) {
394 DEBUG(11,("enum_group_mapping: group %s is non mapped\n",
400 if ((state
->domsid
!= NULL
) &&
401 (dom_sid_compare_domain(state
->domsid
, &map
->sid
) != 0)) {
402 struct dom_sid_buf buf
;
403 DEBUG(11,("enum_group_mapping: group %s is not in domain\n",
404 dom_sid_str_buf(&map
->sid
, &buf
)));
409 tmp
= talloc_realloc(NULL
, state
->maps
, GROUP_MAP
*,
410 state
->num_maps
+ 1);
412 DEBUG(0,("enum_group_mapping: Unable to enlarge group "
419 state
->maps
[state
->num_maps
] = talloc_move(state
->maps
, &map
);
424 static bool enum_group_mapping(const struct dom_sid
*domsid
,
425 enum lsa_SidType sid_name_use
,
426 GROUP_MAP
***pp_rmap
,
427 size_t *p_num_entries
, bool unix_only
)
429 struct enum_map_state state
;
432 state
.domsid
= domsid
;
433 state
.sid_name_use
= sid_name_use
;
434 state
.unix_only
= unix_only
;
438 status
= dbwrap_traverse_read(db
, collect_map
, (void *)&state
, NULL
);
439 if (!NT_STATUS_IS_OK(status
)) {
440 TALLOC_FREE(state
.maps
);
444 *pp_rmap
= state
.maps
;
445 *p_num_entries
= state
.num_maps
;
450 /* This operation happens on session setup, so it should better be fast. We
451 * store a list of aliases a SID is member of hanging off MEMBEROF/SID. */
453 static NTSTATUS
one_alias_membership(const struct dom_sid
*member
,
454 struct dom_sid
**sids
, size_t *num
)
456 struct dom_sid_buf tmp
;
462 TALLOC_CTX
*frame
= talloc_stackframe();
464 slprintf(key
, sizeof(key
), "%s%s", MEMBEROF_PREFIX
,
465 dom_sid_str_buf(member
, &tmp
));
467 status
= dbwrap_fetch_bystring(db
, frame
, key
, &dbuf
);
468 if (!NT_STATUS_IS_OK(status
)) {
473 p
= (const char *)dbuf
.dptr
;
475 while (next_token_talloc(frame
, &p
, &string_sid
, " ")) {
476 struct dom_sid alias
;
479 if (!string_to_sid(&alias
, string_sid
))
483 status
= add_sid_to_array_unique(NULL
, &alias
, sids
, &num_sids
);
484 if (!NT_STATUS_IS_OK(status
)) {
495 static NTSTATUS
alias_memberships(const struct dom_sid
*members
, size_t num_members
,
496 struct dom_sid
**sids
, size_t *num
)
503 for (i
=0; i
<num_members
; i
++) {
504 NTSTATUS status
= one_alias_membership(&members
[i
], sids
, num
);
505 if (!NT_STATUS_IS_OK(status
))
511 static bool is_aliasmem(const struct dom_sid
*alias
, const struct dom_sid
*member
)
513 struct dom_sid
*sids
;
517 /* This feels the wrong way round, but the on-disk data structure
518 * dictates it this way. */
519 if (!NT_STATUS_IS_OK(alias_memberships(member
, 1, &sids
, &num
)))
522 for (i
=0; i
<num
; i
++) {
523 if (dom_sid_compare(alias
, &sids
[i
]) == 0) {
533 static NTSTATUS
add_aliasmem(const struct dom_sid
*alias
, const struct dom_sid
*member
)
537 struct dom_sid_buf string_sid
;
538 char *new_memberstring
;
539 struct db_record
*rec
;
543 map
= talloc_zero(talloc_tos(), GROUP_MAP
);
545 return NT_STATUS_NO_MEMORY
;
548 if (!get_group_map_from_sid(*alias
, map
)) {
550 return NT_STATUS_NO_SUCH_ALIAS
;
553 if ((map
->sid_name_use
!= SID_NAME_ALIAS
) &&
554 (map
->sid_name_use
!= SID_NAME_WKN_GRP
)) {
556 return NT_STATUS_NO_SUCH_ALIAS
;
561 if (is_aliasmem(alias
, member
))
562 return NT_STATUS_MEMBER_IN_ALIAS
;
564 key
= talloc_asprintf(talloc_tos(), "%s%s", MEMBEROF_PREFIX
,
565 dom_sid_str_buf(member
, &string_sid
));
567 return NT_STATUS_NO_MEMORY
;
570 if (dbwrap_transaction_start(db
) != 0) {
571 DEBUG(0, ("transaction_start failed\n"));
572 return NT_STATUS_INTERNAL_DB_CORRUPTION
;
575 rec
= dbwrap_fetch_locked(db
, key
, string_term_tdb_data(key
));
578 DEBUG(10, ("fetch_lock failed\n"));
580 status
= NT_STATUS_INTERNAL_DB_CORRUPTION
;
584 value
= dbwrap_record_get_value(rec
);
586 dom_sid_str_buf(alias
, &string_sid
);
588 if (value
.dptr
!= NULL
) {
589 new_memberstring
= talloc_asprintf(
590 key
, "%s %s", (char *)(value
.dptr
), string_sid
.buf
);
592 new_memberstring
= talloc_strdup(key
, string_sid
.buf
);
595 if (new_memberstring
== NULL
) {
597 status
= NT_STATUS_NO_MEMORY
;
601 status
= dbwrap_record_store(rec
, string_term_tdb_data(new_memberstring
), 0);
605 if (!NT_STATUS_IS_OK(status
)) {
606 DEBUG(10, ("Could not store record: %s\n", nt_errstr(status
)));
610 if (dbwrap_transaction_commit(db
) != 0) {
611 DEBUG(0, ("transaction_commit failed\n"));
612 status
= NT_STATUS_INTERNAL_DB_CORRUPTION
;
619 if (dbwrap_transaction_cancel(db
) != 0) {
620 smb_panic("transaction_cancel failed");
626 struct aliasmem_state
{
628 const struct dom_sid
*alias
;
629 struct dom_sid
**sids
;
633 static int collect_aliasmem(struct db_record
*rec
, void *priv
)
635 struct aliasmem_state
*state
= (struct aliasmem_state
*)priv
;
639 TDB_DATA key
= dbwrap_record_get_key(rec
);
640 TDB_DATA value
= dbwrap_record_get_value(rec
);
642 if (strncmp((const char *)key
.dptr
, MEMBEROF_PREFIX
,
643 MEMBEROF_PREFIX_LEN
) != 0)
646 p
= (const char *)value
.dptr
;
648 frame
= talloc_stackframe();
650 while (next_token_talloc(frame
, &p
, &alias_string
, " ")) {
651 struct dom_sid alias
, member
;
652 const char *member_string
;
655 if (!string_to_sid(&alias
, alias_string
))
658 if (dom_sid_compare(state
->alias
, &alias
) != 0)
661 /* Ok, we found the alias we're looking for in the membership
662 * list currently scanned. The key represents the alias
663 * member. Add that. */
665 member_string
= strchr((const char *)key
.dptr
, '/');
667 /* Above we tested for MEMBEROF_PREFIX which includes the
670 SMB_ASSERT(member_string
!= NULL
);
673 if (!string_to_sid(&member
, member_string
))
676 num_sids
= *state
->num
;
677 if (!NT_STATUS_IS_OK(add_sid_to_array(state
->mem_ctx
, &member
,
684 *state
->num
= num_sids
;
691 static NTSTATUS
enum_aliasmem(const struct dom_sid
*alias
, TALLOC_CTX
*mem_ctx
,
692 struct dom_sid
**sids
, size_t *num
)
695 struct aliasmem_state state
;
697 map
= talloc_zero(talloc_tos(), GROUP_MAP
);
699 return NT_STATUS_NO_MEMORY
;
702 if (!get_group_map_from_sid(*alias
, map
)) {
704 return NT_STATUS_NO_SUCH_ALIAS
;
707 if ((map
->sid_name_use
!= SID_NAME_ALIAS
) &&
708 (map
->sid_name_use
!= SID_NAME_WKN_GRP
)) {
710 return NT_STATUS_NO_SUCH_ALIAS
;
721 state
.mem_ctx
= mem_ctx
;
723 dbwrap_traverse_read(db
, collect_aliasmem
, &state
, NULL
);
727 static NTSTATUS
del_aliasmem(const struct dom_sid
*alias
, const struct dom_sid
*member
)
730 struct dom_sid
*sids
;
735 struct dom_sid_buf sid_string
;
737 if (dbwrap_transaction_start(db
) != 0) {
738 DEBUG(0, ("transaction_start failed\n"));
739 return NT_STATUS_INTERNAL_DB_CORRUPTION
;
742 status
= alias_memberships(member
, 1, &sids
, &num
);
744 if (!NT_STATUS_IS_OK(status
)) {
748 for (i
=0; i
<num
; i
++) {
749 if (dom_sid_compare(&sids
[i
], alias
) == 0) {
757 status
= NT_STATUS_MEMBER_NOT_IN_ALIAS
;
762 sids
[i
] = sids
[num
-1];
766 key
= talloc_asprintf(
770 dom_sid_str_buf(member
, &sid_string
));
773 status
= NT_STATUS_NO_MEMORY
;
778 status
= dbwrap_delete_bystring(db
, key
);
782 member_string
= talloc_strdup(sids
, "");
783 if (member_string
== NULL
) {
785 status
= NT_STATUS_NO_MEMORY
;
789 for (i
=0; i
<num
; i
++) {
791 member_string
= talloc_asprintf_append_buffer(
794 dom_sid_str_buf(&sids
[i
], &sid_string
));
796 if (member_string
== NULL
) {
798 status
= NT_STATUS_NO_MEMORY
;
803 status
= dbwrap_store_bystring(
804 db
, key
, string_term_tdb_data(member_string
), 0);
808 if (!NT_STATUS_IS_OK(status
)) {
809 DEBUG(10, ("dbwrap_store_bystring failed: %s\n",
814 if (dbwrap_transaction_commit(db
) != 0) {
815 DEBUG(0, ("transaction_commit failed\n"));
816 status
= NT_STATUS_INTERNAL_DB_CORRUPTION
;
823 if (dbwrap_transaction_cancel(db
) != 0) {
824 smb_panic("transaction_cancel failed");
830 /* -- ldb->tdb switching code -------------------------------------------- */
832 /* change this if the data format ever changes */
833 #define LTDB_PACKING_FORMAT 0x26011967
835 /* old packing formats (not supported for now,
836 * it was never used for group mapping AFAIK) */
837 #define LTDB_PACKING_FORMAT_NODN 0x26011966
839 static unsigned int pull_uint32(uint8_t *p
, int ofs
)
842 return p
[0] | (p
[1]<<8) | (p
[2]<<16) | (p
[3]<<24);
846 unpack a ldb message from a linear buffer in TDB_DATA
848 static int convert_ldb_record(TDB_CONTEXT
*ltdb
, TDB_DATA key
,
849 TDB_DATA data
, void *ptr
)
851 TALLOC_CTX
*tmp_ctx
= talloc_tos();
852 GROUP_MAP
*map
= NULL
;
856 unsigned int remaining
;
861 uint32_t num_mem
= 0;
862 struct dom_sid
*members
= NULL
;
865 p
= (uint8_t *)data
.dptr
;
866 if (data
.dsize
< 8) {
871 format
= pull_uint32(p
, 0);
872 num_el
= pull_uint32(p
, 4);
875 remaining
= data
.dsize
- 8;
878 case LTDB_PACKING_FORMAT
:
879 len
= strnlen((char *)p
, remaining
);
880 if (len
== remaining
) {
886 /* ignore special LDB attributes */
890 if (strncmp((char *)p
, "rid=", 4)) {
891 /* unknown entry, ignore */
892 DEBUG(3, ("Found unknown entry in group mapping "
893 "database named [%s]\n", (char *)p
));
897 remaining
-= len
+ 1;
901 case LTDB_PACKING_FORMAT_NODN
:
908 /* bad entry, ignore */
912 if (num_el
> remaining
/ 6) {
917 map
= talloc_zero(NULL
, GROUP_MAP
);
923 for (i
= 0; i
< num_el
; i
++) {
926 if (remaining
< 10) {
930 len
= strnlen((char *)p
, remaining
- 6);
931 if (len
== remaining
- 6) {
935 name
= talloc_strndup(tmp_ctx
, (char *)p
, len
);
940 remaining
-= len
+ 1;
943 num_vals
= pull_uint32(p
, 0);
944 if (strcasecmp_m(name
, "member") == 0) {
946 members
= talloc_array(tmp_ctx
, struct dom_sid
, num_mem
);
947 if (members
== NULL
) {
951 } else if (num_vals
!= 1) {
959 for (j
= 0; j
< num_vals
; j
++) {
960 len
= pull_uint32(p
, 0);
961 if (len
> remaining
-5) {
966 val
= talloc_strndup(tmp_ctx
, (char *)(p
+ 4), len
);
972 remaining
-= len
+4+1;
975 /* we ignore unknown or uninteresting attributes
976 * (objectclass, etc.) */
977 if (strcasecmp_m(name
, "gidNumber") == 0) {
978 map
->gid
= smb_strtoul(val
,
982 SMB_STR_FULL_STR_CONV
);
987 } else if (strcasecmp_m(name
, "sid") == 0) {
988 if (!string_to_sid(&map
->sid
, val
)) {
992 } else if (strcasecmp_m(name
, "sidNameUse") == 0) {
998 SMB_STR_FULL_STR_CONV
);
1003 } else if (strcasecmp_m(name
, "ntname") == 0) {
1004 map
->nt_name
= talloc_strdup(map
, val
);
1005 if (!map
->nt_name
) {
1009 } else if (strcasecmp_m(name
, "comment") == 0) {
1010 map
->comment
= talloc_strdup(map
, val
);
1011 if (!map
->comment
) {
1015 } else if (strcasecmp_m(name
, "member") == 0) {
1016 if (!string_to_sid(&members
[j
], val
)) {
1028 if (map
->nt_name
== NULL
) {
1033 if (map
->comment
== NULL
) {
1034 map
->comment
= talloc_strdup(map
, "");
1036 if (map
->comment
== NULL
) {
1041 if (!add_mapping_entry(map
, 0)) {
1047 for (j
= 0; j
< num_mem
; j
++) {
1049 status
= add_aliasmem(&map
->sid
, &members
[j
]);
1050 if (!NT_STATUS_IS_OK(status
)) {
1057 if (remaining
!= 0) {
1058 DEBUG(0, ("Error: %d bytes unread in ltdb_unpack_data\n",
1070 static bool mapping_switch(const char *ldb_path
)
1077 frame
= talloc_stackframe();
1079 ltdb
= tdb_open_log(ldb_path
, 0, TDB_DEFAULT
, O_RDONLY
, 0600);
1080 if (ltdb
== NULL
) goto failed
;
1082 /* ldb is just a very fancy tdb, read out raw data and perform
1084 ret
= tdb_traverse(ltdb
, convert_ldb_record
, NULL
);
1085 if (ret
< 0) goto failed
;
1092 /* now rename the old db out of the way */
1093 new_path
= state_path(talloc_tos(), "group_mapping.ldb.replaced");
1097 if (rename(ldb_path
, new_path
) != 0) {
1098 DEBUG(0,("Failed to rename old group mapping database\n"));
1105 DEBUG(0, ("Failed to switch to tdb group mapping database\n"));
1106 if (ltdb
) tdb_close(ltdb
);
1111 static const struct mapping_backend tdb_backend
= {
1112 .add_mapping_entry
= add_mapping_entry
,
1113 .get_group_map_from_sid
= get_group_map_from_sid
,
1114 .get_group_map_from_gid
= get_group_map_from_gid
,
1115 .get_group_map_from_ntname
= get_group_map_from_ntname
,
1116 .group_map_remove
= group_map_remove
,
1117 .enum_group_mapping
= enum_group_mapping
,
1118 .one_alias_membership
= one_alias_membership
,
1119 .add_aliasmem
= add_aliasmem
,
1120 .del_aliasmem
= del_aliasmem
,
1121 .enum_aliasmem
= enum_aliasmem
1125 initialise the tdb mapping backend
1127 const struct mapping_backend
*groupdb_tdb_init(void)
1129 if (!init_group_mapping()) {
1130 DEBUG(0,("Failed to initialise tdb mapping backend\n"));
1134 return &tdb_backend
;