int setxattr(const char *fusepath, const char *attrname, const char *attrval, size_t attrvalsize, int flags) { const struct fuse_context *fc = fuse_get_context(); const config::Config &config = config::get(); const ugid::SetResetGuard ugid(fc->uid,fc->gid); if(fusepath == config.controlfile) return _setxattr_controlfile(config::get_writable(), attrname, string(attrval,attrvalsize), attrvalsize, flags); return _setxattr(*config.action, config.srcmounts, fusepath, attrname, attrval, attrvalsize, flags); }
CONFUGA_API int confuga_setxattr(confuga *C, const char *path, const char *name, const void *data, size_t size, int flags) { int rc; #if defined(HAS_SYS_XATTR_H) || defined(HAS_ATTR_XATTR_H) SIMPLE_WRAP_UNIX(_setxattr(path, name, data, size, flags), "setxattr(`%s', `%s', %p, %zu, %d)", unresolved_path, name, data, size, flags); #else return ENOSYS; #endif }
int do_lsetxattr (const char *xattr, const char *val, int vallen, const char *path) { #if defined(HAVE_LSETXATTR) return _setxattr (xattr, val, vallen, path, lsetxattr); #else reply_with_error ("no support for lsetxattr"); return -1; #endif }
DWORD LsaCopyExtendedAttributes(PCSTR pszSrcPath, PCSTR pszDstPath) { DWORD dwError=0; char* list = NULL; ssize_t listLen = _listxattr(pszSrcPath, NULL, 0); list = malloc(listLen); listLen = _listxattr(pszSrcPath, list, listLen); int ns = 0; char* value = NULL; for (ns = 0; ns < listLen; ns += strlen(&list[ns]) + 1) { ssize_t valueLen; valueLen = _getxattr(pszSrcPath, &list[ns], NULL, 0); if (valueLen != -1) { value = malloc(valueLen); _getxattr(pszSrcPath, &list[ns], value, valueLen); dwError = LwMapErrnoToLwError(_setxattr(pszDstPath, &list[ns], value, valueLen)); BAIL_ON_LSA_ERROR(dwError); free(value); value = NULL; } } cleanup: if(list) { free(list); } if(value) { free(value); } return dwError; error: goto cleanup; }