aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Seebach <peter.seebach@windriver.com>2015-08-21 14:25:19 -0500
committerPeter Seebach <peter.seebach@windriver.com>2015-08-21 14:25:19 -0500
commitcb1326a6f3f802405d873b6c0e4cac3207457f32 (patch)
treeafcddb0062ff13c32635495fa60c6c450f636c41
parent6dd828b9f9bd03f47167feb6c017e44e1898f6ed (diff)
downloadpseudo-cb1326a6f3f802405d873b6c0e4cac3207457f32.tar.gz
pseudo-cb1326a6f3f802405d873b6c0e4cac3207457f32.tar.bz2
pseudo-cb1326a6f3f802405d873b6c0e4cac3207457f32.zip
Mark dummy entries as dummies
When setting an extended attribute using the database, we create a dummy entry for the file (so there will be a file row corresponding to that path name for later lookups). But this entry was coming in with host UID/GID values in some cases. Instead, use -1 uid/gid, and have STAT report those as failures rather than as existing values. (Other cases should not be copying them. I think.) Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
-rw-r--r--pseudo.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/pseudo.c b/pseudo.c
index 26772e6..6c5360b 100644
--- a/pseudo.c
+++ b/pseudo.c
@@ -896,7 +896,19 @@ pseudo_op(pseudo_msg_t *msg, const char *program, const char *tag, char **respon
* case where there might be a clash.
*/
if (found_ino || found_path) {
- *msg = db_header;
+ #ifdef PSEUDO_XATTRDB
+ if (db_header.uid == (uid_t) -1 &&
+ db_header.gid == (gid_t) -1) {
+ /* special case: this row was created
+ * to allow xattr lookups, and it's not
+ * actually valid data.
+ */
+ msg->result = RESULT_FAIL;
+ } else
+ #endif
+ {
+ *msg = db_header;
+ }
} else {
msg->result = RESULT_FAIL;
}
@@ -1036,6 +1048,14 @@ pseudo_op(pseudo_msg_t *msg, const char *program, const char *tag, char **respon
case OP_SET_XATTR:
/* we need a row entry to store xattr info */
if (row == -1) {
+#ifdef PSEUDO_XATTRDB
+ /* mark the entry as Not Reliable for purposes
+ * of stat-type calls, since changes wouldn't
+ * get reported to us.
+ */
+ msg->uid = (uid_t) -1;
+ msg->gid = (gid_t) -1;
+#endif
pdb_link_file(msg, &row);
}
if (pdb_set_xattr(row, oldpath, oldpathlen, xattr_flags)) {