[systemd-devel] [PATCH v3] Refuse mount on symlink

Timofey Titovets nefelim4ag at gmail.com
Thu Aug 14 16:17:35 PDT 2014


2014-08-15 2:00 GMT+03:00 Lennart Poettering <lennart at poettering.net>:
> On Fri, 15.08.14 01:43, Timofey Titovets (nefelim4ag at gmail.com) wrote:
>
>>
>> +int fail_if_symlink(const char *unit, const char* where) {
>> +        assert(where);
>> +
>> +        if (is_symlink(where) > 0) {
>> +                log_struct_unit(LOG_WARNING,
>> +                                unit,
>> +                                "MESSAGE=%s: Mount on symlink %s
>> not allowed.",
>> +                                unit, where,
>> +                                "WHERE=%s", where,
>> +                                MESSAGE_ID(SD_MESSAGE_OVERMOUNTING),
>> +                                NULL);
>> +
>> +                return -ELOOP;
>> +        }
>> +        return 0;
>> +}
>
> Looks good, but the patch is line broken, I can't apply it like
> that... Maybe attach the patch?
>
>> diff --git a/src/core/mount.h b/src/core/mount.h
>> index 2dcb663..5fc1fe1 100644
>> --- a/src/core/mount.h
>> +++ b/src/core/mount.h
>> @@ -128,3 +128,5 @@ const char* mount_result_to_string(MountResult
>> i) _const_;
>>  MountResult mount_result_from_string(const char *s) _pure_;
>>
>>  void warn_if_dir_nonempty(const char *unit, const char* where);
>> +
>> +int fail_if_symlink(const char *unit, const char* where);
>
> No reason to export this, or am I missing something? Just make the
> function static, and don't include it in the header file, unless some
> other .c file is actually using it.
Fixed in patch
> Otherwise looks good.
>
> Lennart
>
> --
> Lennart Poettering, Red Hat



-- 
Have a nice day,
Timofey.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Refuse-mount-on-symlink.patch
Type: text/x-patch
Size: 2794 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20140815/8cafcb44/attachment.bin>


More information about the systemd-devel mailing list