Text   |  XML   |  ReML   |   Visible Warnings:

File System Race Condition  at file-dotlock.c:382

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

try_create_lock_hardlink

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/file-dotlock.c)expand/collapse
Show more  
 318  static int try_create_lock_hardlink(struct lock_info *lock_info, bool write_pid,
 319                                      string_t *tmp_path)
 320  {
 321          const char *temp_prefix = lock_info->set->temp_prefix;
 322          const char *p;
 323          mode_t old_mask;
 324   
 325          if (lock_info->temp_path == NULL) {
 326                  /* we'll need our temp file first. */
 327                  i_assert(lock_info->fd == -1);
 328   
 329                  p = strrchr(lock_info->lock_path, '/');
 330   
 331                  str_truncate(tmp_path, 0);
 332                  if (temp_prefix != NULL) {
 333                          if (*temp_prefix != '/' && p != NULL) {
 334                                  /* add directory */
 335                                  str_append_n(tmp_path, lock_info->lock_path,
 336
359
Show [ Lines 336 to 359 omitted. ]
 360                                             str_c(tmp_path)) < 0) {
 361                                  (void)close(lock_info->fd);
 362                                  lock_info->fd = -1;
 363                                  return -1;
 364                          }
 365                  }
 366   
 367                  lock_info->temp_path = str_c(tmp_path);
 368          }
 369   
 370          if (nfs_safe_link(lock_info->temp_path,
 371[+]                           lock_info->lock_path, TRUE) < 0) {
 372                  if (errno == EEXIST)
 373                          return 0;
 374   
 375                  if (errno != EACCES) {
 376                          i_error("link(%s, %s) failed: %m",
 377                                  lock_info->temp_path, lock_info->lock_path);
 378                  }
 379                  return -1;
 380          }
 381   
 382          if (unlink(lock_info->temp_path) < 0) {
Show more  




Change Warning 7077.24876 : File System Race Condition

Priority:
State:
Finding:
Owner:
Note: