server session FEATURE any transport combination support
diff --git a/src/session_server.c b/src/session_server.c
index d49edb1..1f6c856 100644
--- a/src/session_server.c
+++ b/src/session_server.c
@@ -1716,8 +1716,6 @@
nc_ps_unlock(ps, q_id, __func__);
}
-#if defined(NC_ENABLED_SSH) || defined(NC_ENABLED_TLS)
-
static int
nc_get_uid(int sock, uid_t *uid)
{
@@ -2103,13 +2101,24 @@
}
if (sock > -1) {
-#if defined(NC_ENABLED_SSH) && defined(NC_ENABLED_TLS)
- VRB("Listening on %s:%u for %s connections.", address, port, (endpt->ti == NC_TI_LIBSSH ? "SSH" : "TLS"));
-#elif defined(NC_ENABLED_SSH)
- VRB("Listening on %s:%u for SSH connections.", address, port);
-#else
- VRB("Listening on %s:%u for TLS connections.", address, port);
+ switch (endpt->ti) {
+ case NC_TI_UNIX:
+ VRB("Listening on %s for UNIX connections.", address);
+ break;
+#ifdef NC_ENABLED_SSH
+ case NC_TI_LIBSSH:
+ VRB("Listening on %s:%u for SSH connections.", address, port);
+ break;
#endif
+#ifdef NC_ENABLED_TLS
+ case NC_TI_OPENSSL:
+ VRB("Listening on %s:%u for TLS connections.", address, port);
+ break;
+#endif
+ default:
+ ERRINT;
+ break;
+ }
}
cleanup:
@@ -2128,12 +2137,16 @@
return nc_server_endpt_set_address_port(endpt_name, address, 0);
}
+#if defined(NC_ENABLED_SSH) || defined(NC_ENABLED_TLS)
+
API int
nc_server_endpt_set_port(const char *endpt_name, uint16_t port)
{
return nc_server_endpt_set_address_port(endpt_name, NULL, port);
}
+#endif
+
API int
nc_server_endpt_set_perms(const char *endpt_name, mode_t mode, uid_t uid, gid_t gid)
{
@@ -2363,6 +2376,8 @@
return msgtype;
}
+#if defined(NC_ENABLED_SSH) || defined(NC_ENABLED_TLS)
+
/* client is expected to be locked */
static int
_nc_server_ch_client_del_endpt(struct nc_ch_client *client, const char *endpt_name, NC_TRANSPORT_IMPL ti)
diff --git a/src/session_server.h b/src/session_server.h
index 7d9fb41..df7b075 100644
--- a/src/session_server.h
+++ b/src/session_server.h
@@ -340,8 +340,6 @@
*/
void nc_ps_clear(struct nc_pollsession *ps, int all, void (*data_free)(void *));
-#if defined(NC_ENABLED_SSH) || defined(NC_ENABLED_TLS)
-
/**@} Server Session */
/**
@@ -400,9 +398,12 @@
*/
int nc_server_endpt_set_address(const char *endpt_name, const char *address);
+#if defined(NC_ENABLED_SSH) || defined(NC_ENABLED_TLS)
+
/**
* @brief Change endpoint listening port.
*
+ * This is only valid on SSH/TLS transport endpoint.
* On error the previous listening socket (if any) is left untouched.
*
* @param[in] endpt_name Existing endpoint name.
@@ -411,10 +412,12 @@
*/
int nc_server_endpt_set_port(const char *endpt_name, uint16_t port);
+#endif
+
/**
* @brief Change endpoint permissions.
*
- * This is only valid on unix transport endpoint.
+ * This is only valid on UNIX transport endpoint.
* On error the previous listening socket (if any) is left untouched.
*
* @param[in] endpt_name Existing endpoint name.
@@ -466,8 +469,6 @@
*/
NC_MSG_TYPE nc_accept(int timeout, struct nc_session **session);
-#endif /* NC_ENABLED_SSH || NC_ENABLED_TLS */
-
#ifdef NC_ENABLED_SSH
/**