From 4cd1a75accab3fccebdb757b0266d8815c86923c Mon Sep 17 00:00:00 2001 From: Stefan Ritt Date: Mon, 20 Oct 2014 13:54:18 +0200 Subject: [PATCH 01/14] Scan subdirectory tree for elog files --- src/elogd.c | 112 ++++++++++++++++++++++++++++------------------------ 1 file changed, 61 insertions(+), 51 deletions(-) diff --git a/src/elogd.c b/src/elogd.c index eb7bc92b..b2bbf4ac 100755 --- a/src/elogd.c +++ b/src/elogd.c @@ -3627,7 +3627,7 @@ int fnmatch1(const char *pattern, const char *string) /*------------------------------------------------------------------*/ -int ss_file_find(char *path, char *pattern, char **plist) +int ss_file_find(const char *path, char *pattern, char **plist) /******************************************************************** Routine: ss_file_find @@ -3808,7 +3808,7 @@ int parse_file(LOGBOOK *lbs, char *file_name) { char str[256], date[256], *buffer, *p, *pn, in_reply_to[80]; int length, i, fh, len; - + fh = open(file_name, O_RDONLY | O_BINARY, 0644); if (fh < 0) { @@ -3891,12 +3891,64 @@ int parse_file(LOGBOOK *lbs, char *file_name) /*------------------------------------------------------------------*/ +int scan_dir_tree(LOGBOOK *lbs, const char *dir, char **file_list, int *n) +{ + int index, i; + char str[MAX_PATH_LENGTH]; + char *fl, *p; + + fl = NULL; + i = ss_file_find(dir, "*", &fl); + if (i == 0) { + if (fl) + xfree(fl); + return 0; + } + + /* go through all files */ + for (index = 0; index < i; index++) { + if (fnmatch1("??????a.log", &fl[index * MAX_PATH_LENGTH]) == 0) { + if (*file_list == NULL) + *file_list = (char *)xmalloc(MAX_PATH_LENGTH); + else + *file_list = (char *)xrealloc(file_list, (*n+1)*MAX_PATH_LENGTH); + p = *file_list + ((*n) * MAX_PATH_LENGTH); + strlcpy(p, dir, MAX_PATH_LENGTH); + if (p[strlen(p)-1] != DIR_SEPARATOR) + strlcat(p, DIR_SEPARATOR_STR, MAX_PATH_LENGTH); + strlcat(p, fl + index * MAX_PATH_LENGTH, MAX_PATH_LENGTH); + (*n)++; + } + } + + /* go through all sub-directories */ + for (index = 0; index < i; index++) { + if (fnmatch1("????", &fl[index * MAX_PATH_LENGTH]) == 0 || + fnmatch1("??", &fl[index * MAX_PATH_LENGTH]) == 0) { + if (strieq(fl + index * MAX_PATH_LENGTH, "..")) + continue; + strlcpy(str, dir, sizeof(str)); + if (str[strlen(str)-1] != DIR_SEPARATOR) + strlcat(str, DIR_SEPARATOR_STR, sizeof(str)); + strlcat(str, fl + index * MAX_PATH_LENGTH, sizeof(str)); + scan_dir_tree(lbs, str, file_list, n); + } + } + + if (fl) + xfree(fl); + + return *n; +} + +/*------------------------------------------------------------------*/ + int el_build_index(LOGBOOK * lbs, BOOL rebuild) /* scan all ??????a.log files and build an index table in eli[] */ { - char *file_list, *dir_list, error_str[256], base_dir[256], dir[256], str[256], + char *file_list, error_str[256], base_dir[256], file_name[MAX_PATH_LENGTH], *buffer; - int dindex, index, n; + int index, n; int i, status; unsigned char digest[16]; @@ -3943,57 +3995,15 @@ int el_build_index(LOGBOOK * lbs, BOOL rebuild) eprintf("Entries:\n"); // move files to directories if (new layout to reduce number of files per directory) - // ## restructure_dir(base_dir); + restructure_dir(base_dir); - dir_list = NULL; - n = ss_file_find(base_dir, "????", &dir_list); - if (n == 0) { - if (dir_list) - xfree(dir_list); - dir_list = NULL; - //return EL_EMPTY; - } - - /* go through all directories */ - for (dindex = 0; dindex < n; dindex++) { - file_list = NULL; - strlcpy(dir, base_dir, sizeof(str)); - strlcat(dir, dir_list + dindex * MAX_PATH_LENGTH, sizeof(str)); - strlcat(dir, DIR_SEPARATOR_STR, sizeof(str)); - n = ss_file_find(dir, "??????a.log", &file_list); - - /* go through all files */ - for (index = 0; index < n; index++) { - strlcpy(file_name, dir, sizeof(file_name)); - strlcat(file_name, file_list + index * MAX_PATH_LENGTH, sizeof(file_name)); - - status = parse_file(lbs, file_name); - if (status != SUCCESS) { - if (file_list) - xfree(file_list); - return status; - } - } - - if (file_list) - xfree(file_list); - } - file_list = NULL; - n = ss_file_find(base_dir, "??????a.log", &file_list); - if (n == 0) { - if (file_list) - xfree(file_list); - file_list = NULL; - return EL_EMPTY; - } - + n = 0; + scan_dir_tree(lbs, base_dir, &file_list, &n); + /* go through all files */ for (index = 0; index < n; index++) { - strlcpy(file_name, base_dir, sizeof(file_name)); - strlcat(file_name, file_list + index * MAX_PATH_LENGTH, sizeof(file_name)); - - status = parse_file(lbs, file_name); + status = parse_file(lbs, file_list+index*MAX_PATH_LENGTH); if (status != SUCCESS) { if (file_list) xfree(file_list); From daedbc788c0357d3b9deacb61fcd540ff1ce44db Mon Sep 17 00:00:00 2001 From: Stefan Ritt Date: Mon, 20 Oct 2014 17:01:30 +0200 Subject: [PATCH 02/14] Implemented saving in subdirectories --- src/elogd.c | 139 ++++++++++++++++++++++++++++++---------------------- src/elogd.h | 1 + 2 files changed, 82 insertions(+), 58 deletions(-) diff --git a/src/elogd.c b/src/elogd.c index b2bbf4ac..a8b5cc90 100755 --- a/src/elogd.c +++ b/src/elogd.c @@ -3712,11 +3712,10 @@ int eli_compare(const void *e1, const void *e2) /*------------------------------------------------------------------*/ -void generate_new_file_name(char *file_name, char *path, int size) +void generate_subdir_name(char *file_name, char *subdir, int size) { - char fn[MAX_PATH_LENGTH], subdir[MAX_PATH_LENGTH]; - int status, year, month; - static int first = TRUE; + char fn[MAX_PATH_LENGTH], path[MAX_PATH_LENGTH]; + int year, month; // extract path from file_name strlcpy(path, file_name, size); @@ -3737,30 +3736,7 @@ void generate_new_file_name(char *file_name, char *path, int size) else sprintf(subdir, "19%02d", year); - // create new subdir - strlcat(path, subdir, size); -#ifdef OS_WINNT - status = mkdir(path); -#else - status = mkdir(path, 0755); -#endif - - if (status == 0) { - if (first) { - eprintf("\nFound old directory structure. Creating subdirectories and moving files...\n"); - first = FALSE; - } - eprintf("Created directory \"%s\"\n", path); - } else { - if (errno != EEXIST) { - eprintf("generate_new_file_name: %s\n", strerror(errno)); - eprintf("Cannot create directory \"%s\"\n", path); - } - } - - // assemble new path - strlcat(path, DIR_SEPARATOR_STR, size); - strlcat(path, fn, size); + strlcat(subdir, DIR_SEPARATOR_STR, size); } /*------------------------------------------------------------------*/ @@ -3768,18 +3744,45 @@ void generate_new_file_name(char *file_name, char *path, int size) int restructure_dir(char *dir) { char *file_list; - int n1, n2, index; - char file_name[MAX_PATH_LENGTH], old_path[MAX_PATH_LENGTH], new_path[MAX_PATH_LENGTH]; + int n1, n2, index, status; + char old_path[MAX_PATH_LENGTH], new_path[MAX_PATH_LENGTH], + subdir[MAX_PATH_LENGTH]; + static int first = TRUE; /* go through all entry files */ n1 = ss_file_find(dir, "??????a.log", &file_list); for (index = 0; index < n1; index++) { - strlcpy(file_name, dir, sizeof(file_name)); - strlcat(file_name, file_list + index * MAX_PATH_LENGTH, sizeof(file_name)); - strlcpy(old_path, file_name, sizeof(old_path)); - strlcpy(new_path, old_path, sizeof(new_path)); + generate_subdir_name(file_list + index * MAX_PATH_LENGTH, subdir, sizeof(subdir)); + + // create new subdir + strlcpy(new_path, dir, MAX_PATH_LENGTH); + strlcat(new_path, subdir, MAX_PATH_LENGTH); + +#ifdef OS_WINNT + status = mkdir(new_path); +#else + status = mkdir(new_path, 0755); +#endif + + if (status == 0) { + if (first) { + eprintf("\nFound old directory structure. Creating subdirectories and moving files...\n"); + first = FALSE; + } + eprintf("Created directory \"%s\"\n", new_path); + } else { + if (errno != EEXIST) { + eprintf("generate_subdir_name: %s\n", strerror(errno)); + eprintf("Cannot create directory \"%s\"\n", new_path); + } + } + + strlcpy(old_path, dir, sizeof(old_path)); + strlcat(old_path, file_list + index * MAX_PATH_LENGTH, sizeof(old_path)); + strlcpy(new_path, dir, sizeof(new_path)); + strlcat(new_path, subdir, sizeof(new_path)); + strlcat(new_path, file_list + index * MAX_PATH_LENGTH, sizeof(new_path)); - generate_new_file_name(old_path, new_path, sizeof(new_path)); rename(old_path, new_path); } if (file_list) @@ -3788,12 +3791,24 @@ int restructure_dir(char *dir) /* go through all attachment files */ n2 = ss_file_find(dir, "??????_??????_*", &file_list); for (index = 0; index < n2; index++) { - strlcpy(file_name, dir, sizeof(file_name)); - strlcat(file_name, file_list + index * MAX_PATH_LENGTH, sizeof(file_name)); - strlcpy(old_path, file_name, sizeof(old_path)); - strlcpy(new_path, old_path, sizeof(new_path)); + generate_subdir_name(file_list + index * MAX_PATH_LENGTH, subdir, sizeof(subdir)); + + // create new subdir + strlcpy(new_path, dir, MAX_PATH_LENGTH); + strlcat(new_path, subdir, MAX_PATH_LENGTH); + +#ifdef OS_WINNT + status = mkdir(new_path); +#else + status = mkdir(new_path, 0755); +#endif + + strlcpy(old_path, dir, sizeof(old_path)); + strlcat(old_path, file_list + index * MAX_PATH_LENGTH, sizeof(old_path)); + strlcpy(new_path, dir, sizeof(new_path)); + strlcat(new_path, subdir, sizeof(new_path)); + strlcat(new_path, file_list + index * MAX_PATH_LENGTH, sizeof(new_path)); - generate_new_file_name(old_path, new_path, sizeof(new_path)); rename(old_path, new_path); } if (file_list) @@ -3840,6 +3855,10 @@ int parse_file(LOGBOOK *lbs, char *file_name) return EL_MEM_ERROR; } + strlcpy(lbs->el_index[*lbs->n_el_index].subdir, file_name+strlen(lbs->data_dir), 256); + if (strrchr(lbs->el_index[*lbs->n_el_index].subdir, DIR_SEPARATOR)) + *(strrchr(lbs->el_index[*lbs->n_el_index].subdir, DIR_SEPARATOR)+1) = 0; + if (strrchr(file_name, DIR_SEPARATOR)) strlcpy(str, strrchr(file_name, DIR_SEPARATOR)+1, sizeof(str)); else @@ -3893,25 +3912,26 @@ int parse_file(LOGBOOK *lbs, char *file_name) int scan_dir_tree(LOGBOOK *lbs, const char *dir, char **file_list, int *n) { - int index, i; + int index, n_files; char str[MAX_PATH_LENGTH]; char *fl, *p; fl = NULL; - i = ss_file_find(dir, "*", &fl); - if (i == 0) { + n_files = ss_file_find(dir, "*", &fl); + if (n_files == 0) { if (fl) xfree(fl); return 0; } + if (*file_list == NULL) + *file_list = (char *)xmalloc(n_files*MAX_PATH_LENGTH); + else + *file_list = (char *)xrealloc(*file_list, ((*n)+n_files)*MAX_PATH_LENGTH); + /* go through all files */ - for (index = 0; index < i; index++) { + for (index = 0; index < n_files; index++) { if (fnmatch1("??????a.log", &fl[index * MAX_PATH_LENGTH]) == 0) { - if (*file_list == NULL) - *file_list = (char *)xmalloc(MAX_PATH_LENGTH); - else - *file_list = (char *)xrealloc(file_list, (*n+1)*MAX_PATH_LENGTH); p = *file_list + ((*n) * MAX_PATH_LENGTH); strlcpy(p, dir, MAX_PATH_LENGTH); if (p[strlen(p)-1] != DIR_SEPARATOR) @@ -3922,7 +3942,7 @@ int scan_dir_tree(LOGBOOK *lbs, const char *dir, char **file_list, int *n) } /* go through all sub-directories */ - for (index = 0; index < i; index++) { + for (index = 0; index < n_files; index++) { if (fnmatch1("????", &fl[index * MAX_PATH_LENGTH]) == 0 || fnmatch1("??", &fl[index * MAX_PATH_LENGTH]) == 0) { if (strieq(fl + index * MAX_PATH_LENGTH, "..")) @@ -3946,8 +3966,7 @@ int scan_dir_tree(LOGBOOK *lbs, const char *dir, char **file_list, int *n) int el_build_index(LOGBOOK * lbs, BOOL rebuild) /* scan all ??????a.log files and build an index table in eli[] */ { - char *file_list, error_str[256], base_dir[256], - file_name[MAX_PATH_LENGTH], *buffer; + char *file_list, error_str[256], base_dir[256], *buffer; int index, n; int i, status; unsigned char digest[16]; @@ -4371,7 +4390,7 @@ int el_retrieve(LOGBOOK * lbs, int message_id, char *date, char attr_list[MAX_N_ if (index == *lbs->n_el_index) return EL_NO_MSG; - sprintf(file_name, "%s%s", lbs->data_dir, lbs->el_index[index].file_name); + sprintf(file_name, "%s%s%s", lbs->data_dir, lbs->el_index[index].subdir, lbs->el_index[index].file_name); fh = open(file_name, O_RDONLY | O_BINARY, 0644); if (fh < 0) { /* file might have been deleted, rebuild index */ @@ -4613,7 +4632,7 @@ int el_retrieve_attachment(LOGBOOK * lbs, int message_id, int n, char name[MAX_P if (index == *lbs->n_el_index) return EL_NO_MSG; - sprintf(file_name, "%s%s", lbs->data_dir, lbs->el_index[index].file_name); + sprintf(file_name, "%s%s%s", lbs->data_dir, lbs->el_index[index].subdir, lbs->el_index[index].file_name); fh = open(file_name, O_RDONLY | O_BINARY, 0644); if (fh < 0) { /* file might have been deleted, rebuild index */ @@ -4664,8 +4683,10 @@ int el_retrieve_attachment(LOGBOOK * lbs, int message_id, int n, char name[MAX_P break; } - if (p) - strlcpy(name, p, MAX_PATH_LENGTH); + if (p) { + strlcpy(name, lbs->el_index[index].subdir, MAX_PATH_LENGTH); + strlcat(name, p, MAX_PATH_LENGTH); + } return EL_SUCCESS; } @@ -4710,7 +4731,7 @@ int el_submit(LOGBOOK * lbs, int message_id, BOOL bedit, char *date, char attr_n char file_name[256], dir[256], str[NAME_LENGTH], date1[256], attrib[MAX_N_ATTR][NAME_LENGTH], reply_to1[MAX_REPLY_TO * 10], in_reply_to1[MAX_REPLY_TO * 10], encoding1[80], *message, *p, *old_text, *buffer; - char attachment_all[64 * MAX_ATTACHMENTS]; + char attachment_all[64 * MAX_ATTACHMENTS], subdir[MAX_PATH_LENGTH]; time_t ltime; tail_size = orig_size = 0; @@ -4738,7 +4759,7 @@ int el_submit(LOGBOOK * lbs, int message_id, BOOL bedit, char *date, char attr_n return -1; } - sprintf(file_name, "%s%s", lbs->data_dir, lbs->el_index[index].file_name); + sprintf(file_name, "%s%s%s", lbs->data_dir, lbs->el_index[index].subdir, lbs->el_index[index].file_name); fh = open(file_name, O_CREAT | O_RDWR | O_BINARY, 0644); if (fh < 0) { xfree(message); @@ -4840,7 +4861,9 @@ int el_submit(LOGBOOK * lbs, int message_id, BOOL bedit, char *date, char attr_n sprintf(file_name, "%c%c%02d%c%ca.log", date1[14], date1[15], i + 1, date1[5], date1[6]); - sprintf(str, "%s%s", dir, file_name); + generate_subdir_name(file_name, subdir, sizeof(subdir)); + + sprintf(str, "%s%s%s", dir, subdir, file_name); fh = open(str, O_CREAT | O_RDWR | O_BINARY, 0644); if (fh < 0) { xfree(message); diff --git a/src/elogd.h b/src/elogd.h index d82b14cb..54238bd8 100644 --- a/src/elogd.h +++ b/src/elogd.h @@ -228,6 +228,7 @@ long _timezone; typedef struct { int message_id; + char subdir[256]; char file_name[32]; time_t file_time; int offset; From 762b7d670848aa0c5ae3e31910c4b0d62ad9413b Mon Sep 17 00:00:00 2001 From: Stefan Ritt Date: Tue, 21 Oct 2014 13:41:44 +0200 Subject: [PATCH 03/14] Serve attachments correctly --- src/elogd.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/elogd.c b/src/elogd.c index a8b5cc90..8208b079 100755 --- a/src/elogd.c +++ b/src/elogd.c @@ -4683,10 +4683,8 @@ int el_retrieve_attachment(LOGBOOK * lbs, int message_id, int n, char name[MAX_P break; } - if (p) { - strlcpy(name, lbs->el_index[index].subdir, MAX_PATH_LENGTH); - strlcat(name, p, MAX_PATH_LENGTH); - } + if (p) + strlcpy(name, p, MAX_PATH_LENGTH); return EL_SUCCESS; } @@ -26620,7 +26618,7 @@ void interprete(char *lbook, char *path) edit_id[80], file_name[256], command[256], enc_path[256], dec_path[256], uname[80], full_name[256], user_email[256], logbook[256], logbook_enc[256], *experiment, group[256], css[256], *pfile, attachment[MAX_PATH_LENGTH], str3[NAME_LENGTH], - thumb_name[256], sid[32], error_str[256]; + thumb_name[256], sid[32], error_str[256], subdir[256]; LOGBOOK *lbs; FILE *f; @@ -27188,6 +27186,8 @@ void interprete(char *lbook, char *path) pfile[13] = '_'; /* file from data directory requested */ strlcpy(file_name, lbs->data_dir, sizeof(file_name)); + generate_subdir_name(pfile, subdir, sizeof(subdir)); + strlcat(file_name, subdir, sizeof(file_name)); strlcat(file_name, pfile, sizeof(file_name)); } else { /* file from theme directory requested */ From 7916f6f61566c54271758aff70279770f161b4d1 Mon Sep 17 00:00:00 2001 From: Stefan Ritt Date: Tue, 21 Oct 2014 17:13:19 +0200 Subject: [PATCH 04/14] Use sub-directories in all places --- src/elogd.c | 81 ++++++++++++++----- .../xcshareddata/elogd.xccheckout | 6 +- 2 files changed, 66 insertions(+), 21 deletions(-) diff --git a/src/elogd.c b/src/elogd.c index 8208b079..4897dd33 100755 --- a/src/elogd.c +++ b/src/elogd.c @@ -4529,7 +4529,7 @@ int el_retrieve(LOGBOOK * lbs, int message_id, char *date, char attr_list[MAX_N_ int el_submit_attachment(LOGBOOK * lbs, const char *afilename, const char *buffer, int buffer_size, char *full_name) { - char file_name[MAX_PATH_LENGTH], ext_file_name[MAX_PATH_LENGTH + 100], str[MAX_PATH_LENGTH], *p; + char file_name[MAX_PATH_LENGTH], ext_file_name[MAX_PATH_LENGTH + 100], str[MAX_PATH_LENGTH], *p, subdir[MAX_PATH_LENGTH]; int fh; time_t now; struct tm tms; @@ -4562,6 +4562,8 @@ int el_submit_attachment(LOGBOOK * lbs, const char *afilename, const char *buffe strlcpy(full_name, ext_file_name, MAX_PATH_LENGTH); strlcpy(str, lbs->data_dir, sizeof(str)); + generate_subdir_name(ext_file_name, subdir, sizeof(subdir)); + strlcat(str, subdir, sizeof(str)); strlcat(str, ext_file_name, sizeof(str)); /* save attachment */ @@ -4585,15 +4587,18 @@ int el_submit_attachment(LOGBOOK * lbs, const char *afilename, const char *buffe void el_delete_attachment(LOGBOOK * lbs, char *file_name) { int i; - char str[MAX_PATH_LENGTH]; + char str[MAX_PATH_LENGTH], subdir[MAX_PATH_LENGTH]; strlcpy(str, lbs->data_dir, sizeof(str)); + generate_subdir_name(file_name, subdir, sizeof(subdir)); + strlcat(str, subdir, sizeof(str)); strlcat(str, file_name, sizeof(str)); remove(str); strlcat(str, ".png", sizeof(str)); remove(str); for (i = 0;; i++) { strlcpy(str, lbs->data_dir, sizeof(str)); + strlcat(str, subdir, sizeof(str)); strlcat(str, file_name, sizeof(str)); sprintf(str + strlen(str), "-%d.png", i); if (file_exist(str)) { @@ -4602,6 +4607,7 @@ void el_delete_attachment(LOGBOOK * lbs, char *file_name) } strlcpy(str, lbs->data_dir, sizeof(str)); + strlcat(str, subdir, sizeof(str)); strlcat(str, file_name, sizeof(str)); if (strrchr(str, '.')) *strrchr(str, '.') = 0; @@ -4725,7 +4731,7 @@ int el_submit(LOGBOOK * lbs, int message_id, BOOL bedit, char *date, char attr_n \********************************************************************/ { - int n, i, j, size, fh, index, tail_size, orig_size, delta, reply_id; + int n, i, j, size, fh, index, tail_size, orig_size, delta, reply_id, status; char file_name[256], dir[256], str[NAME_LENGTH], date1[256], attrib[MAX_N_ATTR][NAME_LENGTH], reply_to1[MAX_REPLY_TO * 10], in_reply_to1[MAX_REPLY_TO * 10], encoding1[80], *message, *p, *old_text, *buffer; @@ -4860,7 +4866,16 @@ int el_submit(LOGBOOK * lbs, int message_id, BOOL bedit, char *date, char attr_n sprintf(file_name, "%c%c%02d%c%ca.log", date1[14], date1[15], i + 1, date1[5], date1[6]); generate_subdir_name(file_name, subdir, sizeof(subdir)); - + sprintf(str, "%s%s", dir, subdir); + if (strlen(str) > 0 && str[strlen(str)-1] == DIR_SEPARATOR) + str[strlen(str)-1] = 0; + +#ifdef OS_WINNT + status = mkdir(str); +#else + status = mkdir(str, 0755); +#endif + sprintf(str, "%s%s%s", dir, subdir, file_name); fh = open(str, O_CREAT | O_RDWR | O_BINARY, 0644); if (fh < 0) { @@ -5091,7 +5106,7 @@ int el_delete_message(LOGBOOK * lbs, int message_id, BOOL delete_attachments, if (index == *lbs->n_el_index) return -1; - sprintf(file_name, "%s%s", lbs->data_dir, lbs->el_index[index].file_name); + sprintf(file_name, "%s%s%s", lbs->data_dir, lbs->el_index[index].subdir, lbs->el_index[index].file_name); fh = open(file_name, O_RDWR | O_BINARY, 0644); if (fh < 0) return EL_FILE_ERROR; @@ -9326,7 +9341,8 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL svalue[MAX_N_ATTR + 10][NAME_LENGTH], owner[256], locked_by[256], class_value[80], class_name[80], ua[NAME_LENGTH], mid[80], title[256], login_name[256], full_name[256], cookie[256], orig_author[256], attr_moptions[MAX_N_LIST][NAME_LENGTH], ref[256], file_enc[256], tooltip[10000], - enc_attr[NAME_LENGTH], user_email[256], cmd[256], thumb_name[256], **user_list, fid[20], upwd[80]; + enc_attr[NAME_LENGTH], user_email[256], cmd[256], thumb_name[256], **user_list, fid[20], upwd[80], + subdir[256]; time_t now, ltime; char fl[8][NAME_LENGTH]; struct tm *pts; @@ -11515,6 +11531,8 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL } else { strlcpy(file_name, lbs->data_dir, sizeof(file_name)); + generate_subdir_name(att[index], subdir, sizeof(subdir)); + strlcat(file_name, subdir, sizeof(file_name)); strlcat(file_name, att[index], sizeof(file_name)); display_inline = is_image(file_name) || is_ascii(file_name); @@ -13358,7 +13376,7 @@ int ascii_compare2(const void *s1, const void *s2) void show_config_page(LOGBOOK * lbs) { - char str[256], user[80], password[80], full_name[80], user_email[80], logbook[256], auth[32], **user_list; + char str[256], user[80], password[80], full_name[256], user_email[256], logbook[256], auth[32], **user_list; int i, n, inactive; BOOL email_notify[1000]; @@ -13447,10 +13465,11 @@ void show_config_page(LOGBOOK * lbs) qsort(user_list, n, sizeof(char *), ascii_compare); for (i = 0; i < n; i++) { + get_user_line(lbs, user_list[i], NULL, full_name, user_email, NULL, NULL, NULL); if (strcmp(user_list[i], user) == 0) - rsprintf("