From 65f90758d4df5581bc94746d47a1548ed8ff738b Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Mon, 6 Apr 2009 15:54:00 -0400 Subject: Unify name parsing and reposnder headers Use common sss_parse_name function in all responders Simplify responder headers by combining common,cmd,dp in one header and add name parse structure as part of the common responder context. --- server/responder/nss/nsssrv.c | 28 +++++----------------------- 1 file changed, 5 insertions(+), 23 deletions(-) (limited to 'server/responder/nss/nsssrv.c') diff --git a/server/responder/nss/nsssrv.c b/server/responder/nss/nsssrv.c index 4f9713b1..834c42d9 100644 --- a/server/responder/nss/nsssrv.c +++ b/server/responder/nss/nsssrv.c @@ -123,7 +123,7 @@ static int nss_get_config(struct nss_ctx *nctx, struct confdb_ctx *cdb) { TALLOC_CTX *tmpctx; - const char *domain, *name; + char *domain, *name; const char **domains; char **filter_list; int ret, num, i, j; @@ -150,8 +150,8 @@ static int nss_get_config(struct nss_ctx *nctx, "filterUsers", &filter_list); if (ret != EOK) goto done; for (i = 0; filter_list[i]; i++) { - ret = nss_parse_name(tmpctx, nctx, filter_list[i], - &domain, &name); + ret = sss_parse_name(tmpctx, nctx->rctx->names, + filter_list[i], &domain, &name); if (ret != EOK) { DEBUG(1, ("Invalid name in filterUsers list: [%s] (%d)\n", filter_list[i], ret)); @@ -192,8 +192,8 @@ static int nss_get_config(struct nss_ctx *nctx, "filterGroups", &filter_list); if (ret != EOK) goto done; for (i = 0; filter_list[i]; i++) { - ret = nss_parse_name(tmpctx, nctx, filter_list[i], - &domain, &name); + ret = sss_parse_name(tmpctx, nctx->rctx->names, + filter_list[i], &domain, &name); if (ret != EOK) { DEBUG(1, ("Invalid name in filterGroups list: [%s] (%d)\n", filter_list[i], ret)); @@ -235,22 +235,6 @@ done: return ret; } -static void *nss_pcre_malloc(size_t size) -{ - return talloc_named_const(NULL, size, "nss_pcre_malloc"); -} - -static void nss_pcre_free(void *ctx) -{ - talloc_free(ctx); -} - -void nss_pcre_setup(void) -{ - pcre_malloc = nss_pcre_malloc; - pcre_free = nss_pcre_free; -} - int nss_process_init(TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct confdb_ctx *cdb) @@ -260,8 +244,6 @@ int nss_process_init(TALLOC_CTX *mem_ctx, struct nss_ctx *nctx; int ret; - nss_pcre_setup(); - nctx = talloc_zero(mem_ctx, struct nss_ctx); if (!nctx) { DEBUG(0, ("fatal error initializing nss_ctx\n")); -- cgit