Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757015AbYAHKjV (ORCPT ); Tue, 8 Jan 2008 05:39:21 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754240AbYAHKg2 (ORCPT ); Tue, 8 Jan 2008 05:36:28 -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 S1753814AbYAHKgL (ORCPT ); Tue, 8 Jan 2008 05:36:11 -0500 X-Greylist: delayed 2759 seconds by postgrey-1.27 at vger.kernel.org; Tue, 08 Jan 2008 05:35:56 EST Message-Id: <20080108095005.880824958@nttdata.co.jp> References: <20080108094903.484613061@nttdata.co.jp> User-Agent: quilt/0.46-1 Date: Tue, 08 Jan 2008 18:49:22 +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 19/21] Conditional permission support. X-OriginalArrivalTime: 08 Jan 2008 09:50:06.0193 (UTC) FILETIME=[D9174E10: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: 25555 Lines: 339 --boundary-1 Content-Disposition: inline; filename="tomoyo-condition.patch" Content-Type: application/octect-stream Content-Transfer-Encoding: base64 VGhpcyBwYXRjaCBhbGxvd3MgYWRtaW5pc3RyYXRvcnMgdXNlIGNvbmRpdGlvbmFsIHBlcm1pc3Np b24uDQpUT01PWU8gTGludXggc3VwcG9ydHMgY29uZGl0aW9uYWwgcGVybWlzc2lvbiBiYXNlZCBv bg0KcHJvY2VzcydzIFVJRCxHSUQgZXRjLiBhbmQvb3IgcmVxdWVzdGVkIHBhdGhuYW1lJ3MgVUlE L0dJRC4NCg0KU2lnbmVkLW9mZi1ieTogS2VudGFyb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ICAgICAgICA5IH0sDQor CVtUQVNLX1NHSURdICAgICAgICA9IHsgInRhc2suc2dpZCIsICAgICAgICAgIDkgfSwNCisJW1RB U0tfRlNHSURdICAgICAgID0geyAidGFzay5mc2dpZCIsICAgICAgICAxMCB9LA0KKwlbVEFTS19Q SURdICAgICAgICAgPSB7ICJ0YXNrLnBpZCIsICAgICAgICAgICA4IH0sDQorCVtUQVNLX1BQSURd ICAgICAgICA9IHsgInRhc2sucHBpZCIsICAgICAgICAgIDkgfSwNCisJW1BBVEgxX1VJRF0gICAg ICAgID0geyAicGF0aDEudWlkIiwgICAgICAgICAgOSB9LA0KKwlbUEFUSDFfR0lEXSAgICAgICAg PSB7ICJwYXRoMS5naWQiLCAgICAgICAgICA5IH0sDQorCVtQQVRIMV9JTk9dICAgICAgICA9IHsg InBhdGgxLmlubyIsICAgICAgICAgIDkgfSwNCisJW1BBVEgxX1BBUkVOVF9VSURdID0geyAicGF0 aDEucGFyZW50LnVpZCIsICAxNiB9LA0KKwlbUEFUSDFfUEFSRU5UX0dJRF0gPSB7ICJwYXRoMS5w YXJlbnQuZ2lkIiwgIDE2IH0sDQorCVtQQVRIMV9QQVJFTlRfSU5PXSA9IHsgInBhdGgxLnBhcmVu dC5pbm8iLCAgMTYgfSwNCisJW1BBVEgyX1BBUkVOVF9VSURdID0geyAicGF0aDIucGFyZW50LnVp ZCIsICAxNiB9LA0KKwlbUEFUSDJfUEFSRU5UX0dJRF0gPSB7ICJwYXRoMi5wYXJlbnQuZ2lkIiwg IDE2IH0sDQorCVtQQVRIMl9QQVJFTlRfSU5PXSA9IHsgInBhdGgyLnBhcmVudC5pbm8iLCAgMTYg fQ0KK307DQorDQorLyoqDQorICogdG15X2Fzc2lnbl9jb25kaXRpb24gLSBjcmVhdGUgY29uZGl0 aW9uIHBhcnQuDQorICogQGNvbmRpdGlvbjogcG9pbnRlciB0byBjb25kaXRpb24gcGFydC4NCisg Kg0KKyAqIFJldHVybnMgcG9pbnRlciB0byAic3RydWN0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ByaW50X3Vsb25nKGJ1ZmZlciwgc2l6ZW9mKGJ1ZmZlcikgLSAxLCAqcHRy MisrLA0KKwkJCQkJKG1hdGNoID4+IDYpICYgMyk7DQorCQkJaWYgKHRteV9pb19wcmludGYoaGVh ZCwgIiVzIiwgYnVmZmVyKSkNCisJCQkJYnJlYWs7DQorCQkJaSsrOw0KKwkJCWlmIChyaWdodCA9 PSBNQVhfS0VZV09SRCArIDEpIHsNCisJCQkJdG15X3ByaW50X3Vsb25nKGJ1ZmZlciwgc2l6ZW9m KGJ1ZmZlcikgLSAxLA0KKwkJCQkJCSpwdHIyKyssIChtYXRjaCA+PiA4KSAmIDMpOw0KKwkJCQlp ZiAodG15X2lvX3ByaW50ZihoZWFkLCAiLSVzIiwgYnVmZmVyKSkNCisJCQkJCWJyZWFrOw0KKwkJ CQlpKys7DQorCQkJfQ0KKwkJfQ0KKwl9DQorCWlmIChpIDwgcHRyLT5sZW5ndGgpDQorCQlyZXR1 cm4gLUVOT01FTTsNCitsYXN0OiA7DQorCXJldHVybiB0bXlfaW9fcHJpbnRmKGhlYWQsICJcbiIp ID8gLUVOT01FTSA6IDA7DQorfQ0KDQotLSANCg== --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/