Add include guards around idmap.h, change ID_NOMAP to ID_QUERY_ONLY
[vlendec/samba-autobuild/.git] / source3 / sam / idmap_tdb.c
1 /* 
2    Unix SMB/CIFS implementation.
3
4    idmap TDB backend
5
6    Copyright (C) Tim Potter 2000
7    Copyright (C) Anthony Liguori 2003
8    Copyright (C) Simo Sorce 2003
9    
10    This program is free software; you can redistribute it and/or modify
11    it under the terms of the GNU General Public License as published by
12    the Free Software Foundation; either version 2 of the License, or
13    (at your option) any later version.
14    
15    This program is distributed in the hope that it will be useful,
16    but WITHOUT ANY WARRANTY; without even the implied warranty of
17    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18    GNU General Public License for more details.
19    
20    You should have received a copy of the GNU General Public License
21    along with this program; if not, write to the Free Software
22    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 */
24
25 #include "includes.h"
26
27 #undef DBGC_CLASS
28 #define DBGC_CLASS DBGC_IDMAP
29
30 /* High water mark keys */
31 #define HWM_GROUP  "GROUP HWM"
32 #define HWM_USER   "USER HWM"
33
34 /* idmap version determines auto-conversion */
35 #define IDMAP_VERSION 2
36
37 /* Globals */
38 static TDB_CONTEXT *idmap_tdb;
39
40 static struct idmap_state {
41
42         /* User and group id pool */
43
44         uid_t uid_low, uid_high;               /* Range of uids to allocate */
45         gid_t gid_low, gid_high;               /* Range of gids to allocate */
46 } idmap_state;
47
48 /* Allocate either a user or group id from the pool */
49 static NTSTATUS db_allocate_id(unid_t *id, int id_type)
50 {
51         BOOL ret;
52         int hwm;
53
54         if (!id)
55                 return NT_STATUS_INVALID_PARAMETER;
56
57         /* Get current high water mark */
58         switch (id_type & ID_TYPEMASK) {
59                 case ID_USERID:
60
61                         if ((hwm = tdb_fetch_int32(idmap_tdb, HWM_USER)) == -1) {
62                                 return NT_STATUS_INTERNAL_DB_ERROR;
63                         }
64
65                         /* check it is in the range */
66                         if (hwm > idmap_state.uid_high) {
67                                 DEBUG(0, ("idmap Fatal Error: UID range full!! (max: %u)\n", idmap_state.uid_high));
68                                 return NT_STATUS_UNSUCCESSFUL;
69                         }
70
71                         /* fetch a new id and increment it */
72                         ret = tdb_change_uint32_atomic(idmap_tdb, HWM_USER, &hwm, 1);
73                         if (!ret) {
74                                 DEBUG(0, ("idmap_tdb: Fatal error while fetching a new id\n!"));
75                                 return NT_STATUS_UNSUCCESSFUL;
76                         }
77
78                         /* recheck it is in the range */
79                         if (hwm > idmap_state.uid_high) {
80                                 DEBUG(0, ("idmap Fatal Error: UID range full!! (max: %u)\n", idmap_state.uid_high));
81                                 return NT_STATUS_UNSUCCESSFUL;
82                         }
83                         
84                         (*id).uid = hwm;
85                         DEBUG(10,("db_allocate_id: ID_USERID (*id).uid = %d\n", (unsigned int)hwm));
86
87                         break;
88                 case ID_GROUPID:
89                         if ((hwm = tdb_fetch_int32(idmap_tdb, HWM_GROUP)) == -1) {
90                                 return NT_STATUS_INTERNAL_DB_ERROR;
91                         }
92
93                         /* check it is in the range */
94                         if (hwm > idmap_state.gid_high) {
95                                 DEBUG(0, ("idmap Fatal Error: GID range full!! (max: %u)\n", idmap_state.gid_high));
96                                 return NT_STATUS_UNSUCCESSFUL;
97                         }
98
99                         /* fetch a new id and increment it */
100                         ret = tdb_change_uint32_atomic(idmap_tdb, HWM_GROUP, &hwm, 1);
101
102                         if (!ret) {
103                                 DEBUG(0, ("idmap_tdb: Fatal error while fetching a new id\n!"));
104                                 return NT_STATUS_UNSUCCESSFUL;
105                         }
106
107                         /* recheck it is in the range */
108                         if (hwm > idmap_state.gid_high) {
109                                 DEBUG(0, ("idmap Fatal Error: GID range full!! (max: %u)\n", idmap_state.gid_high));
110                                 return NT_STATUS_UNSUCCESSFUL;
111                         }
112                         
113                         (*id).gid = hwm;
114                         DEBUG(10,("db_allocate_id: ID_GROUPID (*id).uid = %d\n", (unsigned int)hwm));
115                         
116                         break;
117                 default:
118                         return NT_STATUS_INVALID_PARAMETER;
119         }
120
121         return NT_STATUS_OK;
122 }
123
124 /* Get a sid from an id */
125 static NTSTATUS internal_get_sid_from_id(DOM_SID *sid, unid_t id, int id_type)
126 {
127         TDB_DATA key, data;
128         fstring keystr;
129         NTSTATUS ret = NT_STATUS_UNSUCCESSFUL;
130
131         if (!sid)
132                 return NT_STATUS_INVALID_PARAMETER;
133
134         switch (id_type & ID_TYPEMASK) {
135                 case ID_USERID:
136                         slprintf(keystr, sizeof(keystr), "UID %d", id.uid);
137                         break;
138                 case ID_GROUPID:
139                         slprintf(keystr, sizeof(keystr), "GID %d", id.gid);
140                         break;
141                 default:
142                         return NT_STATUS_UNSUCCESSFUL;
143         }
144
145         key.dptr = keystr;
146         key.dsize = strlen(keystr) + 1;
147
148         DEBUG(10,("internal_get_sid_from_id: fetching record %s\n", keystr ));
149
150         data = tdb_fetch(idmap_tdb, key);
151
152         if (data.dptr) {
153                 if (string_to_sid(sid, data.dptr)) {
154                         DEBUG(10,("internal_get_sid_from_id: fetching record %s -> %s\n", keystr, data.dptr ));
155                         ret = NT_STATUS_OK;
156                 }
157                 SAFE_FREE(data.dptr);
158         }
159
160         return ret;
161 }
162
163 /* Error codes for get_id_from_sid */
164 enum getidfromsiderr { GET_ID_FROM_SID_OK = 0, GET_ID_FROM_SID_NOTFOUND, GET_ID_FROM_SID_WRONG_TYPE, GET_ID_FROM_SID_ERR };
165
166 static enum getidfromsiderr internal_get_id_from_sid(unid_t *id, int *id_type, const DOM_SID *sid) 
167 {
168         enum getidfromsiderr ret = GET_ID_FROM_SID_ERR;
169         fstring keystr;
170         TDB_DATA key, data;
171         int type = *id_type & ID_TYPEMASK;
172
173         /* Check if sid is present in database */
174         sid_to_string(keystr, sid);
175
176         key.dptr = keystr;
177         key.dsize = strlen(keystr) + 1;
178
179         DEBUG(10,("internal_get_id_from_sid: fetching record %s of type 0x%x\n", keystr, type ));
180
181         data = tdb_fetch(idmap_tdb, key);
182         if (!data.dptr) {
183                 DEBUG(10,("internal_get_id_from_sid: record %s not found\n", keystr ));
184                 return GET_ID_FROM_SID_NOTFOUND;
185         } else {
186                 DEBUG(10,("internal_get_id_from_sid: record %s -> %s\n", keystr, data.dptr ));
187         }
188
189         if (type == ID_EMPTY || type == ID_USERID) {
190                 fstring scanstr;
191                 /* Parse and return existing uid */
192                 fstrcpy(scanstr, "UID %d");
193                 
194                 if (sscanf(data.dptr, scanstr, &((*id).uid)) == 1) {
195                         /* uid ok? */
196                         if (type == ID_EMPTY) {
197                                 *id_type = ID_USERID;
198                         }
199                         DEBUG(10,("internal_get_id_from_sid: %s fetching record %s -> %s \n",
200                                                 (type == ID_EMPTY) ? "ID_EMPTY" : "ID_USERID",
201                                                 keystr, data.dptr ));
202                         ret = GET_ID_FROM_SID_OK;
203                 } else {
204                         ret = GET_ID_FROM_SID_WRONG_TYPE;
205                 }
206         }
207         
208         if ((ret != GET_ID_FROM_SID_OK) && (type == ID_EMPTY || type == ID_GROUPID)) {
209                 fstring scanstr;
210                 /* Parse and return existing gid */
211                 fstrcpy(scanstr, "GID %d");
212                 
213                 if (sscanf(data.dptr, scanstr, &((*id).gid)) == 1) {
214                         /* gid ok? */
215                         if (type == ID_EMPTY) {
216                                 *id_type = ID_GROUPID;
217                         }
218                         DEBUG(10,("internal_get_id_from_sid: %s fetching record %s -> %s \n",
219                                                 (type == ID_EMPTY) ? "ID_EMPTY" : "ID_GROUPID",
220                                                 keystr, data.dptr ));
221                         ret = GET_ID_FROM_SID_OK;
222                 } else {
223                         ret = GET_ID_FROM_SID_WRONG_TYPE;
224                 }
225         }
226         
227         SAFE_FREE(data.dptr);
228
229         return ret;
230 }
231
232 /* Get a sid from an id */
233 static NTSTATUS db_get_sid_from_id(DOM_SID *sid, unid_t id, int id_type_in)
234 {
235         NTSTATUS ret = NT_STATUS_UNSUCCESSFUL;
236         enum getidfromsiderr iderr;
237         int id_type = id_type_in & ID_TYPEMASK;
238         unid_t id_tmp = id;
239         int id_type_tmp = id_type;
240
241         DEBUG(10,("db_get_sid_from_id: id_type_in = 0x%x\n", id_type_in));
242
243         ret = internal_get_sid_from_id(sid, id, id_type);
244         if (!NT_STATUS_IS_OK(ret)) {
245                 return ret;
246         }
247         
248         iderr = internal_get_id_from_sid(&id_tmp, &id_type_tmp, sid);
249         if (iderr != GET_ID_FROM_SID_OK) {
250                 return NT_STATUS_UNSUCCESSFUL;
251         }
252         if (id_type_tmp != id_type) {
253                 return NT_STATUS_UNSUCCESSFUL;
254         } else if (id_type == ID_USERID) { 
255                 if (id_tmp.uid != id.uid) {
256                         return NT_STATUS_UNSUCCESSFUL;
257                 }
258         } else if (id_type == ID_GROUPID) {
259                 if (id_tmp.gid != id.gid) {
260                         return NT_STATUS_UNSUCCESSFUL;
261                 }
262         } else {
263                 return NT_STATUS_UNSUCCESSFUL;
264         }
265         return ret;
266 }
267 /* Get an id from a sid */
268 static NTSTATUS db_get_id_from_sid(unid_t *id, int *id_type, const DOM_SID *sid)
269 {
270         NTSTATUS ret = NT_STATUS_UNSUCCESSFUL;
271         enum getidfromsiderr iderr;
272
273         DEBUG(10,("db_get_id_from_sid\n"));
274
275         if (!sid || !id || !id_type)
276                 return NT_STATUS_INVALID_PARAMETER;
277
278         iderr = internal_get_id_from_sid(id, id_type, sid);
279         if (iderr == GET_ID_FROM_SID_OK) {
280                 DOM_SID sid_tmp;
281                 ret = internal_get_sid_from_id(&sid_tmp, *id, *id_type);
282                 if (NT_STATUS_IS_OK(ret)) {
283                         if (!sid_equal(&sid_tmp, sid)) {
284                                 return NT_STATUS_UNSUCCESSFUL;
285                         }
286                 }
287         } else if (iderr == GET_ID_FROM_SID_WRONG_TYPE) {
288                 /* We found a record but not the type we wanted.
289                  * This is an error, not an opportunity to overwrite...
290                  * JRA.
291                  */
292                 return NT_STATUS_UNSUCCESSFUL;
293         }
294
295         if (!(*id_type & ID_QUERY_ONLY) && (iderr != GET_ID_FROM_SID_OK) &&
296                    (((*id_type & ID_TYPEMASK) == ID_USERID)
297                     || (*id_type & ID_TYPEMASK) == ID_GROUPID)) {
298                 TDB_DATA sid_data;
299                 TDB_DATA ugid_data;
300                 fstring sid_string;
301                 
302                 sid_to_string(sid_string, sid);
303                 
304                 sid_data.dptr = sid_string;
305                 sid_data.dsize = strlen(sid_string)+1;
306
307                 /* Lock the record for this SID. */
308                 if (tdb_chainlock(idmap_tdb, sid_data) != 0) {
309                         DEBUG(10,("db_get_id_from_sid: failed to lock record %s. Error %s\n",
310                                         sid_string, tdb_errorstr(idmap_tdb) ));
311                         return NT_STATUS_UNSUCCESSFUL;
312                 }
313
314                 do {
315                         fstring ugid_str;
316
317                         /* Allocate a new id for this sid */
318                         ret = db_allocate_id(id, *id_type);
319                         if (!NT_STATUS_IS_OK(ret))
320                                 break;
321                         
322                         /* Store the UID side */
323                         /* Store new id */
324                         if (*id_type & ID_USERID) {
325                                 slprintf(ugid_str, sizeof(ugid_str), "UID %d", (*id).uid);
326                         } else {
327                                 slprintf(ugid_str, sizeof(ugid_str), "GID %d", (*id).gid);
328                         }
329                         
330                         ugid_data.dptr = ugid_str;
331                         ugid_data.dsize = strlen(ugid_str) + 1;
332
333                         DEBUG(10,("db_get_id_from_sid: storing %s -> %s\n",
334                                         ugid_data.dptr, sid_data.dptr ));
335
336                         if (tdb_store(idmap_tdb, ugid_data, sid_data, TDB_INSERT) != -1) {
337                                 ret = NT_STATUS_OK;
338                                 break;
339                         }
340                         if (tdb_error(idmap_tdb) != TDB_ERR_EXISTS)
341                                 DEBUG(10,("db_get_id_from_sid: error %s\n", tdb_errorstr(idmap_tdb) ));
342                         ret = NT_STATUS_UNSUCCESSFUL;
343                 } while (tdb_error(idmap_tdb) == TDB_ERR_EXISTS);
344
345                 if (NT_STATUS_IS_OK(ret)) {
346
347                         DEBUG(10,("db_get_id_from_sid: storing %s -> %s\n",
348                                 sid_data.dptr, ugid_data.dptr ));
349
350                         if (tdb_store(idmap_tdb, sid_data, ugid_data, TDB_REPLACE) == -1) {
351                                 DEBUG(10,("db_get_id_from_sid: error %s\n", tdb_errorstr(idmap_tdb) ));
352                                 /* TODO: print tdb error !! */
353                                 tdb_chainunlock(idmap_tdb, sid_data);
354                                 return NT_STATUS_UNSUCCESSFUL;
355                         }
356                 }
357
358                 tdb_chainunlock(idmap_tdb, sid_data);
359         }
360         
361         return ret;
362 }
363
364 static NTSTATUS db_set_mapping(const DOM_SID *sid, unid_t id, int id_type)
365 {
366         TDB_DATA ksid, kid, data;
367         fstring ksidstr;
368         fstring kidstr;
369
370         DEBUG(10,("db_set_mapping: id_type = 0x%x\n", id_type));
371
372         if (!sid)
373                 return NT_STATUS_INVALID_PARAMETER;
374
375         sid_to_string(ksidstr, sid);
376
377         ksid.dptr = ksidstr;
378         ksid.dsize = strlen(ksidstr) + 1;
379
380         if (id_type & ID_USERID) {
381                 slprintf(kidstr, sizeof(kidstr), "UID %d", id.uid);
382         } else if (id_type & ID_GROUPID) {
383                 slprintf(kidstr, sizeof(kidstr), "GID %d", id.gid);
384         } else {
385                 return NT_STATUS_INVALID_PARAMETER;
386         }
387
388         kid.dptr = kidstr;
389         kid.dsize = strlen(kidstr) + 1;
390
391         /* *DELETE* prevoius mappings if any.
392          * This is done both SID and [U|G]ID passed in */
393         
394         /* Lock the record for this SID. */
395         if (tdb_chainlock(idmap_tdb, ksid) != 0) {
396                 DEBUG(10,("db_get_id_from_sid: failed to lock record %s. Error %s\n",
397                                 ksidstr, tdb_errorstr(idmap_tdb) ));
398                 return NT_STATUS_UNSUCCESSFUL;
399         }
400
401         DEBUG(10,("db_set_mapping: fetching %s\n", ksid.dptr));
402
403         data = tdb_fetch(idmap_tdb, ksid);
404         if (data.dptr) {
405                 DEBUG(10,("db_set_mapping: deleting %s and %s\n", data.dptr, ksid.dptr ));
406                 tdb_delete(idmap_tdb, data);
407                 tdb_delete(idmap_tdb, ksid);
408                 SAFE_FREE(data.dptr);
409         }
410         data = tdb_fetch(idmap_tdb, kid);
411         if (data.dptr) {
412                 DEBUG(10,("db_set_mapping: deleting %s and %s\n", data.dptr, kid.dptr ));
413                 tdb_delete(idmap_tdb, data);
414                 tdb_delete(idmap_tdb, kid);
415                 SAFE_FREE(data.dptr);
416         }
417
418         if (tdb_store(idmap_tdb, ksid, kid, TDB_INSERT) == -1) {
419                 DEBUG(0, ("idb_set_mapping: tdb_store 1 error: %s\n", tdb_errorstr(idmap_tdb)));
420                 tdb_chainunlock(idmap_tdb, ksid);
421                 return NT_STATUS_UNSUCCESSFUL;
422         }
423         if (tdb_store(idmap_tdb, kid, ksid, TDB_INSERT) == -1) {
424                 DEBUG(0, ("idb_set_mapping: tdb_store 2 error: %s\n", tdb_errorstr(idmap_tdb)));
425                 tdb_chainunlock(idmap_tdb, ksid);
426                 return NT_STATUS_UNSUCCESSFUL;
427         }
428
429         tdb_chainunlock(idmap_tdb, ksid);
430         DEBUG(10,("db_set_mapping: stored %s -> %s and %s -> %s\n", ksid.dptr, kid.dptr, kid.dptr, ksid.dptr ));
431         return NT_STATUS_OK;
432 }
433
434 /*****************************************************************************
435  Initialise idmap database. 
436 *****************************************************************************/
437
438 static NTSTATUS db_idmap_init( char *params )
439 {
440         SMB_STRUCT_STAT stbuf;
441         char *tdbfile = NULL;
442         int32 version;
443         BOOL tdb_is_new = False;
444
445         /* use the old database if present */
446         tdbfile = strdup(lock_path("winbindd_idmap.tdb"));
447         if (!tdbfile) {
448                 DEBUG(0, ("idmap_init: out of memory!\n"));
449                 return NT_STATUS_NO_MEMORY;
450         }
451
452         if (!file_exist(tdbfile, &stbuf)) {
453                 tdb_is_new = True;
454         }
455
456         DEBUG(10,("db_idmap_init: Opening tdbfile %s\n", tdbfile ));
457
458         /* Open idmap repository */
459         if (!(idmap_tdb = tdb_open_log(tdbfile, 0,
460                                        TDB_DEFAULT, O_RDWR | O_CREAT,
461                                        0644))) {
462                 DEBUG(0, ("idmap_init: Unable to open idmap database\n"));
463                 SAFE_FREE(tdbfile);
464                 return NT_STATUS_UNSUCCESSFUL;
465         }
466
467         SAFE_FREE(tdbfile);
468
469         if (tdb_is_new) {
470                 /* the file didn't existed before opening it, let's
471                  * store idmap version as nobody else yet opened and
472                  * stored it. I do not like this method but didn't
473                  * found a way to understand if an opened tdb have
474                  * been just created or not --- SSS */
475                 tdb_store_int32(idmap_tdb, "IDMAP_VERSION", IDMAP_VERSION);
476         }
477
478         /* check against earlier versions */
479         version = tdb_fetch_int32(idmap_tdb, "IDMAP_VERSION");
480         if (version != IDMAP_VERSION) {
481                 DEBUG(0, ("idmap_init: Unable to open idmap database, it's in an old format!\n"));
482                 return NT_STATUS_INTERNAL_DB_ERROR;
483         }
484
485         /* Create high water marks for group and user id */
486         if (!lp_idmap_uid(&idmap_state.uid_low, &idmap_state.uid_high)) {
487                 DEBUG(1, ("idmap uid range missing or invalid\n"));
488                 DEBUGADD(1, ("idmap will be unable to map foreign SIDs\n"));
489         } else {
490                 if (tdb_fetch_int32(idmap_tdb, HWM_USER) == -1) {
491                         if (tdb_store_int32(idmap_tdb, HWM_USER, idmap_state.uid_low) == -1) {
492                                 DEBUG(0, ("idmap_init: Unable to initialise user hwm in idmap database\n"));
493                                 return NT_STATUS_INTERNAL_DB_ERROR;
494                         }
495                 }
496         }
497
498         if (!lp_idmap_gid(&idmap_state.gid_low, &idmap_state.gid_high)) {
499                 DEBUG(1, ("idmap gid range missing or invalid\n"));
500                 DEBUGADD(1, ("idmap will be unable to map foreign SIDs\n"));
501         } else {
502                 if (tdb_fetch_int32(idmap_tdb, HWM_GROUP) == -1) {
503                         if (tdb_store_int32(idmap_tdb, HWM_GROUP, idmap_state.gid_low) == -1) {
504                                 DEBUG(0, ("idmap_init: Unable to initialise group hwm in idmap database\n"));
505                                 return NT_STATUS_INTERNAL_DB_ERROR;
506                         }
507                 }
508         }
509
510         return NT_STATUS_OK;
511 }
512
513 /* Close the tdb */
514 static NTSTATUS db_idmap_close(void)
515 {
516         if (idmap_tdb) {
517                 if (tdb_close(idmap_tdb) == 0) {
518                         return NT_STATUS_OK;
519                 } else {
520                         return NT_STATUS_UNSUCCESSFUL;
521                 }
522         }
523         return NT_STATUS_OK;
524 }
525
526
527 /* Dump status information to log file.  Display different stuff based on
528    the debug level:
529
530    Debug Level        Information Displayed
531    =================================================================
532    0                  Percentage of [ug]id range allocated
533    0                  High water marks (next allocated ids)
534 */
535
536 #define DUMP_INFO 0
537
538 static void db_idmap_status(void)
539 {
540         int user_hwm, group_hwm;
541
542         DEBUG(0, ("winbindd idmap status:\n"));
543
544         /* Get current high water marks */
545
546         if ((user_hwm = tdb_fetch_int32(idmap_tdb, HWM_USER)) == -1) {
547                 DEBUG(DUMP_INFO,
548                       ("\tCould not get userid high water mark!\n"));
549         }
550
551         if ((group_hwm = tdb_fetch_int32(idmap_tdb, HWM_GROUP)) == -1) {
552                 DEBUG(DUMP_INFO,
553                       ("\tCould not get groupid high water mark!\n"));
554         }
555
556         /* Display next ids to allocate */
557
558         if (user_hwm != -1) {
559                 DEBUG(DUMP_INFO,
560                       ("\tNext userid to allocate is %d\n", user_hwm));
561         }
562
563         if (group_hwm != -1) {
564                 DEBUG(DUMP_INFO,
565                       ("\tNext groupid to allocate is %d\n", group_hwm));
566         }
567
568         /* Display percentage of id range already allocated. */
569
570         if (user_hwm != -1) {
571                 int num_users = user_hwm - idmap_state.uid_low;
572                 int total_users =
573                     idmap_state.uid_high - idmap_state.uid_low;
574
575                 DEBUG(DUMP_INFO,
576                       ("\tUser id range is %d%% full (%d of %d)\n",
577                        num_users * 100 / total_users, num_users,
578                        total_users));
579         }
580
581         if (group_hwm != -1) {
582                 int num_groups = group_hwm - idmap_state.gid_low;
583                 int total_groups =
584                     idmap_state.gid_high - idmap_state.gid_low;
585
586                 DEBUG(DUMP_INFO,
587                       ("\tGroup id range is %d%% full (%d of %d)\n",
588                        num_groups * 100 / total_groups, num_groups,
589                        total_groups));
590         }
591
592         /* Display complete mapping of users and groups to rids */
593 }
594
595 static struct idmap_methods db_methods = {
596
597         db_idmap_init,
598         db_get_sid_from_id,
599         db_get_id_from_sid,
600         db_set_mapping,
601         db_idmap_close,
602         db_idmap_status
603
604 };
605
606 NTSTATUS idmap_tdb_init(void)
607 {
608         return smb_register_idmap(SMB_IDMAP_INTERFACE_VERSION, "tdb", &db_methods);
609 }