diff options
Diffstat (limited to 'server/responder')
-rw-r--r-- | server/responder/common/responder_cmd.h | 4 | ||||
-rw-r--r-- | server/responder/common/responder_common.c | 168 | ||||
-rw-r--r-- | server/responder/common/responder_dp.c | 22 | ||||
-rw-r--r-- | server/responder/common/responder_dp.h | 2 | ||||
-rw-r--r-- | server/responder/pam/pam_LOCAL_domain.c | 4 | ||||
-rw-r--r-- | server/responder/pam/pamsrv_cmd.c | 16 | ||||
-rw-r--r-- | server/responder/pam/pamsrv_dp.c | 2 |
7 files changed, 109 insertions, 109 deletions
diff --git a/server/responder/common/responder_cmd.h b/server/responder/common/responder_cmd.h index b70b297a..b91fc23a 100644 --- a/server/responder/common/responder_cmd.h +++ b/server/responder/common/responder_cmd.h @@ -40,7 +40,7 @@ struct cli_request { struct sss_packet *out; }; -struct nss_ctx { +struct resp_ctx { struct tevent_context *ev; struct tevent_fd *lfde; int lfd; @@ -67,7 +67,7 @@ struct nss_ctx { struct cli_ctx { struct tevent_context *ev; - struct nss_ctx *nctx; + struct resp_ctx *rctx; int cfd; struct tevent_fd *cfde; struct sockaddr_un addr; diff --git a/server/responder/common/responder_common.c b/server/responder/common/responder_common.c index 66140f03..37801843 100644 --- a/server/responder/common/responder_common.c +++ b/server/responder/common/responder_common.c @@ -117,7 +117,7 @@ static void client_recv(struct tevent_context *ev, struct cli_ctx *cctx) /* do not read anymore */ TEVENT_FD_NOT_READABLE(cctx->cfde); /* execute command */ - ret = sss_cmd_execute(cctx, cctx->nctx->sss_cmds); + ret = sss_cmd_execute(cctx, cctx->rctx->sss_cmds); if (ret != EOK) { DEBUG(0, ("Failed to execute request, aborting client!\n")); talloc_free(cctx); @@ -171,13 +171,13 @@ static void accept_priv_fd_handler(struct tevent_context *ev, uint16_t flags, void *ptr) { /* accept and attach new event handler */ - struct nss_ctx *nctx = talloc_get_type(ptr, struct nss_ctx); + struct resp_ctx *rctx = talloc_get_type(ptr, struct resp_ctx); struct cli_ctx *cctx; socklen_t len; struct stat stat_buf; int ret; - ret = stat(nctx->priv_sock_name, &stat_buf); + ret = stat(rctx->priv_sock_name, &stat_buf); if (ret == -1) { DEBUG(1, ("stat on privileged pipe failed: [%d][%s].\n", errno, strerror(errno))); @@ -192,7 +192,7 @@ static void accept_priv_fd_handler(struct tevent_context *ev, } - cctx = talloc_zero(nctx, struct cli_ctx); + cctx = talloc_zero(rctx, struct cli_ctx); if (!cctx) { struct sockaddr_un addr; int fd; @@ -200,7 +200,7 @@ static void accept_priv_fd_handler(struct tevent_context *ev, /* accept and close to signal the client we have a problem */ memset(&addr, 0, sizeof(addr)); len = sizeof(addr); - fd = accept(nctx->priv_lfd, (struct sockaddr *)&addr, &len); + fd = accept(rctx->priv_lfd, (struct sockaddr *)&addr, &len); if (fd == -1) { return; } @@ -209,7 +209,7 @@ static void accept_priv_fd_handler(struct tevent_context *ev, } len = sizeof(cctx->addr); - cctx->cfd = accept(nctx->priv_lfd, (struct sockaddr *)&cctx->addr, &len); + cctx->cfd = accept(rctx->priv_lfd, (struct sockaddr *)&cctx->addr, &len); if (cctx->cfd == -1) { DEBUG(1, ("Accept failed [%s]", strerror(errno))); talloc_free(cctx); @@ -227,7 +227,7 @@ static void accept_priv_fd_handler(struct tevent_context *ev, } cctx->ev = ev; - cctx->nctx = nctx; + cctx->rctx = rctx; talloc_set_destructor(cctx, client_destructor); @@ -241,11 +241,11 @@ static void accept_fd_handler(struct tevent_context *ev, uint16_t flags, void *ptr) { /* accept and attach new event handler */ - struct nss_ctx *nctx = talloc_get_type(ptr, struct nss_ctx); + struct resp_ctx *rctx = talloc_get_type(ptr, struct resp_ctx); struct cli_ctx *cctx; socklen_t len; - cctx = talloc_zero(nctx, struct cli_ctx); + cctx = talloc_zero(rctx, struct cli_ctx); if (!cctx) { struct sockaddr_un addr; int fd; @@ -253,7 +253,7 @@ static void accept_fd_handler(struct tevent_context *ev, /* accept and close to signal the client we have a problem */ memset(&addr, 0, sizeof(addr)); len = sizeof(addr); - fd = accept(nctx->lfd, (struct sockaddr *)&addr, &len); + fd = accept(rctx->lfd, (struct sockaddr *)&addr, &len); if (fd == -1) { return; } @@ -262,7 +262,7 @@ static void accept_fd_handler(struct tevent_context *ev, } len = sizeof(cctx->addr); - cctx->cfd = accept(nctx->lfd, (struct sockaddr *)&cctx->addr, &len); + cctx->cfd = accept(rctx->lfd, (struct sockaddr *)&cctx->addr, &len); if (cctx->cfd == -1) { DEBUG(1, ("Accept failed [%s]", strerror(errno))); talloc_free(cctx); @@ -278,7 +278,7 @@ static void accept_fd_handler(struct tevent_context *ev, } cctx->ev = ev; - cctx->nctx = nctx; + cctx->rctx = rctx; talloc_set_destructor(cctx, client_destructor); @@ -287,7 +287,7 @@ static void accept_fd_handler(struct tevent_context *ev, return; } -static int sss_sbus_init(struct nss_ctx *nctx) +static int sss_sbus_init(struct resp_ctx *rctx) { int ret; char *sbus_address; @@ -295,19 +295,19 @@ static int sss_sbus_init(struct nss_ctx *nctx) struct sbus_method_ctx *sm_ctx; /* Set up SBUS connection to the monitor */ - ret = monitor_get_sbus_address(nctx, nctx->cdb, &sbus_address); + ret = monitor_get_sbus_address(rctx, rctx->cdb, &sbus_address); if (ret != EOK) { DEBUG(0, ("Could not locate monitor address.\n")); return ret; } - ret = monitor_init_sbus_methods(nctx, nctx->sss_sbus_methods, &sm_ctx); + ret = monitor_init_sbus_methods(rctx, rctx->sss_sbus_methods, &sm_ctx); if (ret != EOK) { DEBUG(0, ("Could not initialize SBUS methods.\n")); return ret; } - ret = sbus_client_init(nctx, nctx->ev, + ret = sbus_client_init(rctx, rctx->ev, sbus_address, sm_ctx, NULL /* Private Data */, NULL /* Destructor */, @@ -320,13 +320,13 @@ static int sss_sbus_init(struct nss_ctx *nctx) /* Set up NSS-specific listeners */ /* None currently used */ - nctx->ss_ctx = ss_ctx; + rctx->ss_ctx = ss_ctx; return EOK; } /* create a unix socket and listen to it */ -static int set_unix_socket(struct nss_ctx *nctx) +static int set_unix_socket(struct resp_ctx *rctx) { struct sockaddr_un addr; @@ -335,30 +335,30 @@ static int set_unix_socket(struct nss_ctx *nctx) char *default_pipe; int ret; - default_pipe = talloc_asprintf(nctx, "%s/%s", PIPE_PATH, - nctx->sss_pipe_name); + default_pipe = talloc_asprintf(rctx, "%s/%s", PIPE_PATH, + rctx->sss_pipe_name); if (!default_pipe) { return ENOMEM; } - ret = confdb_get_string(nctx->cdb, nctx, - nctx->confdb_socket_path, "unixSocket", - default_pipe, &nctx->sock_name); + ret = confdb_get_string(rctx->cdb, rctx, + rctx->confdb_socket_path, "unixSocket", + default_pipe, &rctx->sock_name); if (ret != EOK) { talloc_free(default_pipe); return ret; } talloc_free(default_pipe); - default_pipe = talloc_asprintf(nctx, "%s/private/%s", PIPE_PATH, - nctx->sss_pipe_name); + default_pipe = talloc_asprintf(rctx, "%s/private/%s", PIPE_PATH, + rctx->sss_pipe_name); if (!default_pipe) { return ENOMEM; } - ret = confdb_get_string(nctx->cdb, nctx, - nctx->confdb_socket_path, "privUnixSocket", - default_pipe, &nctx->priv_sock_name); + ret = confdb_get_string(rctx->cdb, rctx, + rctx->confdb_socket_path, "privUnixSocket", + default_pipe, &rctx->priv_sock_name); if (ret != EOK) { talloc_free(default_pipe); return ret; @@ -366,9 +366,9 @@ static int set_unix_socket(struct nss_ctx *nctx) talloc_free(default_pipe); #endif - if (nctx->sock_name != NULL ) { - nctx->lfd = socket(AF_UNIX, SOCK_STREAM, 0); - if (nctx->lfd == -1) { + if (rctx->sock_name != NULL ) { + rctx->lfd = socket(AF_UNIX, SOCK_STREAM, 0); + if (rctx->lfd == -1) { return EIO; } @@ -376,64 +376,64 @@ static int set_unix_socket(struct nss_ctx *nctx) * It must be readable and writable by anybody on the system. */ umask(0111); - set_nonblocking(nctx->lfd); - set_close_on_exec(nctx->lfd); + set_nonblocking(rctx->lfd); + set_close_on_exec(rctx->lfd); memset(&addr, 0, sizeof(addr)); addr.sun_family = AF_UNIX; - strncpy(addr.sun_path, nctx->sock_name, sizeof(addr.sun_path)); + strncpy(addr.sun_path, rctx->sock_name, sizeof(addr.sun_path)); /* make sure we have no old sockets around */ - unlink(nctx->sock_name); + unlink(rctx->sock_name); - if (bind(nctx->lfd, (struct sockaddr *)&addr, sizeof(addr)) == -1) { - DEBUG(0,("Unable to bind on socket '%s'\n", nctx->sock_name)); + if (bind(rctx->lfd, (struct sockaddr *)&addr, sizeof(addr)) == -1) { + DEBUG(0,("Unable to bind on socket '%s'\n", rctx->sock_name)); goto failed; } - if (listen(nctx->lfd, 10) != 0) { - DEBUG(0,("Unable to listen on socket '%s'\n", nctx->sock_name)); + if (listen(rctx->lfd, 10) != 0) { + DEBUG(0,("Unable to listen on socket '%s'\n", rctx->sock_name)); goto failed; } - nctx->lfde = tevent_add_fd(nctx->ev, nctx, nctx->lfd, - TEVENT_FD_READ, accept_fd_handler, nctx); - if (!nctx->lfde) { + rctx->lfde = tevent_add_fd(rctx->ev, rctx, rctx->lfd, + TEVENT_FD_READ, accept_fd_handler, rctx); + if (!rctx->lfde) { DEBUG(0, ("Failed to queue handler on pipe\n")); goto failed; } } - if (nctx->priv_sock_name != NULL ) { + if (rctx->priv_sock_name != NULL ) { /* create privileged pipe */ - nctx->priv_lfd = socket(AF_UNIX, SOCK_STREAM, 0); - if (nctx->priv_lfd == -1) { - close(nctx->lfd); + rctx->priv_lfd = socket(AF_UNIX, SOCK_STREAM, 0); + if (rctx->priv_lfd == -1) { + close(rctx->lfd); return EIO; } umask(0177); - set_nonblocking(nctx->priv_lfd); - set_close_on_exec(nctx->priv_lfd); + set_nonblocking(rctx->priv_lfd); + set_close_on_exec(rctx->priv_lfd); memset(&addr, 0, sizeof(addr)); addr.sun_family = AF_UNIX; - strncpy(addr.sun_path, nctx->priv_sock_name, sizeof(addr.sun_path)); + strncpy(addr.sun_path, rctx->priv_sock_name, sizeof(addr.sun_path)); - unlink(nctx->priv_sock_name); + unlink(rctx->priv_sock_name); - if (bind(nctx->priv_lfd, (struct sockaddr *)&addr, sizeof(addr)) == -1) { - DEBUG(0,("Unable to bind on socket '%s'\n", nctx->priv_sock_name)); + if (bind(rctx->priv_lfd, (struct sockaddr *)&addr, sizeof(addr)) == -1) { + DEBUG(0,("Unable to bind on socket '%s'\n", rctx->priv_sock_name)); goto failed; } - if (listen(nctx->priv_lfd, 10) != 0) { - DEBUG(0,("Unable to listen on socket '%s'\n", nctx->priv_sock_name)); + if (listen(rctx->priv_lfd, 10) != 0) { + DEBUG(0,("Unable to listen on socket '%s'\n", rctx->priv_sock_name)); goto failed; } - nctx->priv_lfde = tevent_add_fd(nctx->ev, nctx, nctx->priv_lfd, - TEVENT_FD_READ, accept_priv_fd_handler, nctx); - if (!nctx->priv_lfde) { + rctx->priv_lfde = tevent_add_fd(rctx->ev, rctx, rctx->priv_lfd, + TEVENT_FD_READ, accept_priv_fd_handler, rctx); + if (!rctx->priv_lfde) { DEBUG(0, ("Failed to queue handler on privileged pipe\n")); goto failed; } @@ -448,25 +448,25 @@ failed: /* we want default permissions on created files to be very strict, so set our umask to 0177 */ umask(0177); - close(nctx->lfd); - close(nctx->priv_lfd); + close(rctx->lfd); + close(rctx->priv_lfd); return EIO; } -static int sss_init_domains(struct nss_ctx *nctx) +static int sss_init_domains(struct resp_ctx *rctx) { TALLOC_CTX *tmp_ctx; int ret; int retval; - tmp_ctx = talloc_new(nctx); - ret = confdb_get_domains(nctx->cdb, nctx, &nctx->domain_map); + tmp_ctx = talloc_new(rctx); + ret = confdb_get_domains(rctx->cdb, rctx, &rctx->domain_map); if (ret != EOK) { retval = ret; goto done; } - if (nctx->domain_map == NULL) { + if (rctx->domain_map == NULL) { /* No domains configured! * Note: this should never happen, since LOCAL should * always be configured */ @@ -475,9 +475,9 @@ static int sss_init_domains(struct nss_ctx *nctx) goto done; } - ret = confdb_get_string(nctx->cdb, nctx, + ret = confdb_get_string(rctx->cdb, rctx, "config/domains", "default", - NULL, &nctx->default_domain); + NULL, &rctx->default_domain); if (ret != EOK) { retval = ret; goto done; @@ -500,55 +500,55 @@ int sss_process_init(TALLOC_CTX *mem_ctx, const char *confdb_socket_path, struct sbus_method dp_methods[]) { - struct nss_ctx *nctx; + struct resp_ctx *rctx; int ret; - nctx = talloc_zero(mem_ctx, struct nss_ctx); - if (!nctx) { - DEBUG(0, ("fatal error initializing nss_ctx\n")); + rctx = talloc_zero(mem_ctx, struct resp_ctx); + if (!rctx) { + DEBUG(0, ("fatal error initializing resp_ctx\n")); return ENOMEM; } - nctx->ev = ev; - nctx->cdb = cdb; - nctx->sss_sbus_methods = sss_sbus_methods; - nctx->sss_cmds = sss_cmds; - nctx->sock_name = sss_pipe_name; - nctx->priv_sock_name = sss_priv_pipe_name; - nctx->confdb_socket_path = confdb_socket_path; - nctx->dp_methods = dp_methods; + rctx->ev = ev; + rctx->cdb = cdb; + rctx->sss_sbus_methods = sss_sbus_methods; + rctx->sss_cmds = sss_cmds; + rctx->sock_name = sss_pipe_name; + rctx->priv_sock_name = sss_priv_pipe_name; + rctx->confdb_socket_path = confdb_socket_path; + rctx->dp_methods = dp_methods; - ret = sss_init_domains(nctx); + ret = sss_init_domains(rctx); if (ret != EOK) { DEBUG(0, ("fatal error setting up domain map\n")); return ret; } - ret = sss_sbus_init(nctx); + ret = sss_sbus_init(rctx); if (ret != EOK) { DEBUG(0, ("fatal error setting up message bus\n")); return ret; } - ret = sss_dp_init(nctx, nctx->dp_methods); + ret = sss_dp_init(rctx, rctx->dp_methods); if (ret != EOK) { DEBUG(0, ("fatal error setting up backend connector\n")); return ret; } - ret = sysdb_init(nctx, ev, cdb, NULL, &nctx->sysdb); + ret = sysdb_init(rctx, ev, cdb, NULL, &rctx->sysdb); if (ret != EOK) { - DEBUG(0, ("fatal error initializing nss_ctx\n")); + DEBUG(0, ("fatal error initializing resp_ctx\n")); return ret; } /* after all initializations we are ready to listen on our socket */ - ret = set_unix_socket(nctx); + ret = set_unix_socket(rctx); if (ret != EOK) { DEBUG(0, ("fatal error initializing socket\n")); return ret; } - nctx->cache_timeout = 600; /* FIXME: read from conf */ + rctx->cache_timeout = 600; /* FIXME: read from conf */ DEBUG(1, ("NSS Initialization complete\n")); diff --git a/server/responder/common/responder_dp.c b/server/responder/common/responder_dp.c index 1ae3c376..937b48dc 100644 --- a/server/responder/common/responder_dp.c +++ b/server/responder/common/responder_dp.c @@ -9,7 +9,7 @@ #include "providers/dp_sbus.h" struct sss_dp_pvt_ctx { - struct nss_ctx *nctx; + struct resp_ctx *rctx; struct sbus_method *methods; time_t last_retry; int retries; @@ -22,7 +22,7 @@ static void sss_dp_reconnect(struct tevent_context *ev, static void sss_dp_conn_reconnect(struct sss_dp_pvt_ctx *pvt) { - struct nss_ctx *nctx; + struct resp_ctx *rctx; struct tevent_timer *te; struct timeval tv; struct sbus_method_ctx *sm_ctx; @@ -42,30 +42,30 @@ static void sss_dp_conn_reconnect(struct sss_dp_pvt_ctx *pvt) pvt->last_retry = now; pvt->retries++; - nctx = pvt->nctx; + rctx = pvt->rctx; - ret = dp_get_sbus_address(nctx, nctx->cdb, &sbus_address); + ret = dp_get_sbus_address(rctx, rctx->cdb, &sbus_address); if (ret != EOK) { DEBUG(0, ("Could not locate data provider address.\n")); return; } - ret = dp_init_sbus_methods(nctx, pvt->methods, &sm_ctx); + ret = dp_init_sbus_methods(rctx, pvt->methods, &sm_ctx); if (ret != EOK) { DEBUG(0, ("Could not initialize SBUS methods.\n")); return; } - ret = sbus_client_init(nctx, nctx->ev, + ret = sbus_client_init(rctx, rctx->ev, sbus_address, sm_ctx, pvt, sss_dp_conn_destructor, - &nctx->dp_ctx); + &rctx->dp_ctx); if (ret != EOK) { DEBUG(4, ("Failed to reconnect [%d(%s)]!\n", ret, strerror(ret))); tv.tv_sec = now +5; tv.tv_usec = 0; - te = tevent_add_timer(nctx->ev, nctx, tv, sss_dp_reconnect, pvt); + te = tevent_add_timer(rctx->ev, rctx, tv, sss_dp_reconnect, pvt); if (te == NULL) { DEBUG(4, ("Failed to add timed event! Giving up\n")); } else { @@ -105,14 +105,14 @@ int sss_dp_conn_destructor(void *data) return 0; } -int sss_dp_init(struct nss_ctx *nctx, struct sbus_method *dp_methods) +int sss_dp_init(struct resp_ctx *rctx, struct sbus_method *dp_methods) { struct sss_dp_pvt_ctx *pvt; - pvt = talloc_zero(nctx, struct sss_dp_pvt_ctx); + pvt = talloc_zero(rctx, struct sss_dp_pvt_ctx); if (!pvt) return ENOMEM; - pvt->nctx = nctx; + pvt->rctx = rctx; pvt->methods = dp_methods; sss_dp_conn_reconnect(pvt); diff --git a/server/responder/common/responder_dp.h b/server/responder/common/responder_dp.h index 7010e842..528490fc 100644 --- a/server/responder/common/responder_dp.h +++ b/server/responder/common/responder_dp.h @@ -1,3 +1,3 @@ #include "sbus/sssd_dbus.h" -int sss_dp_init(struct nss_ctx *nctx, struct sbus_method dp_methods[]); +int sss_dp_init(struct resp_ctx *rctx, struct sbus_method dp_methods[]); diff --git a/server/responder/pam/pam_LOCAL_domain.c b/server/responder/pam/pam_LOCAL_domain.c index c307a1b9..49a06ff3 100644 --- a/server/responder/pam/pam_LOCAL_domain.c +++ b/server/responder/pam/pam_LOCAL_domain.c @@ -377,12 +377,12 @@ int LOCAL_pam_handler(struct cli_ctx *cctx, pam_dp_callback_t callback, DEBUG(4, ("LOCAL pam handler.\n")); - lreq->domain_info = btreemap_get_value(lreq->cctx->nctx->domain_map, + lreq->domain_info = btreemap_get_value(lreq->cctx->rctx->domain_map, lreq->pd->domain); NULL_CHECK_OR_JUMP(lreq->domain_info, ("Domain info not found.\n"), ret, EINVAL, done); - lreq->dbctx = lreq->cctx->nctx->sysdb; + lreq->dbctx = lreq->cctx->rctx->sysdb; ret = sysdb_get_user_attr(lreq, lreq->dbctx, lreq->domain_info, lreq->pd->user, attrs, diff --git a/server/responder/pam/pamsrv_cmd.c b/server/responder/pam/pamsrv_cmd.c index c13a5b53..1f7be166 100644 --- a/server/responder/pam/pamsrv_cmd.c +++ b/server/responder/pam/pamsrv_cmd.c @@ -97,7 +97,7 @@ static void pam_reply_delay(struct tevent_context *ev, struct tevent_timer *te, static void pam_reply(struct pam_data *pd) { struct cli_ctx *cctx; - struct sss_cmd_ctx *nctx; + struct sss_cmd_ctx *rctx; uint8_t *body; size_t blen; int ret; @@ -134,13 +134,13 @@ static void pam_reply(struct pam_data *pd) } cctx = pd->cctx; - nctx = talloc_zero(cctx, struct sss_cmd_ctx); - if (!nctx) { + rctx = talloc_zero(cctx, struct sss_cmd_ctx); + if (!rctx) { err = ENOMEM; goto done; } - nctx->cctx = cctx; - nctx->check_expiration = true; + rctx->cctx = cctx; + rctx->check_expiration = true; ret = sss_packet_new(cctx->creq, 0, sss_packet_get_cmd(cctx->creq->in), &cctx->creq->out); @@ -196,7 +196,7 @@ static void pam_reply(struct pam_data *pd) done: talloc_free(pd); - sss_cmd_done(nctx); + sss_cmd_done(rctx); } static int pam_forwarder(struct cli_ctx *cctx, int pam_cmd) @@ -228,8 +228,8 @@ static int pam_forwarder(struct cli_ctx *cctx, int pam_cmd) pd->resp_list = NULL; if (pd->domain == NULL) { - if (cctx->nctx->default_domain != NULL) { - pd->domain = cctx->nctx->default_domain; + if (cctx->rctx->default_domain != NULL) { + pd->domain = cctx->rctx->default_domain; } else { pd->domain = talloc_strdup(pd, "LOCAL"); } diff --git a/server/responder/pam/pamsrv_dp.c b/server/responder/pam/pamsrv_dp.c index 2d5d9799..9bd249e2 100644 --- a/server/responder/pam/pamsrv_dp.c +++ b/server/responder/pam/pamsrv_dp.c @@ -117,7 +117,7 @@ int pam_dp_send_req(struct cli_ctx *cctx, return EINVAL; } - conn = sbus_get_connection(cctx->nctx->dp_ctx->scon_ctx); + conn = sbus_get_connection(cctx->rctx->dp_ctx->scon_ctx); dbus_error_init(&dbus_error); msg = dbus_message_new_method_call(NULL, |