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)
56 tdb_path
= state_path(talloc_tos(), "group_mapping.tdb");
57 if (tdb_path
== NULL
) {
60 db
= db_open(NULL
, tdb_path
, 0,
61 TDB_DEFAULT
, O_RDWR
|O_CREAT
, 0600,
62 DBWRAP_LOCK_ORDER_1
, DBWRAP_FLAG_NONE
);
64 DEBUG(0, ("Failed to open group mapping database: %s\n",
66 talloc_free(tdb_path
);
70 ldb_path
= state_path(talloc_tos(), "group_mapping.ldb");
71 if (ldb_path
== NULL
) {
72 talloc_free(tdb_path
);
75 if (file_exist(ldb_path
) && !mapping_switch(ldb_path
)) {
77 talloc_free(tdb_path
);
78 talloc_free(ldb_path
);
82 /* handle upgrade from old versions of the database */
83 #if 0 /* -- Needs conversion to dbwrap -- */
84 const char *vstring
= "INFO/version";
86 GROUP_MAP
*map_table
= NULL
;
87 size_t num_entries
= 0;
89 /* handle a Samba upgrade */
90 tdb_lock_bystring(tdb
, vstring
);
92 /* Cope with byte-reversed older versions of the db. */
93 vers_id
= tdb_fetch_int32(tdb
, vstring
);
94 if ((vers_id
== DATABASE_VERSION_V1
)
95 || (IREV(vers_id
) == DATABASE_VERSION_V1
)) {
97 * Written on a bigendian machine with old fetch_int
100 tdb_store_int32(tdb
, vstring
, DATABASE_VERSION_V2
);
101 vers_id
= DATABASE_VERSION_V2
;
104 /* if its an unknown version we remove everything in the db */
106 if (vers_id
!= DATABASE_VERSION_V2
) {
108 tdb_store_int32(tdb
, vstring
, DATABASE_VERSION_V2
);
111 tdb_unlock_bystring(tdb
, vstring
);
113 /* cleanup any map entries with a gid == -1 */
115 if ( enum_group_mapping( NULL
, SID_NAME_UNKNOWN
, &map_table
,
116 &num_entries
, False
) ) {
119 for ( i
=0; i
<num_entries
; i
++ ) {
120 if ( map_table
[i
].gid
== -1 ) {
121 group_map_remove( &map_table
[i
].sid
);
125 SAFE_FREE( map_table
);
129 talloc_free(tdb_path
);
130 talloc_free(ldb_path
);
134 static char *group_mapping_key(TALLOC_CTX
*mem_ctx
, const struct dom_sid
*sid
)
136 struct dom_sid_buf sidstr
;
138 return talloc_asprintf(
139 mem_ctx
, "%s%s", GROUP_PREFIX
, dom_sid_str_buf(sid
, &sidstr
));
142 /****************************************************************************
143 ****************************************************************************/
144 static bool add_mapping_entry(GROUP_MAP
*map
, int flag
)
150 key
= group_mapping_key(talloc_tos(), &map
->sid
);
155 len
= tdb_pack(NULL
, 0, "ddff",
156 map
->gid
, map
->sid_name_use
, map
->nt_name
, map
->comment
);
158 buf
= talloc_array(key
, char, len
);
163 len
= tdb_pack((uint8_t *)buf
, len
, "ddff", map
->gid
,
164 map
->sid_name_use
, map
->nt_name
, map
->comment
);
166 status
= dbwrap_trans_store(
167 db
, string_term_tdb_data(key
),
168 make_tdb_data((uint8_t *)buf
, len
), TDB_REPLACE
);
172 return NT_STATUS_IS_OK(status
);
176 /****************************************************************************
177 Return the sid and the type of the unix group.
178 ****************************************************************************/
180 static bool get_group_map_from_sid(struct dom_sid sid
, GROUP_MAP
*map
)
189 /* the key is the SID, retrieving is direct */
191 key
= group_mapping_key(talloc_tos(), &sid
);
196 status
= dbwrap_fetch_bystring(db
, key
, key
, &dbuf
);
197 if (!NT_STATUS_IS_OK(status
)) {
202 ret
= tdb_unpack(dbuf
.dptr
, dbuf
.dsize
, "ddff",
203 &map
->gid
, &map
->sid_name_use
,
209 DEBUG(3,("get_group_map_from_sid: tdb_unpack failure\n"));
213 sid_copy(&map
->sid
, &sid
);
215 map
->nt_name
= talloc_strdup(map
, nt_name
);
219 map
->comment
= talloc_strdup(map
, comment
);
227 static bool dbrec2map(const struct db_record
*rec
, GROUP_MAP
*map
)
229 TDB_DATA key
= dbwrap_record_get_key(rec
);
230 TDB_DATA value
= dbwrap_record_get_value(rec
);
235 if ((key
.dsize
< strlen(GROUP_PREFIX
))
236 || (strncmp((char *)key
.dptr
, GROUP_PREFIX
,
237 GROUP_PREFIX_LEN
) != 0)) {
241 if (!string_to_sid(&map
->sid
, (const char *)key
.dptr
242 + GROUP_PREFIX_LEN
)) {
246 ret
= tdb_unpack(value
.dptr
, value
.dsize
, "ddff",
247 &map
->gid
, &map
->sid_name_use
,
251 DEBUG(3, ("dbrec2map: tdb_unpack failure\n"));
255 map
->nt_name
= talloc_strdup(map
, nt_name
);
259 map
->comment
= talloc_strdup(map
, comment
);
267 struct find_map_state
{
269 const char *name
; /* If != NULL, look for name */
270 gid_t gid
; /* valid iff name == NULL */
274 static int find_map(struct db_record
*rec
, void *private_data
)
276 struct find_map_state
*state
= (struct find_map_state
*)private_data
;
278 if (!dbrec2map(rec
, state
->map
)) {
279 DEBUG(10, ("failed to unpack map\n"));
283 if (state
->name
!= NULL
) {
284 if (strequal(state
->name
, state
->map
->nt_name
)) {
290 if (state
->map
->gid
== state
->gid
) {
299 /****************************************************************************
300 Return the sid and the type of the unix group.
301 ****************************************************************************/
303 static bool get_group_map_from_gid(gid_t gid
, GROUP_MAP
*map
)
305 struct find_map_state state
;
308 state
.name
= NULL
; /* Indicate we're looking for gid */
312 dbwrap_traverse_read(db
, find_map
, (void *)&state
, NULL
);
317 /****************************************************************************
318 Return the sid and the type of the unix group.
319 ****************************************************************************/
321 static bool get_group_map_from_ntname(const char *name
, GROUP_MAP
*map
)
323 struct find_map_state state
;
329 dbwrap_traverse_read(db
, find_map
, (void *)&state
, NULL
);
334 /****************************************************************************
335 Remove a group mapping entry.
336 ****************************************************************************/
338 static bool group_map_remove(const struct dom_sid
*sid
)
343 key
= group_mapping_key(talloc_tos(), sid
);
348 status
= dbwrap_trans_delete(db
, string_term_tdb_data(key
));
351 return NT_STATUS_IS_OK(status
);
354 /****************************************************************************
355 Enumerate the group mapping.
356 ****************************************************************************/
358 struct enum_map_state
{
359 const struct dom_sid
*domsid
;
360 enum lsa_SidType sid_name_use
;
367 static int collect_map(struct db_record
*rec
, void *private_data
)
369 struct enum_map_state
*state
= (struct enum_map_state
*)private_data
;
373 map
= talloc_zero(NULL
, GROUP_MAP
);
375 DEBUG(0, ("Unable to allocate group map!\n"));
379 if (!dbrec2map(rec
, map
)) {
383 /* list only the type or everything if UNKNOWN */
384 if (state
->sid_name_use
!= SID_NAME_UNKNOWN
385 && state
->sid_name_use
!= map
->sid_name_use
) {
386 DEBUG(11,("enum_group_mapping: group %s is not of the "
387 "requested type\n", map
->nt_name
));
392 if ((state
->unix_only
== ENUM_ONLY_MAPPED
) && (map
->gid
== -1)) {
393 DEBUG(11,("enum_group_mapping: group %s is non mapped\n",
399 if ((state
->domsid
!= NULL
) &&
400 (dom_sid_compare_domain(state
->domsid
, &map
->sid
) != 0)) {
401 struct dom_sid_buf buf
;
402 DEBUG(11,("enum_group_mapping: group %s is not in domain\n",
403 dom_sid_str_buf(&map
->sid
, &buf
)));
408 tmp
= talloc_realloc(NULL
, state
->maps
, GROUP_MAP
*,
409 state
->num_maps
+ 1);
411 DEBUG(0,("enum_group_mapping: Unable to enlarge group "
418 state
->maps
[state
->num_maps
] = talloc_move(state
->maps
, &map
);
423 static bool enum_group_mapping(const struct dom_sid
*domsid
,
424 enum lsa_SidType sid_name_use
,
425 GROUP_MAP
***pp_rmap
,
426 size_t *p_num_entries
, bool unix_only
)
428 struct enum_map_state state
;
431 state
.domsid
= domsid
;
432 state
.sid_name_use
= sid_name_use
;
433 state
.unix_only
= unix_only
;
437 status
= dbwrap_traverse_read(db
, collect_map
, (void *)&state
, NULL
);
438 if (!NT_STATUS_IS_OK(status
)) {
439 TALLOC_FREE(state
.maps
);
443 *pp_rmap
= state
.maps
;
444 *p_num_entries
= state
.num_maps
;
449 /* This operation happens on session setup, so it should better be fast. We
450 * store a list of aliases a SID is member of hanging off MEMBEROF/SID. */
452 static NTSTATUS
one_alias_membership(const struct dom_sid
*member
,
453 struct dom_sid
**sids
, size_t *num
)
455 struct dom_sid_buf tmp
;
461 TALLOC_CTX
*frame
= talloc_stackframe();
463 slprintf(key
, sizeof(key
), "%s%s", MEMBEROF_PREFIX
,
464 dom_sid_str_buf(member
, &tmp
));
466 status
= dbwrap_fetch_bystring(db
, frame
, key
, &dbuf
);
467 if (!NT_STATUS_IS_OK(status
)) {
472 p
= (const char *)dbuf
.dptr
;
474 while (next_token_talloc(frame
, &p
, &string_sid
, " ")) {
475 struct dom_sid alias
;
478 if (!string_to_sid(&alias
, string_sid
))
482 status
= add_sid_to_array_unique(NULL
, &alias
, sids
, &num_sids
);
483 if (!NT_STATUS_IS_OK(status
)) {
494 static NTSTATUS
alias_memberships(const struct dom_sid
*members
, size_t num_members
,
495 struct dom_sid
**sids
, size_t *num
)
502 for (i
=0; i
<num_members
; i
++) {
503 NTSTATUS status
= one_alias_membership(&members
[i
], sids
, num
);
504 if (!NT_STATUS_IS_OK(status
))
510 static bool is_aliasmem(const struct dom_sid
*alias
, const struct dom_sid
*member
)
512 struct dom_sid
*sids
;
516 /* This feels the wrong way round, but the on-disk data structure
517 * dictates it this way. */
518 if (!NT_STATUS_IS_OK(alias_memberships(member
, 1, &sids
, &num
)))
521 for (i
=0; i
<num
; i
++) {
522 if (dom_sid_compare(alias
, &sids
[i
]) == 0) {
532 static NTSTATUS
add_aliasmem(const struct dom_sid
*alias
, const struct dom_sid
*member
)
536 struct dom_sid_buf string_sid
;
537 char *new_memberstring
;
538 struct db_record
*rec
;
542 map
= talloc_zero(talloc_tos(), GROUP_MAP
);
544 return NT_STATUS_NO_MEMORY
;
547 if (!get_group_map_from_sid(*alias
, map
)) {
549 return NT_STATUS_NO_SUCH_ALIAS
;
552 if ((map
->sid_name_use
!= SID_NAME_ALIAS
) &&
553 (map
->sid_name_use
!= SID_NAME_WKN_GRP
)) {
555 return NT_STATUS_NO_SUCH_ALIAS
;
560 if (is_aliasmem(alias
, member
))
561 return NT_STATUS_MEMBER_IN_ALIAS
;
563 key
= talloc_asprintf(talloc_tos(), "%s%s", MEMBEROF_PREFIX
,
564 dom_sid_str_buf(member
, &string_sid
));
566 return NT_STATUS_NO_MEMORY
;
569 if (dbwrap_transaction_start(db
) != 0) {
570 DEBUG(0, ("transaction_start failed\n"));
571 return NT_STATUS_INTERNAL_DB_CORRUPTION
;
574 rec
= dbwrap_fetch_locked(db
, key
, string_term_tdb_data(key
));
577 DEBUG(10, ("fetch_lock failed\n"));
579 status
= NT_STATUS_INTERNAL_DB_CORRUPTION
;
583 value
= dbwrap_record_get_value(rec
);
585 dom_sid_str_buf(alias
, &string_sid
);
587 if (value
.dptr
!= NULL
) {
588 new_memberstring
= talloc_asprintf(
589 key
, "%s %s", (char *)(value
.dptr
), string_sid
.buf
);
591 new_memberstring
= talloc_strdup(key
, string_sid
.buf
);
594 if (new_memberstring
== NULL
) {
596 status
= NT_STATUS_NO_MEMORY
;
600 status
= dbwrap_record_store(rec
, string_term_tdb_data(new_memberstring
), 0);
604 if (!NT_STATUS_IS_OK(status
)) {
605 DEBUG(10, ("Could not store record: %s\n", nt_errstr(status
)));
609 if (dbwrap_transaction_commit(db
) != 0) {
610 DEBUG(0, ("transaction_commit failed\n"));
611 status
= NT_STATUS_INTERNAL_DB_CORRUPTION
;
618 if (dbwrap_transaction_cancel(db
) != 0) {
619 smb_panic("transaction_cancel failed");
625 struct aliasmem_state
{
627 const struct dom_sid
*alias
;
628 struct dom_sid
**sids
;
632 static int collect_aliasmem(struct db_record
*rec
, void *priv
)
634 struct aliasmem_state
*state
= (struct aliasmem_state
*)priv
;
638 TDB_DATA key
= dbwrap_record_get_key(rec
);
639 TDB_DATA value
= dbwrap_record_get_value(rec
);
641 if (strncmp((const char *)key
.dptr
, MEMBEROF_PREFIX
,
642 MEMBEROF_PREFIX_LEN
) != 0)
645 p
= (const char *)value
.dptr
;
647 frame
= talloc_stackframe();
649 while (next_token_talloc(frame
, &p
, &alias_string
, " ")) {
650 struct dom_sid alias
, member
;
651 const char *member_string
;
654 if (!string_to_sid(&alias
, alias_string
))
657 if (dom_sid_compare(state
->alias
, &alias
) != 0)
660 /* Ok, we found the alias we're looking for in the membership
661 * list currently scanned. The key represents the alias
662 * member. Add that. */
664 member_string
= strchr((const char *)key
.dptr
, '/');
666 /* Above we tested for MEMBEROF_PREFIX which includes the
669 SMB_ASSERT(member_string
!= NULL
);
672 if (!string_to_sid(&member
, member_string
))
675 num_sids
= *state
->num
;
676 if (!NT_STATUS_IS_OK(add_sid_to_array(state
->mem_ctx
, &member
,
683 *state
->num
= num_sids
;
690 static NTSTATUS
enum_aliasmem(const struct dom_sid
*alias
, TALLOC_CTX
*mem_ctx
,
691 struct dom_sid
**sids
, size_t *num
)
694 struct aliasmem_state state
;
696 map
= talloc_zero(talloc_tos(), GROUP_MAP
);
698 return NT_STATUS_NO_MEMORY
;
701 if (!get_group_map_from_sid(*alias
, map
)) {
703 return NT_STATUS_NO_SUCH_ALIAS
;
706 if ((map
->sid_name_use
!= SID_NAME_ALIAS
) &&
707 (map
->sid_name_use
!= SID_NAME_WKN_GRP
)) {
709 return NT_STATUS_NO_SUCH_ALIAS
;
720 state
.mem_ctx
= mem_ctx
;
722 dbwrap_traverse_read(db
, collect_aliasmem
, &state
, NULL
);
726 static NTSTATUS
del_aliasmem(const struct dom_sid
*alias
, const struct dom_sid
*member
)
729 struct dom_sid
*sids
;
734 struct dom_sid_buf sid_string
;
736 if (dbwrap_transaction_start(db
) != 0) {
737 DEBUG(0, ("transaction_start failed\n"));
738 return NT_STATUS_INTERNAL_DB_CORRUPTION
;
741 status
= alias_memberships(member
, 1, &sids
, &num
);
743 if (!NT_STATUS_IS_OK(status
)) {
747 for (i
=0; i
<num
; i
++) {
748 if (dom_sid_compare(&sids
[i
], alias
) == 0) {
756 status
= NT_STATUS_MEMBER_NOT_IN_ALIAS
;
761 sids
[i
] = sids
[num
-1];
765 key
= talloc_asprintf(
769 dom_sid_str_buf(member
, &sid_string
));
772 status
= NT_STATUS_NO_MEMORY
;
777 status
= dbwrap_delete_bystring(db
, key
);
781 member_string
= talloc_strdup(sids
, "");
782 if (member_string
== NULL
) {
784 status
= NT_STATUS_NO_MEMORY
;
788 for (i
=0; i
<num
; i
++) {
790 member_string
= talloc_asprintf_append_buffer(
793 dom_sid_str_buf(&sids
[i
], &sid_string
));
795 if (member_string
== NULL
) {
797 status
= NT_STATUS_NO_MEMORY
;
802 status
= dbwrap_store_bystring(
803 db
, key
, string_term_tdb_data(member_string
), 0);
807 if (!NT_STATUS_IS_OK(status
)) {
808 DEBUG(10, ("dbwrap_store_bystring failed: %s\n",
813 if (dbwrap_transaction_commit(db
) != 0) {
814 DEBUG(0, ("transaction_commit failed\n"));
815 status
= NT_STATUS_INTERNAL_DB_CORRUPTION
;
822 if (dbwrap_transaction_cancel(db
) != 0) {
823 smb_panic("transaction_cancel failed");
829 /* -- ldb->tdb switching code -------------------------------------------- */
831 /* change this if the data format ever changes */
832 #define LTDB_PACKING_FORMAT 0x26011967
834 /* old packing formats (not supported for now,
835 * it was never used for group mapping AFAIK) */
836 #define LTDB_PACKING_FORMAT_NODN 0x26011966
838 static unsigned int pull_uint32(uint8_t *p
, int ofs
)
841 return p
[0] | (p
[1]<<8) | (p
[2]<<16) | (p
[3]<<24);
845 unpack a ldb message from a linear buffer in TDB_DATA
847 static int convert_ldb_record(TDB_CONTEXT
*ltdb
, TDB_DATA key
,
848 TDB_DATA data
, void *ptr
)
850 TALLOC_CTX
*tmp_ctx
= talloc_tos();
851 GROUP_MAP
*map
= NULL
;
855 unsigned int remaining
;
860 uint32_t num_mem
= 0;
861 struct dom_sid
*members
= NULL
;
864 p
= (uint8_t *)data
.dptr
;
865 if (data
.dsize
< 8) {
870 format
= pull_uint32(p
, 0);
871 num_el
= pull_uint32(p
, 4);
874 remaining
= data
.dsize
- 8;
877 case LTDB_PACKING_FORMAT
:
878 len
= strnlen((char *)p
, remaining
);
879 if (len
== remaining
) {
885 /* ignore special LDB attributes */
889 if (strncmp((char *)p
, "rid=", 4)) {
890 /* unknown entry, ignore */
891 DEBUG(3, ("Found unknown entry in group mapping "
892 "database named [%s]\n", (char *)p
));
896 remaining
-= len
+ 1;
900 case LTDB_PACKING_FORMAT_NODN
:
907 /* bad entry, ignore */
911 if (num_el
> remaining
/ 6) {
916 map
= talloc_zero(NULL
, GROUP_MAP
);
922 for (i
= 0; i
< num_el
; i
++) {
925 if (remaining
< 10) {
929 len
= strnlen((char *)p
, remaining
- 6);
930 if (len
== remaining
- 6) {
934 name
= talloc_strndup(tmp_ctx
, (char *)p
, len
);
939 remaining
-= len
+ 1;
942 num_vals
= pull_uint32(p
, 0);
943 if (strcasecmp_m(name
, "member") == 0) {
945 members
= talloc_array(tmp_ctx
, struct dom_sid
, num_mem
);
946 if (members
== NULL
) {
950 } else if (num_vals
!= 1) {
958 for (j
= 0; j
< num_vals
; j
++) {
959 len
= pull_uint32(p
, 0);
960 if (len
> remaining
-5) {
965 val
= talloc_strndup(tmp_ctx
, (char *)(p
+ 4), len
);
971 remaining
-= len
+4+1;
974 /* we ignore unknown or uninteresting attributes
975 * (objectclass, etc.) */
976 if (strcasecmp_m(name
, "gidNumber") == 0) {
977 map
->gid
= smb_strtoul(val
,
981 SMB_STR_FULL_STR_CONV
);
986 } else if (strcasecmp_m(name
, "sid") == 0) {
987 if (!string_to_sid(&map
->sid
, val
)) {
991 } else if (strcasecmp_m(name
, "sidNameUse") == 0) {
997 SMB_STR_FULL_STR_CONV
);
1002 } else if (strcasecmp_m(name
, "ntname") == 0) {
1003 map
->nt_name
= talloc_strdup(map
, val
);
1004 if (!map
->nt_name
) {
1008 } else if (strcasecmp_m(name
, "comment") == 0) {
1009 map
->comment
= talloc_strdup(map
, val
);
1010 if (!map
->comment
) {
1014 } else if (strcasecmp_m(name
, "member") == 0) {
1015 if (!string_to_sid(&members
[j
], val
)) {
1027 if (map
->nt_name
== NULL
) {
1032 if (map
->comment
== NULL
) {
1033 map
->comment
= talloc_strdup(map
, "");
1035 if (map
->comment
== NULL
) {
1040 if (!add_mapping_entry(map
, 0)) {
1046 for (j
= 0; j
< num_mem
; j
++) {
1048 status
= add_aliasmem(&map
->sid
, &members
[j
]);
1049 if (!NT_STATUS_IS_OK(status
)) {
1056 if (remaining
!= 0) {
1057 DEBUG(0, ("Error: %d bytes unread in ltdb_unpack_data\n",
1069 static bool mapping_switch(const char *ldb_path
)
1076 frame
= talloc_stackframe();
1078 ltdb
= tdb_open_log(ldb_path
, 0, TDB_DEFAULT
, O_RDONLY
, 0600);
1079 if (ltdb
== NULL
) goto failed
;
1081 /* ldb is just a very fancy tdb, read out raw data and perform
1083 ret
= tdb_traverse(ltdb
, convert_ldb_record
, NULL
);
1084 if (ret
< 0) goto failed
;
1091 /* now rename the old db out of the way */
1092 new_path
= state_path(talloc_tos(), "group_mapping.ldb.replaced");
1096 if (rename(ldb_path
, new_path
) != 0) {
1097 DEBUG(0,("Failed to rename old group mapping database\n"));
1104 DEBUG(0, ("Failed to switch to tdb group mapping database\n"));
1105 if (ltdb
) tdb_close(ltdb
);
1110 static const struct mapping_backend tdb_backend
= {
1111 .add_mapping_entry
= add_mapping_entry
,
1112 .get_group_map_from_sid
= get_group_map_from_sid
,
1113 .get_group_map_from_gid
= get_group_map_from_gid
,
1114 .get_group_map_from_ntname
= get_group_map_from_ntname
,
1115 .group_map_remove
= group_map_remove
,
1116 .enum_group_mapping
= enum_group_mapping
,
1117 .one_alias_membership
= one_alias_membership
,
1118 .add_aliasmem
= add_aliasmem
,
1119 .del_aliasmem
= del_aliasmem
,
1120 .enum_aliasmem
= enum_aliasmem
1124 initialise the tdb mapping backend
1126 const struct mapping_backend
*groupdb_tdb_init(void)
1128 if (!init_group_mapping()) {
1129 DEBUG(0,("Failed to initialise tdb mapping backend\n"));
1133 return &tdb_backend
;