ZGlmZiAtLWdpdCBhL2FwL2FwcC9jY2FwcC9jY19tYWluLmMgYi9hcC9hcHAvY2NhcHAvY2NfbWFpbi5jCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLjJjNDA2MTIKLS0tIC9kZXYvbnVsbAorKysgYi9hcC9hcHAvY2NhcHAvY2NfbWFpbi5jCkBAIC0wLDAgKzEsNTQ2IEBACisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioNCisqDQorKiAgICAgICAgICAgICAgICAgIENvcHlyaWdodCAoYykgMjAxMyBaVEUgQ29ycG9yYXRpb24uDQorKg0KKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KKyogxKMgv+kgw/sgOiBDYw0KKyogzsQgvP4gw/sgOiBDY19tYWluLmMNCisqIM/gudjOxLz+IDoNCisqIMq1z9a5psTcIDogtee7sNK1zvHD/MHut6LLzbrNveG5+7SmwO3Eo7/puq/K/bao0uUNCisqINf3ICAgINXfIDogDQorKiCw5iAgICCxviA6IA0KKyogzeqzycjVxtogOg0KKyogxuTL/Mu1w/cgOg0KKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLw0KKw0KKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KKyog0N64xLzHwrwgOg0KKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8NCisNCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioNCisqICNpbmNsdWRlx/gNCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8NCisjaW5jbHVkZSA8ZXJybm8uaD4NCisvLyNpbmNsdWRlIDxzaWduYWwuaD4NCisjaW5jbHVkZSA8c3RkaW8uaD4NCisjaW5jbHVkZSA8c3RyaW5nLmg+DQorI2luY2x1ZGUgPHN0ZGxpYi5oPg0KKy8vI2luY2x1ZGUgPHRpbWUuaD4NCisjaW5jbHVkZSA8ZmNudGwuaD4NCisjaW5jbHVkZSAiY2NfbWFpbi5oIg0KKyNpbmNsdWRlICJjY19wcm9jLmgiDQorI2luY2x1ZGUgImNjX2NvbS5oIg0KKyNpbmNsdWRlICJjY19hdC5oIg0KKyNpbmNsdWRlIDxzeXMvdHlwZXMuaD4NCisjaWZkZWYgVEVTVF9DQ0FQUA0KKyNpbmNsdWRlICJzb2Z0X3RpbWVyLmgiDQorI2VuZGlmDQorDQorDQorDQorLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqDQorKiCzo8G/tqjS5cf4DQorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovDQorLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqDQorKiDK/b7dveG5ubao0uXH+A0KKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLw0KK2V4dGVybiBUX0NDX0FQUF9BdEluZFByb2NJdGVtIGdDY0FwcEF0SW5kUHJvY1tdOw0KK2V4dGVybiBTSU5UMzIgZ0NjQXBwUmVjdkF0SW5kQ250Ow0KK1RfekNjX0NhbGxEZXRhaWwgZ19DY19DYWxsRGV0YWlsOw0KK2NoYXIgZ196Q2NBcHBfQXRJbmRCdWZbWkNDX0FQUF9BVF9CVUZfTUFYX0xFTisxXTsNCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioNCisqIHN0YXRpY7qvyv3J+cP3x/gNCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8NCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioNCisqIMirvtax5MG/tqjS5cf4DQorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovDQorc3RhdGljIFNJTlQzMiBnX3pDY19Nc3FJZCA9IE5VTEw7DQorLy9zdGF0aWMgU0lOVDMyIGdfekNjX0F0SW5kUnNwSWQgPSBOVUxMOw0KK1NJTlQzMiBnX3pDY19BdFJzcElkID0gTlVMTDsNCisNCisNCitzdGF0aWMgU0lOVDMyIGdfekNjX2dldFNsaWNFdl90aHJlYWRJZCA9IC0xOyANCisNCitpbnQgekNjX3NsZWVwKGxvbmcgbXMpIA0KK3sNCisgICAgc3RydWN0IHRpbWV2YWwgdHY7DQorICAgIHR2LnR2X3NlYyA9IDA7DQorICAgIHR2LnR2X3VzZWMgPSBtcyAqIDEwMDA7DQorICAgIHJldHVybiBzZWxlY3QoMCwgTlVMTCwgTlVMTCwgTlVMTCwgJnR2KTsNCit9DQorVk9JRCB6Q2NfU2xpY01zZ1Byb2MoTVNHX0JVRiAqcHRNc2dCdWYpDQorew0KKyAgICBhc3NlcnQocHRNc2dCdWYgIT0gTlVMTCk7DQorICAgIC8vZ19DY19DYWxsRGV0YWlsLmN1ckV2dCA9IHB0TXNnQnVmLT51c01zZ0NtZDsNCisgICAgaWYgKHB0TXNnQnVmLT51c01zZ0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CAienRlX2NjYXBwLmxvZyIsIiVzIG1zZ3JjdiBRdWV1ZU1zZy5hdWNEYXRhQnVmID0gJWQgXG4iLF9fRlVOQ1RJT05fXyxRdWV1ZU1zZy51c01zZ0NtZCk7DQorICAgICAgICAgICAgIHJldCA9IHpDY0FwcF9BdEluZFJzcFByb2MoJlF1ZXVlTXNnKTsNCisgICAgICAgICB9DQorICAgICAgICBlbHNlDQorICAgICAgICB7DQorICAgICAgICAgICAgY29udGludWU7DQorICAgICAgICB9DQorICAgICAgICANCisgICAgfQ0KK30gICANCisNCitWT0lEIHpDY19BdFJlY3ZNc2dQcm9jKE1TR19CVUYgKnB0TXNnQnVmKQ0KK3sNCisgICAgYXNzZXJ0KHB0TXNnQnVmICE9IE5VTEwpOw0KKyAgICBVTE9ORyAgICAgICAgICAgY21kSWQgICAgICAgICAgICAgICA9IHB0TXNnQnVmLT51c01zZ0NtZDsNCisgICAgU0lOVDMyIGkgOw0KKyAgICBTSU5UMzIgcmV0ICA9IC0xOw0KKw0KKyAgICBmb3IoaT0wO2k8IGdDY0FwcFJlY3ZBdEluZENudDtpKyspDQorICAgIHsNCisgICAgICAgIGlmKGNtZElkID09IGdDY0FwcEF0SW5kUHJvY1tpXS5jbWRJZCkNCisgICAgICAgIHsNCisgICAgICAgICAgICBpZihOVUxMIT0gZ0NjQXBwQXRJbmRQcm9jW2ldLkF0SW5kUHJvY0Z1bikNCisgICAgICAgICAgICB7DQorICAgICAgICAgICAgICAgIHJldCA9IGdDY0FwcEF0SW5kUHJvY1tpXS5BdEluZFByb2NGdW4ocHRNc2dCdWYpOw0KKyAgICAgICAgICAgIH0NCisgICAgICAgICAgICBicmVhazsNCisgICAgICAgIH0NCisgICAgfQ0KK30NCisNCitzdGF0aWMgVk9JRCB6Q2NfU2V0UmoxMUxlZFN0YXR1cyhjaGFyKiBMZWRTdGF0dXMpDQorew0KKwlpbnQgcmV0ID0gMDsNCisJDQorCXNjX2NmZ19zZXQoImNjX3JqMTFfc3RhdHVz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19IT09LT046DQorICAgICAgICAgICAgICAgIG1zZ0J1Zi51c01zZ0NtZCAgID0gWkNDX1JFTEVBU0VfRTsNCisgICAgICAgICAgICAgICAgbXNnQnVmLnNyY19pZCA9IE1PRFVMRV9JRF9TTElDOw0KKyAgICAgICAgICAgICAgICB6Q2NfU2VuZE1zZ1RvU3ViKCZtc2dCdWYpOyAvKiC3ornSu/ogysK8/rj41vfP37PMICovIA0KKyAgICAgICAgICAgICAgICBicmVhazsNCisgICAgICAgICAgICBjYXNlIEVWX0ZYU19IT09LT0ZGOg0KKyAgICAgICAgICAgICAgICBtc2dCdWYudXNNc2dDbWQgICA9IFpDQ19TRUlaRV9FOw0KKyAgICAgICAgICAgICAgICBtc2dCdWYuc3JjX2lkID0gTU9EVUxFX0lEX1NMSUM7DQorICAgICAgICAgICAgICAgIHpDY19TZW5kTXNnVG9TdWIoJm1zZ0J1Zik7IC8qILei1aq7+srCvP64+Nb3z9+zzCAqLw0KKyAgICAgICAgICAgICAgICBicmVhazsNCisgICAgICAgICAgICBjYXNlIEVWX0ZYU19DT0xMRUNUX0RJRzovLyAnMCctJzknLCAnKicsICcjJw0KKyAgICAgICAgICAgICAgICBkdG1mID0gZHRtZjE7DQorICAgICAgICAgICAgICAgIG1zZ0J1Zi51c01zZ0NtZCAgID0gWkNDX0RUTUZfRTsNCisgICAgICAgICAgICAgICAgbXNnQnVmLnNyY19pZCA9IE1PRFVMRV9JRF9TTElDOw0KKyAgICAgICAgICAgICAgICBtc2dCdWYuYXVjRGF0YUJ1ZlswXSA9IChVSU5UOCkoZHRtZik7DQorICAgICAgICAgICAgICAgIG1zZ0J1Zi51c0RhdGFMZW4gPSAxOw0KKyAgICAgICAgICAgICAgICB6Q2NfU2VuZE1zZ1RvU3ViKCZtc2dCdWYpOyAvKiC3okRUTUYgysK8/rj41vfP37PMICovDQorICAgICAgICAgICAgICAgIGJyZWFrOyAgICAgICAgICAgICAgICANCisgICAgICAgICAgICBjYXNlIEVWX0ZYU19GTEFT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Ow0KKyAgICAgICAgIHJldHVybiAtMTsNCisgICAgfQ0KKyAgICBlbHNlDQorICAgIHsgDQorICAgICAgICAgenRlX2xvZ19hcHBlbmQoX19GSUxFX18sIF9fTElORV9fLCAienRlX2NjYXBwLmxvZyIsIiVzIHB0aHJlYWRfY3JlYXRlIHpDY0FwcF9BdEluZFJlYWRlciBzdWNjXG4iLF9fRlVOQ1RJT05fXyk7DQorICAgIH0NCisgICANCisgICAgekNjX1NlbmRBdEltc1BsdXNSZXEoMSwxKTsvL8no1sNpbXNwbHVzyc+xqA0KKw0KKyAgICB3aGlsZSAoMSkNCisgICAgeyAgICAgICANCisgICAgICAgIHp0ZV9sb2dfYXBwZW5kKF9fRklMRV9fLCBfX0xJTkVfXywgInp0ZV9jY2FwcC5sb2ciLCJCQUNLIFRPIG1haW5cbiIpOw0KKyAgICAgICAgcmV0ID0gbXNncmN2KGdfekNjX01zcUlkLCAmUXVldWVNc2csICBzaXplb2YoTVNHX0JVRiktc2l6ZW9mKExPTkcpLCAwLCAwKTsNCisgICAgICAgIGlmKHJldD09LTEpDQorICAgICAgICB7DQorICAgICAgICAgICAgenRlX2xvZ19hcHBlbmQoX19GSUxFX18sIF9fTElORV9fLCAienRlX2NjYXBwLmxvZyIsIiVzIG1zZ3JjdiByZXR1cm4gIHJldD0gJWQgZXJybm89JWRcbiIsX19GVU5DVElPTl9fLHJldCwgZXJybm8pOw0KKyAgICAgICAgICAgIGNvbnRpbnVlOw0KKyAgICAgICAgfQ0KKyAgICAgICAgZWxzZQ0KKyAgICAgICAgew0KKyAgICAgICAgc3dpdGNoIChRdWV1ZU1zZy5zcmNfaWQpDQorICAgICAgICAgICAgeyAgICAgICAgICAgIA0KKyAgICAgICAgICAgIGNhc2UgTU9EVUxFX0lEX1NMSUM6IC8vIG1lc3NhZ2UgZnJvbSBzbGljDQorICAgICAgICAgICAgICAgIHpDY19TbGljTXNnUHJvYygmUXVldWVNc2cpOw0KKyAgICAgICAgICAgICAgICBicmVhazsNCisgICAgICAgICAgICBkZWZhdWx0OiAvLyBBVCBJbmQgbXNnDQorICAgICAgICAgICAgICAgIHp0ZV9sb2dfYXBwZW5kKF9fRklMRV9fLCBfX0xJTkVfXywgInp0ZV9jY2FwcC5sb2ciLCJyZWN2IG1zZyAlZCBmcm9tIGF0X2N0bFxuIixRdWV1ZU1zZy51c01zZ0NtZCk7DQorICAgICAgICAgICAgICAgIGlmIChRdWV1ZU1zZy51c01zZ0NtZD09TVNHX0NNRF9aSU1TUExVU19JTkQNCisgICAgICAgICAgICAgICAgIHx8UXVldWVNc2cudXNNc2dDbWQ9PU1TR19DTURfRFNDSV9JTkQNCisgICAgICAgICAgICAgICAgIHx8UXVldWVNc2cudXNNc2dDbWQ9PU1TR19DTURfWkNQSQ0KKyAgICAgICAgICAgICAgICAgfHxRdWV1ZU1zZy51c01zZ0NtZD09TVNHX0NNRF9aVk9JQ0VDSE5MKQ0KKyAgICAgICAgICAgICAgICB7DQorICAgICAgICAgICAgICAgICAgICB6Q2NfQ2hlY2tTbGF2ZVN0YXRlKCJpbiB6Q2NfQXRSZWN2TXNnUHJvYyIpOw0KKyAgICAgICAgICAgICAgICAgICAgekNjX0F0UmVjdk1zZ1Byb2MoJlF1ZXVlTXNnKTsNCisgICAgICAgICAgICAgICAgfQ0KKyAgICAgICAgICAgICAgICBicmVhazsNCisgICAgICAgICAgICB9DQorCQkJaWYgKFF1ZXVlTXNnLnVzTXNnQ21kPT1NU0dfQ01EX1ZUU19SU1ApDQorCQkJew0KKwkJCQl6Q2NBcHBfVnRzX1JzcCgpOw0KKwkJCX0NCisgICAgICAgICAgICB6Q2NfUnVuTWFzdGVyKCZRdWV1ZU1zZyk7DQorICAgICAgICB9DQorICAgIH0NCisNCityZXR1cm4gMDsNCit9DQorI2VuZGlmDQorDQo=