Changeset da680b4b in mainline for uspace/srv/volsrv/part.c


Ignore:
Timestamp:
2018-07-06T17:18:28Z (7 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6419c6e
Parents:
9ba040a
Message:

Don't automatically mount writable filesystems on ATA hard drives. Better be safe than sorry. (But no way to override yet.)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/volsrv/part.c

    r9ba040a rda680b4b  
    256256}
    257257
     258/** Determine if partition is allowed to be mounted by default.
     259 *
     260 * @param part Partition
     261 * @return @c true iff partition is allowed to be mounted by default
     262 */
     263static bool vol_part_allow_mount_by_def(vol_part_t *part)
     264{
     265        /* CDFS is safe to mount (after all, it is read-only) */
     266        if (part->pcnt == vpc_fs && part->fstype == fs_cdfs)
     267                return true;
     268
     269        /* For other file systems disallow mounting from ATA hard drive */
     270        if (str_str(part->svc_name, "\\ata-c") != NULL)
     271                return false;
     272
     273        /* Allow otherwise (e.g. USB mass storage) */
     274        return true;
     275}
     276
    258277static errno_t vol_part_mount(vol_part_t *part)
    259278{
     
    265284                /* Don't mount nameless volumes */
    266285                log_msg(LOG_DEFAULT, LVL_NOTE, "Not mounting nameless partition.");
     286                return EOK;
     287        }
     288
     289        if (!vol_part_allow_mount_by_def(part)) {
     290                /* Don't mount partition by default */
     291                log_msg(LOG_DEFAULT, LVL_NOTE, "Not mounting per default policy.");
    267292                return EOK;
    268293        }
Note: See TracChangeset for help on using the changeset viewer.