Bladeren bron

add raddius gcc

balbekova 7 jaren geleden
bovenliggende
commit
4a6b9e0401

+ 6 - 4
modules/HTTP_Server/http_server.c

@@ -18,6 +18,7 @@
 #include "megatec.h"
 #include "log.h"
 #include "hal.h"
+#include "radius_user.h"
 
 #ifdef PRINTF_STDLIB
 #include <stdio.h>
@@ -1721,9 +1722,10 @@ int HTTP_ConfirmWebPwd(char *bufIn, char *bufOut, uint16_t lenBufIn, uint16_t *l
 
 	  /* Add " " to the string in order GetParamValue() can be able to parse the param */
 	  strcat(tempStr, " ");
+	  GetParamValue(tempStr, "login=", login, &valueLen);
+	  GetParamValue(tempStr, "password=", password, &valueLen);
 
-	  if (GetParamValue(tempStr, "login=", login, &valueLen) &&
-	      GetParamValue(tempStr, "password=", password, &valueLen))
+	  if (RC_Login(login, password) == RC_LOGIN_ADMIN_OK)
 	  {
 	      for (user_id = 0; user_id < MAX_WEB_USERS; user_id++) {
 
@@ -1731,8 +1733,8 @@ int HTTP_ConfirmWebPwd(char *bufIn, char *bufOut, uint16_t lenBufIn, uint16_t *l
 	        GetUserPassword(user_id, WebPassword, &valueLen);
 
 	        /* Check login and password */
-	        if ((strncmp(WebLogin, login, MAX_WEB_LOGIN_LEN) == 0) &&
-	            (strncmp(WebPassword, password, MAX_WEB_PASSWD_LEN) == 0)) {
+	        if ((strncmp(WebLogin, "admin", MAX_WEB_LOGIN_LEN) == 0) &&
+	            (strncmp(WebPassword, "12345", MAX_WEB_PASSWD_LEN) == 0)) {
 
 	            /* Login and pass are valid */
 

+ 10 - 0
modules/Makefile

@@ -45,6 +45,7 @@ INCLUDES += -Icommon
 INCLUDES += -Imonitor
 INCLUDES += -Ilog
 INCLUDES += -Itesting
+INCLUDES += -Iradius
 CSRC += $(wildcard leds/*.c)
 CSRC += $(wildcard buttons/*.c)
 CSRC += $(wildcard jumper/*.c)
@@ -54,6 +55,7 @@ CSRC += $(wildcard common/*.c)
 CSRC += $(wildcard monitor/*.c)
 CSRC += $(wildcard log/*.c)
 CSRC += $(wildcard testing/*.c)
+CSRC += $(wildcard radius/*.c)
 
 CFLAGS += -DOS_FREERTOS
 CFLAGS += -DHARDWARE_$(shell echo $(HARDWARE) | tr a-z A-Z)
@@ -104,6 +106,14 @@ INCLUDES += -I../thirdparty/PolarSSL/include/polarssl/
 INCLUDES += -I../thirdparty/PolarSSL/include/
 
 CSRC += $(wildcard ../thirdparty/PolarSSL/library/*.c)
+
+#RADDIUS_SERVER
+
+INCLUDES += -I../thirdparty/FreeRadius/
+INCLUDES += -I../thirdparty/FreeRadius/include/
+INCLUDES += -I../thirdparty/FreeRadius/lib/
+
+CSRC += $(wildcard ../thirdparty/FreeRadius/lib/*.c)
     
     
 CFLAGS += -DUSE_STDPERIPH_DRIVER -DSTM32F40_41xxx -DLOG_ENABLE

+ 2 - 2
modules/radius/radius_user.c

@@ -148,7 +148,7 @@ RadiusClientResult RC_Login(char* login, char* pas)
         return RC_ERROR;
     break;
     }
-    
+    return RC_ERROR;
     //printf("\r\n");
     //printf("Radius client result: %i\r\n", result);
     
@@ -321,4 +321,4 @@ int RC_GetAccessRights(char* buf)
 }
 
 
-/********************************* (C) РОТЕК **********************************/
+/********************************* (C) РОТЕК **********************************/

+ 1 - 1
modules/radius/radius_user.h

@@ -56,4 +56,4 @@ int RC_GetAccessRights(char* buf);
 
 #endif /* #ifndef __RADIUS_USER_H */
 
-/****************************** (C) LiteMesh ***************** end of file ****/
+/****************************** (C) LiteMesh ***************** end of file ****/

+ 1 - 0
modules/settings_api.c

@@ -22,6 +22,7 @@
 
 #include "FreeRTOS.h"
 #include "task.h"
+#include "main.h"
 
 #include <string.h>
 #include <stdlib.h>

+ 2 - 1
peripheral_modules/src/usart.c

@@ -28,7 +28,7 @@
 
 #ifdef __ICCARM__
   #define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)    
-#endif  
+
 
 PUTCHAR_PROTOTYPE   
 {   
@@ -36,6 +36,7 @@ PUTCHAR_PROTOTYPE
   while(USART_GetFlagStatus(USER_USART, USART_FLAG_TXE) == RESET) {}   
   return ch;   
 }   
+#endif
 
 #ifdef BT6702_SERVICE
 #define UPS_RBUF_SIZE 1024

+ 1 - 1
user/init_task.c

@@ -195,7 +195,7 @@ void InitTask(void *params)
  
   SETTINGS_ResetBootTry();
 
-  RC_Login("test1","12345");
+ // RC_Login("test1", "12345");
   
   // Отправка трапа о перезагрузке в случае статического IP
  /* if (!dhcp)

+ 2 - 2
user/main.h

@@ -58,9 +58,9 @@
 #define __packed		__attribute__(( packed ))
 #endif
    
-//#define DEBUG
+//#define OUR_DEBUG
 
-#ifdef DEBUG
+#ifdef OUR_DEBUG
 #define DBG
 #else
 #define DBG if (0)