[45412] in Cypherpunks
Secured RM ? (source)
daemon@ATHENA.MIT.EDU (root)
Thu Dec 14 20:57:59 1995
Date: Mon, 21 Jan 1980 06:53:36 -0500 (EST)
From: root <root@HellSpawn.gate.net>
To: cypherpunks@toad.com
OK ... here we go.. Based on discussion on this list this is what I
hacked out to (hopefully) more securely remove a file under unix.
I'd really apreciate any input, but my main interest is in the security of
the protocol in general and not the sloppy and embarassing C
programming.. :)
While we're here.. I havn't been able to find anyone on the planet who's
seen or heard of a linux un-remove, which makes testing my code very
tricky. If anyone can point me at it I'd apreciate it. Hell, if someone
can definitively say they've /seen/ such a thing it'd be nice. So far
i've found one person who insists that his system admins sisters
boyfriends cousin from Saint Petersburg has been using un-rm for unix for
years. *sigh*
int Pc = 0;
int Px = 0;
int Pz = 0;
paranoia(Pfilename)
{
char Pfilename[200];
FILE *Pfp;
if ( (Pfp = fopen(Pfilename, "rb") ) == NULL)
{
return -1;
}
while(1)
{
fgetc(Pfp);
if (!feof( Pfp ))
Px++;
else
break;
}
fclose(Pfp);
while (Pz < 5)
{
if ( (Pfp = fopen(Pfilename, "wb") ) == NULL)
{
return -1;
}
while(Pc < (Px + 1024))
{
fputc(Pz,Pfp);
if (!feof( Pfp ))
c++;
else
break;
}
Pz++;
Pc = 0;
}
fclose(Pfilename);
remove(Pfilename);
}