From 400f419580800020bc832412ef737116a02a9703 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Sat, 27 Jan 2007 03:27:34 +0000 Subject: [PATCH] r21036: Fix the ad nss info backend to not abort the search when called outside the idmap daemon (This used to be commit 57160e3dd96a7a776389da604393c20a738202ea) --- source3/nsswitch/idmap_ad.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/source3/nsswitch/idmap_ad.c b/source3/nsswitch/idmap_ad.c index 208ccc2d4df..a0ed0847657 100644 --- a/source3/nsswitch/idmap_ad.c +++ b/source3/nsswitch/idmap_ad.c @@ -708,34 +708,28 @@ static NTSTATUS nss_ad_get_info( struct nss_domain_entry *e, char **gecos, uint32 *gid ) { - char *home, *sh, *gec; + ADS_STRUCT *ads_internal = NULL; - if ( !ad_schema ) + /* We are assuming that the internal ADS_STRUCT is for the + same forest as the incoming *ads pointer */ + + ads_internal = ad_idmap_cached_connection(); + + if ( !ads_internal || !ad_schema ) return NT_STATUS_OBJECT_NAME_NOT_FOUND; if ( !homedir || !shell || !gecos ) return NT_STATUS_INVALID_PARAMETER; - home = ads_pull_string( ads, ctx, msg, ad_schema->posix_homedir_attr ); - sh = ads_pull_string( ads, ctx, msg, ad_schema->posix_shell_attr ); - gec = ads_pull_string( ads, ctx, msg, ad_schema->posix_gecos_attr ); + *homedir = ads_pull_string( ads, ctx, msg, ad_schema->posix_homedir_attr ); + *shell = ads_pull_string( ads, ctx, msg, ad_schema->posix_shell_attr ); + *gecos = ads_pull_string( ads, ctx, msg, ad_schema->posix_gecos_attr ); if ( gid ) { if ( !ads_pull_uint32(ads, msg, ad_schema->posix_gidnumber_attr, gid ) ) *gid = 0; } - if ( home ) - *homedir = talloc_strdup( ctx, home ); - if ( sh ) - *shell = talloc_strdup( ctx, sh ); - if ( gec ) - *gecos = talloc_strdup( ctx, gec ); - - SAFE_FREE( home ); - SAFE_FREE( sh ); - SAFE_FREE( gec ); - return NT_STATUS_OK; }