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

dbox_mailbox_create

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib-storage/index/dbox/dbox-storage.c)expand/collapse
Show more  
 346  static int dbox_mailbox_create(struct mail_storage *_storage,
 347                                 const char *name, bool directory)
 348  {
 349          struct dbox_storage *storage = (struct dbox_storage *)_storage;
 350          const char *path, *alt_path;
 351          struct stat st;
 352   
 353          path = mailbox_list_get_path(_storage->list, name,
 354                                       directory ? MAILBOX_LIST_PATH_TYPE_DIR :
 355[+]                                      MAILBOX_LIST_PATH_TYPE_MAILBOX);
 356          if (stat(path, &st) == 0) {
 357                  mail_storage_set_error(_storage, MAIL_ERROR_EXISTS,
 358                                         "Mailbox already exists");
 359                  return -1;
 360          }
 361   
 362          /* make sure the alt path doesn't exist yet. it shouldn't (except with 
 363             race conditions with RENAME/DELETE), but if something crashed and 
 364             left it lying around we don't want to start overwriting files in
 365             it. */
 366          alt_path = directory ? NULL : dbox_get_alt_path(storage, path);
 367          if (alt_path != NULL && stat(alt_path, &st) == 0) {
 368                  mail_storage_set_error(_storage, MAIL_ERROR_EXISTS,
 369                                         "Mailbox already exists");
 370                  return -1;
 371          }
 372   
 373[+]         return create_dbox(_storage, path);
expand/collapse

create_dbox

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib-storage/index/dbox/dbox-storage.c)expand/collapse
Show more  
 161  static int create_dbox(struct mail_storage *storage, const char *path)
 162  {
 163          const char *origin;
 164          mode_t mode;
 165          gid_t gid;
 166   
 167          mailbox_list_get_dir_permissions(storage->list, NULL,
 168                                           &mode, &gid, &origin);
 169[+]         if (mkdir_parents_chgrp(path, mode, gid, origin) < 0 &&
expand/collapse

mkdir_parents_chgrp

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/mkdir-parents.c)expand/collapse
Show more  
 115  int mkdir_parents_chgrp(const char *path, mode_t mode,
 116                          gid_t gid, const char *gid_origin)
 117  {
 118[+]         return mkdir_parents_chown_full(path, mode, (uid_t)-1, gid, gid_origin);
expand/collapse

mkdir_parents_chown_full

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/mkdir-parents.c)expand/collapse
Show more  
 80  mkdir_parents_chown_full(const char *path, mode_t mode, uid_t uid, gid_t gid,
 81                           const char *gid_origin)
 82  {
 83          const char *p;
 84          int ret;
 85   
 86[+]         if (mkdir_chown_full(path, mode, uid, gid, gid_origin) < 0) {
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  
Show more  




Change Warning 7482.25015 : File System Race Condition

Priority:
State:
Finding:
Owner:
Note: