[prev in list] [next in list] [prev in thread] [next in thread]
List: klik-devel
Subject: [klik-devel] [klikclient commit] r1632 -
From: codesite-noreply () google ! com
Date: 2008-07-30 0:32:29
Message-ID: 0016e64b9d083b8ff8045332e480 () google ! com
[Download RAW message or body]
Author: lionel.tricon
Date: Tue Jul 29 09:24:25 2008
New Revision: 1632
Modified:
trunk/virtualization/unionfuse/trunk/fusioniso/src/fs.c
Log:
Added some improvements for sandboxing
Modified: trunk/virtualization/unionfuse/trunk/fusioniso/src/fs.c
==============================================================================
--- trunk/virtualization/unionfuse/trunk/fusioniso/src/fs.c (original)
+++ trunk/virtualization/unionfuse/trunk/fusioniso/src/fs.c Tue Jul 29
09:24:25 2008
@@ -93,6 +93,7 @@
#include <pthread.h>
#include <sys/statfs.h>
#include <iconv.h>
+#include <errno.h>
#include "fs.h"
@@ -722,7 +723,7 @@
if (filler && !lstat(v_chemin,&v_stbuf))
{
filler(filler_buf, v_dirent->d_name, &v_stbuf, 0);
- if (extern_debug) printf("FILLER [%s]\n", v_dirent->d_name);
+ if (extern_debug) printf("FILLER #1 [%s]\n", v_dirent->d_name);
}
}
}
@@ -757,8 +758,11 @@
memset(&v_stbuf, '\0', sizeof(struct stat));
if (filler && !lstat(v_chemin,&v_stbuf))
{
- filler(filler_buf, v_dirent->d_name, &v_stbuf, 0);
- if (extern_debug) printf("FILLER [%s]\n", v_dirent->d_name);
+ if (current_inode==NULL
&& !g_hash_table_lookup(removed_lookup_table, v_chemin))
+ {
+ filler(filler_buf, v_dirent->d_name,
&v_stbuf, 0);
+ if (extern_debug) printf("FILLER #2
[%s]\n", v_dirent->d_name);
+ }
}
}
}
@@ -826,7 +830,7 @@
return -ENOENT;
}
- printf("getattr: found %s, size %d\n", path, isonum_733(inode->record->size));
+ fprintf(stderr, "getattr: found %s, size %d\n", path, isonum_733(inode->record->size));
memset(stbuf, 0, sizeof(struct stat));
isofs_direntry2stat(stbuf, inode);
/* if (ISO_FLAGS_DIR(inode->record->flags)) {
@@ -1203,6 +1207,7 @@
}
return retval;
case -1:
+ if (extern_debug) printf("****** #2 unlink(%s)\n", newpath);
// If the file exist on disk,
// we keep the file name in a list
if (lstat(path,&v_stbuf) == 0)
@@ -1212,7 +1217,7 @@
return 0;
}
}
- if (extern_debug) printf("****** #2 unlink(%s)\n", newpath);
+ if (extern_debug) printf("****** #3 unlink(%s)\n", newpath);
return unlink(newpath);
}
@@ -1270,17 +1275,16 @@
return -EPERM;
}
- if (fs_home(path,&newpath) == 0) fs_path_mkdir(newpath,0);
+ if (fs_home(path,&newpath) == 0) fs_path_mkdir(newpath,1);
if (extern_debug) printf("****** mkdir: %s %d\n", newpath, mode);
+
return mkdir(newpath, mode);
}
int fs_real_symlink(const char *path1, const char *path2)
{
- char sppath1[FS_MAXPATH],sppath2[FS_MAXPATH];
- char *spath1=sppath1;
+ char sppath2[FS_MAXPATH];
char *spath2=sppath2;
- int retint;
if (extern_debug) printf("****** SYMLINK: (%s) -> (%s)\n", path1, path2);
isofs_inode *inode = fs_lookup(path2);
@@ -1290,12 +1294,11 @@
return -EPERM;
}
- retint = fs_home(path1,&spath1);
- if (fs_home(path2,&spath2)==0 || retint==0)
+ if (fs_home(path2,&spath2) == 0)
{
fs_path_mkdir(spath2, 1);
- if (extern_debug) printf("****** symlink #1 %s -> %s\n",
spath1, spath2);
- return symlink(spath1, spath2);
+ if (extern_debug) printf("****** symlink #1 %s -> %s\n",
path1, spath2);
+ return symlink(path1, spath2);
}
if (extern_debug) printf("****** symlink #2 %s -> %s\n", path1, path2);
@@ -1305,8 +1308,10 @@
int fs_real_rename(const char *oldpath, const char *newpath)
{
char ppath1[FS_MAXPATH],ppath2[FS_MAXPATH];
+ struct stat v_stbuf;
char *path1=ppath1;
char *path2=ppath2;
+ int retval;
if (extern_debug) printf("****** RENAME: (%s) -> (%s)\n", oldpath, newpath);
isofs_inode *inode = fs_lookup(oldpath);
if (inode)
@@ -1314,18 +1319,33 @@
fprintf(stderr, "rename: you don't have permission on %s\n", oldpath);
return -EPERM;
}
- if (fs_home(oldpath,&path1)==0 && fs_home(newpath,&path2)==0)
+ retval = fs_home_stat(oldpath,&path1,&v_stbuf);
+ if (fs_home(newpath,&path2)==0 || retval!=1)
{
+ if (retval == -1)
+ {
+ retval = stat(oldpath, &v_stbuf);
+ if (!retval && S_ISDIR(v_stbuf.st_mode))
+ {
+ printf("TODO\n");
+ fflush(stdout);
+ }
+ else fs_file_dup(oldpath,path1);
+ if (extern_debug) printf("****** INSERT
removed_lookup_table -> %s\n", oldpath);
+ g_hash_table_insert(removed_lookup_table,
g_strdup(oldpath), removed_value);
+ }
fs_path_mkdir(path2, 1);
+
+ if (extern_debug) printf("****** rename #1 %s -> %s\n", path1, path2);
return rename(path1, path2);
}
+ if (extern_debug) printf("****** rename #2 %s -> %s\n", oldpath, newpath);
return rename(oldpath, newpath);
}
int fs_real_link(const char *oldpath, const char *newpath)
{
- char ppath1[FS_MAXPATH],ppath2[FS_MAXPATH];
- char *path1=ppath1;
+ char ppath2[FS_MAXPATH];
char *path2=ppath2;
if (extern_debug) printf("****** LINK: (%s) -> (%s)\n", oldpath, newpath);
isofs_inode *inode = fs_lookup(oldpath);
@@ -1335,12 +1355,13 @@
return -EPERM;
}
- fs_home(oldpath,&path1);
if (fs_home(newpath,&path2) == 0)
{
fs_path_mkdir(path2, 1);
- return link(path1, path2);
+ if (extern_debug) printf("****** link #1: %s -> %s\n",
oldpath, path2);
+ return link(oldpath, path2);
}
+ if (extern_debug) printf("****** link #2: %s -> %s\n", oldpath, oldpath);
return link(oldpath, newpath);
}
_______________________________________________
klik-devel mailing list
klik-devel@kde.org
https://mail.kde.org/mailman/listinfo/klik-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic