Пример #1
0
int
xattr_close (Npfid *fid)
{
    Fid *f = fid->aux;
    int rc = 0;

    if (f->xattr) {
        if ((f->xattr->flags & XATTR_FLAGS_SET)) {
            if (f->xattr->len > 0) {
                if (lsetxattr (path_s (f->path), f->xattr->name, f->xattr->buf,
                               f->xattr->len, f->xattr->setflags) < 0) {
                    np_uerror (errno);
                    rc = -1;
                }
            } else if (f->xattr->len == 0) {
                if (lremovexattr (path_s (f->path), f->xattr->name) < 0) {
                    np_uerror (errno);
                    rc = -1;
                }
            }
        }
        _xattr_destroy (&f->xattr);
    }
    return rc;
}
Пример #2
0
static int xmp_removexattr(const char *path, const char *name)
{
	int res = lremovexattr(path, name);
	if (res == -1)
		return -errno;
	return 0;
}
Пример #3
0
int sys_lremovexattr (const char *path, const char *uname)
{
	const char *name = prefix(uname);
#if defined(HAVE_LREMOVEXATTR)
	return lremovexattr(path, name);
#elif defined(HAVE_REMOVEXATTR) && defined(XATTR_ADD_OPT)
	int options = XATTR_NOFOLLOW;
	return removexattr(path, name, options);
#elif defined(HAVE_LREMOVEEA)
	return lremoveea(path, name);
#elif defined(HAVE_EXTATTR_DELETE_LINK)
	return extattr_delete_link(path, EXTATTR_NAMESPACE_USER, uname);
#elif defined(HAVE_ATTR_REMOVE)
	int flags = ATTR_DONTFOLLOW;
	char *attrname = strchr(name,'.') + 1;
	
	if (strncmp(name, "system", 6) == 0) flags |= ATTR_ROOT;

	return attr_remove(path, attrname, flags);
#elif defined(HAVE_ATTROPEN)
	int ret = -1;
	int attrdirfd = solaris_attropen(path, ".", O_RDONLY|AT_SYMLINK_NOFOLLOW, 0);
	if (attrdirfd >= 0) {
		ret = solaris_unlinkat(attrdirfd, name);
		close(attrdirfd);
	}
	return ret;
#else
	errno = ENOSYS;
	return -1;
#endif
}
static int process_remove_xattr(const char *path, const char *name, void *user)
{
	int ret = 0;
	struct btrfs_receive *r = user;
	char full_path[PATH_MAX];

	ret = path_cat_out(full_path, r->full_subvol_path, path);
	if (ret < 0) {
		error("remove_xattr: path invalid: %s", path);
		goto out;
	}

	if (g_verbose >= 2) {
		fprintf(stderr, "remove_xattr %s - name=%s\n",
				path, name);
	}

	ret = lremovexattr(full_path, name);
	if (ret < 0) {
		ret = -errno;
		error("lremovexattr %s %s failed: %s",
				path, name, strerror(-ret));
		goto out;
	}

out:
	return ret;
}
Пример #5
0
static int xmp_removexattr(const char *path, const char *name)
{
    char buf[BUFSIZE];
    int res = lremovexattr(_xmp_fullpath(buf, path, BUFSIZE), name);
    if (res == -1)
        return -errno;
    return 0;
}
Пример #6
0
static INT64_T chirp_fs_local_lremovexattr(const char *path, const char *name)
{
#ifdef CCTOOLS_OPSYS_DARWIN
	return removexattr(path, name, XATTR_NOFOLLOW);
#else
	return lremovexattr(path, name);
#endif
}
Пример #7
0
static int xmp_removexattr(const char *path, const char *name)
{
	const char* new_path = rewritepath(path);
	int res = lremovexattr(new_path, name);
	free((void*)new_path);
	if (res == -1)
		return -errno;
	return 0;
}
Пример #8
0
static int encfs_removexattr(const char *path, const char *name)
{
	char fpath[PATH_MAX]; // Full buffer to pass to static function
	dj_fullpath(fpath, path);
	int res = lremovexattr(fpath, name);
	if (res == -1)
		return -errno;
	return 0;
}
static int xmp_removexattr(const char *path, const char *name)
{
	char fpath[PATH_MAX];
	xmp_fullpath(fpath, path);
	int res = lremovexattr(path, name);
	if (res == -1)
		return -errno;
	return 0;
}
Пример #10
0
static int bru_removexattr(const char *path, const char *name)
{
	SET_CALLER_UID();
	REDIR_PATH(path, new_path);

	int ret = lremovexattr(new_path, name);

	SET_RET_ERRNO();
	return ret;
}
Пример #11
0
static int enc_removexattr(const char *path, const char *name)
{
  /* change path to specific mirror directory instead of root */
  char fpath[PATH_MAX];
  enc_fullpath(fpath, path);
  int res = lremovexattr(fpath, name);
  if (res == -1)
    return -errno;
  return 0;
}
Пример #12
0
static ssize_t xattr_removexattr(const char *path, const char *name, int options) {
    if (!(options == 0 || options == XATTR_XATTR_NOFOLLOW)) {
        return -1;
    }
    if (options & XATTR_XATTR_NOFOLLOW) {
        return lremovexattr(path, name);
    } else {
        return removexattr(path, name);
    }
}
Пример #13
0
/** Remove extended attributes */
int bb_removexattr(const char *path, const char *name)
{
    int retstat = 0;
    char fpath[PATH_MAX];
    
    bb_fullpath(fpath, path);
    
    retstat = lremovexattr(fpath, name);
    return retstat;
}
Пример #14
0
/** Remove extended attributes */
int bb_removexattr(const char *path, const char *name)
{
    char fpath[PATH_MAX];
    
    log_msg("\nbb_removexattr(path=\"%s\", name=\"%s\")\n",
	    path, name);
    bb_fullpath(fpath, path);

    return log_syscall("lremovexattr", lremovexattr(fpath, name), 0);
}
Пример #15
0
static int xmp_removexattr(const char *path, const char *name)
{
	char filepath[PATH_MAX];
	xmp_extendPath(filepath, path);
	
	int res = lremovexattr(filepath, name);
	if (res == -1)
		return -errno;
	return 0;
}
Пример #16
0
static int xmp_removexattr(const char *path, const char *name)
{
	fprintf(f,"removexatrr: %s\n",path);
	int res = lremovexattr(path, name);
	if (res == -1){
		fprintf(f, "operation failed\n");
		return -errno;
	}
	fprintf(f, "operation succeeded\n");
	return 0;
}
Пример #17
0
/** Remove extended attributes */
int bb_removexattr(const char *path, const char *name) {
   int retstat = 0;
   char fpath[PATH_MAX];
    
   log_msg("\nbb_removexattr(path=\"%s\", name=\"%s\")\n", path, name);
   bb_fullpath(fpath, path);
    
   retstat = lremovexattr(fpath, name);
   if (retstat < 0) retstat = bb_error("bb_removexattr lrmovexattr");
   return retstat;
}
Пример #18
0
static INT64_T chirp_fs_local_lremovexattr(const char *path, const char *name)
{
	PREAMBLE("lremovexattr(`%s', `%s')", path, name);
	RESOLVE(path)
#ifdef CCTOOLS_OPSYS_DARWIN
	rc = removexattr(path, name, XATTR_NOFOLLOW);
#else
	rc = lremovexattr(path, name);
#endif
	PROLOGUE
}
Пример #19
0
/** Remove extended attributes */
int sfs_removexattr(const char *path, const char *name) {
    int retstat = 0;
    char fpath[PATH_MAX];

    // TODO: log?
    sfs_fullpath(fpath, path);

    retstat = lremovexattr(fpath, name);
    if (retstat < 0)
        retstat = sfs_error("sfs_removexattr lrmovexattr");

    return retstat;
}
Пример #20
0
int thesmurFS_removexattr(const char* path, const char* name) {
    char* physical_path;
    int r;
    //emergency_output("removexattr");
    if(get_physical_path(path, &physical_path) == -1) {
        //emergency_output("ENOMEM");
        return -errno;
    }
    r = lremovexattr(physical_path, name);
    if(r<0)
        return -errno;
    return r;
}
Пример #21
0
/** Remove extended attributes */
int fusion_removexattr(const char *path, const char *name) {
	int retstat = 0;
	char fpath[PATH_MAX] = {0};

	log_msg("\nfusion_removexattr(path=\"%s\", name=\"%s\")\n", path, name);
	fusion_fullpath(fpath, path);

	retstat = lremovexattr(fpath, name);
	if (retstat < 0)
		retstat = fusion_error("fusion_removexattr lrmovexattr");

	return retstat;
}
Пример #22
0
int smack_label_path(const char *path, const char *label) {
#ifdef HAVE_SMACK
        if (!use_smack())
                return 0;

        if (label)
                return setxattr(path, "security.SMACK64", label, strlen(label), 0);
        else
                return lremovexattr(path, "security.SMACK64");
#else
        return 0;
#endif
}
Пример #23
0
Файл: attr.c Проект: Jaharmi/zsh
static int
xremovexattr(const char *path, const char *name, int symlink)
{
#ifdef XATTR_EXTRA_ARGS
    return removexattr(path, name, symlink ? XATTR_NOFOLLOW : 0);
#else
    switch (symlink) {
    case 0:
        return removexattr(path, name);
    default:
        return lremovexattr(path, name);
    }
#endif
}
Пример #24
0
static int mp_user_removexattr(FsContext *ctx,
                               const char *path, const char *name)
{
    char buffer[PATH_MAX];
    if (strncmp(name, "user.virtfs.", 12) == 0) {
        /*
         * Don't allow fetch of user.virtfs namesapce
         * in case of mapped security
         */
        errno = EACCES;
        return -1;
    }
    return lremovexattr(rpath(ctx, path, buffer), name);
}
/** Remove extended attributes */
int cloudfs_removexattr(const char *path, const char *name)
{
  int retstat = 0;
  char fpath[PATH_MAX];

  d_printf("\ncloudfs_removexattr(path=\"%s\", name=\"%s\")\n",
      path, name);
  cloudfs_fullpath(fpath, path);

  retstat = lremovexattr(fpath, name);
  if (retstat < 0)
    retstat = cloudfs_error("cloudfs_removexattr lrmovexattr");

  return retstat;
}
Пример #26
0
static int unionfs_removexattr(const char *path, const char *name) {
	DBG("%s\n", path);

	int i = find_rw_branch_cow(path);
	if (i == -1) RETURN(-errno);

	char p[PATHLEN_MAX];
	if (BUILD_PATH(p, uopt.branches[i].path, path)) RETURN(-ENAMETOOLONG);

	int res = lremovexattr(p, name);

	if (res == -1) RETURN(-errno);

	RETURN(res);
}
Пример #27
0
/** Remove extended attributes */
int sfs_removexattr(const char *path, const char *name)
{
	int retstat = 0;
	char fpath[PATH_MAX];

	printf("\nsfs_removexattr(path=\"%s\", name=\"%s\")\n",
			path, name);
	sfs_fullpath(fpath, path);

	retstat = lremovexattr(fpath, name);
	if (retstat < 0) {
		retstat = sfs_error("sfs_removexattr lrmovexattr");
	}

	return retstat;
}
Пример #28
0
int sys_lremovexattr (const char *path, const char *name)
{
#if defined(HAVE_LREMOVEXATTR)
	return lremovexattr(path, name);
#elif defined(HAVE_ATTR_REMOVE)
	int flags = ATTR_DONTFOLLOW;
	char *attrname = strchr(name,'.') +1;
	
	if (strncmp(name, "system", 6) == 0) flags |= ATTR_ROOT;

	return attr_remove(path, attrname, flags);
#else
	errno = ENOSYS;
	return -1;
#endif
}
Пример #29
0
/*
 *NAME xattrs-write
 *DESCRIPTION this test does setxattr on a file
 *
 *argv[1] - file to test
 *argv[2] - xattr namespace to test
 *argv[3] - "read", "write", "remove"
 */
int main(int argc, char *argv[])
{
	ssize_t len;
	char name[256];

	if (argc != 4) {
		int i;
		fprintf(stderr, "usage: %s file xattr-name_space {read,write,remove}\n",
			argv[0]);
		for (i=0; i < argc; i++) {
			fprintf(stderr, "arg%d: %s\n", i, argv[i]);
		}
		return 1;
	}
	
	snprintf(name, sizeof(name), "%s.sdtest", argv[2]);
	if (strcmp(argv[3], "read") == 0) {
		char value[256];
		len = lgetxattr(argv[1], name, &value, 256);
		if (len == -1) {
			fprintf(stderr, "FAIL: get of %s on %s.  %s\n", name,
				argv[1], strerror(errno));
			return 1;
		}
	} else if (strcmp(argv[3], "write") == 0) {
		len = lsetxattr(argv[1], name, msgstring, msglen, 0);
		if (len == -1) {
			fprintf(stderr, "FAIL: set of %s on %s.  %s\n", name,
				argv[1], strerror(errno));
			return 1;
		}
	} else if (strcmp(argv[3], "remove") == 0) {
		len = lremovexattr(argv[1], name);
		if (len == -1) {
			fprintf(stderr, "FAIL: remove of %s on %s.  %s\n",
				name, argv[1], strerror(errno));
			return 1;
		}
	} else {
		fprintf(stderr, "usage: %s invalid option %s is not one of {read, write, remove}\n", argv[0], argv[3]);
		return 1;
	}

	printf("PASS\n");

	return 0;
}
Пример #30
0
static int mp_pacl_removexattr(FsContext *ctx,
                               const char *path, const char *name)
{
    int ret;
    char buffer[PATH_MAX];
    ret  = lremovexattr(rpath(ctx, path, buffer), MAP_ACL_ACCESS);
    if (ret == -1 && errno == ENODATA) {
        /*
         * We don't get ENODATA error when trying to remove a
         * posix acl that is not present. So don't throw the error
         * even in case of mapped security model
         */
        errno = 0;
        ret = 0;
    }
    return ret;
}