On Mon, 3 Jan 2000, Olaf Kirch wrote:
> when you're dealing with files in /tmp that are supposed to be re-opened
> (rather than opened once and then discarded) there's an established
> way to do it which goes like this:
The problem lies in the premises: these files should not be stored in
/tmp.
My post yesterday seems to have died during moderation.
This happened to my last 2 incidentally - both looked worthwhile to me.
Olaf Kirch:
> That's not true for setuid processes. You're allowed to signal a process
> if _either_ the effective or the real uid match. Try running passwd in
> one win
>>When
>>the application reaches the critical section of code between the
>>lstat and the open, you stop it by sending it a SIGSTOP. You record
>>the device and inode number of your /tmp file, remove it, and wait.
The ploy should fail right here: as far as I'm aware, this protection
only works on
Hi!
> when you're dealing with files in /tmp that are supposed to be re-opened
> (rather than opened once and then discarded) there's an established
> way to do it which goes like this:
>
> if (lstat(fname, &stb1) >= 0 && S_ISREG(stb1.st_mode)) {
> fd = open(fname, O_RDWR);
>
Hi,
>>when you're dealing with files in /tmp that are supposed to be re-opened
>>(rather than opened once and then discarded) there's an established
>>way to do it which goes like this:
[...]
>I did something that way:
oh, not a good idea:
>FILE *DoOpen(const char *cpFile, long bAppend)
>{
>
Hi,
>when you're dealing with files in /tmp that are supposed to be re-opened
>(rather than opened once and then discarded) there's an established
>way to do it which goes like this:
>
>if (lstat(fname, &stb1) >= 0 && S_ISREG(stb1.st_mode)) {
>fd = open(fname, O_RDWR);
>
On Jan 4, 12:11pm, [EMAIL PROTECTED] (Goetz Babin-Ebell) wrote:
-- Subject: Re: Symlinks and Cryogenic Sleep
| At 21:24 03.01.00 +0100, Olaf Kirch wrote:
| >Hi all,
| Hallo Olaf,
|
| >when you're dealing with files in /tmp that are supposed to be re-opened
| >(rather than opened
der Mouse <[EMAIL PROTECTED]> wrote:
> > [symlink-paranoia code]
>
> > However, consider an average setuid root application, [...]. When
> > the application reaches the critical section of code between the
> > lstat and the open, you stop it by sending it a SIGSTOP.
>
> If you can send it a SIGS
Olaf Kirch asked about checking files when you reopen them and
questioned the usefulness of
> if (lstat(fname, &stb1) >= 0 && S_ISREG(stb1.st_mode)) {
> fd = open(fname, O_RDWR);
> if (fd < 0 || fstat(fd, &stb2) < 0
>|| ino_or_dev_mismatch(&stb1,
Olaf Kirch:
> Hi all,
>
> when you're dealing with files in /tmp that are supposed to be re-opened
> (rather than opened once and then discarded) there's an established
> way to do it which goes like this:
>
> if (lstat(fname, &stb1) >= 0 && S_ISREG(stb1.st_mode)) {
> fd = open
Mark A. Heilpern wrote:
> Maybe I'm just naive, but it's my understanding that you cannot
> send signals to a process you don't own unless you are root.
You can if you control the pty where the program is running. Then
simulate susp characters (usually ^Z) to generate SIGTSTP, break (^C) to
gene
Why not do an:
fd = open(file, O_RDWR);
fstat(fd, &fi);
lstat(file, &li);
if (fi.st_ino == li.st_ino && fi.st_dev == li.st_dev && S_ISREG(fi.st_mode)) {
/* it's a real, plain, file */
}
That guarantees that the directory structure reflects your file descriptor.
The method below has
On Mon, Jan 03, 2000 at 05:34:45PM -0500, Mark A. Heilpern wrote:
> Maybe I'm just naive, but it's my understanding that you cannot send signals
> to a process you don't own unless you are root.
That's not true for setuid processes. You're allowed to signal a process
if _either_ the effective or
I think I see a flaw with this...
Goetz Babin-Ebell wrote:
>
> I did something that way:
>
> FILE *DoOpen(const char *cpFile, long bAppend)
> {
>FILE *spNew;
>FILE *spTest;
>struct stat sStat;
>
>spTest = fopen(cpFile,"a");
>if (!spTest)
>{
> Log("ERR FILE OPEN",cpFi
> [symlink-paranoia code]
> However, consider an average setuid root application, [...]. When
> the application reaches the critical section of code between the
> lstat and the open, you stop it by sending it a SIGSTOP.
If you can send it a SIGSTOP, either you're running as root (in which
case
At 21:24 03.01.00 +0100, Olaf Kirch wrote:
>Hi all,
Hallo Olaf,
>when you're dealing with files in /tmp that are supposed to be re-opened
>(rather than opened once and then discarded) there's an established
>way to do it which goes like this:
>
> if (lstat(fname, &stb1) >= 0 && S_ISREG(stb1
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
At 09:24 PM 1/3/00 +0100, you wrote:
[snip]
>When
>the application reaches the critical section of code between the
>lstat and the open, you stop it by sending it a SIGSTOP. You record
>the device and inode number of your /tmp file, remove it, and wa
Hi all,
when you're dealing with files in /tmp that are supposed to be re-opened
(rather than opened once and then discarded) there's an established
way to do it which goes like this:
if (lstat(fname, &stb1) >= 0 && S_ISREG(stb1.st_mode)) {
fd = open(fname, O_RDWR);
18 matches
Mail list logo