@@ -30,19 +30,22 @@ namespace tcp_in {
3030 * <params>
3131 * <localPort>...</localPort> <!-- optional -->
3232 * <localIPAddress>...</localIPAddress> <!-- optional, multiple times -->
33+ * <certificatePath>...</certificatePath> <!-- optional -->
3334 * </params>
3435 */
3536
3637enum ParamsXmlNodes {
3738 PARAM_PORT,
3839 PARAM_IPADDR,
40+ PARAM_CERTIFICATE,
3941};
4042
4143static const struct fds_xml_args args_params[] = {
4244 FDS_OPTS_ROOT (" params" ),
43- FDS_OPTS_ELEM (PARAM_PORT , " localPort" , FDS_OPTS_T_UINT , FDS_OPTS_P_OPT),
44- FDS_OPTS_ELEM (PARAM_IPADDR, " localIPAddress" , FDS_OPTS_T_STRING, FDS_OPTS_P_OPT
45- | FDS_OPTS_P_MULTI),
45+ FDS_OPTS_ELEM (PARAM_PORT , " localPort" , FDS_OPTS_T_UINT , FDS_OPTS_P_OPT),
46+ FDS_OPTS_ELEM (PARAM_IPADDR , " localIPAddress" , FDS_OPTS_T_STRING, FDS_OPTS_P_OPT
47+ | FDS_OPTS_P_MULTI),
48+ FDS_OPTS_ELEM (PARAM_CERTIFICATE, " certificateFile" , FDS_OPTS_T_STRING, FDS_OPTS_P_OPT),
4649 FDS_OPTS_END,
4750};
4851
@@ -69,6 +72,7 @@ Config::Config(ipx_ctx *ctx, const char *params) : local_port(DEFAULT_PORT), loc
6972void Config::parse_params (ipx_ctx *ctx, fds_xml_ctx_t *params) {
7073 const struct fds_xml_cont *content;
7174 bool empty_address = false ;
75+ bool empty_cert = false ;
7276
7377 while (fds_xml_next (params, &content) != FDS_EOC) {
7478 switch (content->id ) {
@@ -92,6 +96,15 @@ void Config::parse_params(ipx_ctx *ctx, fds_xml_ctx_t *params) {
9296 empty_address = true ;
9397 }
9498 break ;
99+ case PARAM_CERTIFICATE:
100+ assert (content->type == FDS_OPTS_T_STRING);
101+ // check if the string is not empty
102+ if (*content->ptr_string ) {
103+ certificate_file = content->ptr_string ;
104+ } else {
105+ empty_cert = true ;
106+ }
107+ break ;
95108 default :
96109 throw std::invalid_argument (" Unexpected element within <params>." );
97110 }
@@ -104,6 +117,14 @@ void Config::parse_params(ipx_ctx *ctx, fds_xml_ctx_t *params) {
104117 " listen on all interfaces but only on the specified addresses."
105118 );
106119 }
120+
121+ if (empty_cert) {
122+ IPX_CTX_WARNING (
123+ ctx,
124+ " Empty certificate path in configuration ignored. Tcp plugin will "
125+ " NOT accept TLS connections."
126+ )
127+ }
107128}
108129
109130} // namespace tcp_in
0 commit comments