[hackers] [sltar] version 0.2 || gottox
changeset: 17:87155651d191
tag: 0.2
user: gottox_AT_rootkit.lan
date: Wed Dec 19 16:08:07 2007 +0100
files: config.mk sltar.1 sltar.c
description:
version 0.2
diff -r e25fd0b6bbc3 -r 87155651d191 config.mk
--- a/config.mk Wed Dec 19 15:14:43 2007 +0100
+++ b/config.mk Wed Dec 19 16:08:07 2007 +0100
_AT_@ -1,5 +1,5 @@
# sltar version
-VERSION = 0.1.3
+VERSION = 0.2
# Customize below to fit your system
diff -r e25fd0b6bbc3 -r 87155651d191 sltar.1
--- a/sltar.1 Wed Dec 19 15:14:43 2007 +0100
+++ b/sltar.1 Wed Dec 19 16:08:07 2007 +0100
_AT_@ -12,7 +12,7 @@
extract tarball from stdin
.TP
.B t
-lists all files in tarball from stdin
+list all files in tarball from stdin
.SH BUGS
sltar cannot create special files like devices,
sockets, or fifos.
diff -r e25fd0b6bbc3 -r 87155651d191 sltar.c
--- a/sltar.c Wed Dec 19 15:14:43 2007 +0100
+++ b/sltar.c Wed Dec 19 16:08:07 2007 +0100
_AT_@ -11,8 +11,7 @@
enum Header {
MODE = 100, UID = 108, GID = 116, SIZE = 124, MTIME = 136,
- TYPE = 156, LINK = 157, DEVMAJOR = 329, DEVMINOR = 337,
- END = 512
+ TYPE = 156, LINK = 157, MAJ = 329, MIN = 337, END = 512
};
int main(int argc, char *argv[]) {
_AT_@ -22,7 +21,7 @@
if((argc != 2 || (a = argv[1][0]) == '\0') ||
argv[1][1] != '\0' || (a != 't' && a != 'x')) {
- fputs("sltar-" VERSION " - suckless tar\nsltar [xt]",stderr);
+ fputs("sltar-" VERSION " - suckless tar\nsltar [xt]\n",stderr);
return EXIT_FAILURE;
}
for(lname[100] = fname[100] = l = 0; fread(b,END,1,stdin); l -= END)
_AT_@ -43,7 +42,7 @@
unlink(fname);
switch(b[TYPE]) {
case '0': /* file */
- if(!(f = fopen(b,"w")))
+ if(!(f = fopen(fname,"w")) || chmod(fname,strtoul(b + MODE,0,8)))
perror(fname);
break;
case '1': /* hardlink */
_AT_@ -60,14 +59,17 @@
break;
case '3': /* char device */
case '4': /* block device */
- /* TODO */
+ mknod(fname, (b[TYPE] == '3' ? S_IFCHR : S_IFBLK) | strtoul(b + MODE,0,8),
+ makedev(strtoul(b + MAJ,0,8),
+ strtoul(b + MIN,0,8)));
break;
case '6': /* fifo */
- /* TODO */
+ mknod(fname, S_IFIFO | strtoull(b + MODE,0,8), 0);
break;
default:
fputs("not supported filetype\n",stderr);
}
+ chown(fname, strtoul(b + UID,0,8),strtoul(b + GID,0,8));
}
else if(a == 'x' && f && !fwrite(b,l > 512 ? END : l,1,f)) {
perror(fname);
Received on Sun Nov 11 2012 - 17:23:44 CET
This archive was generated by hypermail 2.3.0
: Sun Nov 11 2012 - 17:24:40 CET