From 47bd42ab1c0c5de62e0692f152c01df80abecdeb Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 26 Jun 2007 09:15:37 +0000 Subject: r23607: Add legacy support for Services for Unix (SFU) 2.0. Guenther (This used to be commit 11b390309b9677805e5b68f3a1b780658ae85137) --- source3/nsswitch/idmap_ad.c | 45 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 3 deletions(-) (limited to 'source3/nsswitch') diff --git a/source3/nsswitch/idmap_ad.c b/source3/nsswitch/idmap_ad.c index aadbb2419d..4f898c3fa0 100644 --- a/source3/nsswitch/idmap_ad.c +++ b/source3/nsswitch/idmap_ad.c @@ -143,6 +143,7 @@ static ADS_STRUCT *ad_idmap_cached_connection(void) /* Otherwise, set the schema model */ if ( (ad_map_type == WB_POSIX_MAP_SFU) || + (ad_map_type == WB_POSIX_MAP_SFU20) || (ad_map_type == WB_POSIX_MAP_RFC2307) ) { ADS_STATUS schema_status; @@ -196,6 +197,8 @@ static NTSTATUS idmap_ad_initialize(struct idmap_domain *dom) if ( schema_mode && schema_mode[0] ) { if ( strequal(schema_mode, "sfu") ) ad_map_type = WB_POSIX_MAP_SFU; + else if ( strequal(schema_mode, "sfu20" ) ) + ad_map_type = WB_POSIX_MAP_SFU20; else if ( strequal(schema_mode, "rfc2307" ) ) ad_map_type = WB_POSIX_MAP_RFC2307; else @@ -673,7 +676,7 @@ static NTSTATUS idmap_ad_close(struct idmap_domain *dom) } /* - * nss_info_{sfu,rfc2307} + * nss_info_{sfu,sfu20,rfc2307} */ /************************************************************************ @@ -693,11 +696,32 @@ static NTSTATUS nss_sfu_init( struct nss_domain_entry *e ) return NT_STATUS_NOT_SUPPORTED; } - ad_map_type = WB_POSIX_MAP_SFU; + ad_map_type = WB_POSIX_MAP_SFU; return NT_STATUS_OK; } +/************************************************************************ + Initialize the {sfu,rfc2307} state + ***********************************************************************/ + +static NTSTATUS nss_sfu20_init( struct nss_domain_entry *e ) +{ + /* Sanity check if we have previously been called with a + different schema model */ + + if ( (ad_map_type != WB_POSIX_MAP_UNKNOWN) && + (ad_map_type != WB_POSIX_MAP_SFU20) ) + { + DEBUG(0,("nss_sfu20_init: Posix Map type has already been set. " + "Mixed schema models not supported!\n")); + return NT_STATUS_NOT_SUPPORTED; + } + + ad_map_type = WB_POSIX_MAP_SFU20; + + return NT_STATUS_OK; +} static NTSTATUS nss_rfc2307_init( struct nss_domain_entry *e ) { /* Sanity check if we have previously been called with a @@ -711,7 +735,7 @@ static NTSTATUS nss_rfc2307_init( struct nss_domain_entry *e ) return NT_STATUS_NOT_SUPPORTED; } - ad_map_type = WB_POSIX_MAP_RFC2307; + ad_map_type = WB_POSIX_MAP_RFC2307; return NT_STATUS_OK; } @@ -795,6 +819,13 @@ static struct nss_info_methods nss_sfu_methods = { .close_fn = nss_ad_close }; +static struct nss_info_methods nss_sfu20_methods = { + .init = nss_sfu20_init, + .get_nss_info = nss_ad_get_info, + .close_fn = nss_ad_close +}; + + /************************************************************************ Initialize the plugins @@ -805,6 +836,7 @@ NTSTATUS idmap_ad_init(void) static NTSTATUS status_idmap_ad = NT_STATUS_UNSUCCESSFUL; static NTSTATUS status_nss_rfc2307 = NT_STATUS_UNSUCCESSFUL; static NTSTATUS status_nss_sfu = NT_STATUS_UNSUCCESSFUL; + static NTSTATUS status_nss_sfu20 = NT_STATUS_UNSUCCESSFUL; /* Always register the AD method first in order to get the idmap_domain interface called */ @@ -830,6 +862,13 @@ NTSTATUS idmap_ad_init(void) return status_nss_sfu; } + if ( !NT_STATUS_IS_OK( status_nss_sfu20 ) ) { + status_nss_sfu20 = smb_register_idmap_nss(SMB_NSS_INFO_INTERFACE_VERSION, + "sfu20", &nss_sfu20_methods ); + if ( !NT_STATUS_IS_OK(status_nss_sfu20) ) + return status_nss_sfu20; + } + return NT_STATUS_OK; } -- cgit