Skip to content

Commit

Permalink
session server UPDATE remove obsolete funcions
Browse files Browse the repository at this point in the history
  • Loading branch information
roman committed Nov 3, 2023
1 parent ca3c9dd commit f790ea1
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 137 deletions.
27 changes: 0 additions & 27 deletions src/session_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -2060,33 +2060,6 @@ nc_server_endpt_count(void)
return server_opts.endpt_count;
}

API int
nc_server_is_endpt(const char *name)
{
uint16_t i;
int found = 0;

if (!name) {
return found;
}

/* CONFIG READ LOCK */
pthread_rwlock_rdlock(&server_opts.config_lock);

/* check name uniqueness */
for (i = 0; i < server_opts.endpt_count; ++i) {
if (!strcmp(server_opts.endpts[i].name, name)) {
found = 1;
break;
}
}

/* CONFIG UNLOCK */
pthread_rwlock_unlock(&server_opts.config_lock);

return found;
}

API NC_MSG_TYPE
nc_accept(int timeout, const struct ly_ctx *ctx, struct nc_session **session)
{
Expand Down
25 changes: 0 additions & 25 deletions src/session_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -378,14 +378,6 @@ void nc_ps_clear(struct nc_pollsession *ps, int all, void (*data_free)(void *));
*/
int nc_server_endpt_count(void);

/**
* @brief Check if an endpoint exists.
*
* @param[in] name Endpoint name.
* @return 0 if does not exists, non-zero otherwise.
*/
int nc_server_is_endpt(const char *name);

/** @} */

/**
Expand Down Expand Up @@ -475,23 +467,6 @@ void nc_server_ssh_set_interactive_auth_clb(int (*interactive_auth_clb)(const st
* @{
*/

/**
* @brief Get a cert-to-name entry.
*
* If a parameter is NULL, it is ignored. If its dereferenced value is NULL,
* it is filled and returned. If the value is set, it is used as a filter.
* Returns first matching entry.
*
* @param[in] endpt_name Existing endpoint name.
* @param[in,out] id Priority of the entry.
* @param[in,out] fingerprint Fingerprint fo the entry.
* @param[in,out] map_type Mapping type of the entry.
* @param[in,out] name Specific username for the entry.
* @return 0 on success, -1 on not finding any match.
*/
int nc_server_tls_endpt_get_ctn(const char *endpt_name, uint32_t *id, char **fingerprint, NC_TLS_CTN_MAPTYPE *map_type,
char **name);

/**
* @brief Get client certificate.
*
Expand Down
85 changes: 0 additions & 85 deletions src/session_server_tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -799,91 +799,6 @@ nc_tlsclb_verify(int preverify_ok, X509_STORE_CTX *x509_ctx)
return 0;
}

static int
nc_server_tls_get_ctn(uint32_t *id, char **fingerprint, NC_TLS_CTN_MAPTYPE *map_type, char **name,
struct nc_server_tls_opts *opts)
{
struct nc_ctn *ctn;
int ret = -1;

for (ctn = opts->ctn; ctn; ctn = ctn->next) {
if (id && *id && (*id != ctn->id)) {
continue;
}
if (fingerprint && *fingerprint && (!ctn->fingerprint || strcmp(*fingerprint, ctn->fingerprint))) {
continue;
}
if (map_type && *map_type && (!ctn->map_type || (*map_type != ctn->map_type))) {
continue;
}
if (name && *name && (!ctn->name || strcmp(*name, ctn->name))) {
continue;
}

/* first match, good enough */
if (id && !(*id)) {
*id = ctn->id;
}
if (fingerprint && !(*fingerprint) && ctn->fingerprint) {
*fingerprint = strdup(ctn->fingerprint);
}
if (map_type && !(*map_type) && ctn->map_type) {
*map_type = ctn->map_type;
}
if (name && !(*name) && ctn->name) {
*name = strdup(ctn->name);
}

ret = 0;
break;
}

return ret;
}

API int
nc_server_tls_endpt_get_ctn(const char *endpt_name, uint32_t *id, char **fingerprint, NC_TLS_CTN_MAPTYPE *map_type,
char **name)
{
int ret;
struct nc_endpt *endpt;

NC_CHECK_ARG_RET(NULL, endpt_name, -1);

/* LOCK */
endpt = nc_server_endpt_lock_get(endpt_name, NC_TI_OPENSSL, NULL);
if (!endpt) {
return -1;
}
ret = nc_server_tls_get_ctn(id, fingerprint, map_type, name, endpt->opts.tls);
/* UNLOCK */
pthread_rwlock_unlock(&server_opts.config_lock);

return ret;
}

API int
nc_server_tls_ch_client_endpt_get_ctn(const char *client_name, const char *endpt_name, uint32_t *id, char **fingerprint,
NC_TLS_CTN_MAPTYPE *map_type, char **name)
{
int ret;
struct nc_ch_client *client;
struct nc_ch_endpt *endpt;

/* LOCK */
endpt = nc_server_ch_client_lock(client_name, endpt_name, NC_TI_OPENSSL, &client);
if (!endpt) {
return -1;
}

ret = nc_server_tls_get_ctn(id, fingerprint, map_type, name, endpt->opts.tls);

/* UNLOCK */
nc_server_ch_client_unlock(client);

return ret;
}

API const X509 *
nc_session_get_client_cert(const struct nc_session *session)
{
Expand Down

0 comments on commit f790ea1

Please sign in to comment.