1
1

* vfs.h: Remove vfs_uid and vfs_gid. Fix all dependencies.

Этот коммит содержится в:
Pavel Roskin 2002-12-06 02:14:28 +00:00
родитель 34e6f513ed
Коммит b9c6a9b3d1
6 изменённых файлов: 79 добавлений и 79 удалений

Просмотреть файл

@ -1,3 +1,7 @@
2002-12-05 Pavel Roskin <proski@gnu.org>
* vfs.h: Remove vfs_uid and vfs_gid. Fix all dependencies.
2002-12-05 Andrew V. Samoilov <sav@bcs.zp.ua> 2002-12-05 Andrew V. Samoilov <sav@bcs.zp.ua>
* extfs.c (open_archive): Use open_error_pipe before popen() and * extfs.c (open_archive): Use open_error_pipe before popen() and

Просмотреть файл

@ -541,18 +541,18 @@ static void *cpio_super_check(vfs *me, char *archive_name, char *op)
return &sb; return &sb;
} }
static int cpio_super_same(vfs *me, struct vfs_s_super *parc, char *archive_name, char *op, void *cookie) static int
cpio_super_same (vfs *me, struct vfs_s_super *parc, char *archive_name,
char *op, void *cookie)
{ {
struct stat *archive_stat = cookie; /* stat of main archive */ struct stat *archive_stat = cookie; /* stat of main archive */
if(strcmp(parc->name, archive_name)) return 0; if (strcmp (parc->name, archive_name))
if(vfs_uid && (!(archive_stat->st_mode & 0004)))
if((archive_stat->st_gid != vfs_gid) || !(archive_stat->st_mode & 0040))
if((archive_stat->st_uid != vfs_uid) || !(archive_stat->st_mode & 0400))
return 0; return 0;
/* Has the cached archive been changed on the disk? */ /* Has the cached archive been changed on the disk? */
if(parc->u.cpio.stat.st_mtime < archive_stat->st_mtime) { /* Yes, reload! */ if (parc->u.cpio.stat.st_mtime < archive_stat->st_mtime) {
/* Yes, reload! */
(*vfs_cpiofs_ops.free) ((vfsid) parc); (*vfs_cpiofs_ops.free) ((vfsid) parc);
vfs_rmstamp (&vfs_cpiofs_ops, (vfsid) parc, 0); vfs_rmstamp (&vfs_cpiofs_ops, (vfsid) parc, 0);
return 2; return 2;

Просмотреть файл

@ -398,10 +398,12 @@ static int read_archive (int fstype, char *name, struct archive **pparc)
static char *get_path (char *inname, struct archive **archive, int is_dir, static char *get_path (char *inname, struct archive **archive, int is_dir,
int do_not_open); int do_not_open);
/* Returns path inside argument. Returned char* is inside inname, which is mangled /*
* by this operation (so you must not free it's return value) * Return path inside argument. Returned char* is inside inname, which is mangled
* by this operation, so don't free the return value.
*/ */
static char *get_path_mangle (char *inname, struct archive **archive, int is_dir, static char *
get_path_mangle (char *inname, struct archive **archive, int is_dir,
int do_not_open) int do_not_open)
{ {
char *local, *archive_name, *op; char *local, *archive_name, *op;
@ -413,39 +415,33 @@ static char *get_path_mangle (char *inname, struct archive **archive, int is_dir
archive_name = inname; archive_name = inname;
vfs_split (inname, &local, &op); vfs_split (inname, &local, &op);
fstype = extfs_which( NULL, op ); /* FIXME: we really should pass
self pointer. But as we know that extfs_which does not touch vfs /*
*me, it does not matter for now */ * FIXME: we really should pass self pointer. But as we know that
* extfs_which does not touch vfs *me, it does not matter for now
*/
fstype = extfs_which (NULL, op);
if (fstype == -1) if (fstype == -1)
return NULL; return NULL;
if (!local) if (!local)
local = ""; local = "";
/* All filesystems should have some local archive, at least /*
* All filesystems should have some local archive, at least
* it can be '/'. * it can be '/'.
*
* Actually, we should implement an alias mechanism that would
* translate: "a:" to "dos:a.
*
*/ */
for (parc = first_archive; parc != NULL; parc = parc->next) for (parc = first_archive; parc != NULL; parc = parc->next)
if (parc->name) { if (parc->name) {
if (!strcmp (parc->name, archive_name)) { if (!strcmp (parc->name, archive_name)) {
struct stat *s=&(parc->extfsstat);
if (vfs_uid && (!(s->st_mode & 0004)))
if ((s->st_gid != vfs_gid) || !(s->st_mode & 0040))
if ((s->st_uid != vfs_uid) || !(s->st_mode & 0400))
return NULL;
/* This is not too secure - in some cases (/#mtools) files created
under user a are probably visible to everyone else since / usually
has permissions 755 */
vfs_stamp (&vfs_extfs_ops, (vfsid) parc); vfs_stamp (&vfs_extfs_ops, (vfsid) parc);
goto return_success; goto return_success;
} }
} }
result = do_not_open ? -1 : read_archive (fstype, archive_name, &parc); result = do_not_open ? -1 : read_archive (fstype, archive_name, &parc);
if (result == -1) ERRNOR (EIO, NULL); if (result == -1)
ERRNOR (EIO, NULL);
if (archive_name) { if (archive_name) {
v = vfs_type (archive_name); v = vfs_type (archive_name);

Просмотреть файл

@ -107,16 +107,14 @@ static char *
redirect (vfs *me, char *name) redirect (vfs *me, char *name)
{ {
struct cachedfile *cur = head; struct cachedfile *cur = head;
uid_t uid = vfs_uid;
char *cache; char *cache;
int handle; int handle;
while (cur) { while (cur) {
if ((!strcmp (name, cur->name)) &&
(uid == cur->uid) &&
(uptodate (cur->name, cur->cache)))
/* FIXME: when not uptodate, we might want to kill cache /* FIXME: when not uptodate, we might want to kill cache
* file immediately, not to wait until timeout. */ { * file immediately, not to wait until timeout. */
if ((!strcmp (name, cur->name)) && (cur->uid == 0)
&& (uptodate (cur->name, cur->cache))) {
vfs_stamp (&vfs_sfs_ops, cur); vfs_stamp (&vfs_sfs_ops, cur);
return cur->cache; return cur->cache;
} }
@ -135,7 +133,7 @@ redirect (vfs *me, char *name)
cur = g_new (struct cachedfile, 1); cur = g_new (struct cachedfile, 1);
cur->name = g_strdup (name); cur->name = g_strdup (name);
cur->cache = cache; cur->cache = cache;
cur->uid = uid; cur->uid = 0;
cur->next = head; cur->next = head;
head = cur; head = cur;
@ -207,7 +205,8 @@ static int sfs_readlink (vfs *me, char *path, char *buf, int size)
return readlink (path, buf, size); return readlink (path, buf, size);
} }
static vfsid sfs_getid (vfs *me, char *path, struct vfs_stamping **parent) static vfsid
sfs_getid (vfs *me, char *path, struct vfs_stamping **parent)
{ /* FIXME: what should I do? */ { /* FIXME: what should I do? */
vfs *v; vfs *v;
vfsid id; vfsid id;
@ -215,8 +214,7 @@ static vfsid sfs_getid (vfs *me, char *path, struct vfs_stamping **parent)
struct cachedfile *cur = head; struct cachedfile *cur = head;
while (cur) { while (cur) {
if ((!strcmp( path, cur->name )) && if ((!strcmp (path, cur->name)) && (cur->uid == 0))
(vfs_uid == cur->uid))
break; break;
cur = cur->next; cur = cur->next;
} }
@ -228,8 +226,13 @@ static vfsid sfs_getid (vfs *me, char *path, struct vfs_stamping **parent)
{ {
char *path2 = g_strdup (path); char *path2 = g_strdup (path);
v = vfs_split (path2, NULL, NULL); /* Strip suffix which led to this being sfs */
v = vfs_split (path2, NULL, NULL); /* ... and learn whoever was the parent system */ /* Strip suffix which led to this being sfs */
v = vfs_split (path2, NULL, NULL);
/* ... and learn whoever was the parent system */
v = vfs_split (path2, NULL, NULL);
id = (*v->getid) (v, path2, &par); id = (*v->getid) (v, path2, &par);
g_free (path2); g_free (path2);
} }

Просмотреть файл

@ -441,18 +441,18 @@ static void *tar_super_check(vfs *me, char *archive_name, char *op)
return &stat_buf; return &stat_buf;
} }
static int tar_super_same(vfs *me, struct vfs_s_super *parc, char *archive_name, char *op, void *cookie) static int
tar_super_same (vfs *me, struct vfs_s_super *parc, char *archive_name,
char *op, void *cookie)
{ {
struct stat *archive_stat = cookie; /* stat of main archive */ struct stat *archive_stat = cookie; /* stat of main archive */
if (strcmp (parc->name, archive_name)) return 0; if (strcmp (parc->name, archive_name))
if (vfs_uid && (!(archive_stat->st_mode & 0004)))
if ((archive_stat->st_gid != vfs_gid) || !(archive_stat->st_mode & 0040))
if ((archive_stat->st_uid != vfs_uid) || !(archive_stat->st_mode & 0400))
return 0; return 0;
/* Has the cached archive been changed on the disk? */ /* Has the cached archive been changed on the disk? */
if (parc->u.tar.tarstat.st_mtime < archive_stat->st_mtime) { /* Yes, reload! */ if (parc->u.tar.tarstat.st_mtime < archive_stat->st_mtime) {
/* Yes, reload! */
(*vfs_tarfs_ops.free) ((vfsid) parc); (*vfs_tarfs_ops.free) ((vfsid) parc);
vfs_rmstamp (&vfs_tarfs_ops, (vfsid) parc, 0); vfs_rmstamp (&vfs_tarfs_ops, (vfsid) parc, 0);
return 2; return 2;

Просмотреть файл

@ -355,9 +355,6 @@ extern void vfs_print_stats (const char *fs_name, const char *action,
#define MCCTL_WANT_STALE_DATA 9 #define MCCTL_WANT_STALE_DATA 9
#define MCCTL_NO_STALE_DATA 10 #define MCCTL_NO_STALE_DATA 10
#define vfs_uid 0
#define vfs_gid 0
#define FL_ALWAYS_MAGIC 1 #define FL_ALWAYS_MAGIC 1
#define FL_NO_MCFS 2 #define FL_NO_MCFS 2
#define FL_NO_FTPFS 4 #define FL_NO_FTPFS 4