aboutsummaryrefslogtreecommitdiffstats
path: root/pseudo.c
diff options
context:
space:
mode:
authorPeter Seebach <peter.seebach@windriver.com>2014-04-21 18:13:50 -0500
committerPeter Seebach <peter.seebach@windriver.com>2014-04-21 18:13:50 -0500
commit399303f0ac1722d809aef02e15691714fb08182a (patch)
treeb51b4be6a56ec346897d549857ffdadae7bfd1ea /pseudo.c
parentd4c7177bb87aad975852715c6956426b5595bb78 (diff)
downloadpseudo-399303f0ac1722d809aef02e15691714fb08182a.tar.gz
pseudo-399303f0ac1722d809aef02e15691714fb08182a.tar.bz2
pseudo-399303f0ac1722d809aef02e15691714fb08182a.zip
Extended attribute improvements (no path, binary data)
Issue #1: If an operation came in for an item with no path provided by the wrapper, the client would not construct the combined "path" value. Fixed, and missing paths are now consistently handled as 0-byte paths. Issue #2: The database code was assuming the values were strings, and ignoring a specified length. Issue #3: The computation of the length of the stored value was off by one, because it was including the extra terminating null the client added in case the value was a path. With this in place, "cp -a" on CentOS is consistently duplicating the system.posix_acl_access fields as expected, but unfortunately not handling their permissions too. (Intent is to translate a system.posix_acl_access setxattr into corresponding permissions whenever possible.) Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
Diffstat (limited to 'pseudo.c')
-rw-r--r--pseudo.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/pseudo.c b/pseudo.c
index bb8c60b..144f441 100644
--- a/pseudo.c
+++ b/pseudo.c
@@ -524,6 +524,7 @@ pseudo_op(pseudo_msg_t *msg, const char *program, const char *tag, char **respon
*/
if (msg->pathlen) {
+ size_t initial_len;
switch (msg->op) {
case OP_RENAME:
case OP_CREATE_XATTR:
@@ -532,10 +533,18 @@ pseudo_op(pseudo_msg_t *msg, const char *program, const char *tag, char **respon
case OP_REPLACE_XATTR:
case OP_SET_XATTR:
/* In a rename there are two paths, null separated in msg->path */
- oldpath = msg->path + strlen(msg->path) + 1;
- oldpathlen = msg->pathlen - (oldpath - msg->path);
- pseudo_debug(PDBGF_OP | PDBGF_FILE | PDBGF_XATTR, "%s: path '%s', oldpath '%s' [%d]\n",
- pseudo_op_name(msg->op), msg->path, oldpath, (int) oldpathlen);
+ initial_len = strlen(msg->path);
+ oldpath = msg->path + initial_len + 1;
+ /* for rename, the path name would be null-terminated,
+ * but for *xattr, we don't want the null. */
+ oldpathlen = msg->pathlen - (oldpath - msg->path) - 1;
+ pseudo_debug(PDBGF_OP | PDBGF_FILE | PDBGF_XATTR, "%s: path '%s', oldpath '%s' [%d/%d]\n",
+ pseudo_op_name(msg->op), msg->path, oldpath, (int) oldpathlen, (int) msg->pathlen);
+ /* if we got an oldpath, but a 0-length initial
+ * path, we don't want to act as though we had
+ * a non-empty initial path.
+ */
+ msg->pathlen = initial_len;
break;
default:
break;
@@ -956,8 +965,8 @@ pseudo_op(pseudo_msg_t *msg, const char *program, const char *tag, char **respon
} else {
*response_path = oldpath;
*response_len = oldpathlen;
- pseudo_debug(PDBGF_XATTR, "get results: '%s' (%d bytes)\n",
- *response_path, (int) *response_len);
+ pseudo_debug(PDBGF_XATTR, "get results: '%.*s' (%d bytes)\n",
+ (int) *response_len, *response_path, (int) *response_len);
}
break;
case OP_LIST_XATTR: