Update to 1.1.1
From changelog: Bugs fixed since ChironFS 1.1.0: o ChironFS could not locate the correct place where chirctl was when called using the environment variable $PATH to find it. Now chirctl is called in the same way as ChironFS, leaving this work to $PATH searches. Changes since ChironFS 1.1.0 --------------------- o ChironFS could not locate the correct place where chirctl was when called using the environment variable $PATH to find it. Now chirctl is called in the same way as ChironFS, leaving this work to $PATH searches. Changes since ChironFS 1.0.0 --------------------- o Added the --ctl (or -c) option which allows to mount a pseudo-filesystem (like /proc) to control the behavior of the Chiron filesystem being mounted. Currently, it's only possible to show the status of the replicas and change their status. Dynamically generated nagios plugin scripts are provided too. o Updated the howto in the chapter 5, explaining the use of the --ctl option.
This commit is contained in:
parent
4b6c3f9f0b
commit
2206838a94
8 changed files with 426 additions and 195 deletions
|
@ -1,8 +1,9 @@
|
|||
# $NetBSD: Makefile,v 1.1.1.1 2007/11/27 18:55:40 pooka Exp $
|
||||
# $NetBSD: Makefile,v 1.2 2009/04/09 03:33:12 manu Exp $
|
||||
#
|
||||
|
||||
DISTNAME= chironfs-1.0-RC9
|
||||
PKGNAME= fuse-chironfs-1.0RC9
|
||||
DISTNAME= chironfs-1.1.1
|
||||
PKGNAME= fuse-chironfs-1.1.1
|
||||
PKGREVISION= 1
|
||||
CATEGORIES= filesystems
|
||||
MASTER_SITES= http://chironfs.googlecode.com/files/
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
@comment $NetBSD: PLIST,v 1.1.1.1 2007/11/27 18:55:40 pooka Exp $
|
||||
@comment $NetBSD: PLIST,v 1.2 2009/04/09 03:33:12 manu Exp $
|
||||
bin/chironfs
|
||||
bin/chirctl
|
||||
man/man8/chironfs.8
|
||||
share/doc/chironfs/README
|
||||
share/doc/chironfs/AUTHORS
|
||||
|
@ -7,6 +8,11 @@ share/doc/chironfs/changelog.Debian
|
|||
share/doc/chironfs/HOWTO.html
|
||||
share/doc/chironfs/NEWS
|
||||
share/doc/chironfs/TODO
|
||||
share/doc/chironfs/ChangeLog
|
||||
share/doc/chironfs/copyright
|
||||
share/doc/chironfs/changelog
|
||||
share/doc/chironfs/chironfs.css
|
||||
share/doc/chironfs/large.gif
|
||||
share/doc/chironfs/med.gif
|
||||
share/doc/chironfs/small.gif
|
||||
|
||||
@dirrm share/doc/chironfs
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
$NetBSD: distinfo,v 1.1.1.1 2007/11/27 18:55:40 pooka Exp $
|
||||
$NetBSD: distinfo,v 1.2 2009/04/09 03:33:12 manu Exp $
|
||||
|
||||
SHA1 (chironfs-1.0-RC9.tar.gz) = a7f703afb8bc9d2a1dcdd833fa17c6358b4225f9
|
||||
RMD160 (chironfs-1.0-RC9.tar.gz) = d6962e5af8b530080ec04191e33aaee433154c01
|
||||
Size (chironfs-1.0-RC9.tar.gz) = 398831 bytes
|
||||
SHA1 (patch-aa) = bcabe1a6b4841ad93b53c031c2f75c1bd4968270
|
||||
SHA1 (patch-ab) = 30dface656c86e5e883a2b99fa7fb570fb932611
|
||||
SHA1 (patch-ac) = 316d880066d9a3dc482edcd034dd754073011d21
|
||||
SHA1 (patch-ad) = 681867b573d4a5e60fe283be8170294112695994
|
||||
SHA1 (chironfs-1.1.1.tar.gz) = cc92d8ed39a1594da0422408daf080681efe7ba5
|
||||
RMD160 (chironfs-1.1.1.tar.gz) = 29cc8fb3aac8148d3238a6b79bb002d7f8aad826
|
||||
Size (chironfs-1.1.1.tar.gz) = 444036 bytes
|
||||
SHA1 (patch-ae) = a4112ec0162a39ce67c897de5177890f5a157f04
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
$NetBSD: patch-aa,v 1.1.1.1 2007/11/27 18:55:40 pooka Exp $
|
||||
|
||||
--- src/Makefile.in.orig 2007-10-23 06:25:06.000000000 +0200
|
||||
+++ src/Makefile.in 2007-11-27 19:04:11.000000000 +0100
|
||||
@@ -146,7 +146,7 @@
|
||||
top_srcdir = @top_srcdir@
|
||||
AM_CFLAGS = $(all_includes) -Wall -W -Wmissing-prototypes -g -O2 -DFUSE_USE_VERSION=25 -D_FILE_OFFSET_BITS=64
|
||||
chironfs_SOURCES = chironfs.c chiron-conf.c chironfs.h
|
||||
-chironfs_LDFLAGS = -L/usr/local/lib -lfuse -ldl -lm
|
||||
+chironfs_LDFLAGS = -L/usr/local/lib -lfuse -lm
|
||||
chironfs_OBJS = chironfs.o chiron-conf.o
|
||||
all: all-am
|
||||
|
|
@ -1,82 +0,0 @@
|
|||
$NetBSD: patch-ab,v 1.1.1.1 2007/11/27 18:55:40 pooka Exp $
|
||||
|
||||
--- src/chiron-conf.c.orig 2007-10-23 04:54:53.000000000 +0200
|
||||
+++ src/chiron-conf.c 2007-11-27 18:05:11.000000000 +0100
|
||||
@@ -34,7 +34,11 @@
|
||||
#include <dlfcn.h>
|
||||
|
||||
#include <libgen.h>
|
||||
+#ifdef __linux__
|
||||
#include <linux/limits.h>
|
||||
+#else
|
||||
+#include <limits.h>
|
||||
+#endif
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/resource.h>
|
||||
@@ -232,7 +236,8 @@
|
||||
int do_mount(char *filesystems, char *mountpoint)
|
||||
{
|
||||
char buf[100];
|
||||
- int i, start, fd, res, errno, rep_on_mount=0, err;
|
||||
+ int fd, res;
|
||||
+ int i, start, errno, rep_on_mount=0, err;
|
||||
int *tmp_high, *tmp_low;
|
||||
unsigned long tmpfd;
|
||||
struct rlimit rlp;
|
||||
@@ -249,21 +254,21 @@
|
||||
}
|
||||
|
||||
fd = open("/proc/sys/fs/file-max",O_RDONLY);
|
||||
- if (fd<0) {
|
||||
- print_err(errno,"opening /proc/sys/fs/file-max");
|
||||
- exit(errno);
|
||||
- }
|
||||
- res = read(fd,buf,99);
|
||||
- if (res<0) {
|
||||
- print_err(errno,"reading /proc/sys/fs/file-max");
|
||||
- exit(errno);
|
||||
+ if (fd != -1) {
|
||||
+ res = read(fd,buf,99);
|
||||
+ if (res<0) {
|
||||
+ print_err(errno,"reading /proc/sys/fs/file-max");
|
||||
+ exit(errno);
|
||||
+ }
|
||||
+ sscanf(buf,"%qu",&FD_BUF_SIZE);
|
||||
+ close(fd);
|
||||
+ } else {
|
||||
+ FD_BUF_SIZE = 4096;
|
||||
}
|
||||
- sscanf(buf,"%qu",&FD_BUF_SIZE);
|
||||
- close(fd);
|
||||
|
||||
tmpfd = (FD_BUF_SIZE >>= 1);
|
||||
|
||||
- if (getrlimit(RLIMIT_OFILE,&rlp)) {
|
||||
+ if (getrlimit(RLIMIT_NOFILE,&rlp)) {
|
||||
print_err(errno,"reading nofile resource limit");
|
||||
exit(errno);
|
||||
}
|
||||
@@ -356,11 +361,11 @@
|
||||
}
|
||||
|
||||
if (mountpoint[0]==':') {
|
||||
- mount_point = realpath(mountpoint+1,NULL);
|
||||
+ mount_point = do_realpath(mountpoint+1,NULL);
|
||||
rep_on_mount = i = 1;
|
||||
tmp_high[max_replica_high++] = 0;
|
||||
} else {
|
||||
- mount_point = realpath(mountpoint,NULL);
|
||||
+ mount_point = do_realpath(mountpoint,NULL);
|
||||
i = 0;
|
||||
}
|
||||
if (mount_point==NULL) {
|
||||
@@ -380,7 +385,7 @@
|
||||
tmp_high[max_replica_high++] = i;
|
||||
}
|
||||
|
||||
- paths[i].path = realpath(filesystems+start, NULL);
|
||||
+ paths[i].path = do_realpath(filesystems+start, NULL);
|
||||
if (paths[i].path==NULL) {
|
||||
free_paths();
|
||||
free_tab_fd();
|
|
@ -1,75 +0,0 @@
|
|||
$NetBSD: patch-ac,v 1.1.1.1 2007/11/27 18:55:40 pooka Exp $
|
||||
|
||||
--- src/chironfs.c.orig 2007-11-27 17:00:15.000000000 +0100
|
||||
+++ src/chironfs.c 2007-11-27 19:08:07.000000000 +0100
|
||||
@@ -27,8 +27,7 @@
|
||||
#define FUSE_USE_VERSION 25
|
||||
|
||||
#include <fuse.h>
|
||||
-#include <fuse/fuse.h>
|
||||
-#include <fuse/fuse_opt.h>
|
||||
+#include <fuse_opt.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@@ -43,13 +42,17 @@
|
||||
#ifdef HAVE_SETXATTR
|
||||
#include <sys/xattr.h>
|
||||
#endif
|
||||
+#ifdef __linux__
|
||||
#include <linux/limits.h>
|
||||
#include <mntent.h>
|
||||
-#include <stdint.h>
|
||||
#include <bits/wordsize.h>
|
||||
+#endif
|
||||
+#include <stdint.h>
|
||||
#include <pwd.h>
|
||||
#include <grp.h>
|
||||
|
||||
+#include "config.h"
|
||||
+
|
||||
#define _CHIRON_H_
|
||||
#include "chironfs.h"
|
||||
|
||||
@@ -186,6 +189,16 @@
|
||||
}
|
||||
}
|
||||
|
||||
+char *do_realpath(const char *path, char *resolvedpath)
|
||||
+{
|
||||
+
|
||||
+#ifndef __linux__
|
||||
+ if (resolvedpath == NULL)
|
||||
+ resolvedpath = malloc(PATH_MAX);
|
||||
+#endif
|
||||
+ return realpath(path, resolvedpath);
|
||||
+}
|
||||
+
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -2234,7 +2247,7 @@
|
||||
return(NULL);
|
||||
}
|
||||
} else {
|
||||
- realbasedir = realpath(basedir,NULL);
|
||||
+ realbasedir = do_realpath(basedir,NULL);
|
||||
if (realbasedir==NULL) {
|
||||
free(basedir);
|
||||
return(NULL);
|
||||
@@ -2383,6 +2396,7 @@
|
||||
dbg(("\nfuse_argv: %s %s %s", fuse_argv[0], fuse_argv[1], fuse_argv[2]));
|
||||
dbg(("\n-------------------------------------------------------------------------------"));
|
||||
|
||||
+#ifdef HAVE_GETMNTENT
|
||||
FILE *mtab;
|
||||
struct mntent *mntentry;
|
||||
mtab = setmntent("/etc/mtab", "r");
|
||||
@@ -2393,6 +2407,7 @@
|
||||
}
|
||||
} while(mntentry!=NULL);
|
||||
endmntent (mtab);
|
||||
+#endif
|
||||
dbg(("\n-------------------------------------------------------------------------------"));
|
||||
|
||||
res = fuse_main(3, fuse_argv, &chiron_oper);
|
|
@ -1,12 +0,0 @@
|
|||
$NetBSD: patch-ad,v 1.1.1.1 2007/11/27 18:55:40 pooka Exp $
|
||||
|
||||
--- src/chironfs.h.orig 2007-10-23 05:09:39.000000000 +0200
|
||||
+++ src/chironfs.h 2007-11-27 19:10:43.000000000 +0100
|
||||
@@ -157,6 +157,7 @@
|
||||
int fd_hashseek(int fd_main);
|
||||
void print_err(int err, char *specifier);
|
||||
void call_log(char *fnname, char *resource, int err);
|
||||
+char *do_realpath(const char *pathname, char *resolvedname);
|
||||
int choose_replica(int try);
|
||||
void disable_replica(int n);
|
||||
void opt_parse(char *fo, char**log, char**argvbuf);
|
409
filesystems/fuse-chironfs/patches/patch-ae
Normal file
409
filesystems/fuse-chironfs/patches/patch-ae
Normal file
|
@ -0,0 +1,409 @@
|
|||
$NetBSD: patch-ae,v 1.1 2009/04/09 03:33:13 manu Exp $
|
||||
--- src/chirctl.c.orig 2008-06-19 03:27:08.000000000 +0200
|
||||
+++ src/chirctl.c 2009-03-28 22:54:07.000000000 +0100
|
||||
@@ -29,9 +29,11 @@
|
||||
#include <fuse/fuse_opt.h>
|
||||
|
||||
#else
|
||||
|
||||
+#ifndef __NetBSD__
|
||||
typedef uint64_t cpuset_t;
|
||||
+#endif
|
||||
|
||||
//
|
||||
// The lines below are from a patch contributed by Antti Kantee
|
||||
// to make ChironFS run on NetBSD
|
||||
--- src/chiron-conf.c.orig 2008-06-12 03:55:22.000000000 +0200
|
||||
+++ src/chiron-conf.c 2009-03-28 22:54:07.000000000 +0100
|
||||
@@ -188,8 +188,13 @@
|
||||
fo[i] = 0;
|
||||
quiet_mode = 1;
|
||||
sprintf(fo+start,"%s",fo+6);
|
||||
i = start - 1;
|
||||
+ } else if (!strncmp(fo+start,"nochown", 7)) {
|
||||
+ fo[i] = 0;
|
||||
+ nochown_mode = 1;
|
||||
+ sprintf(fo+start,"%s",fo+7);
|
||||
+ i = start - 1;
|
||||
} else {
|
||||
start = i + 1;
|
||||
}
|
||||
}
|
||||
--- src/chirondbg.c.orig 2008-06-15 21:10:49.000000000 +0200
|
||||
+++ src/chirondbg.c 2009-03-29 12:14:03.000000000 +0200
|
||||
@@ -40,9 +40,11 @@
|
||||
#include <fuse/fuse_opt.h>
|
||||
|
||||
#else
|
||||
|
||||
+#ifndef __NetBSD__
|
||||
typedef uint64_t cpuset_t;
|
||||
+#endif
|
||||
|
||||
//
|
||||
// The lines below are from a patch contributed by Antti Kantee
|
||||
// to make ChironFS run on NetBSD
|
||||
@@ -204,18 +206,24 @@
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void print_err(int err, char *specifier)
|
||||
{
|
||||
+ char errbuf[1024];
|
||||
+
|
||||
if (!quiet_mode) {
|
||||
if (specifier==NULL) {
|
||||
if (err>0) {
|
||||
- fprintf(stderr,"%s\n",strerror(err));
|
||||
+ if (strerror_r(err, errbuf, sizeof(errbuf)) != 0)
|
||||
+ strncpy(errbuf, "strerror_r() failure", sizeof(errbuf));
|
||||
+ fprintf(stderr,"%s\n",errbuf);
|
||||
} else {
|
||||
fprintf(stderr,"%s\n",errtab[-(err+1)]);
|
||||
}
|
||||
} else {
|
||||
if (err>0) {
|
||||
- fprintf(stderr,"%s: %s\n",specifier,strerror(err));
|
||||
+ if (strerror_r(err, errbuf, sizeof(errbuf)) != 0)
|
||||
+ strncpy(errbuf, "strerror_r() failure", sizeof(errbuf));
|
||||
+ fprintf(stderr,"%s: %s\n",specifier,errbuf);
|
||||
} else {
|
||||
fprintf(stderr,"%s: %s\n",specifier,errtab[-(err+1)]);
|
||||
}
|
||||
}
|
||||
@@ -225,16 +233,17 @@
|
||||
|
||||
void call_log(char *fnname, char *resource, int err)
|
||||
{
|
||||
time_t t;
|
||||
- struct tm *ptm;
|
||||
+ struct tm *ptm, tmbuf;
|
||||
char tmstr[20];
|
||||
+ char errbuf[1024];
|
||||
|
||||
if (logfd!=NULL) {
|
||||
attach_log();
|
||||
flockfile(logfd);
|
||||
t = time(NULL);
|
||||
- ptm = localtime(&t);
|
||||
+ ptm = localtime_r(&t, &tmbuf);
|
||||
strftime(tmstr,19,"%Y/%m/%d %H:%M ",ptm);
|
||||
fputs(tmstr,logfd);
|
||||
fputs(fnname,logfd);
|
||||
if (err!=CHIRONFS_ADM_FORCED) {
|
||||
@@ -245,9 +254,11 @@
|
||||
fputs(resource,logfd);
|
||||
if (err) {
|
||||
fputs(" ",logfd);
|
||||
if (err>0) {
|
||||
- fputs(strerror(err),logfd);
|
||||
+ if (strerror_r(err, errbuf, sizeof(errbuf)) != 0)
|
||||
+ strncpy(errbuf, "strerror_r() failure", sizeof(errbuf));
|
||||
+ fputs(errbuf,logfd);
|
||||
} else {
|
||||
fputs(errtab[-(err+1)],logfd);
|
||||
}
|
||||
}
|
||||
--- src/chironfn.c.orig 2008-06-09 20:02:39.000000000 +0200
|
||||
+++ src/chironfn.c 2009-03-29 11:46:25.000000000 +0200
|
||||
@@ -104,4 +104,79 @@
|
||||
dbg(("\nxlate:%s",rname));
|
||||
return(rname);
|
||||
}
|
||||
|
||||
+/*
|
||||
+ * chiron_dirname is derived from NetBSD's libc dirname(3), with
|
||||
+ * changes from Emmanuel Dreyfus <manu@netbsd.org>. This code is
|
||||
+ * subject to the 2-clauses BSD license below
|
||||
+ */
|
||||
+
|
||||
+/*-
|
||||
+ * Copyright (c) 1997, 2002 The NetBSD Foundation, Inc.
|
||||
+ * All rights reserved.
|
||||
+ *
|
||||
+ * This code is derived from software contributed to The NetBSD Foundation
|
||||
+ * by Klaus Klein and Jason R. Thorpe.
|
||||
+ *
|
||||
+ * Redistribution and use in source and binary forms, with or without
|
||||
+ * modification, are permitted provided that the following conditions
|
||||
+ * are met:
|
||||
+ * 1. Redistributions of source code must retain the above copyright
|
||||
+ * notice, this list of conditions and the following disclaimer.
|
||||
+ * 2. Redistributions in binary form must reproduce the above copyright
|
||||
+ * notice, this list of conditions and the following disclaimer in the
|
||||
+ * documentation and/or other materials provided with the distribution.
|
||||
+ *
|
||||
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
+ * POSSIBILITY OF SUCH DAMAGE.
|
||||
+ */
|
||||
+
|
||||
+char *
|
||||
+chiron_dirname(char *path) {
|
||||
+ static char singledot[] = ".";
|
||||
+ const char *lastp;
|
||||
+ size_t len;
|
||||
+
|
||||
+ /*
|
||||
+ * If `path' is a null pointer or points to an empty string,
|
||||
+ * return a pointer to the string ".".
|
||||
+ */
|
||||
+ if ((path == NULL) || (*path == '\0'))
|
||||
+ return (singledot);
|
||||
+
|
||||
+ /* Strip trailing slashes, if any. */
|
||||
+ lastp = path + strlen(path) - 1;
|
||||
+ while (lastp != path && *lastp == '/')
|
||||
+ lastp--;
|
||||
+
|
||||
+ /* Terminate path at the last occurence of '/'. */
|
||||
+ do {
|
||||
+ if (*lastp == '/') {
|
||||
+ /* Strip trailing slashes, if any. */
|
||||
+ while (lastp != path && *lastp == '/')
|
||||
+ lastp--;
|
||||
+
|
||||
+ /* ...and copy the result into the result buffer. */
|
||||
+ len = (lastp - path) + 1 /* last char */;
|
||||
+ if (len > (PATH_MAX - 1))
|
||||
+ len = PATH_MAX - 1;
|
||||
+
|
||||
+ path[len] = '\0';
|
||||
+ return(path);
|
||||
+ }
|
||||
+ } while (--lastp >= path);
|
||||
+
|
||||
+ /* No /'s found, return a pointer to the string ".". */
|
||||
+ return (singledot);
|
||||
+}
|
||||
+
|
||||
+
|
||||
--- src/chironfn.h.orig 2008-06-08 08:26:58.000000000 +0200
|
||||
+++ src/chironfn.h 2009-03-28 22:55:55.000000000 +0100
|
||||
@@ -10,4 +10,5 @@
|
||||
|
||||
|
||||
int read_a_line(char **buf, int *c, FILE *f);
|
||||
char *xlate(const char *fname, char *rpath);
|
||||
+char *chiron_dirname(char *path);
|
||||
--- src/chironfs.c.orig 2008-06-21 03:09:19.000000000 +0200
|
||||
+++ src/chironfs.c 2009-03-29 12:12:26.000000000 +0200
|
||||
@@ -37,9 +37,11 @@
|
||||
#include <fuse/fuse_opt.h>
|
||||
|
||||
#else
|
||||
|
||||
+#ifndef __NetBSD__
|
||||
typedef uint64_t cpuset_t;
|
||||
+#endif
|
||||
|
||||
//
|
||||
// The line below are from a patch contributed by Antti Kantee
|
||||
// to make ChironFS run on NetBSD
|
||||
@@ -125,8 +127,9 @@
|
||||
#include "chironfn.h"
|
||||
#define _CHIRON_H_
|
||||
#include "chironfs.h"
|
||||
|
||||
+int nochown_mode = 0;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -405,13 +408,18 @@
|
||||
} \
|
||||
if (result!=NULL) { \
|
||||
member = result->gr_mem; \
|
||||
while (*member) { \
|
||||
- pw = getpwnam(*member); \
|
||||
- pw_uid = pw->pw_uid; \
|
||||
- if (pw_uid==context->uid) { \
|
||||
- perm = (stbuf.st_mode&070) >> 3; \
|
||||
- break; \
|
||||
+ struct passwd pwres; \
|
||||
+ char pwbuf[1024]; \
|
||||
+ \
|
||||
+ if (getpwnam_r(*member, &pwres, pwbuf, \
|
||||
+ sizeof(pwbuf), &pw) == 0) { \
|
||||
+ pw_uid = pw->pw_uid; \
|
||||
+ if (pw_uid==context->uid) { \
|
||||
+ perm = (stbuf.st_mode&070) >> 3; \
|
||||
+ break; \
|
||||
+ } \
|
||||
} \
|
||||
member++; \
|
||||
} \
|
||||
if (*member==NULL) { \
|
||||
@@ -432,9 +440,9 @@
|
||||
return(-1); \
|
||||
} \
|
||||
bkdname = dname; \
|
||||
do { \
|
||||
- dname = dirname(dname); \
|
||||
+ dname = chiron_dirname(dname); \
|
||||
get_rights(stat,dname); \
|
||||
process_rights(); \
|
||||
if (!(perm&1)) { \
|
||||
free(dname); \
|
||||
@@ -570,9 +578,9 @@
|
||||
if (dname==NULL) {
|
||||
errno = ENOMEM;
|
||||
perm = -1;
|
||||
} else {
|
||||
- perm = get_rights_by_name(dirname(dname));
|
||||
+ perm = get_rights_by_name(chiron_dirname(dname));
|
||||
free(dname);
|
||||
}
|
||||
} else {
|
||||
perm = get_rights_by_name(fname);
|
||||
@@ -600,9 +608,9 @@
|
||||
err_list[i] = errno;
|
||||
} else {
|
||||
if (!file_exists) {
|
||||
get_ownership();
|
||||
- if (lchown(fname, context->uid, gid)==(-1)) {
|
||||
+ if (!nochown_mode && lchown(fname, context->uid, gid)==(-1)) {
|
||||
fail_cnt++;
|
||||
err_list[i] = -errno;
|
||||
close(fd[i]);
|
||||
fd[i] = -1;
|
||||
@@ -1245,9 +1253,9 @@
|
||||
if (dname==NULL) {
|
||||
perm = -1;
|
||||
errno = ENOMEM;
|
||||
} else {
|
||||
- perm = get_rights_by_name(dirname(dname));
|
||||
+ perm = get_rights_by_name(chiron_dirname(dname));
|
||||
free(dname);
|
||||
}
|
||||
if (perm<0) {
|
||||
fail_cnt++;
|
||||
@@ -1262,9 +1270,9 @@
|
||||
fd[i] = open(fname, O_CREAT | O_EXCL | O_WRONLY, mode);
|
||||
if (fd[i] >= 0) {
|
||||
fd[i] = close(fd[i]);
|
||||
get_ownership();
|
||||
- if (lchown(fname, context->uid, gid)==(-1)) {
|
||||
+ if (!nochown_mode && lchown(fname, context->uid, gid)==(-1)) {
|
||||
fail_cnt++;
|
||||
err_list[i] = -errno;
|
||||
fd[i] = -1;
|
||||
} else {
|
||||
@@ -1288,9 +1296,9 @@
|
||||
}
|
||||
}
|
||||
if (fd[i]==0) {
|
||||
get_ownership();
|
||||
- if (lchown(fname, context->uid, gid)==(-1)) {
|
||||
+ if (!nochown_mode && lchown(fname, context->uid, gid)==(-1)) {
|
||||
fail_cnt++;
|
||||
err_list[i] = -errno;
|
||||
fd[i] = -1;
|
||||
} else {
|
||||
@@ -1519,9 +1527,9 @@
|
||||
dbg(("\nrmdir: %s\n",path_orig));
|
||||
do_byname_rw(rmdir(fname), "rmdir",(
|
||||
((dname=strdup(fname))==NULL)
|
||||
? ( errno = ENOMEM, -1 )
|
||||
- : ( tmpperm = get_rights_by_name(dirname(dname)), free(dname), tmpperm)
|
||||
+ : ( tmpperm = get_rights_by_name(chiron_dirname(dname)), free(dname), tmpperm)
|
||||
),||,0,EACCES);
|
||||
}
|
||||
|
||||
static int chiron_unlink(const char *path_orig)
|
||||
@@ -1531,9 +1539,9 @@
|
||||
dbg(("\nunlink: %s\n",path_orig));
|
||||
do_byname_rw(unlink(fname), "unlink",(
|
||||
((dname=strdup(fname))==NULL)
|
||||
? ( errno = ENOMEM, -1 )
|
||||
- : ( tmpperm = get_rights_by_name(dirname(dname)), free(dname), tmpperm)
|
||||
+ : ( tmpperm = get_rights_by_name(chiron_dirname(dname)), free(dname), tmpperm)
|
||||
),||,0,EACCES);
|
||||
}
|
||||
|
||||
int chiron_mkdir(const char *path_orig, mode_t mode)
|
||||
@@ -1571,9 +1579,9 @@
|
||||
if (dname==NULL) {
|
||||
perm = -1;
|
||||
errno = ENOMEM;
|
||||
} else {
|
||||
- perm = get_rights_by_name(dirname(dname));
|
||||
+ perm = get_rights_by_name(chiron_dirname(dname));
|
||||
free(dname);
|
||||
}
|
||||
if (perm<0) {
|
||||
fail_cnt++;
|
||||
@@ -1586,9 +1594,9 @@
|
||||
} else {
|
||||
fd[i] = mkdir(fname, mode);
|
||||
if (fd[i]==0) {
|
||||
get_ownership();
|
||||
- if (lchown(fname, context->uid, gid)==(-1)) {
|
||||
+ if (!nochown_mode && lchown(fname, context->uid, gid)==(-1)) {
|
||||
fail_cnt++;
|
||||
err_list[i] = -errno;
|
||||
fd[i] = -1;
|
||||
} else {
|
||||
@@ -1683,9 +1691,9 @@
|
||||
if (dname==NULL) {
|
||||
perm = -1;
|
||||
errno = ENOMEM;
|
||||
} else {
|
||||
- perm = get_rights_by_name(dirname(dname));
|
||||
+ perm = get_rights_by_name(chiron_dirname(dname));
|
||||
free(dname);
|
||||
}
|
||||
if (perm<0) {
|
||||
fail_cnt++;
|
||||
@@ -1701,9 +1709,9 @@
|
||||
fail_cnt++;
|
||||
err_list[i] = errno;
|
||||
} else {
|
||||
get_ownership();
|
||||
- if (lchown(fname, context->uid, gid)==(-1)) {
|
||||
+ if (!nochown_mode && lchown(fname, context->uid, gid)==(-1)) {
|
||||
fail_cnt++;
|
||||
err_list[i] = -errno;
|
||||
fd[i] = -1;
|
||||
} else {
|
||||
@@ -1775,9 +1783,9 @@
|
||||
if (dname==NULL) { \
|
||||
perm = -1; \
|
||||
errno = -ENOMEM; \
|
||||
} else { \
|
||||
- perm = get_rights_by_name(dirname(dname)); \
|
||||
+ perm = get_rights_by_name(chiron_dirname(dname)); \
|
||||
free(dname); \
|
||||
} \
|
||||
} \
|
||||
if (perm<0) { \
|
||||
@@ -1798,9 +1806,9 @@
|
||||
if (dname==NULL) { \
|
||||
perm = -1; \
|
||||
errno = -ENOMEM; \
|
||||
} else { \
|
||||
- perm = get_rights_by_name(dirname(dname)); \
|
||||
+ perm = get_rights_by_name(chiron_dirname(dname)); \
|
||||
free(dname); \
|
||||
} \
|
||||
} \
|
||||
if (perm<0) { \
|
||||
--- src/chironfs.h.orig 2008-06-16 01:32:23.000000000 +0200
|
||||
+++ src/chironfs.h 2009-03-28 22:54:07.000000000 +0100
|
||||
@@ -150,8 +150,9 @@
|
||||
extern int mount_ctl;
|
||||
|
||||
#endif
|
||||
|
||||
+extern int nochown_mode;
|
||||
|
||||
void help(void);
|
||||
void free_tab_fd(void);
|
||||
int **mk_round_robin(int *tmp_list, int dim);
|
Loading…
Reference in a new issue