Text   |  XML   |  ReML   |   Visible Warnings:

File System Race Condition  at unlink-directory.c:170

No properties have been set. | edit properties
Jump to warning location ↓ warning details...
Show Events | Options

maildirplusplus_iter_is_mailbox

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib-storage/index/maildir/maildir-storage.c)expand/collapse
Show more  
 1007  maildirplusplus_iter_is_mailbox(struct mailbox_list_iterate_context *ctx,
 1008                                  const char *dir, const char *fname,
 1009                                  const char *mailbox_name ATTR_UNUSED,
 1010                                  enum mailbox_list_file_type type,
 1011                                  enum mailbox_info_flags *flags)
 1012  {
 1013[+]         struct maildir_storage *storage = MAILDIR_LIST_CONTEXT(ctx->list);
 1014          struct mail_storage *_storage = &storage->storage;
 1015          int ret;
 1016   
 1017          if (fname[1] == mailbox_list_get_hierarchy_sep(_storage->list) &&
 1018              strcmp(fname+2, MAILDIR_UNLINK_DIRNAME) == 0) {
 1019                  const char *path;
 1020                  struct stat st;
 1021   
 1022                  /* this directory is in the middle of being deleted,
 1023                     or the process trying to delete it had died.
 1024                     delete it ourself if it's been there longer than
 1025                     one hour. */
 1026[+]                 path = t_strdup_printf("%s/%s", dir, fname);
 1027                  if (stat(path, &st) == 0 &&
 1028                      st.st_mtime < ioloop_time - 3600)
 1029[+]                         (void)unlink_directory(path, TRUE);
expand/collapse

unlink_directory

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/unlink-directory.c)expand/collapse
Show more  
 145  int unlink_directory(const char *dir, bool unlink_dir)
 146  {
 147          int fd, ret, old_errno;
 148   
 149          fd = open(".", O_RDONLY);
 150          if (fd == -1)
 151                  return -1;
 152   
 153[+]         ret = unlink_directory_r(dir);
 154          if (ret < 0 && errno == ENOENT)
 155                  ret = 0;
 156          old_errno = errno;
 157   
 158          if (fchdir(fd) < 0) {
 159                  i_fatal("unlink_directory(%s): "
 160                          "Can't fchdir() back to our original dir: %m", dir);
 161          }
 162          (void)close(fd);
 163   
 164          if (ret < 0) {
 165                  errno = old_errno;
 166                  return -1;
 167          }
 168   
 169          if (unlink_dir) {
 170                  if (rmdir(dir) < 0 && errno != ENOENT)
Show more  
Show more  




Change Warning 7391.24822 : File System Race Condition

Priority:
State:
Finding:
Owner:
Note: