2 * idmap_ad: map between Active Directory and RFC 2307 accounts
4 * Copyright (C) Volker Lendecke 2015
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, see <http://www.gnu.org/licenses/>.
23 #include "tldap_gensec_bind.h"
24 #include "tldap_util.h"
26 #include "lib/param/param.h"
27 #include "utils/net.h"
28 #include "auth/gensec/gensec.h"
29 #include "librpc/gen_ndr/ndr_netlogon.h"
30 #include "libads/ldap_schema_oids.h"
31 #include "../libds/common/flags.h"
32 #include "libcli/ldap/ldap_ndr.h"
33 #include "libcli/security/dom_sid.h"
35 struct idmap_ad_schema_names;
37 struct idmap_ad_context {
38 struct idmap_domain *dom;
39 struct tldap_context *ld;
40 struct idmap_ad_schema_names *schema;
41 const char *default_nc;
43 bool unix_primary_group;
47 static NTSTATUS idmap_ad_get_context(struct idmap_domain *dom,
48 struct idmap_ad_context **pctx);
50 static char *get_schema_path(TALLOC_CTX *mem_ctx, struct tldap_context *ld)
52 struct tldap_message *rootdse;
54 rootdse = tldap_rootdse(ld);
55 if (rootdse == NULL) {
59 return tldap_talloc_single_attribute(rootdse, "schemaNamingContext",
63 static char *get_default_nc(TALLOC_CTX *mem_ctx, struct tldap_context *ld)
65 struct tldap_message *rootdse;
67 rootdse = tldap_rootdse(ld);
68 if (rootdse == NULL) {
72 return tldap_talloc_single_attribute(rootdse, "defaultNamingContext",
76 struct idmap_ad_schema_names {
85 static TLDAPRC get_attrnames_by_oids(struct tldap_context *ld,
87 const char *schema_path,
93 const char *attrs[] = { "lDAPDisplayName", "attributeId" };
96 struct tldap_message **msgs;
99 filter = talloc_strdup(mem_ctx, "(|");
100 if (filter == NULL) {
101 return TLDAP_NO_MEMORY;
104 for (i=0; i<num_oids; i++) {
105 filter = talloc_asprintf_append_buffer(
106 filter, "(attributeId=%s)", oids[i]);
107 if (filter == NULL) {
108 return TLDAP_NO_MEMORY;
112 filter = talloc_asprintf_append_buffer(filter, ")");
113 if (filter == NULL) {
114 return TLDAP_NO_MEMORY;
117 rc = tldap_search(ld, schema_path, TLDAP_SCOPE_SUB, filter,
118 attrs, ARRAY_SIZE(attrs), 0, NULL, 0, NULL, 0,
119 0, 0, 0, mem_ctx, &msgs);;
121 if (!TLDAP_RC_IS_SUCCESS(rc)) {
125 for (i=0; i<num_oids; i++) {
129 num_msgs = talloc_array_length(msgs);
131 for (i=0; i<num_msgs; i++) {
132 struct tldap_message *msg = msgs[i];
136 if (tldap_msg_type(msg) != TLDAP_RES_SEARCH_ENTRY) {
137 /* Could be a TLDAP_RES_SEARCH_REFERENCE */
141 oid = tldap_talloc_single_attribute(
142 msg, "attributeId", msg);
147 for (j=0; j<num_oids; j++) {
148 if (strequal(oid, oids[j])) {
159 names[j] = tldap_talloc_single_attribute(
160 msg, "lDAPDisplayName", mem_ctx);
165 return TLDAP_SUCCESS;
168 static TLDAPRC get_posix_schema_names(struct tldap_context *ld,
169 const char *schema_mode,
171 struct idmap_ad_schema_names **pschema)
174 struct idmap_ad_schema_names *schema;
176 const char *oids_sfu[] = {
177 ADS_ATTR_SFU_UIDNUMBER_OID,
178 ADS_ATTR_SFU_GIDNUMBER_OID,
179 ADS_ATTR_SFU_HOMEDIR_OID,
180 ADS_ATTR_SFU_SHELL_OID,
181 ADS_ATTR_SFU_GECOS_OID,
184 const char *oids_sfu20[] = {
185 ADS_ATTR_SFU20_UIDNUMBER_OID,
186 ADS_ATTR_SFU20_GIDNUMBER_OID,
187 ADS_ATTR_SFU20_HOMEDIR_OID,
188 ADS_ATTR_SFU20_SHELL_OID,
189 ADS_ATTR_SFU20_GECOS_OID,
190 ADS_ATTR_SFU20_UID_OID
192 const char *oids_rfc2307[] = {
193 ADS_ATTR_RFC2307_UIDNUMBER_OID,
194 ADS_ATTR_RFC2307_GIDNUMBER_OID,
195 ADS_ATTR_RFC2307_HOMEDIR_OID,
196 ADS_ATTR_RFC2307_SHELL_OID,
197 ADS_ATTR_RFC2307_GECOS_OID,
198 ADS_ATTR_RFC2307_UID_OID
204 schema = talloc(mem_ctx, struct idmap_ad_schema_names);
205 if (schema == NULL) {
206 return TLDAP_NO_MEMORY;
209 schema_path = get_schema_path(schema, ld);
210 if (schema_path == NULL) {
212 return TLDAP_NO_MEMORY;
217 if ((schema_mode != NULL) && (schema_mode[0] != '\0')) {
218 if (strequal(schema_mode, "sfu")) {
220 } else if (strequal(schema_mode, "sfu20")) {
222 } else if (strequal(schema_mode, "rfc2307" )) {
225 DBG_WARNING("Unknown schema mode %s\n", schema_mode);
229 rc = get_attrnames_by_oids(ld, schema, schema_path, 6, oids, names);
230 TALLOC_FREE(schema_path);
231 if (!TLDAP_RC_IS_SUCCESS(rc)) {
236 schema->uid = names[0];
237 schema->gid = names[1];
238 schema->dir = names[2];
239 schema->shell = names[3];
240 schema->gecos = names[4];
241 schema->name = names[5];
245 return TLDAP_SUCCESS;
248 static NTSTATUS idmap_ad_get_tldap_ctx(TALLOC_CTX *mem_ctx,
250 struct tldap_context **pld)
252 struct netr_DsRGetDCNameInfo *dcinfo;
253 struct sockaddr_storage dcaddr;
254 struct cli_credentials *creds;
255 struct loadparm_context *lp_ctx;
256 struct tldap_context *ld;
262 status = wb_dsgetdcname_gencache_get(mem_ctx, domname, &dcinfo);
263 if (!NT_STATUS_IS_OK(status)) {
264 DBG_DEBUG("Could not get dcinfo for %s: %s\n", domname,
269 if (dcinfo->dc_unc == NULL) {
271 return NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND;
273 if (dcinfo->dc_unc[0] == '\\') {
276 if (dcinfo->dc_unc[0] == '\\') {
280 ok = resolve_name(dcinfo->dc_unc, &dcaddr, 0x20, true);
282 DBG_DEBUG("Could not resolve name %s\n", dcinfo->dc_unc);
284 return NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND;
287 status = open_socket_out(&dcaddr, 389, 10000, &fd);
288 if (!NT_STATUS_IS_OK(status)) {
289 DBG_DEBUG("open_socket_out failed: %s\n", nt_errstr(status));
294 ld = tldap_context_create(dcinfo, fd);
296 DBG_DEBUG("tldap_context_create failed\n");
299 return NT_STATUS_NO_MEMORY;
303 * Here we use or own machine account as
304 * we run as domain member.
306 status = pdb_get_trust_credentials(lp_workgroup(),
310 if (!NT_STATUS_IS_OK(status)) {
311 DBG_DEBUG("pdb_get_trust_credentials() failed - %s\n",
317 lp_ctx = loadparm_init_s3(dcinfo, loadparm_s3_helpers());
318 if (lp_ctx == NULL) {
319 DBG_DEBUG("loadparm_init_s3 failed\n");
321 return NT_STATUS_NO_MEMORY;
324 rc = tldap_gensec_bind(ld, creds, "ldap", dcinfo->dc_unc, NULL, lp_ctx,
325 GENSEC_FEATURE_SIGN | GENSEC_FEATURE_SEAL);
326 if (!TLDAP_RC_IS_SUCCESS(rc)) {
327 DBG_DEBUG("tldap_gensec_bind failed: %s\n",
328 tldap_errstr(dcinfo, ld, rc));
330 return NT_STATUS_LDAP(TLDAP_RC_V(rc));
333 rc = tldap_fetch_rootdse(ld);
334 if (!TLDAP_RC_IS_SUCCESS(rc)) {
335 DBG_DEBUG("tldap_fetch_rootdse failed: %s\n",
336 tldap_errstr(dcinfo, ld, rc));
338 return NT_STATUS_LDAP(TLDAP_RC_V(rc));
341 *pld = talloc_move(mem_ctx, &ld);
346 static int idmap_ad_context_destructor(struct idmap_ad_context *ctx)
348 if ((ctx->dom != NULL) && (ctx->dom->private_data == ctx)) {
349 ctx->dom->private_data = NULL;
354 static NTSTATUS idmap_ad_context_create(TALLOC_CTX *mem_ctx,
355 struct idmap_domain *dom,
357 struct idmap_ad_context **pctx)
359 struct idmap_ad_context *ctx;
360 const char *schema_mode;
364 ctx = talloc(mem_ctx, struct idmap_ad_context);
366 return NT_STATUS_NO_MEMORY;
370 talloc_set_destructor(ctx, idmap_ad_context_destructor);
372 status = idmap_ad_get_tldap_ctx(ctx, domname, &ctx->ld);
373 if (!NT_STATUS_IS_OK(status)) {
374 DBG_DEBUG("idmap_ad_get_tldap_ctx failed: %s\n",
380 ctx->default_nc = get_default_nc(ctx, ctx->ld);
381 if (ctx->default_nc == NULL) {
382 DBG_DEBUG("No default nc\n");
387 ctx->unix_primary_group = idmap_config_bool(
388 domname, "unix_primary_group", false);
389 ctx->unix_nss_info = idmap_config_bool(
390 domname, "unix_nss_info", false);
392 schema_mode = idmap_config_const_string(
393 domname, "schema_mode", "rfc2307");
395 rc = get_posix_schema_names(ctx->ld, schema_mode, ctx, &ctx->schema);
396 if (!TLDAP_RC_IS_SUCCESS(rc)) {
397 DBG_DEBUG("get_posix_schema_names failed: %s\n",
398 tldap_errstr(ctx, ctx->ld, rc));
400 return NT_STATUS_LDAP(TLDAP_RC_V(rc));
407 static NTSTATUS idmap_ad_query_user(struct idmap_domain *domain,
408 struct wbint_userinfo *info)
410 struct idmap_ad_context *ctx;
413 char *sidstr, *filter;
414 const char *attrs[4];
416 struct tldap_message **msgs;
418 status = idmap_ad_get_context(domain, &ctx);
419 if (!NT_STATUS_IS_OK(status)) {
423 if (!(ctx->unix_primary_group || ctx->unix_nss_info)) {
427 attrs[0] = ctx->schema->gid;
428 attrs[1] = ctx->schema->gecos;
429 attrs[2] = ctx->schema->dir;
430 attrs[3] = ctx->schema->shell;
432 sidstr = ldap_encode_ndr_dom_sid(talloc_tos(), &info->user_sid);
433 if (sidstr == NULL) {
434 return NT_STATUS_NO_MEMORY;
437 filter = talloc_asprintf(talloc_tos(), "(objectsid=%s)", sidstr);
439 if (filter == NULL) {
440 return NT_STATUS_NO_MEMORY;
443 DBG_DEBUG("Filter: [%s]\n", filter);
445 rc = tldap_search(ctx->ld, ctx->default_nc, TLDAP_SCOPE_SUB, filter,
446 attrs, ARRAY_SIZE(attrs), 0, NULL, 0, NULL, 0,
447 0, 0, 0, talloc_tos(), &msgs);
448 if (!TLDAP_RC_IS_SUCCESS(rc)) {
449 return NT_STATUS_LDAP(TLDAP_RC_V(rc));
454 num_msgs = talloc_array_length(msgs);
456 for (i=0; i<num_msgs; i++) {
457 struct tldap_message *msg = msgs[i];
459 if (tldap_msg_type(msg) != TLDAP_RES_SEARCH_ENTRY) {
463 if (ctx->unix_primary_group) {
467 ok = tldap_pull_uint32(msg, ctx->schema->gid, &gid);
469 DBG_DEBUG("Setting primary group "
470 "to %"PRIu32" from attr %s\n",
471 gid, ctx->schema->gid);
472 info->primary_gid = gid;
476 if (ctx->unix_nss_info) {
479 attr = tldap_talloc_single_attribute(
480 msg, ctx->schema->dir, talloc_tos());
482 info->homedir = talloc_move(info, &attr);
486 attr = tldap_talloc_single_attribute(
487 msg, ctx->schema->shell, talloc_tos());
489 info->shell = talloc_move(info, &attr);
493 attr = tldap_talloc_single_attribute(
494 msg, ctx->schema->gecos, talloc_tos());
496 info->full_name = talloc_move(info, &attr);
505 static NTSTATUS idmap_ad_initialize(struct idmap_domain *dom)
507 dom->query_user = idmap_ad_query_user;
508 dom->private_data = NULL;
512 static NTSTATUS idmap_ad_get_context(struct idmap_domain *dom,
513 struct idmap_ad_context **pctx)
515 struct idmap_ad_context *ctx = NULL;
518 if (dom->private_data != NULL) {
519 *pctx = talloc_get_type_abort(dom->private_data,
520 struct idmap_ad_context);
524 status = idmap_ad_context_create(dom, dom, dom->name, &ctx);
525 if (!NT_STATUS_IS_OK(status)) {
526 DBG_DEBUG("idmap_ad_context_create failed: %s\n",
531 dom->private_data = ctx;
536 static NTSTATUS idmap_ad_unixids_to_sids(struct idmap_domain *dom,
539 struct idmap_ad_context *ctx;
542 struct tldap_message **msgs;
545 char *u_filter, *g_filter, *filter;
547 const char *attrs[] = {
550 NULL, /* attr_uidnumber */
551 NULL, /* attr_gidnumber */
554 status = idmap_ad_get_context(dom, &ctx);
555 if (!NT_STATUS_IS_OK(status)) {
559 attrs[2] = ctx->schema->uid;
560 attrs[3] = ctx->schema->gid;
562 u_filter = talloc_strdup(talloc_tos(), "");
563 if (u_filter == NULL) {
564 return NT_STATUS_NO_MEMORY;
567 g_filter = talloc_strdup(talloc_tos(), "");
568 if (g_filter == NULL) {
569 return NT_STATUS_NO_MEMORY;
572 for (i=0; ids[i] != NULL; i++) {
573 struct id_map *id = ids[i];
575 id->status = ID_UNKNOWN;
577 switch (id->xid.type) {
579 u_filter = talloc_asprintf_append_buffer(
580 u_filter, "(%s=%ju)", ctx->schema->uid,
581 (uintmax_t)id->xid.id);
582 if (u_filter == NULL) {
583 return NT_STATUS_NO_MEMORY;
589 g_filter = talloc_asprintf_append_buffer(
590 g_filter, "(%s=%ju)", ctx->schema->gid,
591 (uintmax_t)id->xid.id);
592 if (g_filter == NULL) {
593 return NT_STATUS_NO_MEMORY;
599 DBG_WARNING("Unknown id type: %u\n",
600 (unsigned)id->xid.type);
605 filter = talloc_strdup(talloc_tos(), "(|");
606 if (filter == NULL) {
607 return NT_STATUS_NO_MEMORY;
610 if (*u_filter != '\0') {
611 filter = talloc_asprintf_append_buffer(
613 "(&(|(sAMAccountType=%d)(sAMAccountType=%d)"
614 "(sAMAccountType=%d))(|%s))",
615 ATYPE_NORMAL_ACCOUNT, ATYPE_WORKSTATION_TRUST,
616 ATYPE_INTERDOMAIN_TRUST, u_filter);
617 if (filter == NULL) {
618 return NT_STATUS_NO_MEMORY;
621 TALLOC_FREE(u_filter);
623 if (*g_filter != '\0') {
624 filter = talloc_asprintf_append_buffer(
626 "(&(|(sAMAccountType=%d)(sAMAccountType=%d))(|%s))",
627 ATYPE_SECURITY_GLOBAL_GROUP,
628 ATYPE_SECURITY_LOCAL_GROUP,
630 if (filter == NULL) {
631 return NT_STATUS_NO_MEMORY;
634 TALLOC_FREE(g_filter);
636 filter = talloc_asprintf_append_buffer(filter, ")");
637 if (filter == NULL) {
638 return NT_STATUS_NO_MEMORY;
641 DBG_DEBUG("Filter: [%s]\n", filter);
643 rc = tldap_search(ctx->ld, ctx->default_nc, TLDAP_SCOPE_SUB, filter,
644 attrs, ARRAY_SIZE(attrs), 0, NULL, 0, NULL, 0,
645 0, 0, 0, talloc_tos(), &msgs);
646 if (!TLDAP_RC_IS_SUCCESS(rc)) {
647 return NT_STATUS_LDAP(TLDAP_RC_V(rc));
652 num_msgs = talloc_array_length(msgs);
654 for (i=0; i<num_msgs; i++) {
655 struct tldap_message *msg = msgs[i];
664 if (tldap_msg_type(msg) != TLDAP_RES_SEARCH_ENTRY) {
668 ok = tldap_entry_dn(msg, &dn);
670 DBG_DEBUG("No dn found in msg %zu\n", i);
674 ok = tldap_pull_uint32(msg, "sAMAccountType", &atype);
676 DBG_DEBUG("No atype in object %s\n", dn);
680 switch (atype & 0xF0000000) {
681 case ATYPE_SECURITY_GLOBAL_GROUP:
682 case ATYPE_SECURITY_LOCAL_GROUP:
685 case ATYPE_NORMAL_ACCOUNT:
686 case ATYPE_WORKSTATION_TRUST:
687 case ATYPE_INTERDOMAIN_TRUST:
691 DBG_WARNING("unrecognized SAM account type %08x\n",
696 ok = tldap_pull_uint32(msg, (type == ID_TYPE_UID) ?
697 ctx->schema->uid : ctx->schema->gid,
700 DBG_WARNING("No unix id in object %s\n", dn);
704 ok = tldap_pull_binsid(msg, "objectSid", &sid);
706 DBG_DEBUG("No objectSid in object %s\n", dn);
711 for (j=0; ids[j]; j++) {
712 if ((type == ids[j]->xid.type) &&
713 (xid == ids[j]->xid.id)) {
719 DBG_DEBUG("Got unexpected sid %s from object %s\n",
720 sid_string_tos(&sid), dn);
724 sid_copy(map->sid, &sid);
725 map->status = ID_MAPPED;
727 DBG_DEBUG("Mapped %s -> %ju (%d)\n", sid_string_dbg(map->sid),
728 (uintmax_t)map->xid.id, map->xid.type);
736 static NTSTATUS idmap_ad_sids_to_unixids(struct idmap_domain *dom,
739 struct idmap_ad_context *ctx;
742 struct tldap_message **msgs;
747 const char *attrs[] = {
750 NULL, /* attr_uidnumber */
751 NULL, /* attr_gidnumber */
754 status = idmap_ad_get_context(dom, &ctx);
755 if (!NT_STATUS_IS_OK(status)) {
759 attrs[2] = ctx->schema->uid;
760 attrs[3] = ctx->schema->gid;
762 filter = talloc_asprintf(
764 "(&(|(sAMAccountType=%d)(sAMAccountType=%d)(sAMAccountType=%d)"
765 "(sAMAccountType=%d)(sAMAccountType=%d))(|",
766 ATYPE_NORMAL_ACCOUNT, ATYPE_WORKSTATION_TRUST,
767 ATYPE_INTERDOMAIN_TRUST, ATYPE_SECURITY_GLOBAL_GROUP,
768 ATYPE_SECURITY_LOCAL_GROUP);
769 if (filter == NULL) {
770 return NT_STATUS_NO_MEMORY;
773 for (i=0; ids[i]; i++) {
776 ids[i]->status = ID_UNKNOWN;
778 sidstr = ldap_encode_ndr_dom_sid(talloc_tos(), ids[i]->sid);
779 if (sidstr == NULL) {
780 return NT_STATUS_NO_MEMORY;
783 filter = talloc_asprintf_append_buffer(
784 filter, "(objectSid=%s)", sidstr);
786 if (filter == NULL) {
787 return NT_STATUS_NO_MEMORY;
791 filter = talloc_asprintf_append_buffer(filter, "))");
792 if (filter == NULL) {
793 return NT_STATUS_NO_MEMORY;
796 DBG_DEBUG("Filter: [%s]\n", filter);
798 rc = tldap_search(ctx->ld, ctx->default_nc, TLDAP_SCOPE_SUB, filter,
799 attrs, ARRAY_SIZE(attrs), 0, NULL, 0, NULL, 0,
800 0, 0, 0, talloc_tos(), &msgs);
801 if (!TLDAP_RC_IS_SUCCESS(rc)) {
802 return NT_STATUS_LDAP(TLDAP_RC_V(rc));
807 num_msgs = talloc_array_length(msgs);
809 for (i=0; i<num_msgs; i++) {
810 struct tldap_message *msg = msgs[i];
816 uint64_t account_type, xid;
819 if (tldap_msg_type(msg) != TLDAP_RES_SEARCH_ENTRY) {
823 ok = tldap_entry_dn(msg, &dn);
825 DBG_DEBUG("No dn found in msg %zu\n", i);
829 ok = tldap_pull_binsid(msg, "objectSid", &sid);
831 DBG_DEBUG("No objectSid in object %s\n", dn);
836 for (j=0; ids[j]; j++) {
837 if (dom_sid_equal(&sid, ids[j]->sid)) {
843 DBG_DEBUG("Got unexpected sid %s from object %s\n",
844 sid_string_tos(&sid), dn);
848 ok = tldap_pull_uint64(msg, "sAMAccountType", &account_type);
850 DBG_DEBUG("No sAMAccountType in %s\n", dn);
854 switch (account_type & 0xF0000000) {
855 case ATYPE_SECURITY_GLOBAL_GROUP:
856 case ATYPE_SECURITY_LOCAL_GROUP:
859 case ATYPE_NORMAL_ACCOUNT:
860 case ATYPE_WORKSTATION_TRUST:
861 case ATYPE_INTERDOMAIN_TRUST:
865 DBG_WARNING("unrecognized SAM account type %"PRIu64"\n",
870 ok = tldap_pull_uint64(msg,
871 type == ID_TYPE_UID ?
872 ctx->schema->uid : ctx->schema->gid,
875 DBG_DEBUG("No xid in %s\n", dn);
880 map->xid.type = type;
882 map->status = ID_MAPPED;
884 DEBUG(10, ("Mapped %s -> %lu (%d)\n", sid_string_dbg(map->sid),
885 (unsigned long)map->xid.id, map->xid.type));
893 static NTSTATUS idmap_ad_unixids_to_sids_retry(struct idmap_domain *dom,
896 const NTSTATUS status_server_down =
897 NT_STATUS_LDAP(TLDAP_RC_V(TLDAP_SERVER_DOWN));
900 status = idmap_ad_unixids_to_sids(dom, ids);
902 if (NT_STATUS_EQUAL(status, status_server_down)) {
903 TALLOC_FREE(dom->private_data);
904 status = idmap_ad_unixids_to_sids(dom, ids);
910 static NTSTATUS idmap_ad_sids_to_unixids_retry(struct idmap_domain *dom,
913 const NTSTATUS status_server_down =
914 NT_STATUS_LDAP(TLDAP_RC_V(TLDAP_SERVER_DOWN));
917 status = idmap_ad_sids_to_unixids(dom, ids);
919 if (NT_STATUS_EQUAL(status, status_server_down)) {
920 TALLOC_FREE(dom->private_data);
921 status = idmap_ad_sids_to_unixids(dom, ids);
927 static struct idmap_methods ad_methods = {
928 .init = idmap_ad_initialize,
929 .unixids_to_sids = idmap_ad_unixids_to_sids_retry,
930 .sids_to_unixids = idmap_ad_sids_to_unixids_retry,
934 NTSTATUS idmap_ad_init(TALLOC_CTX *ctx)
938 status = smb_register_idmap(SMB_IDMAP_INTERFACE_VERSION,
940 if (!NT_STATUS_IS_OK(status)) {
944 status = idmap_ad_nss_init(ctx);
945 if (!NT_STATUS_IS_OK(status)) {