1.修改解析URL中源证书越界,段错误

2.修改LOG文件命名
3.修改非授信证书从本地签发
This commit is contained in:
fengweihao
2018-10-23 11:31:57 +08:00
parent a6a80839aa
commit 26cba8d900
6 changed files with 99 additions and 95 deletions

View File

@@ -22,45 +22,12 @@
#include "MESA_prof_load.h"
#include "MESA_handle_logger.h"
static void rt_get_pname_by_pid(pid_t pid, char *task_name)
{
#define BUF_SIZE 1024
char proc_pid_path[BUF_SIZE];
char buf[BUF_SIZE];
sprintf(proc_pid_path, "/proc/%d/status", pid);
FILE* fp = fopen(proc_pid_path, "r");
if(NULL != fp){
if( fgets(buf, BUF_SIZE-1, fp)== NULL ){
fclose(fp);
}
fclose(fp);
sscanf(buf, "%*s %s", task_name);
}
}
void mesa_logging_print(int log_level, char *module, char *msg)
{
MESA_handle_runtime_log(logging_sc_lid.run_log_handle, log_level, module, msg);
return;
}
int mesa_logging_mkfile(char *file, size_t size)
{
char tm[24] = {0};
char pname[32]= {0};
assert(file);
if (size < 32)
return -1;
rt_curr_tms2str(EVAL_TM_STYLE, tm, 23);
rt_get_pname_by_pid(getpid(), &pname[0]);
snprintf(file, 63, "%s-%s-%d-%d-%s.log", pname, getpwuid(getuid())->pw_name, getpwuid(getuid())->pw_uid, getpwuid(getuid())->pw_gid, tm);
return 0;
}
void cert_syslog_init(char *config)
{
char run_log_path[256] = {0};
@@ -72,10 +39,7 @@ void cert_syslog_init(char *config)
MESA_load_profile_string_def(config, (const char *)"SYSTEM",(const char *)"RUN_LOG_PATH",
logging_sc_lid.run_log_path, 128, NULL);
char file[64] = {0};
mesa_logging_mkfile(file, 63);
//STRCAT(logging_sc_lid.run_log_path, file);
snprintf(run_log_path, 255, "%s/%s", logging_sc_lid.run_log_path, file);
snprintf(run_log_path, 255, "%s/%s", logging_sc_lid.run_log_path, "certstore.log");
logging_sc_lid.run_log_handle = MESA_create_runtime_log_handle(run_log_path, logging_sc_lid.run_log_level);
if(logging_sc_lid.run_log_handle == NULL){