From 9729b3341b4a1d5cc90007be760d3c8931f2bf3d Mon Sep 17 00:00:00 2001 From: Aleksandr Lysikov <lysikov@inbox.ru> Date: Mon, 29 Apr 2019 22:54:03 +0500 Subject: [PATCH] added key field for authorisation of vpn-client --- stream/dap_stream.c | 3 +++ stream/dap_stream.h | 2 ++ stream/dap_stream_ctl.c | 1 + 3 files changed, 6 insertions(+) diff --git a/stream/dap_stream.c b/stream/dap_stream.c index 5b06c95..238e0a5 100755 --- a/stream/dap_stream.c +++ b/stream/dap_stream.c @@ -168,6 +168,9 @@ void stream_headers_read(dap_http_client_t * cl_ht, void * arg) if(dap_stream_session_open(ss)==0){ // Create new stream dap_stream_t * sid = stream_new(cl_ht); sid->session=ss; + dap_http_header_t *header = dap_http_header_find(cl_ht->in_headers, "Service-Key"); + if (header) + sid->service_key = strdup(header->value); size_t count_channels = strlen(ss->active_channels); for(size_t i = 0; i < count_channels; i++) { dap_stream_ch_new(sid, ss->active_channels[i]); diff --git a/stream/dap_stream.h b/stream/dap_stream.h index 2a149cc..1fe1807 100755 --- a/stream/dap_stream.h +++ b/stream/dap_stream.h @@ -83,6 +83,8 @@ typedef struct dap_stream { dap_stream_ch_t * channel[255]; // TODO reduce channels to 16 to economy memory size_t channel_count; + char *service_key; + size_t frame_sent; // Frame counter size_t seq_id; diff --git a/stream/dap_stream_ctl.c b/stream/dap_stream_ctl.c index e4095d6..f4038a9 100755 --- a/stream/dap_stream_ctl.c +++ b/stream/dap_stream_ctl.c @@ -111,6 +111,7 @@ void stream_ctl_proc(struct dap_http_simple *cl_st, void * arg) l_new_session = true; } else if(strcmp(dg->url_path, "socket_forward" ) == 0) { + l_channels_str[0] = '\0'; l_new_session = true; } /* }else if (strcmp(dg->url_path,"stream_ctl")==0) { -- GitLab