Text   |  XML   |  ReML   |   Visible Warnings:

File System Race Condition  at mkdir-parents.c:22

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

maildir_create_subdirs

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib-storage/index/maildir/maildir-util.c)expand/collapse
Show more  
 173  static int maildir_create_subdirs(struct maildir_mailbox *mbox)
 174  {
 175          static const char *subdirs[] = { "cur", "new", "tmp" };
 176          const char *dirs[N_ELEMENTS(subdirs) + 2];
 177          struct mailbox *box = &mbox->ibox.box;
 178          struct stat st;
 179          const char *path;
 180          unsigned int i;
 181          bool is_mail_dir;
 182   
 183          /* @UNSAFE: get a list of directories we want to create */
 184          for (i = 0; i < N_ELEMENTS(subdirs); i++)
 185                  dirs[i] = t_strconcat(mbox->path, "/", subdirs[i], NULL);
 186          dirs[i++] = mail_storage_get_mailbox_control_dir(box->storage,
 187                                                           box->name);
 188          dirs[i++] = mail_storage_get_mailbox_index_dir(box->storage,
 189                                                         box->name);
 190          i_assert(i == N_ELEMENTS(dirs));
 191   
 192          for (i = 0; i < N_ELEMENTS(dirs); i++) {
 193                  path = dirs[i];
 194                  if (path == NULL || stat(path, &st) == 0)
 195                          continue;
 196                  if (errno != ENOENT) {
 197                          mail_storage_set_critical(box->storage,
 198                                                    "stat(%s) failed: %m", path);
 199                          break;
 200                  }
 201                  is_mail_dir = i < N_ELEMENTS(subdirs);
 202[+]                 if (maildir_create_path(box, path, is_mail_dir) < 0)
expand/collapse

maildir_create_path

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib-storage/index/maildir/maildir-util.c)expand/collapse
Show more  
 133  static int maildir_create_path(struct mailbox *box, const char *path,
 134                                 bool is_mail_dir)
 135  {
 136          const char *p, *parent, *origin;
 137          mode_t parent_mode;
 138          gid_t parent_gid;
 139   
 140          if (mkdir_chgrp(path, box->dir_create_mode, box->file_create_gid,
 141[+]                         box->file_create_gid_origin) == 0)
expand/collapse

mkdir_chgrp

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/mkdir-parents.c)expand/collapse
Show more  
 73  int mkdir_chgrp(const char *path, mode_t mode,
 74                  gid_t gid, const char *gid_origin)
 75  {
 76[+]         return mkdir_chown_full(path, mode, (uid_t)-1, gid, gid_origin);
expand/collapse

mkdir_chown_full

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/mkdir-parents.c)expand/collapse
Show more  
 14  mkdir_chown_full(const char *path, mode_t mode, uid_t uid,
 15                   gid_t gid, const char *gid_origin)
 16  {
 17          string_t *str;
 18          mode_t old_mask;
 19          int ret, orig_errno;
 20   
 21          old_mask = umask(0);
 22          ret = mkdir(path, mode);
Show more  
Show more  
Show more  
Show more  




Change Warning 7299.24998 : File System Race Condition

Priority:
State:
Finding:
Owner:
Note: