Can someone explain this:

funk:~/tmp% sed 1q /var/run/dmesg.boot    
OpenBSD 3.0-current (GENERIC) #7: Sat Nov 24 03:52:08 PST 2001
funk:~/tmp% perl -V:version               
version='5.6.1';
funk:~/tmp% perl -V:.\* |grep uid
d_dosuid='undef'
d_seteuid='define'
d_setresuid='undef'
d_setreuid='undef'
d_setruid='undef'
d_suidsafe='define'
uidformat='"lu"'
uidsign='1'
uidsize='4'
uidtype='uid_t'
funk:~/tmp% ls -l open_test               
-r-sr-xr-x  1 cups  cups  193 Nov 28 00:05 open_test
funk:~/tmp% grep cups /etc/passwd          
cups:*:1002:1002:CUPS Account:/nonexistent:/sbin/nologin
funk:~/tmp% cat ./open_test      
#!/usr/bin/perl -w
use Fcntl;

$path = "/etc/cups/new";
sysopen (FH, $path, O_WRONLY | O_EXCL | O_CREAT, 0400)
  or die "Couldn't open file: $!\n";
print FH "hello\n";
close (FH);

exit (0);
funk:~/tmp% ls -l /etc |grep cups
drwxrwxr-x   5 root  cups         512 Nov 28 05:33 cups
funk:~/tmp% ls -l /etc/cups/new
colorls: /etc/cups/new: No such file or directory
funk:~/tmp% echo $USER
jakemsr
funk:~/tmp% ./open_test
Couldn't open file: Permission denied
funk:~/tmp% su
Password:
funk# echo $USER
jakemsr
funk# ./open_test
Couldn't open file: Permission denied
funk# su cups
This account is currently not available.
funk# chsh -s /bin/sh cups
funk# su cups
$ echo $USER
cups
$ ./open_test
$ ./open_test 
Couldn't open file: File exists
$ ls -l /etc/cups/new                                                          
-r--------  1 cups  cups  5 Nov 28 05:36 /etc/cups/new

In particular, why neither I nor root could write the file. 

-- 
<[EMAIL PROTECTED]>
<[EMAIL PROTECTED]>
<[EMAIL PROTECTED]>

Reply via email to