Skip to contentSkip to conversation

tabled: return correct owner in lists

PATCH In review Pete Zaitcev 1 participant 1 message Jan 3, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 2/3 tabled: return correct owner in lists

For some reason we were printing the user which were executing the request instead of the owner of the key in question, even before the changeove to obj_vitals.

---
 server/bucket.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

commit 699fb8443f84b55c3cb6af471082527e177244da

Author: Master <[email protected]>
Date:   Sun Jan 3 00:31:04 2010 -0700

Print the correct owner.

server/bucket.c +4 -2
index 690da79..300a8a6 100644
@@ -817,6 +817,7 @@ struct obj_vitals {
 	uint64_t		mtime;
 	struct db_obj_addr	addr;
 	char			md5[40];
+	char			owner[65];
 };
 
 static bool bucket_list_iter(const char *key, struct obj_vitals *v,
@@ -1021,6 +1022,7 @@ static bool bucket_list_keys(struct client *cli, const char *user,
 
 		memset(&v, 0, sizeof(v));
 		strcpy(v.md5, obj->md5);
+		strncpy(v.owner, obj->owner, sizeof(v.owner)-1);
 		if (!(GUINT32_FROM_LE(obj->flags) & DB_OBJ_INLINE))
 			memcpy(&v.addr, &obj->d.a, sizeof(v.addr));
 		v.mtime = GUINT64_FROM_LE(obj->mtime);
@@ -1096,8 +1098,8 @@ static bool bucket_list_keys(struct client *cli, const char *user,
 			 time2str(timestr, sizeof(timestr), vp->mtime / 1000000),
 			 vp->md5,
 			 (unsigned long long) vp->size,
-			 user,
-			 user);
+			 vp->owner,
+			 vp->owner);
 
 		content = g_list_append(content, s);