xattr.c (d475a507457b5cafa428871a473d0dcc828c5f68) | xattr.c (43b113fea2d427e17e7663494fc70c4e93e83d5e) |
---|---|
1/* 2 * This file is part of UBIFS. 3 * 4 * Copyright (C) 2006-2008 Nokia Corporation. 5 * 6 * This program is free software; you can redistribute it and/or modify it 7 * under the terms of the GNU General Public License version 2 as published by 8 * the Free Software Foundation. --- 383 unchanged lines hidden (view full) --- 392out_iput: 393 mutex_unlock(&ui->ui_mutex); 394 iput(inode); 395out_unlock: 396 kfree(xent); 397 return err; 398} 399 | 1/* 2 * This file is part of UBIFS. 3 * 4 * Copyright (C) 2006-2008 Nokia Corporation. 5 * 6 * This program is free software; you can redistribute it and/or modify it 7 * under the terms of the GNU General Public License version 2 as published by 8 * the Free Software Foundation. --- 383 unchanged lines hidden (view full) --- 392out_iput: 393 mutex_unlock(&ui->ui_mutex); 394 iput(inode); 395out_unlock: 396 kfree(xent); 397 return err; 398} 399 |
400static bool xattr_visible(const char *name) 401{ 402 /* File encryption related xattrs are for internal use only */ 403 if (strcmp(name, UBIFS_XATTR_NAME_ENCRYPTION_CONTEXT) == 0) 404 return false; 405 406 /* Show trusted namespace only for "power" users */ 407 if (strncmp(name, XATTR_TRUSTED_PREFIX, 408 XATTR_TRUSTED_PREFIX_LEN) == 0 && !capable(CAP_SYS_ADMIN)) 409 return false; 410 411 return true; 412} 413 |
|
400ssize_t ubifs_listxattr(struct dentry *dentry, char *buffer, size_t size) 401{ 402 union ubifs_key key; 403 struct inode *host = d_inode(dentry); 404 struct ubifs_info *c = host->i_sb->s_fs_info; 405 struct ubifs_inode *host_ui = ubifs_inode(host); 406 struct ubifs_dent_node *xent, *pxent = NULL; 407 int err, len, written = 0; --- 19 unchanged lines hidden (view full) --- 427 if (IS_ERR(xent)) { 428 err = PTR_ERR(xent); 429 break; 430 } 431 432 nm.name = xent->name; 433 nm.len = le16_to_cpu(xent->nlen); 434 | 414ssize_t ubifs_listxattr(struct dentry *dentry, char *buffer, size_t size) 415{ 416 union ubifs_key key; 417 struct inode *host = d_inode(dentry); 418 struct ubifs_info *c = host->i_sb->s_fs_info; 419 struct ubifs_inode *host_ui = ubifs_inode(host); 420 struct ubifs_dent_node *xent, *pxent = NULL; 421 int err, len, written = 0; --- 19 unchanged lines hidden (view full) --- 441 if (IS_ERR(xent)) { 442 err = PTR_ERR(xent); 443 break; 444 } 445 446 nm.name = xent->name; 447 nm.len = le16_to_cpu(xent->nlen); 448 |
435 /* Show trusted namespace only for "power" users */ 436 if (strncmp(xent->name, XATTR_TRUSTED_PREFIX, 437 XATTR_TRUSTED_PREFIX_LEN) || 438 capable(CAP_SYS_ADMIN)) { | 449 if (xattr_visible(xent->name)) { |
439 memcpy(buffer + written, nm.name, nm.len + 1); 440 written += nm.len + 1; 441 } 442 443 kfree(pxent); 444 pxent = xent; 445 key_read(c, &xent->key, &key); 446 } --- 190 unchanged lines hidden --- | 450 memcpy(buffer + written, nm.name, nm.len + 1); 451 written += nm.len + 1; 452 } 453 454 kfree(pxent); 455 pxent = xent; 456 key_read(c, &xent->key, &key); 457 } --- 190 unchanged lines hidden --- |