epoll_fd = epoll_create(MAX_EPOLL_EVENT);
if (epoll_fd < 0) {
- EM_DEBUG_CRITICAL_EXCEPTION("epoll_create failed: %s[%d]", EM_STRERROR(errno_buf), errno);
+ EM_DEBUG_CRITICAL_EXCEPTION("epoll_create failed: [%d]", errno);
err = EMAIL_ERROR_IMAP4_IDLE_FAILURE;
goto FINISH_OFF;
}
SNPRINTF(command, sizeof(command), "%s UID SEARCH 1:* SINCE %s\015\012", tag, since_date_string);
EM_DEBUG_LOG("COMMAND [%s] ", command);
- EM_SAFE_STRCPY(before_date_string, since_date_string);
+ g_strlcpy(before_date_string, since_date_string, 20);
EM_SAFE_FREE(since_date_string);
#ifdef FEATURE_CORE_DEBUG
EM_DEBUG_LOG(" [IMAP4] >>> [%s]", command);
time(&RawTime);
EM_DEBUG_LOG("RawTime Info [%lu]", RawTime);
-
- timeinfo = localtime(&RawTime);
+ struct tm time_buf;
+ timeinfo = localtime_r(&RawTime, &time_buf);
if (timeinfo == NULL) {
EM_DEBUG_EXCEPTION("localtime failed");
err = EMAIL_ERROR_SYSTEM_FAILURE;
}
time_t t = time(0);
- struct tm *data = localtime(&t);
+ struct tm time_buf;
+ struct tm *data = localtime_r(&t, &time_buf);
if (data == NULL) {
EM_DEBUG_EXCEPTION("localtime failed");
return NULL;
int zone = t->tm_hour * 60 + t->tm_min;
int julian = t->tm_yday;
- t = localtime(&input_mail_tbl_data->date_time);
+ struct tm t_buf;
+ t = localtime_r(&input_mail_tbl_data->date_time, &t_buf);
if (t == NULL) {
EM_DEBUG_EXCEPTION("localtime failed");
error = EMAIL_ERROR_SYSTEM_FAILURE;
int day_count = 0;
int start_hour = 0;
int start_min = 0;
+ struct tm time_buf;
struct tm *time_info;
if (output_time == NULL) {
goto FINISH_OFF;
}
- time_info = localtime(&input_current_time);
+ time_info = localtime_r(&input_current_time, &time_buf);
if (time_info == NULL) {
EM_DEBUG_EXCEPTION("localtime failed");
err = EMAIL_ERROR_SYSTEM_FAILURE;
{
EM_DEBUG_FUNC_BEGIN("input_account_ref [%p] input_time[%d] output_result[%p]", input_account_ref, input_time, output_result);
int err = EMAIL_ERROR_NONE;
+ struct tm time_buf;
struct tm *time_info;
int wday = 1;
int result = 0;
goto FINISH_OFF;
}
- time_info = localtime(&input_time);
+ time_info = localtime_r(&input_time, &time_buf);
if (time_info == NULL) {
EM_DEBUG_EXCEPTION("localtime failed");
err = EMAIL_ERROR_SYSTEM_FAILURE;
{
EM_DEBUG_FUNC_BEGIN("input_time[%p] output_date_string[%p]", input_time, output_date_string);
int err = EMAIL_ERROR_NONE;
- struct tm *timeinfo = NULL;
+ struct tm time_buf;
+ struct tm *timeinfo;
char *mon = NULL;
char *temp_date_string = NULL;
EM_DEBUG_LOG("RawTime Info [%lu]", input_time);
- timeinfo = localtime(&input_time);
+ timeinfo = localtime_r(&input_time, &time_buf);
if (timeinfo == NULL) {
EM_DEBUG_EXCEPTION("localtime failed");
err = EMAIL_ERROR_SYSTEM_FAILURE;
EM_DEBUG_LOG("MULTI_USER_NAME : [%s]", multi_user_name);
if (EM_SAFE_STRLEN(multi_user_name) > 0) {
- sprintf(recv_password_file_name, ".email_account_%d_recv_%s", account_id, multi_user_name);
- sprintf(send_password_file_name, ".email_account_%d_send_%s", account_id, multi_user_name);
+ snprintf(recv_password_file_name, MAX_PW_FILE_NAME_LENGTH, ".email_account_%d_recv_%s", account_id, multi_user_name);
+ sprintf(send_password_file_name, MAX_PW_FILE_NAME_LENGTH, ".email_account_%d_send_%s", account_id, multi_user_name);
} else {
- sprintf(recv_password_file_name, ".email_account_%d_recv", account_id);
- sprintf(send_password_file_name, ".email_account_%d_send", account_id);
+ sprintf(recv_password_file_name, MAX_PW_FILE_NAME_LENGTH, ".email_account_%d_recv", account_id);
+ sprintf(send_password_file_name, MAX_PW_FILE_NAME_LENGTH, ".email_account_%d_send", account_id);
}
EM_DEBUG_FUNC_END();
goto FINISH_OFF;
}
- sprintf(path_buf, "%s", MAILHOME);
- sprintf(path_buf+EM_SAFE_STRLEN(path_buf), "%s%d", DIR_SEPERATOR, account_id);
+ snprintf(path_buf, 512, "%s", MAILHOME);
+ snprintf(path_buf+EM_SAFE_STRLEN(path_buf), 512 - EM_SAFE_STRLEN(path_buf), "%s%d", DIR_SEPERATOR, account_id);
if (mail_id > 0)
- sprintf(path_buf+EM_SAFE_STRLEN(path_buf), "%s%d", DIR_SEPERATOR, mail_id);
+ snprintf(path_buf+EM_SAFE_STRLEN(path_buf), 512 - EM_SAFE_STRLEN(path_buf), "%s%d", DIR_SEPERATOR, mail_id);
if (atch_id > 0)
- sprintf(path_buf+EM_SAFE_STRLEN(path_buf), "%s%d", DIR_SEPERATOR, atch_id);
+ snprintf(path_buf+EM_SAFE_STRLEN(path_buf), 512 - EM_SAFE_STRLEN(path_buf), "%s%d", DIR_SEPERATOR, atch_id);
if (fname) {
temp_file = EM_SAFE_STRDUP(fname);
return ret;
}
+/*
INTERNAL_FUNC int emstorage_get_dele_name(char *multi_user_name, int account_id, int mail_id, int atch_id, char *fname, char *name_buf, int *err_code)
{
EM_DEBUG_FUNC_BEGIN("account_id[%d], mail_id[%d], atch_id[%d], fname[%p], name_buf[%p], err_code[%p]", account_id, mail_id, atch_id, fname, name_buf, err_code);
EM_DEBUG_FUNC_END();
return true;
}
+*/
INTERNAL_FUNC int emstorage_create_dir(char *multi_user_name, int account_id, int mail_id, int atch_id, int *err_code)
{
memset(&server, 0, sizeof(server));
server.sun_family = AF_UNIX;
- strcpy(server.sun_path, ipc_socket_path);
+ strncpy(server.sun_path, ipc_socket_path, sizeof(server.sun_path)-1);
EM_SAFE_FREE(ipc_socket_path);