From 492942a66ad89172135512cd433b50c13726f777 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 16 Apr 2012 17:14:06 +1000 Subject: s3-xattr_tdb: Be nice to xattr_tdb_getxattr callers, return the full blob In this case, the blob is already in memory, so it is easier to return the full blob to the caller, and let the caller decide if some interface restriction stops the full blob from being passed all the way up the stack. This allows us to quickly write a python wrapper for this xattr storage mechanism. Andrew Bartlett --- source3/lib/xattr_tdb.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'source3/lib/xattr_tdb.c') diff --git a/source3/lib/xattr_tdb.c b/source3/lib/xattr_tdb.c index 21223f04b8..6f33163ed6 100644 --- a/source3/lib/xattr_tdb.c +++ b/source3/lib/xattr_tdb.c @@ -169,8 +169,9 @@ static NTSTATUS xattr_tdb_save_attrs(struct db_record *rec, */ ssize_t xattr_tdb_getattr(struct db_context *db_ctx, + TALLOC_CTX *mem_ctx, const struct file_id *id, - const char *name, void *value, size_t size) + const char *name, DATA_BLOB *blob) { struct tdb_xattrs *attribs; uint32_t i; @@ -200,13 +201,8 @@ ssize_t xattr_tdb_getattr(struct db_context *db_ctx, goto fail; } - if (attribs->eas[i].value.length > size) { - errno = ERANGE; - goto fail; - } - - memcpy(value, attribs->eas[i].value.data, - attribs->eas[i].value.length); + *blob = attribs->eas[i].value; + talloc_steal(mem_ctx, blob->data); result = attribs->eas[i].value.length; fail: -- cgit