jed-users mailing list

[2009 Date Index] [2009 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Bug: Jed flags readonly file as readonly while opening it as root


Hi,

opening a file that misses the flag for write permission does not mean we
can't write to it. Root can write to everything, execpt some
exceptions. :) So I think jed should better use the access function to
determine if it should flag a buffer readonly or not. Maybe some
special file tweakings also allow write access, i.e. ACLs.

% cat test.c
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>

int main(int argc, char** argv)
{
    const char* path = argc > 1 ? argv[1] : "ro-file";

    printf("writing to %s with UID %d %s\n", path, getuid(),
           access(path, W_OK) ? "forbidden" : "allowed");

    return 0;
}

% ./test 
writing to ro-file with UID 1000 forbidden
% sudo ./test
writing to ro-file with UID 0 allowed
% ls -l ro-file
---------- 1 joerg users 0 24. Nov 00:31 ro-file

Bye, Jörg.
-- 
Fazit: „Schießen Sie nicht mit dem Geiger!“
<news:46778c4c$0$6396$9b4e6d93@xxxxxxxxxxxxxxxxxxxxxxxxxxx>

--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.


[2009 date index] [2009 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]