Text   |  XML   |  ReML   |   Visible Warnings:

File System Race Condition  at mbox-storage.c:348

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

mbox_get_list_settings

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib-storage/index/mbox/mbox-storage.c)expand/collapse
Show more  
 279  mbox_get_list_settings(struct mailbox_list_settings *list_set,
 280                         const char *data, struct mail_storage *storage,
 281                         const char **layout_r, const char **error_r)
 282  {
 283          enum mail_storage_flags flags = storage->flags;
 284          bool debug = (flags & MAIL_STORAGE_FLAG_DEBUG) != 0;
 285          const char *p;
 286          struct stat st;
 287          bool autodetect;
 288   
 289          *layout_r = "fs";
 290   
 291          memset(list_set, 0, sizeof(*list_set));
 292          list_set->subscription_fname = MBOX_SUBSCRIPTION_FILE_NAME;
 293          list_set->maildir_name = "";
 294   
 295          autodetect = data == NULL || *data == '\0';
 296          if (autodetect) {
 297                  if ((flags & MAIL_STORAGE_FLAG_NO_AUTODETECTION) != 0) {
 298                          *error_r = "Root mail directory not given";
 299                          return -1;
 300                  }
 301   
 302                  /* we'll need to figure out the mail location ourself.
 303                     it's root dir if we've already chroot()ed, otherwise 
 304                     either ~/mail or ~/Mail */
 305                  list_set->root_dir = get_root_dir(storage);
 306                  if (list_set->root_dir == NULL) {
 307                          *error_r = "Autodetection failed";
 308                          return -1;
 309                  }
 310          } else {
 311                  if (debug)
 312                          i_info("mbox: data=%s", data);
 313                  p = strchr(data, ':');
 314                  if ((flags & MAIL_STORAGE_FLAG_NO_AUTODETECTION) == 0 &&
 315                      p == NULL && data[strlen(data)-1] != '/') {
 316                          /* if the data points to a file, treat it as an INBOX */
 317[+]                         data = mail_user_home_expand(storage->ns->user, data);
 318                          if (stat(data, &st) < 0 || S_ISDIR(st.st_mode))
 319                                  list_set->root_dir = data;
 320                          else {
 321                                  list_set->root_dir = get_root_dir(storage);
 322                                  list_set->inbox_path = data;
 323                          }
 324                  } else if (strncmp(data, "INBOX=", 6) == 0) {
 325                          /* the most common misconfiguration */
 326                          *error_r = "Root mail directory not given";
 327                          return -1;
 328                  } else {
 329                          if (mailbox_list_settings_parse(data, list_set,
 330                                                          storage->ns,
 331                                                          layout_r, NULL,
 332                                                          error_r) < 0)
 333                                  return -1;
 334                  }
 335          }
 336   
 337          if (list_set->root_dir == NULL || *list_set->root_dir == '\0') {
 338                  if ((flags & MAIL_STORAGE_FLAG_NO_AUTOCREATE) != 0) {
 339                          *error_r = "Root mail directory not given";
 340                          return -1;
 341                  }
 342   
 343                  list_set->root_dir = create_root_dir(storage, error_r);
 344                  if (list_set->root_dir == NULL)
 345                          return -1;
 346          } else {
 347                  /* make sure the directory exists */
 348                  if (lstat(list_set->root_dir, &st) == 0) {
Show more  




Change Warning 7435.25053 : File System Race Condition

Priority:
State:
Finding:
Owner:
Note: