From 2b722af4235e6cd01e53272bfe0747642bae624b Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 3 Jan 2017 12:17:27 +0000 Subject: [PATCH] winbind: Remove unused nss_get_info_cached Signed-off-by: Volker Lendecke Reviewed-by: Uri Simchoni Reviewed-by: Andreas Schneider --- source3/winbindd/winbindd_cache.c | 116 ------------------------------ source3/winbindd/winbindd_proto.h | 8 --- 2 files changed, 124 deletions(-) diff --git a/source3/winbindd/winbindd_cache.c b/source3/winbindd/winbindd_cache.c index 4a2b1aa9586..0b8a9aa86a7 100644 --- a/source3/winbindd/winbindd_cache.c +++ b/source3/winbindd/winbindd_cache.c @@ -3763,29 +3763,6 @@ static int validate_de(TALLOC_CTX *mem_ctx, const char *keystr, TDB_DATA dbuf, return 0; } -static int validate_pwinfo(TALLOC_CTX *mem_ctx, const char *keystr, - TDB_DATA dbuf, struct tdb_validation_status *state) -{ - struct cache_entry *centry = create_centry_validate(keystr, dbuf, state); - - if (!centry) { - return 1; - } - - (void)centry_string(centry, mem_ctx); - (void)centry_string(centry, mem_ctx); - (void)centry_string(centry, mem_ctx); - (void)centry_uint32(centry); - - centry_free(centry); - - if (!(state->success)) { - return 1; - } - DEBUG(10,("validate_pwinfo: %s ok\n", keystr)); - return 0; -} - static int validate_nss_an(TALLOC_CTX *mem_ctx, const char *keystr, TDB_DATA dbuf, struct tdb_validation_status *state) @@ -3907,7 +3884,6 @@ struct key_val_struct { {"GM/", validate_gm}, {"DR/", validate_dr}, {"DE/", validate_de}, - {"NSS/PWINFO/", validate_pwinfo}, {"TRUSTDOMCACHE/", validate_trustdomcache}, {"NSS/NA/", validate_nss_na}, {"NSS/AN/", validate_nss_an}, @@ -4639,98 +4615,6 @@ void wcache_tdc_clear( void ) return; } - -/********************************************************************* - ********************************************************************/ - -static void wcache_save_user_pwinfo(struct winbindd_domain *domain, - NTSTATUS status, - const struct dom_sid *user_sid, - const char *homedir, - const char *shell, - const char *gecos, - uint32_t gid) -{ - struct cache_entry *centry; - fstring tmp; - - if ( (centry = centry_start(domain, status)) == NULL ) - return; - - centry_put_string( centry, homedir ); - centry_put_string( centry, shell ); - centry_put_string( centry, gecos ); - centry_put_uint32( centry, gid ); - - centry_end(centry, "NSS/PWINFO/%s", sid_to_fstring(tmp, user_sid) ); - - DEBUG(10,("wcache_save_user_pwinfo: %s\n", sid_string_dbg(user_sid) )); - - centry_free(centry); -} - -#ifdef HAVE_ADS - -NTSTATUS nss_get_info_cached( struct winbindd_domain *domain, - const struct dom_sid *user_sid, - TALLOC_CTX *ctx, - const char **homedir, const char **shell, - const char **gecos, gid_t *p_gid) -{ - struct winbind_cache *cache = get_cache(domain); - struct cache_entry *centry = NULL; - NTSTATUS nt_status; - fstring tmp; - - if (!cache->tdb) - goto do_query; - - centry = wcache_fetch(cache, domain, "NSS/PWINFO/%s", - sid_to_fstring(tmp, user_sid)); - - if (!centry) - goto do_query; - - *homedir = centry_string( centry, ctx ); - *shell = centry_string( centry, ctx ); - *gecos = centry_string( centry, ctx ); - *p_gid = centry_uint32( centry ); - - centry_free(centry); - - DEBUG(10,("nss_get_info_cached: [Cached] - user_sid %s\n", - sid_string_dbg(user_sid))); - - return NT_STATUS_OK; - -do_query: - - nt_status = nss_get_info( domain->name, user_sid, ctx, - homedir, shell, gecos, p_gid ); - - DEBUG(10, ("nss_get_info returned %s\n", nt_errstr(nt_status))); - - if ( NT_STATUS_IS_OK(nt_status) ) { - DEBUG(10, ("result:\n\thomedir = '%s'\n", *homedir)); - DEBUGADD(10, ("\tshell = '%s'\n", *shell)); - DEBUGADD(10, ("\tgecos = '%s'\n", *gecos)); - DEBUGADD(10, ("\tgid = '%u'\n", (unsigned int)*p_gid)); - - wcache_save_user_pwinfo( domain, nt_status, user_sid, - *homedir, *shell, *gecos, *p_gid ); - } - - if ( NT_STATUS_EQUAL( nt_status, NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND ) ) { - DEBUG(5,("nss_get_info_cached: Setting domain %s offline\n", - domain->name )); - set_domain_offline( domain ); - } - - return nt_status; -} - -#endif - static bool wcache_ndr_key(TALLOC_CTX *mem_ctx, const char *domain_name, uint32_t opnum, const DATA_BLOB *req, TDB_DATA *pkey) diff --git a/source3/winbindd/winbindd_proto.h b/source3/winbindd/winbindd_proto.h index 42e731d81c1..d7dec3a4076 100644 --- a/source3/winbindd/winbindd_proto.h +++ b/source3/winbindd/winbindd_proto.h @@ -184,14 +184,6 @@ bool wcache_tdc_add_domain( struct winbindd_domain *domain ); struct winbindd_tdc_domain * wcache_tdc_fetch_domain( TALLOC_CTX *ctx, const char *name ); struct winbindd_tdc_domain* wcache_tdc_fetch_domainbysid(TALLOC_CTX *ctx, const struct dom_sid *sid); void wcache_tdc_clear( void ); -#ifdef HAVE_ADS -struct ads_struct; -NTSTATUS nss_get_info_cached( struct winbindd_domain *domain, - const struct dom_sid *user_sid, - TALLOC_CTX *ctx, - const char **homedir, const char **shell, - const char **gecos, gid_t *p_gid); -#endif bool wcache_store_seqnum(const char *domain_name, uint32_t seqnum, time_t last_seq_check); bool wcache_fetch_ndr(TALLOC_CTX *mem_ctx, struct winbindd_domain *domain, -- 2.34.1