aboutsummaryrefslogtreecommitdiffstats
path: root/security/tomoyo/file.c
diff options
context:
space:
mode:
authorTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>2010-06-16 03:21:36 -0400
committerJames Morris <jmorris@namei.org>2010-08-02 01:34:32 -0400
commitcf6e9a6468ec82a94cbc707b607452ec4454182c (patch)
tree6b289c8575f1915395d3c1348d473ab07fbe34a8 /security/tomoyo/file.c
parent05336dee9f5a23c042e5938b42f996dd35e31ee6 (diff)
TOMOYO: Pass parameters via structure.
To make it possible to use callback function, pass parameters via "struct tomoyo_request_info". Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'security/tomoyo/file.c')
-rw-r--r--security/tomoyo/file.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/security/tomoyo/file.c b/security/tomoyo/file.c
index 50875d7e8603..32661df10e85 100644
--- a/security/tomoyo/file.c
+++ b/security/tomoyo/file.c
@@ -973,6 +973,9 @@ int tomoyo_path_permission(struct tomoyo_request_info *r, u8 operation,
973 r->mode = tomoyo_get_mode(r->profile, r->type); 973 r->mode = tomoyo_get_mode(r->profile, r->type);
974 if (r->mode == TOMOYO_CONFIG_DISABLED) 974 if (r->mode == TOMOYO_CONFIG_DISABLED)
975 return 0; 975 return 0;
976 r->param_type = TOMOYO_TYPE_PATH_ACL;
977 r->param.path.filename = filename;
978 r->param.path.operation = operation;
976 do { 979 do {
977 error = tomoyo_path_acl(r, filename, 1 << operation); 980 error = tomoyo_path_acl(r, filename, 1 << operation);
978 if (error && operation == TOMOYO_TYPE_READ && 981 if (error && operation == TOMOYO_TYPE_READ &&
@@ -1143,6 +1146,10 @@ static int tomoyo_path_number_perm2(struct tomoyo_request_info *r,
1143 break; 1146 break;
1144 } 1147 }
1145 tomoyo_print_ulong(buffer, sizeof(buffer), number, radix); 1148 tomoyo_print_ulong(buffer, sizeof(buffer), number, radix);
1149 r->param_type = TOMOYO_TYPE_PATH_NUMBER_ACL;
1150 r->param.path_number.operation = type;
1151 r->param.path_number.filename = filename;
1152 r->param.path_number.number = number;
1146 do { 1153 do {
1147 error = tomoyo_path_number_acl(r, type, filename, number); 1154 error = tomoyo_path_number_acl(r, type, filename, number);
1148 if (!error) 1155 if (!error)
@@ -1369,8 +1376,15 @@ int tomoyo_path_number3_perm(const u8 operation, struct path *path,
1369 idx = tomoyo_read_lock(); 1376 idx = tomoyo_read_lock();
1370 error = -ENOMEM; 1377 error = -ENOMEM;
1371 if (tomoyo_get_realpath(&buf, path)) { 1378 if (tomoyo_get_realpath(&buf, path)) {
1379 dev = new_decode_dev(dev);
1380 r.param_type = TOMOYO_TYPE_PATH_NUMBER3_ACL;
1381 r.param.mkdev.filename = &buf;
1382 r.param.mkdev.operation = operation;
1383 r.param.mkdev.mode = mode;
1384 r.param.mkdev.major = MAJOR(dev);
1385 r.param.mkdev.minor = MINOR(dev);
1372 error = tomoyo_path_number3_perm2(&r, operation, &buf, mode, 1386 error = tomoyo_path_number3_perm2(&r, operation, &buf, mode,
1373 new_decode_dev(dev)); 1387 dev);
1374 kfree(buf.name); 1388 kfree(buf.name);
1375 } 1389 }
1376 tomoyo_read_unlock(idx); 1390 tomoyo_read_unlock(idx);
@@ -1421,6 +1435,10 @@ int tomoyo_path2_perm(const u8 operation, struct path *path1,
1421 tomoyo_add_slash(&buf2); 1435 tomoyo_add_slash(&buf2);
1422 break; 1436 break;
1423 } 1437 }
1438 r.param_type = TOMOYO_TYPE_PATH2_ACL;
1439 r.param.path2.operation = operation;
1440 r.param.path2.filename1 = &buf1;
1441 r.param.path2.filename2 = &buf2;
1424 do { 1442 do {
1425 error = tomoyo_path2_acl(&r, operation, &buf1, &buf2); 1443 error = tomoyo_path2_acl(&r, operation, &buf1, &buf2);
1426 if (!error) 1444 if (!error)