Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756417AbYAHKil (ORCPT ); Tue, 8 Jan 2008 05:38:41 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754049AbYAHKgU (ORCPT ); Tue, 8 Jan 2008 05:36:20 -0500 Received: from ms1.nttdata.co.jp ([163.135.193.232]:40593 "EHLO ms1.nttdata.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753528AbYAHKgI (ORCPT ); Tue, 8 Jan 2008 05:36:08 -0500 X-Greylist: delayed 2759 seconds by postgrey-1.27 at vger.kernel.org; Tue, 08 Jan 2008 05:35:56 EST Message-Id: <20080108095004.912821472@nttdata.co.jp> References: <20080108094903.484613061@nttdata.co.jp> User-Agent: quilt/0.46-1 Date: Tue, 08 Jan 2008 18:49:20 +0900 From: Kentaro Takeda To: akpm@linux-foundation.org Cc: linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, Kentaro Takeda , Tetsuo Handa Subject: [TOMOYO #6 17/21] Capability access control functions. X-OriginalArrivalTime: 08 Jan 2008 09:50:05.0006 (UTC) FILETIME=[D8622EE0:01C851DB] MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="boundary-1" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 16908 Lines: 227 --boundary-1 Content-Disposition: inline; filename="tomoyo-capability.patch" Content-Type: application/octect-stream Content-Transfer-Encoding: base64 VE9NT1lPIExpbnV4IGNoZWNrcyBwZXJtaXNzaW9uIGZvciBub24tUE9TSVggY2FwYWJpbGl0eQ0K c28gdGhhdCB0aGUgbnVtYmVyIG9mIGNhcGFiaWxpdGllcyB3b24ndCBiZSBsaW1pdGVkIHRvIDMy IG9yIDY0Lg0KDQpUT01PWU8gTGludXggdXNlcyBwZXItYS1kb21haW4gY2FwYWJpbGl0eSwgYW4g YXBwcm9hY2ggdGhhdCBhc3NvY2lhdGUNCmNhcGFiaWxpd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yogT0sgKi8NCisJeyAidXNlX3JvdXRlIiwgMCwgInNvY2tldChQRl9ST1VURSkiIH0sDQorCVtU TVlfVVNFX1BBQ0tFVF9TT0NLRVRdICAgICAgICAgID0gLyogT0sgKi8NCisJeyAidXNlX3BhY2tl dCIsIDAsICJzb2NrZXQoUEZfUEFDS0VUKSIgfSwNCisJW1RNWV9TWVNfTU9VTlRdICAgICAgICAg ICAgICAgICAgPSAvKiBPSyAqLw0KKwl7ICJTWVNfTU9VTlQiLCAwLCAic3lzX21vdW50KCkiIH0s DQorCVtUTVlfU1lTX1VNT1VOVF0gICAgICAgICAgICAgICAgID0gLyogT0sgKi8NCisJeyAiU1lT X1VNT1VOVCIsIDAsICJzeXNfdW1vdW50KCkiIH0sDQorCVtUTVlfU1lTX1JFQk9PVF0gICAgICAg ICAgICAgICAgID0gLyogVG9vIG1hbnkgaG9va3MuICovDQorCXsgIlNZU19SRUJPT1QiLCAwLCAi c3lzX3JlYm9vdCgpIiB9LA0KKwlbVE1ZX1NZU19DSFJPT1RdICAgICAgICAgICAgICAgICA9IC8q IE9LICovDQorCXsgIlNZU19DSFJPT1QiLCAwLCAic3lzX2Nocm9vdCgpIiB9LA0KKwlbVE1ZX1NZ U19LSUxMXSAgICAgICAgICAgICAgICAgICA9IC8qIE5vIGFwcHJvcHJpYXRlIGhvb2suICovDQor CXsgIlNZU19LSUxMIiwgMCwgInN5c19raWxsKCkiIH0sDQorCVtUTVlfU1lTX1ZIQU5HVVBdICAg ICAgICAgICAgICAgID0gLyogVG9vIG1hbnkgaG9va3MuICovDQorCXsgIlNZU19WSEFOR1VQIiwg MCwgInN5c192aGFuZ3VwKCkiIH0sDQorCVtUTVlfU1lTX1NFVFRJTUVdICAgICAgICAgICAgICAg ID0gLyogVG9vIG1hbnkgaG9va3MuICovDQorCXsgIlNZU19USU1FIiwgMCwgInN5c19zZXR0aW1l b2ZkYXkoKSIgfSwNCisJW1RNWV9TWVNfTklDRV0gICAgICAgICAgICAgICAgICAgPSAvKiBObyBh cHByb3ByaWF0ZSBob29rLiAqLw0KKwl7ICJTWVNfTklDRSIsIDAsICJzeXNfbmljZSgpIiB9LA0K KwlbVE1ZX1NZU19TRVRIT1NUTkFNRV0gICAgICAgICAgICA9IC8qIE5vIGFwcHJvcHJpYXRlIGhv b2suICovDQorCXsgIlNZU19TRVRIT1NUTkFNRSIsIDAsICJzeXNfc2V0aG9zdG5hbWUoKSIgfSwN CisJW1RNWV9VU0VfS0VSTkVMX01PRFVMRV0gICAgICAgICAgPSAvKiBUb28gbWFueSBob29rcy4g Ki8NCisJeyAidXNlX2tlcm5lbF9tb2R1bGUiLCAwLCAia2VybmVsX21vZHVsZSIgfSwNCisJW1RN WV9DUkVBVEVfRklGT10gICAgICAgICAgICAgICAgPSAvKiBPSyAqLw0KKwl7ICJjcmVhdGVfZmlm byIsIDAsICJta25vZChGSUZPKSIgfSwNCisJW1RNWV9DUkVBVEVfQkxPQ0tfREVWXSAgICAgICAg ICAgPSAvKiBPSyAqLw0KKwl7ICJjcmVhdGVfYmxvY2tfZGV2IiwgMCwgIm1rbm9kKEJERVYpIiB9 LA0KKwlbVE1ZX0NSRUFURV9DSEFSX0RFVl0gICAgICAgICAgICA9IC8qIE9LICovDQorCXsgImNy ZWF0ZV9jaGFyX2RldiIsIDAsICJta25vZChDREVWKSIgfSwNCisJW1RNWV9DUkVBVEVfVU5JWF9T T0NLRVRdICAgICAgICAgPSAvKiBPSyAqLw0KKwl7ICJjcmVhdGVfdW5peF9zb2NrZXQiLCAwLCAi bWtub2QoU09DS0VUKSIgfSwNCisJW1RNWV9TWVNfTElOS10gICAgICAgICAgICAgICAgICAgPSAv KiBPSyAqLw0KKwl7ICJTWVNfTElOSyIsIDAsICJzeXNfbGluaygpIiB9LA0KKwlbVE1ZX1NZU19T WU1MSU5LXSAgICAgICAgICAgICAgICA9IC8qIE9LICovDQorCXsgIlNZU19TWU1MSU5LIiwgMCwg InN5c19zeW1saW5rKCkiIH0sDQorCVtUTVlfU1lTX1JFTkFNRV0gICAgICAgICAgICAgICAgID0g LyogT0sgKi8NCisJeyAiU1lTX1JFTkFNRSIsIDAsICJzeXNfcmVuYW1lKCkiIH0sDQorCVtUTVlf U1lTX1VOTElOS10gICAgICAgICAgICAgICAgID0gLyogT0sgKi8NCisJeyAiU1lTX1VOTElOSyIs IDAsICJzeXNfdW5saW5rKCkiIH0sDQorCVtUTVlfU1lTX0NITU9EXSAgICAgICAgICAgICAgICAg ID0gLyogT0sgKi8NCisJeyAiU1lTX0NITU9EIiwgMCwgInN5c19jaG1vZCgpIiB9LA0KKwlbVE1Z X1NZU19DSE9XTl0gICAgICAgICAgICAgICAgICA9IC8qIE9LICovDQorCXsgIlNZU19DSE9XTiIs IDAsICJzeXNfY2hvd24oKSIgfSwNCisJW1RNWV9TWVNfSU9DVExdICAgICAgICAgICAgICAgICAg PSAvKiBUb28gbWFueSBob29rcy4gKi8NCisJeyAiU1lTX0lPQ1RMIiwgMCwgInN5c19pb2N0bCgp IiB9LA0KKwlbVE1ZX1NZU19LRVhFQ19MT0FEXSAgICAgICAgICAgICA9IC8qIE5vIGFwcHJvcHJp YXRlIGhvb2suICovDQorCXsgIlNZU19LRVhFQ19MT0FEIiwgMCwgInN5c19rZXhlY19sb2FkKCki IH0sDQorCVtUTVlfU1lTX1BJVk9UX1JPT1RdICAgICAgICAgICAgID0gLyogT0sgKi8NCisJeyAi U1lTX1BJVk9UX1JPT1QiLCAwLCAic3lzX3Bpdm90X3Jvb3QoKSIgfSwNCit9Ow0KKw0KK3N0cnVj dCBwcm9maWxlIHsNCisJdW5zaWduZWQgY2hhciB2YWx1ZVtUTVlfTUFYX0NBUEFCSUxJVFlfSU5E RVhdOw0KK307DQorDQorc3RhdGljIHN0cnVjdCBwcm9maWxlICpwcm9maWxlX3B0cltUTVlfTUFY X1BST0ZJTEVTXTsNCisNCisvKioqKioqKioqKioqKioqKioqKioqKioqKiAgVVRJTElUWSBGVU5D VElPTlMgICoqKioqKioqKioqKioqKioqKioqKio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zIGRlbGV0ZSByZXF1ZXN0Pw0KKyAqDQorICogUmV0dXJucyB6ZXJvIG9u IHN1Y2Nlc3MuDQorICogUmV0dXJucyBub256ZXJvIG9uIGZhaWx1cmUuDQorICovDQoraW50IHRt eV9hZGRfY2FwYWJpbGl0eV9wb2xpY3koY2hhciAqZGF0YSwgc3RydWN0IGRvbWFpbl9pbmZvICpk b21haW4sDQorCQkJICAgICAgY29uc3Qgc3RydWN0IGNvbmRpdGlvbl9saXN0ICpjb25kLA0KKwkJ CSAgICAgIGNvbnN0IGJvb2wgaXNfZGVsZXRlKQ0KK3sNCisJdW5zaWduZWQgaW50IGNhcGFiaWxp dHk7DQorCWZvciAoY2FwYWJpbGl0eSA9IDA7IGNhcGFiaWxpdHkgPCBUTVlfTUFYX0NBUEFCSUxJ VFlfSU5ERVg7DQorCSAgICAgY2FwYWJpbGl0eSsrKSB7DQorCQlpZiAoc3RyY21wKGRhdGEsIGNh cGFiaWxpdHlfY29udHJvbF9hcnJheVtjYXBhYmlsaXR5XS5rZXl3b3JkKSkNCisJCQljb250aW51 ZTsNCisJCXJldHVybiB0bXlfYWRkX2NhcGFiaWxpdHlfYWNsKGNhcGFiaWxpdHksIGRvbWFpbiwN CisJCQkJCSAgICAgIGNvbmQsIGlzX2RlbGV0ZSk7DQorCX0NCisJcmV0dXJuIC1FSU5WQUw7DQor fQ0KDQotLSANCg== --boundary-1-- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/