diff options
Diffstat (limited to 'server/responder/common')
-rw-r--r-- | server/responder/common/responder.h | 8 | ||||
-rw-r--r-- | server/responder/common/responder_common.c | 8 | ||||
-rw-r--r-- | server/responder/common/responder_dp.c | 27 |
3 files changed, 38 insertions, 5 deletions
diff --git a/server/responder/common/responder.h b/server/responder/common/responder.h index f4187650..881c3306 100644 --- a/server/responder/common/responder.h +++ b/server/responder/common/responder.h @@ -104,8 +104,10 @@ int sss_process_init(TALLOC_CTX *mem_ctx, const char *confdb_service_path, const char *svc_name, uint16_t svc_version, - struct sbus_interface *dp_intf, struct sbus_interface *monitor_intf, + uint16_t cli_type, uint16_t cli_version, + const char *cli_name, const char *cli_domain, + struct sbus_interface *dp_intf, struct resp_ctx **responder_ctx); int sss_parse_name(TALLOC_CTX *memctx, @@ -119,7 +121,9 @@ int sss_cmd_get_version(struct cli_ctx *cctx); struct cli_protocol_version *register_cli_protocol_version(void); /* responder_dp.c */ -int sss_dp_init(struct resp_ctx *rctx, struct sbus_interface *intf); +int sss_dp_init(struct resp_ctx *rctx, struct sbus_interface *intf, + uint16_t cli_type, uint16_t cli_version, + const char *cli_name, const char *cli_domain); #define NSS_DP_USER 1 #define NSS_DP_GROUP 2 diff --git a/server/responder/common/responder_common.c b/server/responder/common/responder_common.c index 75e72103..cf06c3ca 100644 --- a/server/responder/common/responder_common.c +++ b/server/responder/common/responder_common.c @@ -455,8 +455,10 @@ int sss_process_init(TALLOC_CTX *mem_ctx, const char *confdb_service_path, const char *svc_name, uint16_t svc_version, - struct sbus_interface *dp_intf, struct sbus_interface *monitor_intf, + uint16_t cli_type, uint16_t cli_version, + const char *cli_name, const char *cli_domain, + struct sbus_interface *dp_intf, struct resp_ctx **responder_ctx) { struct resp_ctx *rctx; @@ -486,7 +488,9 @@ int sss_process_init(TALLOC_CTX *mem_ctx, return ret; } - ret = sss_dp_init(rctx, dp_intf); + ret = sss_dp_init(rctx, dp_intf, + cli_type, cli_version, + cli_name, cli_domain); if (ret != EOK) { DEBUG(0, ("fatal error setting up backend connector\n")); return ret; diff --git a/server/responder/common/responder_dp.c b/server/responder/common/responder_dp.c index dc810fd9..fd13208f 100644 --- a/server/responder/common/responder_dp.c +++ b/server/responder/common/responder_dp.c @@ -11,6 +11,12 @@ struct sss_dp_pvt_ctx { struct resp_ctx *rctx; struct sbus_interface *intf; + + uint16_t cli_type; + uint16_t cli_version; + const char *cli_name; + const char *cli_domain; + time_t last_retry; int retries; }; @@ -52,6 +58,17 @@ static void sss_dp_conn_reconnect(struct sss_dp_pvt_ctx *pvt) ret = sbus_client_init(rctx, rctx->ev, sbus_address, pvt->intf, &rctx->dp_conn, sss_dp_conn_destructor, pvt); + + if (ret == EOK) { + /* Identify ourselves to the data provider */ + ret = dp_common_send_id(rctx->dp_conn, + pvt->cli_type, pvt->cli_version, + pvt->cli_name, pvt->cli_domain); + if (ret != EOK) { + DEBUG(0, ("Failed to identify to the data provider!\n")); + } + } + if (ret != EOK) { DEBUG(4, ("Failed to reconnect [%d(%s)]!\n", ret, strerror(ret))); @@ -97,7 +114,9 @@ int sss_dp_conn_destructor(void *data) return 0; } -int sss_dp_init(struct resp_ctx *rctx, struct sbus_interface *dp_intf) +int sss_dp_init(struct resp_ctx *rctx, struct sbus_interface *dp_intf, + uint16_t cli_type, uint16_t cli_version, + const char *cli_name, const char *cli_domain) { struct sss_dp_pvt_ctx *pvt; @@ -106,6 +125,12 @@ int sss_dp_init(struct resp_ctx *rctx, struct sbus_interface *dp_intf) pvt->rctx = rctx; pvt->intf = dp_intf; + pvt->cli_type = cli_type; + pvt->cli_version = cli_version; + pvt->cli_name = talloc_strdup(pvt, cli_name); + if (!pvt->cli_name) return ENOMEM; + pvt->cli_domain = talloc_strdup(pvt, cli_domain); + if (!pvt->cli_domain) return ENOMEM; sss_dp_conn_reconnect(pvt); |