[hackers] [sltar] chmod works for special files; chown produces an error. || gottox
changeset: 23:a28a4da81d45
user: gottox_AT_rootkit.lan
date: Mon Jan 14 20:02:55 2008 +0100
files: sltar.c
description:
chmod works for special files; chown produces an error.
diff -r 18021ed2100c -r a28a4da81d45 sltar.c
--- a/sltar.c Thu Dec 27 19:35:50 2007 +0100
+++ b/sltar.c Mon Jan 14 20:02:55 2008 +0100
_AT_@ -42,7 +42,7 @@
unlink(fname);
switch(b[TYPE]) {
case '0': /* file */
- if(!(f = fopen(fname,"w")) || chmod(fname,strtoul(b + MODE,0,8)))
+ if(!(f = fopen(fname,"w")))
perror(fname);
break;
case '1': /* hardlink */
_AT_@ -71,7 +71,10 @@
default:
fputs("not supported filetype\n",stderr);
}
- chown(fname, strtoul(b + UID,0,8),strtoul(b + GID,0,8));
+ if(chmod(fname,strtoul(b + MODE,0,8)))
+ perror(fname);
+ if(getuid() == 0 && chown(fname, strtoul(b + UID,0,8),strtoul(b + GID,0,8)))
+ perror(fname);
}
else if(a == 'x' && f && !fwrite(b,l > 512 ? END : l,1,f)) {
perror(fname);
Received on Sun Nov 11 2012 - 17:23:50 CET
This archive was generated by hypermail 2.3.0
: Sun Nov 11 2012 - 17:24:45 CET