Răsfoiți Sursa

[BT-6703]fix ssl_server

balbekova 5 ani în urmă
părinte
comite
bcb5fb5df8

+ 3 - 2
modules/HTTP_Server/my_ssl_server.c

@@ -4,6 +4,8 @@
  *  Created on: 08.11.2017
  *      Author: balbekova
  */
+#include "common_config.h"
+
 #ifdef SSL_SERVER_ENABLE
 
 #include "lwip/opt.h"
@@ -18,7 +20,6 @@
 #include "bt6703_fs/fsdata.c"
 #include "settings_api.h"
 #include "netconf.h"
-#include "common_config.h"
 #include "testing.h"
 #include "rtc.h"
 #include "rng.h"
@@ -1622,7 +1623,7 @@ int HTTP_ConfirmWebPwd(char *bufIn, char *bufOut, uint16_t lenBufIn, uint16_t *l
     memset(name_login, 0, 50);
     tempStr[0] = '0';
     /* Get first 50 bytes of string */
-    strncpy(tempStr, bufIn, 49);
+    strncat(tempStr, bufIn, 49);
 
     /* Add " " to the string in order GetParamValue() can be able to parse the param */
     strcat(tempStr, " ");

+ 6 - 4
modules/HTTP_Server/my_ssl_server.h

@@ -4,18 +4,19 @@
  *  Created on: 08.11.2017
  *      Author: balbekova
  */
-#ifdef SSL_SERVER_ENABLE
 
 #ifndef MY_SSL_SERVER_H_
 #define MY_SSL_SERVER_H_
 
-
+#include "common_config.h"
 #include "lwip/opt.h"
 #include "lwip/arch.h"
 #include "lwip/api.h"
 
 #include "mbedtls/ssl.h"
 
+#ifdef SSL_SERVER_ENABLE
+
 #define HTTP_AUTH_ENABLE
 
 #define SSL_TASK_PRIO   ( configMAX_PRIORITIES - 3 )
@@ -241,6 +242,7 @@ void ssl_server(void *pvParameters);
 int RandVal(void* arg);
 void HTTP_SendHistory(void);
 void HTTP_SendLog(void);
+void HTTP_Init();
 void HTTPS_Init();
 int SSL_ReadRoutine(mbedtls_ssl_context *ssl, unsigned char* recvBuf);
 char* SSL_ProcessingRoutine(uint16_t* sendLen);
@@ -253,7 +255,7 @@ SSL_SERVER_STATE SSL_Write(mbedtls_ssl_context *ssl, char *data, int datalen);
 #endif
 
 
-
+#endif
 
 #endif /* SSL_SERVER_H_ */
-#endif
+

+ 5 - 4
user/init_task.c

@@ -35,7 +35,8 @@
 #endif
 #ifdef HTTP_SERVER_ENABLE
 #include "http_server.h"
-#elif defined SSL_SERVER_ENABLE
+#endif
+#ifdef SSL_SERVER_ENABLE
 #include "my_ssl_server.h"
 #endif
 #ifdef PORTGW_ENABLE
@@ -159,13 +160,13 @@ void InitTask(void *params)
   LwIP_Init();
 
 #ifdef HTTP_SERVER_ENABLE
-
 	  HTTP_Init();
+#endif
 #ifdef SSL_SERVER_ENABLE
-	   HTTPS_Init();
+    HTTP_Init();
+	  HTTPS_Init();
 //#define SSL_TASK_PRIO   ( configMAX_PRIORITIES - 3 )
 	   xTaskCreate(ssl_server, "SSL", 24*configMINIMAL_STACK_SIZE, NULL, SSL_TASK_PRIO, NULL);
-#endif
 #endif
 	   // UDP for net settings 
 	   if(strncmp(sSettings.sFlags.testState, "T2OK", 4)){