idmap_autorid: move the checks from idmap_autorid_initialize to idmap_autorid_savecon...
[obnox/samba/samba-obnox.git] / source3 / winbindd / idmap_autorid.c
1 /*
2  *  idmap_autorid: static map between Active Directory/NT RIDs
3  *  and RFC 2307 accounts
4  *
5  *  based on the idmap_rid module, but this module defines the ranges
6  *  for the domains by automatically allocating a range for each domain
7  *
8  *  Copyright (C) Christian Ambach, 2010-2012
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 3 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, see <http://www.gnu.org/licenses/>.
22  *
23  */
24
25 /*
26  * This module allocates ranges for domains to be used in a
27  * algorithmic mode like idmap_rid. Multiple ranges are supported
28  * for a single domain: If a rid exceeds the range size, a matching
29  * range is allocated to hold the rid's id.
30  *
31  * Here are the formulas applied:
32  *
33  *
34  * For a sid of the form domain_sid-rid, we have
35  *
36  *   rid = reduced_rid + domain_range_index * range_size
37  *
38  * with
39  *   reduced_rid := rid % range_size
40  *   domain_range_index := rid / range_size
41  *
42  * And reduced_rid fits into a range.
43  *
44  * In the database, we associate a range_number to
45  * the pair domain_sid,domain_range_index.
46  *
47  * Now the unix id for the given sid calculates as:
48  *
49  *   id = reduced_rid + range_low_id
50  *
51  * with
52  *
53  *   range_low_id = low_id + range_number * range_size
54  *
55  *
56  * The inverse calculation goes like this:
57  *
58  * Given a unix id, let
59  *
60  *   normalized_id := id - low_id
61  *   reduced_rid := normalized_id % range_size
62  *   range_number = normalized_id / range_size
63  *
64  * Then we have
65  *
66  *   id = reduced_rid + low_id + range_number * range_size
67  *
68  * From the database, get the domain_sid,domain_range_index pair
69  * belonging to the range_number (if there is already one).
70  *
71  * Then the rid for the unix id calculates as:
72  *
73  *   rid = reduced_rid + domain_range_index * range_size
74  */
75
76 #include "idmap_autorid.h"
77 #include "winbindd.h"
78 #include "idmap.h"
79 #include "idmap_rw.h"
80 #include "../libcli/security/dom_sid.h"
81
82 #undef DBGC_CLASS
83 #define DBGC_CLASS DBGC_IDMAP
84
85 /* handle to the tdb storing domain <-> range assignments */
86 static struct db_context *autorid_db;
87
88 static bool ignore_builtin = false;
89
90 static NTSTATUS idmap_autorid_allocate_id(struct idmap_domain *dom,
91                                           struct unixid *xid) {
92
93         NTSTATUS ret;
94         struct idmap_tdb_common_context *commoncfg;
95         struct autorid_global_config *globalcfg;
96         struct autorid_range_config range;
97
98         commoncfg =
99             talloc_get_type_abort(dom->private_data,
100                                   struct idmap_tdb_common_context);
101
102         globalcfg = talloc_get_type(commoncfg->private_data,
103                                     struct autorid_global_config);
104
105         if (dom->read_only) {
106                 DEBUG(3, ("Backend is read-only, refusing "
107                           "new allocation request\n"));
108                 return NT_STATUS_UNSUCCESSFUL;
109         }
110
111         /* fetch the range for the allocation pool */
112
113         ZERO_STRUCT(range);
114
115         range.globalcfg = globalcfg;
116         fstrcpy(range.domsid, ALLOC_RANGE);
117
118         ret = idmap_autorid_get_domainrange(autorid_db, &range, dom->read_only);
119
120         if (!NT_STATUS_IS_OK(ret)) {
121                 DEBUG(3, ("Could not determine range for allocation pool, "
122                           "check previous messages for reason\n"));
123                 return ret;
124         }
125
126         ret = idmap_tdb_common_get_new_id(dom, xid);
127
128         if (!NT_STATUS_IS_OK(ret)) {
129                 DEBUG(1, ("Fatal error while allocating new ID!\n"));
130                 return ret;
131         }
132
133         xid->id = xid->id + range.low_id;
134
135         DEBUG(10, ("Returned new %s %d from allocation range\n",
136                    (xid->type==ID_TYPE_UID)?"uid":"gid", xid->id));
137
138         return ret;
139 }
140
141 /*
142  * map a SID to xid using the idmap_tdb like pool
143  */
144 static NTSTATUS idmap_autorid_map_id_to_sid(struct idmap_domain *dom,
145                                             struct id_map *map)
146 {
147         NTSTATUS ret;
148
149         /* look out for the mapping */
150         ret = idmap_tdb_common_unixid_to_sid(dom, map);
151
152         if (NT_STATUS_IS_OK(ret)) {
153                 map->status = ID_MAPPED;
154                 return ret;
155         }
156
157         map->status = ID_UNKNOWN;
158
159         DEBUG(10, ("no ID->SID mapping for %d could be found\n", map->xid.id));
160
161         return ret;
162 }
163
164 static NTSTATUS idmap_autorid_id_to_sid(struct autorid_global_config *cfg,
165                                         struct idmap_domain *dom,
166                                         struct id_map *map)
167 {
168         uint32_t range_number;
169         uint32_t domain_range_index = 0;
170         uint32_t normalized_id;
171         uint32_t reduced_rid;
172         uint32_t rid;
173         TDB_DATA data = tdb_null;
174         char *keystr;
175         struct dom_sid domsid;
176         NTSTATUS status;
177         bool ok;
178         const char *q = NULL;
179
180         /* can this be one of our ids? */
181         if (map->xid.id < cfg->minvalue) {
182                 DEBUG(10, ("id %d is lower than minimum value, "
183                            "ignoring mapping request\n", map->xid.id));
184                 map->status = ID_UNKNOWN;
185                 return NT_STATUS_OK;
186         }
187
188         if (map->xid.id > (cfg->minvalue + cfg->rangesize * cfg->maxranges)) {
189                 DEBUG(10, ("id %d is outside of maximum id value, "
190                            "ignoring mapping request\n", map->xid.id));
191                 map->status = ID_UNKNOWN;
192                 return NT_STATUS_OK;
193         }
194
195         /* determine the range of this uid */
196
197         normalized_id = map->xid.id - cfg->minvalue;
198         range_number = normalized_id / cfg->rangesize;
199
200         keystr = talloc_asprintf(talloc_tos(), "%u", range_number);
201         if (!keystr) {
202                 return NT_STATUS_NO_MEMORY;
203         }
204
205         status = dbwrap_fetch_bystring(autorid_db, talloc_tos(), keystr, &data);
206         TALLOC_FREE(keystr);
207
208         if (!NT_STATUS_IS_OK(status)) {
209                 DEBUG(4, ("id %d belongs to range %d which does not have "
210                           "domain mapping, ignoring mapping request\n",
211                           map->xid.id, range_number));
212                 TALLOC_FREE(data.dptr);
213                 map->status = ID_UNKNOWN;
214                 return NT_STATUS_OK;
215         }
216
217         if (strncmp((const char *)data.dptr,
218                     ALLOC_RANGE,
219                     strlen(ALLOC_RANGE)) == 0) {
220                 /*
221                  * this is from the alloc range, check if there is a mapping
222                  */
223                 DEBUG(5, ("id %d belongs to allocation range, "
224                           "checking for mapping\n",
225                           map->xid.id));
226                 TALLOC_FREE(data.dptr);
227                 return idmap_autorid_map_id_to_sid(dom, map);
228         }
229
230         ok = dom_sid_parse_endp((const char *)data.dptr, &domsid, &q);
231         TALLOC_FREE(data.dptr);
232         if (!ok) {
233                 map->status = ID_UNKNOWN;
234                 return NT_STATUS_OK;
235         }
236         if (q != NULL)
237                 if (sscanf(q+1, "%"SCNu32, &domain_range_index) != 1) {
238                         DEBUG(10, ("Domain range index not found, "
239                                    "ignoring mapping request\n"));
240                         map->status = ID_UNKNOWN;
241                         return NT_STATUS_OK;
242                 }
243
244         reduced_rid = normalized_id % cfg->rangesize;
245         rid = reduced_rid + domain_range_index * cfg->rangesize;
246
247         sid_compose(map->sid, &domsid, rid);
248
249         /* We **really** should have some way of validating
250            the SID exists and is the correct type here.  But
251            that is a deficiency in the idmap_rid design. */
252
253         map->status = ID_MAPPED;
254         map->xid.type = ID_TYPE_BOTH;
255
256         return NT_STATUS_OK;
257 }
258
259 /**********************************
260  Single sid to id lookup function.
261 **********************************/
262
263 static NTSTATUS idmap_autorid_sid_to_id(struct autorid_global_config *global,
264                                         struct autorid_range_config *range,
265                                         struct id_map *map)
266 {
267         uint32_t rid;
268         uint32_t reduced_rid;
269
270         sid_peek_rid(map->sid, &rid);
271
272         reduced_rid = rid % global->rangesize;
273
274         map->xid.id = reduced_rid + range->low_id;
275         map->xid.type = ID_TYPE_BOTH;
276
277         /* We **really** should have some way of validating
278            the SID exists and is the correct type here.  But
279            that is a deficiency in the idmap_rid design. */
280
281         map->status = ID_MAPPED;
282
283         return NT_STATUS_OK;
284 }
285
286 /**********************************
287  lookup a set of unix ids.
288 **********************************/
289
290 static NTSTATUS idmap_autorid_unixids_to_sids(struct idmap_domain *dom,
291                                               struct id_map **ids)
292 {
293         struct idmap_tdb_common_context *commoncfg;
294         struct autorid_global_config *globalcfg;
295         NTSTATUS ret;
296         int i;
297         int num_tomap = 0;
298         int num_mapped = 0;
299
300         /* initialize the status to avoid surprise */
301         for (i = 0; ids[i]; i++) {
302                 ids[i]->status = ID_UNKNOWN;
303                 num_tomap++;
304         }
305
306         commoncfg =
307             talloc_get_type_abort(dom->private_data,
308                                   struct idmap_tdb_common_context);
309
310         globalcfg = talloc_get_type(commoncfg->private_data,
311                                     struct autorid_global_config);
312
313         for (i = 0; ids[i]; i++) {
314
315                 ret = idmap_autorid_id_to_sid(globalcfg, dom, ids[i]);
316
317                 if ((!NT_STATUS_IS_OK(ret)) &&
318                     (!NT_STATUS_EQUAL(ret, NT_STATUS_NONE_MAPPED))) {
319                         /* some fatal error occurred, log it */
320                         DEBUG(3, ("Unexpected error resolving an ID "
321                                   " (%d)\n", ids[i]->xid.id));
322                         goto failure;
323                 }
324
325                 if (NT_STATUS_IS_OK(ret) && ids[i]->status == ID_MAPPED) {
326                         num_mapped++;
327                 }
328
329         }
330
331         if (num_tomap == num_mapped) {
332                 return NT_STATUS_OK;
333         } else if (num_mapped == 0) {
334                 return NT_STATUS_NONE_MAPPED;
335         }
336
337         return STATUS_SOME_UNMAPPED;
338
339
340       failure:
341         return ret;
342 }
343
344 /*
345  * map a SID to xid using the idmap_tdb like pool
346  */
347 static NTSTATUS idmap_autorid_map_sid_to_id(struct idmap_domain *dom,
348                                             struct id_map *map,
349                                             struct idmap_tdb_common_context *ctx)
350 {
351         NTSTATUS ret;
352         int res;
353
354         /* see if we already have a mapping */
355         ret = idmap_tdb_common_sid_to_unixid(dom, map);
356
357         if (NT_STATUS_IS_OK(ret)) {
358                 map->status = ID_MAPPED;
359                 return ret;
360         }
361
362         /* bad things happened */
363         if (!NT_STATUS_EQUAL(ret, NT_STATUS_NONE_MAPPED)) {
364                 DEBUG(1, ("Looking up SID->ID mapping for %s failed\n",
365                           sid_string_dbg(map->sid)));
366                 return ret;
367         }
368
369         if (dom->read_only) {
370                 DEBUG(3, ("Not allocating new mapping for %s, because backend "
371                           "is read-only\n", sid_string_dbg(map->sid)));
372                 return NT_STATUS_NONE_MAPPED;
373         }
374
375         DEBUG(10, ("Creating new mapping in pool for %s\n",
376                    sid_string_dbg(map->sid)));
377
378         /* create new mapping */
379         res = dbwrap_transaction_start(ctx->db);
380         if (res != 0) {
381                 DEBUG(2, ("transaction_start failed\n"));
382                 return NT_STATUS_INTERNAL_DB_CORRUPTION;
383         }
384
385         ret = idmap_tdb_common_new_mapping(dom, map);
386
387         map->status = (NT_STATUS_IS_OK(ret))?ID_MAPPED:ID_UNMAPPED;
388
389         if (!NT_STATUS_IS_OK(ret)) {
390                 if (dbwrap_transaction_cancel(ctx->db) != 0) {
391                         smb_panic("Cancelling transaction failed");
392                 }
393                 return ret;
394         }
395
396         res = dbwrap_transaction_commit(ctx->db);
397         if (res == 0) {
398                 return ret;
399         }
400
401         DEBUG(2, ("transaction_commit failed\n"));
402         return NT_STATUS_INTERNAL_DB_CORRUPTION;
403
404 }
405
406 /**********************************
407  lookup a set of sids.
408 **********************************/
409
410 static NTSTATUS idmap_autorid_sids_to_unixids(struct idmap_domain *dom,
411                                               struct id_map **ids)
412 {
413         struct idmap_tdb_common_context *commoncfg;
414         struct autorid_global_config *global;
415         NTSTATUS ret;
416         int i;
417         int num_tomap = 0;
418         int num_mapped = 0;
419
420         /* initialize the status to avoid surprise */
421         for (i = 0; ids[i]; i++) {
422                 ids[i]->status = ID_UNKNOWN;
423                 num_tomap++;
424         }
425
426         commoncfg =
427             talloc_get_type_abort(dom->private_data,
428                                   struct idmap_tdb_common_context);
429
430         global = talloc_get_type(commoncfg->private_data,
431                                  struct autorid_global_config);
432
433         for (i = 0; ids[i]; i++) {
434                 struct winbindd_tdc_domain *domain;
435                 struct autorid_range_config range;
436                 uint32_t rid;
437                 struct dom_sid domainsid;
438
439                 ZERO_STRUCT(range);
440
441                 DEBUG(10, ("Trying to map %s\n", sid_string_dbg(ids[i]->sid)));
442
443                 sid_copy(&domainsid, ids[i]->sid);
444                 if (!sid_split_rid(&domainsid, &rid)) {
445                         DEBUG(4, ("Could not determine domain SID from %s, "
446                                   "ignoring mapping request\n",
447                                   sid_string_dbg(ids[i]->sid)));
448                         continue;
449                 }
450
451                 /* is this a well-known SID? */
452
453                 if (sid_check_is_wellknown_domain(&domainsid, NULL)) {
454
455                         DEBUG(10, ("SID %s is well-known, using pool\n",
456                                    sid_string_dbg(ids[i]->sid)));
457
458                         ret = idmap_autorid_map_sid_to_id(dom, ids[i],
459                                                           commoncfg);
460
461                         if (!NT_STATUS_IS_OK(ret) &&
462                             !NT_STATUS_EQUAL(ret, NT_STATUS_NONE_MAPPED)) {
463                                 DEBUG(3, ("Unexpected error resolving "
464                                           "SID (%s)\n",
465                                           sid_string_dbg(ids[i]->sid)));
466                                 goto failure;
467                         }
468
469                         if (ids[i]->status == ID_MAPPED) {
470                                 num_mapped++;
471                         }
472
473                         continue;
474                 }
475
476                 /* BUILTIN is passdb's job */
477                 if (dom_sid_equal(&domainsid, &global_sid_Builtin) &&
478                     ignore_builtin) {
479                         DEBUG(10, ("Ignoring request for BUILTIN domain\n"));
480                         continue;
481                 }
482
483                 /*
484                  * Check if the domain is around
485                  */
486                 domain = wcache_tdc_fetch_domainbysid(talloc_tos(),
487                                                       &domainsid);
488                 if (domain == NULL) {
489                         DEBUG(10, ("Ignoring unknown domain sid %s\n",
490                                    sid_string_dbg(&domainsid)));
491                         continue;
492                 }
493                 TALLOC_FREE(domain);
494
495                 range.globalcfg = global;
496                 sid_to_fstring(range.domsid, &domainsid);
497
498                 /* Calculate domain_range_index for multi-range support */
499                 range.domain_range_index = rid / (global->rangesize);
500
501                 ret = idmap_autorid_get_domainrange(autorid_db, &range,
502                                                     dom->read_only);
503
504                 /* read-only mode and a new domain range would be required? */
505                 if (NT_STATUS_EQUAL(ret, NT_STATUS_NOT_FOUND) &&
506                     dom->read_only) {
507                         DEBUG(10, ("read-only is enabled, did not allocate "
508                                    "new range for domain %s\n",
509                                    sid_string_dbg(&domainsid)));
510                         continue;
511                 }
512
513                 if (!NT_STATUS_IS_OK(ret)) {
514                         DEBUG(3, ("Could not determine range for domain, "
515                                   "check previous messages for reason\n"));
516                         goto failure;
517                 }
518
519                 ret = idmap_autorid_sid_to_id(global, &range, ids[i]);
520
521                 if ((!NT_STATUS_IS_OK(ret)) &&
522                     (!NT_STATUS_EQUAL(ret, NT_STATUS_NONE_MAPPED))) {
523                         /* some fatal error occurred, log it */
524                         DEBUG(3, ("Unexpected error resolving a SID (%s)\n",
525                                   sid_string_dbg(ids[i]->sid)));
526                         goto failure;
527                 }
528
529                 if (NT_STATUS_IS_OK(ret)) {
530                         num_mapped++;
531                 }
532         }
533
534         if (num_tomap == num_mapped) {
535                 return NT_STATUS_OK;
536         } else if (num_mapped == 0) {
537                 return NT_STATUS_NONE_MAPPED;
538         }
539
540         return STATUS_SOME_UNMAPPED;
541
542       failure:
543         return ret;
544
545 }
546
547 static NTSTATUS idmap_autorid_preallocate_wellknown(struct idmap_domain *dom)
548 {
549         const char *groups[] = { "S-1-1-0", "S-1-2-0", "S-1-2-1",
550                 "S-1-3-0", "S-1-3-1", "S-1-3-2", "S-1-3-3", "S-1-3-4",
551                 "S-1-5-1", "S-1-5-2", "S-1-5-3", "S-1-5-4", "S-1-5-6",
552                 "S-1-5-7", "S-1-5-8", "S-1-5-9", "S-1-5-10", "S-1-5-11",
553                 "S-1-5-12", "S-1-5-13", "S-1-5-14", "S-1-5-15",
554                 "S-1-5-17", "S-1-5-18", "S-1-5-19", "S-1-5-20"
555         };
556
557         struct id_map **maps;
558         int i, num;
559         NTSTATUS status;
560
561         if (dom->read_only) {
562                 return NT_STATUS_OK;
563         }
564
565         num = ARRAY_SIZE(groups);
566
567         maps = talloc_array(talloc_tos(), struct id_map*, num+1);
568         if (!maps) {
569                 return NT_STATUS_NO_MEMORY;
570         }
571
572         for (i = 0; i < num; i++) {
573                 maps[i] = talloc(maps, struct id_map);
574                 if (maps[i] == NULL) {
575                         talloc_free(maps);
576                         return NT_STATUS_NO_MEMORY;
577                 }
578                 maps[i]->xid.type = ID_TYPE_GID;
579                 maps[i]->sid = dom_sid_parse_talloc(maps, groups[i]);
580         }
581
582         maps[num] = NULL;
583
584         status = idmap_autorid_sids_to_unixids(dom, maps);
585
586         DEBUG(10,("Preallocation run finished with status %s\n",
587                   nt_errstr(status)));
588
589         talloc_free(maps);
590
591         return NT_STATUS_IS_OK(status)?NT_STATUS_OK:NT_STATUS_UNSUCCESSFUL;
592 }
593
594 static NTSTATUS idmap_autorid_initialize(struct idmap_domain *dom)
595 {
596         struct idmap_tdb_common_context *commonconfig;
597         struct autorid_global_config *config;
598         NTSTATUS status;
599
600         if (!strequal(dom->name, "*")) {
601                 DEBUG(0, ("idmap_autorid_initialize: Error: autorid configured "
602                           "for domain '%s'. But autorid can only be used for "
603                           "the default idmap configuration.\n", dom->name));
604                 return NT_STATUS_INVALID_PARAMETER;
605         }
606
607         commonconfig = talloc_zero(dom, struct idmap_tdb_common_context);
608         if (!commonconfig) {
609                 DEBUG(0, ("Out of memory!\n"));
610                 return NT_STATUS_NO_MEMORY;
611         }
612
613         commonconfig->rw_ops = talloc_zero(commonconfig, struct idmap_rw_ops);
614         if (commonconfig->rw_ops == NULL) {
615                 DEBUG(0, ("Out of memory!\n"));
616                 return NT_STATUS_NO_MEMORY;
617         }
618
619         config = talloc_zero(commonconfig, struct autorid_global_config);
620         if (!config) {
621                 DEBUG(0, ("Out of memory!\n"));
622                 return NT_STATUS_NO_MEMORY;
623         }
624
625         status = idmap_autorid_db_init(state_path("autorid.tdb"),
626                                        NULL, /* TALLOC_CTX */
627                                        &autorid_db);
628         if (!NT_STATUS_IS_OK(status)) {
629                 goto error;
630         }
631
632         config->minvalue = dom->low_id;
633         config->rangesize = lp_parm_int(-1, "idmap config *",
634                                         "rangesize", 100000);
635
636         config->maxranges = (dom->high_id - dom->low_id + 1) /
637             config->rangesize;
638
639         if (config->maxranges == 0) {
640                 DEBUG(1, ("allowed uid range is smaller then rangesize, "
641                           "increase uid range or decrease rangesize\n"));
642                 status = NT_STATUS_INVALID_PARAMETER;
643                 goto error;
644         }
645
646         /* check if the high-low limit is a multiple of the rangesize */
647         if ((dom->high_id - dom->low_id + 1) % config->rangesize != 0) {
648                 DEBUG(5, ("High uid-low uid difference of %d "
649                           "is not a multiple of the rangesize %d, "
650                           "limiting ranges to lower boundary number of %d\n",
651                           (dom->high_id - dom->low_id + 1), config->rangesize,
652                           config->maxranges));
653         }
654
655         status = idmap_autorid_saveconfig(autorid_db, config);
656
657         if (!NT_STATUS_IS_OK(status)) {
658                 DEBUG(1, ("Failed to store configuration data!\n"));
659                 goto error;
660         }
661
662         DEBUG(5, ("%d domain ranges with a size of %d are available\n",
663                   config->maxranges, config->rangesize));
664
665         ignore_builtin = lp_parm_bool(-1, "idmap config *",
666                                       "ignore builtin", false);
667
668         /* fill the TDB common configuration */
669         commonconfig->private_data = config;
670
671         commonconfig->db = autorid_db;
672         commonconfig->max_id = config->rangesize -1;
673         commonconfig->hwmkey_uid = ALLOC_HWM_UID;
674         commonconfig->hwmkey_gid = ALLOC_HWM_GID;
675         commonconfig->rw_ops->get_new_id = idmap_autorid_allocate_id;
676         commonconfig->rw_ops->set_mapping = idmap_tdb_common_set_mapping;
677
678         dom->private_data = commonconfig;
679
680         /* preallocate well-known SIDs in the pool */
681         status = idmap_autorid_preallocate_wellknown(dom);
682
683         goto done;
684
685 error:
686         talloc_free(config);
687
688 done:
689         return status;
690 }
691
692 /*
693   Close the idmap tdb instance
694 */
695 static struct idmap_methods autorid_methods = {
696         .init = idmap_autorid_initialize,
697         .unixids_to_sids = idmap_autorid_unixids_to_sids,
698         .sids_to_unixids = idmap_autorid_sids_to_unixids,
699         .allocate_id     = idmap_autorid_allocate_id
700 };
701
702 NTSTATUS samba_init_module(void)
703 {
704         return smb_register_idmap(SMB_IDMAP_INTERFACE_VERSION,
705                                   "autorid", &autorid_methods);
706 }