From: Volker Lendecke Date: Tue, 3 Jan 2017 12:35:15 +0000 (+0000) Subject: winbind: remove nss_get_info backend functions X-Git-Tag: samba-4.6.0rc1~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=319d60285c92bbf86bc0a3f872f9c9f9d0530129;p=thirdparty%2Fsamba.git winbind: remove nss_get_info backend functions Signed-off-by: Volker Lendecke Reviewed-by: Uri Simchoni Reviewed-by: Andreas Schneider --- diff --git a/source3/include/nss_info.h b/source3/include/nss_info.h index b3fb151739b..54b4399056a 100644 --- a/source3/include/nss_info.h +++ b/source3/include/nss_info.h @@ -61,11 +61,6 @@ struct nss_domain_entry { struct nss_info_methods { NTSTATUS (*init)( struct nss_domain_entry *e ); - NTSTATUS (*get_nss_info)( struct nss_domain_entry *e, - const struct dom_sid *sid, - TALLOC_CTX *ctx, - const char **homedir, const char **shell, - const char **gecos, gid_t *p_gid); NTSTATUS (*map_to_alias)(TALLOC_CTX *mem_ctx, struct nss_domain_entry *e, const char *name, char **alias); diff --git a/source3/winbindd/idmap_ad_nss.c b/source3/winbindd/idmap_ad_nss.c index d979231e88a..8b27b36b2ca 100644 --- a/source3/winbindd/idmap_ad_nss.c +++ b/source3/winbindd/idmap_ad_nss.c @@ -197,109 +197,6 @@ static NTSTATUS nss_rfc2307_init( struct nss_domain_entry *e ) return nss_ad_generic_init(e, WB_POSIX_MAP_RFC2307); } - -/************************************************************************ - ***********************************************************************/ - -static NTSTATUS nss_ad_get_info( struct nss_domain_entry *e, - const struct dom_sid *sid, - TALLOC_CTX *mem_ctx, - const char **homedir, - const char **shell, - const char **gecos, - gid_t *p_gid ) -{ - const char *attrs[] = {NULL, /* attr_homedir */ - NULL, /* attr_shell */ - NULL, /* attr_gecos */ - NULL, /* attr_gidnumber */ - NULL }; - char *filter = NULL; - LDAPMessage *msg_internal = NULL; - ADS_STATUS ads_status = ADS_ERROR_NT(NT_STATUS_UNSUCCESSFUL); - NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL; - char *sidstr = NULL; - struct idmap_domain *dom; - struct idmap_ad_context *ctx; - - DEBUG(10, ("nss_ad_get_info called for sid [%s] in domain '%s'\n", - sid_string_dbg(sid), e->domain?e->domain:"NULL")); - - /* Only do query if we are online */ - if (idmap_is_offline()) { - return NT_STATUS_FILE_IS_OFFLINE; - } - - dom = talloc_get_type(e->state, struct idmap_domain); - ctx = talloc_get_type(dom->private_data, struct idmap_ad_context); - - ads_status = ad_idmap_cached_connection(dom); - if (!ADS_ERR_OK(ads_status)) { - return NT_STATUS_OBJECT_NAME_NOT_FOUND; - } - - if (!ctx->ad_schema) { - DEBUG(10, ("nss_ad_get_info: no ad_schema configured!\n")); - return NT_STATUS_OBJECT_NAME_NOT_FOUND; - } - - if (!sid || !homedir || !shell || !gecos) { - return NT_STATUS_INVALID_PARAMETER; - } - - /* Have to do our own query */ - - DEBUG(10, ("nss_ad_get_info: no ads connection given, doing our " - "own query\n")); - - attrs[0] = ctx->ad_schema->posix_homedir_attr; - attrs[1] = ctx->ad_schema->posix_shell_attr; - attrs[2] = ctx->ad_schema->posix_gecos_attr; - attrs[3] = ctx->ad_schema->posix_gidnumber_attr; - - sidstr = ldap_encode_ndr_dom_sid(mem_ctx, sid); - filter = talloc_asprintf(mem_ctx, "(objectSid=%s)", sidstr); - TALLOC_FREE(sidstr); - - if (!filter) { - nt_status = NT_STATUS_NO_MEMORY; - goto done; - } - - ads_status = ads_search_retry(ctx->ads, &msg_internal, filter, attrs); - if (!ADS_ERR_OK(ads_status)) { - nt_status = ads_ntstatus(ads_status); - goto done; - } - - *homedir = ads_pull_string(ctx->ads, mem_ctx, msg_internal, ctx->ad_schema->posix_homedir_attr); - *shell = ads_pull_string(ctx->ads, mem_ctx, msg_internal, ctx->ad_schema->posix_shell_attr); - *gecos = ads_pull_string(ctx->ads, mem_ctx, msg_internal, ctx->ad_schema->posix_gecos_attr); - - if (p_gid != NULL) { - uint32_t gid = UINT32_MAX; - bool ok; - - ok = ads_pull_uint32(ctx->ads, msg_internal, - ctx->ad_schema->posix_gidnumber_attr, - &gid); - if (ok) { - *p_gid = gid; - } else { - *p_gid = (gid_t)-1; - } - } - - nt_status = NT_STATUS_OK; - -done: - if (msg_internal) { - ads_msgfree(ctx->ads, msg_internal); - } - - return nt_status; -} - /********************************************************************** *********************************************************************/ @@ -475,21 +372,18 @@ done: static struct nss_info_methods nss_rfc2307_methods = { .init = nss_rfc2307_init, - .get_nss_info = nss_ad_get_info, .map_to_alias = nss_ad_map_to_alias, .map_from_alias = nss_ad_map_from_alias, }; static struct nss_info_methods nss_sfu_methods = { .init = nss_sfu_init, - .get_nss_info = nss_ad_get_info, .map_to_alias = nss_ad_map_to_alias, .map_from_alias = nss_ad_map_from_alias, }; static struct nss_info_methods nss_sfu20_methods = { .init = nss_sfu20_init, - .get_nss_info = nss_ad_get_info, .map_to_alias = nss_ad_map_to_alias, .map_from_alias = nss_ad_map_from_alias, }; diff --git a/source3/winbindd/idmap_hash/idmap_hash.c b/source3/winbindd/idmap_hash/idmap_hash.c index 0aba36c3035..743b0ec4ff8 100644 --- a/source3/winbindd/idmap_hash/idmap_hash.c +++ b/source3/winbindd/idmap_hash/idmap_hash.c @@ -282,46 +282,6 @@ static NTSTATUS nss_hash_init(struct nss_domain_entry *e ) return NT_STATUS_OK; } -/********************************************************************** - *********************************************************************/ - -static NTSTATUS nss_hash_get_info(struct nss_domain_entry *e, - const struct dom_sid *sid, - TALLOC_CTX *ctx, - const char **homedir, - const char **shell, - const char **gecos, - gid_t *p_gid ) -{ - NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL; - - nt_status = nss_hash_init(e); - BAIL_ON_NTSTATUS_ERROR(nt_status); - - if (!homedir || !shell || !gecos) { - nt_status = NT_STATUS_INVALID_PARAMETER; - BAIL_ON_NTSTATUS_ERROR(nt_status); - } - - *homedir = talloc_strdup(ctx, lp_template_homedir()); - BAIL_ON_PTR_NT_ERROR(*homedir, nt_status); - - *shell = talloc_strdup(ctx, lp_template_shell()); - BAIL_ON_PTR_NT_ERROR(*shell, nt_status); - - *gecos = NULL; - - /* Initialize the gid so that the upper layer fills - in the proper Windows primary group */ - - if (*p_gid) { - *p_gid = (gid_t)-1; - } - -done: - return nt_status; -} - /********************************************************************** *********************************************************************/ @@ -374,7 +334,6 @@ static struct idmap_methods hash_idmap_methods = { static struct nss_info_methods hash_nss_methods = { .init = nss_hash_init, - .get_nss_info = nss_hash_get_info, .map_to_alias = nss_hash_map_to_alias, .map_from_alias = nss_hash_map_from_alias, .close_fn = nss_hash_close diff --git a/source3/winbindd/nss_info_template.c b/source3/winbindd/nss_info_template.c index de93803064d..53159b6c02e 100644 --- a/source3/winbindd/nss_info_template.c +++ b/source3/winbindd/nss_info_template.c @@ -30,32 +30,6 @@ static NTSTATUS nss_template_init( struct nss_domain_entry *e ) return NT_STATUS_OK; } -/************************************************************************ - ***********************************************************************/ - -static NTSTATUS nss_template_get_info( struct nss_domain_entry *e, - const struct dom_sid *sid, - TALLOC_CTX *ctx, - const char **homedir, - const char **shell, - const char **gecos, - gid_t *gid ) -{ - if ( !homedir || !shell || !gecos ) - return NT_STATUS_INVALID_PARAMETER; - - /* protect against home directories using whitespace in the - username */ - *homedir = talloc_strdup( ctx, lp_template_homedir() ); - *shell = talloc_strdup( ctx, lp_template_shell() ); - - if ( !*homedir || !*shell ) { - return NT_STATUS_NO_MEMORY; - } - - return NT_STATUS_OK; -} - /********************************************************************** *********************************************************************/ @@ -92,7 +66,6 @@ static NTSTATUS nss_template_close( void ) static struct nss_info_methods nss_template_methods = { .init = nss_template_init, - .get_nss_info = nss_template_get_info, .map_to_alias = nss_template_map_to_alias, .map_from_alias = nss_template_map_from_alias, .close_fn = nss_template_close