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dXRleFtwb3J0XSk7CiAvLyAgICBMT0dEKCJMSU5FIDogJXMiLCBsaW5lKTsKICAgICBpZiAoc3BfcmVzcG9uc2VbcG9ydF0gPT0gTlVMTCkKICAgICB7CiAgICAgICAgIC8qIG5vIGNvbW1hbmQgcGVuZGluZyAqLwotICAgICAgICBoYW5kbGVVbnNvbGljaXRlZChsaW5lKTsKKyAgICAgICAgaGFuZGxlVW5zb2xpY2l0ZWQocG9ydCwgbGluZSk7CiAgICAgfQogICAgIGVsc2UgaWYgKGlzRmluYWxSZXNwb25zZVN1Y2Nlc3MobGluZSkpCiAgICAgewpAQCAtMjk3LDcgKzI5OCw3IEBACiAgICAgZWxzZSBzd2l0Y2ggKHNfdHlwZVtwb3J0XSkKICAgICAgICAgewogICAgICAgICAgICAgY2FzZSBOT19SRVNVTFQ6Ci0gICAgICAgICAgICAgICAgaGFuZGxlVW5zb2xpY2l0ZWQobGluZSk7CisgICAgICAgICAgICAgICAgaGFuZGxlVW5zb2xpY2l0ZWQocG9ydCwgbGluZSk7CiAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICBjYXNlIE5VTUVSSUM6CiAgICAgICAgICAgICAgICAgaWYgKHNwX3Jlc3BvbnNlW3BvcnRdLT5wX2ludGVybWVkaWF0ZXMgPT0gTlVMTApAQCAtMzEwLDcgKzMxMSw3IEBACiAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAvKiBlaXRoZXIgd2UgYWxyZWFkeSBoYXZlIGFuIGludGVybWVkaWF0ZSByZXNwb25zZSBvcgogICAgICAgICAgICAgICAgICAgICAgICB0aGUgbGluZSBkb2Vzbid0IGJlZ2luIHdpdGggYSBkaWdpdCAqLwotICAgICAgICAgICAgICAgICAgICBoYW5kbGVVbnNvbGljaXRlZChsaW5lKTsKKyAgICAgICAgICAgICAgICAgICAgaGFuZGxlVW5zb2xpY2l0ZWQocG9ydCwgbGluZSk7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgY2FzZSBTSU5HTEVMSU5FOgpAQCAtMzQzLDcgKzM0NCw3IEBACiAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgLyogd2UgYWxyZWFkeSBoYXZlIGFuIGludGVybWVkaWF0ZSByZXNwb25zZSAqLwotICAgICAgICAgICAgICAgICAgICBoYW5kbGVVbnNvbGljaXRlZChsaW5lKTsKKyAgICAgICAgICAgICAgICAgICAgaGFuZGxlVW5zb2xpY2l0ZWQocG9ydCwgbGluZSk7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgY2FzZSBNVUxUSUxJTkU6CkBAIC0zNTMsMTMgKzM1NCwxMyBAQAogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICBoYW5kbGVVbnNvbGljaXRlZChsaW5lKTsKKyAgICAgICAgICAgICAgICAgICAgaGFuZGxlVW5zb2xpY2l0ZWQocG9ydCwgbGluZSk7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIGJyZWFrOwogCiAgICAgICAgICAgICBkZWZhdWx0OiAvKiB0aGlzIHNob3VsZCBuZXZlciBiZSByZWFjaGVkICovCiAgICAgICAgICAgICAgICAgTE9HRSgiVW5zdXBwb3J0ZWQgQVQgY29tbWFuZCB0eXBlICVkXG4iLCBzX3R5cGVbcG9ydF0pOwotICAgICAgICAgICAgICAgIGhhbmRsZVVuc29saWNpdGVkKGxpbmUpOworICAgICAgICAgICAgICAgIGhhbmRsZVVuc29saWNpdGVkKHBvcnQsIGxpbmUpOwogICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICB9CiAKQEAgLTM5OCw3ICszOTksNyBAQAogICogaGF2ZSBidWZmZXJlZCBzdGRpby4KICAqLwogCi1zdGF0aWMgY29uc3QgY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KTsKICAgICByZXR1cm4gcmV0OwogfQogCiAKLQotc3RhdGljIHZvaWQgb25SZWFkZXJDbG9zZWQoQVRQb3J0VHlwZV9lbnVtIHBvcnQpCitzdGF0aWMgdm9pZCBvblJlYWRlckNsb3NlZChBVFBvcnRJZF9lbnVtIHBvcnQpCiB7CiAgICAgTE9HRCgib25SZWFkZXJDbG9zZWQoKSIpOwogICAgIGlmIChzX29uUmVhZGVyQ2xvc2VkICE9IE5VTEwgJiYgc19yZWFkZXJDbG9zZWQgPT0gMCkKQEAgLTYzMyw3ICs2MzYsNyBAQAogc3RhdGljIHZvaWQgKnJlYWRlckxvb3Aodm9pZCAqYXJnKQogewogICAgIFVOVVNFRChhcmcpOwotICAgIEFUUG9ydFR5cGVfZW51bSAqcG9ydCA9IChBVFBvcnRUeXBlX2VudW0qKWFyZzsKKyAgICBBVFBvcnRJZF9lbnVtICpwb3J0ID0gKEFUUG9ydElkX2VudW0qKWFyZzsKICAgICBmb3IgKDs7KQogICAgIHsKICAgICAgICAgY29uc3QgY2hhciAqIGxpbmU7CkBAIC02NzMsOSArNjc2LDkgQEAKICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgIH0KIAotICAgICAgICAgICAgaWYgKHNfdW5zb2xIYW5kbGVyICE9IE5VTEwpCisgICAgICAgICAgICBpZiAoc191bnNvbEhhbmRsZXJbKnBvcnQgPCBBVFBPUlRJRF9TSU0yXzAgPyBNQlRLX1NJTV8xIDogTUJUS19TSU1fMl0gIT0gTlVMTCkKICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICBzX3Vuc29sSGFuZGxlciAobGluZTEsIGxpbmUyKTsKKyAgICAgICAgICAgICAgICBzX3Vuc29sSGFuZGxlclsqcG9ydCA8IEFUUE9SVElEX1NJTTJfMCA/IE1CVEtfU0lNXzEgOiBNQlRLX1NJTV8yXSAobGluZTEsIGxpbmUyKTsKICAgICAgICAgICAgIH0KICAgICAgICAgICAgIGZyZWUobGluZTEpOwogICAgICAgIC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dXN0IGJlIGV2ZW50dWFsbHkgZnJlZWQgd2l0aAogICogYXRfcmVzcG9uc2VfZnJlZQogICovCi1pbnQgYXRfc2VuZF9jb21tYW5kIChBVFBvcnRUeXBlX2VudW0gcG9ydCwgY29uc3QgY2hhciAqY29tbWFuZCwgQVRSZXNwb25zZSAqKnBwX291dFJlc3BvbnNlKQoraW50IGF0X3NlbmRfY29tbWFuZCAoQVRQb3J0SWRfZW51bSBwb3J0LCBjb25zdCBjaGFyICpjb21tYW5kLCBBVFJlc3BvbnNlICoqcHBfb3V0UmVzcG9uc2UpCiB7CiAgICAgcmV0dXJuIGF0X3NlbmRfY29tbWFuZF9mdWxsIChwb3J0LCBjb21tYW5kLCBOT19SRVNVTFQsIE5VTEwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBOVUxMLCAwLCBwcF9vdXRSZXNwb25zZSk7CiB9CiAKIAotaW50IGF0X3NlbmRfY29tbWFuZF9zaW5nbGVsaW5lIChBVFBvcnRUeXBlX2VudW0gcG9ydCwgY29uc3QgY2hhciAqY29tbWFuZCwKK2ludCBhdF9zZW5kX2NvbW1hbmRfc2luZ2xlbGluZSAoQVRQb3J0SWRfZW51bSBwb3J0LCBjb25zdCBjaGFyICpjb21tYW5kLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBjaGFyICpyZXNwb25zZVByZWZpeCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQVRSZXNwb25zZSAqKnBwX291dFJlc3BvbnNlKQogewpAQCAtMTE0OSw3ICsxMTUyLDcgQEAKICAgICByZXR1cm4gZXJyOwogfQogCi1pbnQgYXRfc2VuZF9jb21tYW5kX3NpbmdsZWxpbmVfd2l0aF90aW1lb3V0IChBVFBvcnRUeXBlX2VudW0gcG9ydCwgY29uc3QgY2hhciAqY29tbWFuZCwKK2ludCBhdF9zZW5kX2NvbW1hbmRfc2luZ2xlbGluZV93aXRoX3RpbWVvdXQgKEFUUG9ydElkX2VudW0gcG9ydCwgY29uc3QgY2hhciAqY29tbWFuZCwKICAgICAgICAgY29uc3QgY2hhciAqcmVzcG9uc2VQcmVmaXgsCiAgICAgICAgIEFUUmVzcG9uc2UgKipwcF9vdXRSZXNwb25zZSxsb25nIGxvbmcgdGltZW91dE1zZWMpCiB7CkBAIC0xMTc0LDcgKzExNzcsNyBAQAogCiAKIAotaW50IGF0X3NlbmRfY29tbWFuZF9udW1lcmljIChBVFBvcnRUeXBlX2VudW0gcG9ydCwgY29uc3QgY2hhciAqY29tbWFuZCwKK2ludCBhdF9zZW5kX2NvbW1hbmRfbnVtZXJpYyAoQVRQb3J0SWRfZW51bSBwb3J0LCBjb25zdCBjaGFyICpjb21tYW5kLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBVFJlc3BvbnNlICoqcHBfb3V0UmVzcG9uc2UpCiB7CiAgICAgaW50IGVycjsKQEAgLTExOTcsNyArMTIwMCw3IEBACiB9CiAKIAotaW50IGF0X3NlbmRfY29tbWFuZF9zbXMgKEFUUG9ydFR5cGVfZW51bSBwb3J0LCBjb25zdCBjaGFyICpjb21tYW5kLAoraW50IGF0X3NlbmRfY29tbWFuZF9zbXMgKEFUUG9ydElkX2VudW0gcG9ydCwgY29uc3QgY2hhciAqY29tbWFuZCwKICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBjaGFyICpwZHUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgY2hhciAqcmVzcG9uc2VQcmVmaXgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgQVRSZXNwb25zZSAqKnBwX291dFJlc3BvbnNlKQpAQCAtMTIyMiw3ICsxMjI1LDcgQEAKIH0KIAogCi1pbnQgYXRfc2VuZF9jb21tYW5kX211bHRpbGluZSAoQVRQb3J0VHlwZV9lbnVtIHBvcnQsIGNvbnN0IGNoYXIgKmNvbW1hbmQsCitpbnQgYXRfc2VuZF9jb21tYW5kX211bHRpbGluZSAoQVRQb3J0SWRfZW51bSBwb3J0LCB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gICBiYW5kX2luZm8uYmFuZF9zZXRfc3VjY2VzcyA9IFRSVUU7DQotICAgICAgICAgICAgICAgIGlmKGJhbmRfaW5mby5iYW5kX2FyZWEgPT0gTUJUS19NT0RFTV9CQU5EX0FSRUFfQ04pIHsNCi0gICAgICAgICAgICAgICAgICAgIHByb3BlcnR5X3NldCgicGVyc2lzdC5tYnRrLmJhbmRfY29uZmlnIiwgIkNOIik7DQotICAgICAgICAgICAgICAgIH0gZWxzZSBpZihiYW5kX2luZm8uYmFuZF9hcmVhID09IE1CVEtfTU9ERU1fQkFORF9BUkVBX0VVKSB7DQotICAgICAgICAgICAgICAgICAgICBwcm9wZXJ0eV9zZXQoInBlcnNpc3QubWJ0ay5iYW5kX2NvbmZpZyIsICJFVSIpOw0KLSAgICAgICAgICAgICAgICB9IGVsc2UgaWYoYmFuZF9pbmZvLmJhbmRfYXJlYSA9PSBNQlRLX01PREVNX0JBTkRfQVJFQV9TQSkgew0KLSAgICAgICAgICAgICAgICAgICAgcHJvcGVydHlfc2V0KCJwZXJzaXN0Lm1idGsuYmFuZF9jb25maWciLCAiU0EiKTsNCi0gICAgICAgICAgICAgICAgfSBlbHNlIHsNCi0gICAgICAgICAgICAgICAgICAgIHByb3BlcnR5X3NldCgicGVyc2lzdC5tYnRrLmJhbmRfY29uZmlnIiwgIkFMTCIpOw0KKyAgICAgICAgICAgICAgICBMT0dEKCJTZXQgU0lNMSBiYW5kIHN1Y2Nlc3MuIik7DQorICAgICAgICAgICAgICAgIGNtZV9lcnIgPSBNQlRLX1JJTF9FUlJfQ01FX05PTjsNCisgICAgICAgICAgICAgICAgaWYocmVxX2JhbmRfc2V0KE1CVEtfU0lNXzIsIEFUUE9SVFRZUEVfMCwgJmJhbmRfaW5mby5iYW5kX3N1cHBvcnQsICZjbWVfZXJyKSB8fCBjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKQ0KKyAgICAgICAgICAgICAgICB7DQorICAgICAgICAgICAgICAgICAgICBMT0dFKCJTZXQgU0lNMiBiYW5kIGZhaWwuIik7DQogICAgICAgICAgICAgICAgIH0NCi0gICAgICAgICAgICAgICAgTE9HRCgiU2V0IGJhbmQgc3VjY2Vzcy4iKTsNCisgICAgICAgICAgICAgICAgZWxzZSAvLyBTZXQgYmFuZCBzdWNjZXNzLg0KKyAgICAgICAgICAgICAgICB7DQorICAgICAgICAgICAgICAgICAgICBMT0dEKCJTZXQgU0lNMiBiYW5kIHN1Y2Nlc3MuIik7DQorICAgICAgICAgICAgICAgICAgICAvLyBsb2dfaGV4KCJCQU5ELTIiLCAmYmFuZF9zZXRfaW5mbywgc2l6ZW9mKGJhbmRfc2V0X2luZm9fdCkpOw0KKyAgICAgICAgICAgICAgICAgICAgYmFuZF9pbmZvLmJhbmRfc2V0X3N1Y2Nlc3MgPSBUUlVFOw0KKyAgICAgICAgICAgICAgICAgICAgaWYoYmFuZF9pbmZvLmJhbmRfYXJlYSA9PSBNQlRLX01PREVNX0JBTkRfQVJFQV9DTikgew0KKyAgICAgICAgICAgICAgICAgICAgICAgIHByb3BlcnR5X3NldCgicGVyc2lzdC5tYnRrLmJhbmRfY29uZmlnIiwgIkNOIik7DQorICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYoYmFuZF9pbmZvLmJhbmRfYXJlYSA9PSBNQlRLX01PREVNX0JBTkRfQVJFQV9FVSkgew0KKyAgICAgICAgICAgICAgICAgICAgICAgIHByb3BlcnR5X3NldCgicGVyc2lzdC5tYnRrLmJhbmRfY29uZmlnIiwgIkVVIik7DQorICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYoYmFuZF9pbmZvLmJhbmRfYXJlYSA9PSBNQlRLX01PREVNX0JBTkRfQVJFQV9TQSkgew0KKyAgICAgICAgICAgICAgICAgICAgICAgIHByb3BlcnR5X3NldCgicGVyc2lzdC5tYnRrLmJhbmRfY29uZmlnIiwgIlNBIik7DQorICAgICAgICAgICAgICAgICAgICB9IGVsc2Ugew0KKyAgICAgICAgICAgICAgICAgICAgICAgIHByb3BlcnR5X3NldCgicGVyc2lzdC5tYnRrLmJhbmRfY29uZmlnIiwgIkFMTCIpOw0KKyAgICAgICAgICAgICAgICAgICAgfQ0KKyAgICAgICAgICAgICAgICB9DQogICAgICAgICAgICAgfQ0KICAgICAgICAgICAgIGJyZWFrOw0KICAgICAgICAgfQ0KQEAgLTI3MjMsMTMgKzI3OTgsMTQgQEAKIA0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gRGVmYXVsdCBBVCBwb3J0Lg0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5mby0+cG9ydCA9IEFUUE9SVFRZUEVfMDsNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluZm8tPnNpbV9pZCA9IE1CVEtfU0lNXzE7DQogDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaXN0X2FkZChyaWxfaW5mby5zb2NrX2NsaWVudF9saXN0LCBpbmZvKTsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExPRygiQWRkIE5ldyBDbGllbnQgRkQgSW50byBMaXN0LiIpOw0KIA0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gU2VuZCBtc2cgUklMX01TR19JRF9JTkRfU0VSX1NUQVRFX0NIQU5HRSB0byBjbGllbnQuDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYnRrX3JpbF9zZXJfc3RhdGVfZW51bSBzdGF0ZSA9IE1CVEtfUklMX1NFUl9TVEFURV9SRUFEWTsNCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJpbF9pbmRfcGFja19zZW5kKGNsaWVudF9mZCwgUklMX01TR19JRF9JTkRfU0VSX1NUQVRFX0NIQU5HRSwgJnN0YXRlLCAxKTsNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJpbF9pbmRfcGFja19zZW5kKE1CVEtfU0lNXzEsIGNsaWVudF9mZCwgUklMX01TR19JRF9JTkRfU0VSX1NUQVRFX0NIQU5HRSwgJnN0YXRlLCAxKTsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CkBAIC0yNzQ2LDcgKzI4MjIsNyBAQAogICAgICAgICAgICAgICAgICAgICAgICAgLy8gUGFyc2UgcGFja2V0IGVycm9yLHNlbmQgZXJyb3IgcmVzcG9uc2UgdG8gY2xpZW50LgogICAgICAgICAgICAgICAgICAgICAgICAgaWYocGFjayA9PSBOVUxMKQogICAgICAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJpbF9lcnJvcl9wYWNrX3NlbmQoY2xpX2luZm8tPnBvcnQsIGNsaV9pbmZvLT5mZCwgUklMX01TR19JRF9VTktOT1dOLCBSSUxfTVNHX0lOREVYX0lOVkFMSUQsIGVycik7DQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJpbF9lcnJvcl9wYWNrX3NlbmQoY2xpX2luZm8tPnNpbV9pZCwgY2xpX2luZm8tPnBvcnQsIGNsaV9pbmZvLT5mZCwgUklMX01TR19JRF9VTktOT1dOLCBSSUxfTVNHX0lOREVYX0lOVkFMSUQsIGVycik7DQogICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgewpAQCAtMjc1NSw2ICsyODMxLDExIEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgew0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gVXBkYXRlIEFUIHBvcnQgaW4gdGhlIGZpcnN0Lg0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xpX2luZm8tPnBvcnQgPSAoQVRQb3J0VHlwZV9lbnVtKSgoKnBhY2tfcHRyKS0+YXRfcG9ydCk7DQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGlfaW5mby0+c2ltX2lkID0gKG1idGtfc2ltX3R5cGVfZW51bSkoKCpwYWNrX3B0ciktPnNpbV9pZCk7DQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZihjbGlfaW5mby0+c2ltX2lkID09IE1CVEtfU0lNX0FVVE8pIHsNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGlfaW5mby0+c2ltX2lkID0gcmlsX2luZm8uY3VyX3NpbV9pZDsNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMT0dEKCJBdXRvIHNpbSA9PiAlZCIsIGNsaV9pbmZvLT5zaW1faWQpOw0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQ0KIA0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFja19kaXN0cmlidXRlKGNsaV9pbmZvLCAqcGFja19wdHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBOb3QgZnJlZSx3aWxsIGZyZWUgaW4gcGFja19wcm9jZXNzKCkgb3IgcGFja2V0IHByb2Nlc3MgdGhyZWFkLgpAQCAtMjg3OCw3ICsyOTU5LDcgQEAKICAgICAgICAgICAgICAgICBlcnIgPSBwYWNrX3JlcV9wcm9jZXNzKGl0ZW0tPmNsaV9pbmZvLCBwYWNrKTsKICAgICAgICAgICAgICAgICBpZihlcnIgIT0gTUJUS19SSUxfRVJSX1NVQ0NFU1MpDQogICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgcmlsX2Vycm9yX3BhY2tfc2VuZChpdGVtLT5jbGlfaW5mby0+cG9ydCwgaXRlbS0+Y2xpX2luZm8tPmZkLCBwYWNrLT5tc2dfaWQsIHBhY2stPm1zZ19pbmRleCwgZXJyKTsNCisgICAgICAgICAgICAgICAgICAgIHJpbF9lcnJvcl9wYWNrX3NlbmQoaXRlbS0+Y2xpX2luZm8tPnNpbV9pZCwgaXRlbS0+Y2xpX2lu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bW1hbmQgaXMgPSAlcy5cbiIsIGNtZCk7Ci0gICAgaW50IGVyciA9IGF0X3NlbmRfY29tbWFuZChwb3J0LCBjbWQsICZyZXNwb25zZSk7CisgICAgaW50IGVyciA9IGF0X3NlbmRfY29tbWFuZChwb3J0VHlwZV8yX3BvcnRJZChzaW1faWQsIHBvcnQpLCBjbWQsICZyZXNwb25zZSk7CiAgICAgaWYgKGVyciA8IDAgfHwgcmVzcG9uc2UtPnN1Y2Nlc3MgPT0gMCl7CiAgICAgICAgICpjbWVfZXJyID0gYXRfZ2V0X2NtZV9lcnJvcihyZXNwb25zZSk7CiAgICAgICAgIGdvdG8gZXhpdDsKQEAgLTM2Nyw3ICszNjgsNyBAQAogICAgICAgICAgICAgZWxzZSAgICAgLy8gU2V0CiAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgY2hhciAqcG4gPSAoY2hhciopKHBhY2stPmRhdGEpOwotICAgICAgICAgICAgICAgIGlmKHJlcV9jYWxsX3N0YXJ0KGNsaV9pbmZvLT5wb3J0LCBwbiwgJmNtZV9lcnIpIHx8IGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pCisgICAgICAgICAgICAgICAgaWYocmVxX2NhbGxfc3RhcnQoY2xpX2luZm8tPnNpbV9pZCwgY2xpX2luZm8tPnBvcnQsIHBuLCAmY21lX2VycikgfHwgY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikKICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgIGlmKGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pIHsKICAgICAgICAgICAgICAgICAgICAgICAgIGVyciA9IE1CVEtfUklMX0VSUl9DTUUgKyBjbWVfZXJyOwpAQCAtMzc4LDcgKzM3OSw3IEBACiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCBOVUxMLCAwKTsKKyAgICAgICAgICAgICAgICAgICAgcmlsX3JzcF9wYWNrX3NlbmQoY2xpX2luZm8tPnNpbV9pZCwgY2xpX2luZm8tPnBvcnQsIGNsaV9pbmZvLT5mZCwgcGFjay0+bXNnX2lkLCBwYWNrLT5tc2dfaW5kZXgsIE5VTEwsIDApOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KICAgICAgICAgICAgIGJyZWFrOwpAQCAtMzg3LDcgKzM4OCw3IEBACiAgICAgICAgIHsKICAgICAgICAgICAgIGlmKHBhY2stPmRhdGFfbGVuID09IDAgfHwgcGFjay0+ZGF0YSA9PSBOVUxMKQogICAgICAgICAgICAgewotICAgICAgICAgICAgICAgaWYocmVxX2Fuc3dlcl9jYWxsKGNsaV9pbmZvLT5wb3J0LCAmY21lX2VycikgfHwgY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikKKyAgICAgICAgICAgICAgIGlmKHJlcV9hbnN3ZXJfY2FsbChjbGlfaW5mby0+c2ltX2lkLCBjbGlfaW5mby0+cG9ydCwgJmNtZV9lcnIpIHx8IGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pCiAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICBpZihjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBlcnIgPSBNQlRLX1JJTF9FUlJfQ01FICsgY21lX2VycjsKQEAgLTM5OCw3ICszOTksNyBAQAogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICByaWxfcnNwX3BhY2tfc2VuZChjbGlfaW5mby0+cG9ydCwgY2xpX2luZm8tPmZkLCBwYWNrLT5tc2dfaWQsIHBhY2stPm1zZ19pbmRleCwgTlVMTCwgMCk7CisgICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCBOVUxMLCAwKTsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBlbHNlICAgICAvLyBTZXQKQEAgLTQxMiw3ICs0MTMsNyBAQAogICAgICAgICB7CiAgICAgICAgICAgICBpZihwYWNrLT5kYXRhX2xlbiA9PSAwIHx8IHBhY2stPmRhdGEgPT0gTlVMTCkKICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICBpZihyZXFfaGFuZ3VwX2NhbGwoY2xpX2luZm8tPnBvcnQsICZjbWVfZXJyKSB8fCBjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKQorICAgICAgICAgICAgICAgIGlmKHJlcV9oYW5ndXBfY2FsbChjbGlfaW5mby0+c2ltX2lkLCBjbGlfaW5mby0+cG9ydCwgJmNtZV9lcnIpIHx8IGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pCiAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICBpZihjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBlcnIgPSBNQlRLX1JJTF9FUlJfQ01FICsgY21lX2VycjsKQEAgLTQyMyw3ICs0MjQsNyBAQAogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICByaWxfcnNwX3BhY2tfc2VuZChjbGlfaW5mby0+cG9ydCwgY2xpX2luZm8tPmZkLCBwYWNrLT5tc2dfaWQsIHBhY2stPm1zZ19pbmRleCwgTlVMTCwgMCk7CisgICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCBOVUxMLCAwKTsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBlbHNlICAgICAvLyBTZXQKQEAgLTQ0Myw3ICs0NDQsNyBAQAogICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgewogICAgICAgICAgICAgICAgIHVpbnQ4IHBob25lX2lkID0gKihwYWNrLT5kYXRhKTsKLSAgICAgICAgICAgICAgICBpZihyZXFfaGFuZ3VwX2FfY2FsbChjbGlfaW5mby0+cG9ydCwgcGhvbmVfaWQsICZjbWVfZXJyKSB8fCBjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKQorICAgICAgICAgICAgICAgIGlmKHJlcV9oYW5ndXBfYV9jYWxsKGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCBwaG9uZV9pZCwgJmNtZV9lcnIpIHx8IGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pCiAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICBpZihjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBlcnIgPSBNQlRLX1JJTF9FUlJfQ01FICsgY21lX2VycjsKQEAgLTQ1NCw3ICs0NTUsNyBAQAogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICByaWxfcnNwX3BhY2tfc2VuZChjbGlfaW5mby0+cG9ydCwgY2xpX2luZm8tPmZkLCBwYWNrLT5tc2dfaWQsIHBhY2stPm1zZ19pbmRleCwgTlVMTCwgMCk7CisgICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCBOVUxMLCAwKTsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBicmVhazsKQEAgLTQ2Myw3ICs0NjQsNyBAQAogICAgICAgICB7CiAgICAgICAgICAgICBpZihwYWNrLT5kYXRhX2xlbiA9PSAwIHx8IHBhY2stPmRhdGEgPT0gTlVMTCkKICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICBpZihyZXFfaGFuZ3VwX3dhaXRpbmdfb3JfYmFja2dyb3VuZF9jYWxsKGNsaV9pbmZvLT5wb3J0LCAmY21lX2VycikgfHwgY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikKKyAgICAgICAgICAgICAgICBpZihyZXFfaGFuZ3VwX3dhaXRpbmdfb3JfYmFja2dyb3VuZF9jYWxsKGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCAmY21lX2VycikgfHwgY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikKICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgIGlmKGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pIHsKICAgICAgICAgICAgICAgICAgICAgICAgIGVyciA9IE1CVEtfUklMX0VSUl9DTUUgKyBjbWVfZXJyOwpAQCAtNDc0LDcgKzQ3NSw3IEBACiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCBOVUxMLCAwKTsKKyAgICAgICAgICAgICAgICAgICAgcmlsX3JzcF9wYWNrX3NlbmQoY2xpX2luZm8tPnNpbV9pZCwgY2xpX2luZm8tPnBvcnQsIGNsaV9pbmZvLT5mZCwgcGFjay0+bXNnX2lkLCBwYWNrLT5tc2dfaW5kZXgsIE5VTEwsIDApOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KICAgICAgICAgICAgIGVsc2UKQEAgLTQ4OCw3ICs0ODksNyBAQAogICAgICAgICB7CiAgICAgICAgICAgICBpZihwYWNrLT5kYXRhX2xlbiA9PSAwIHx8IHBhY2stPmRhdGEgPT0gTlVMTCkKICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICBpZihyZXFfaGFuZ3VwX2ZvcmVncm91bmRfcmVzdW1lX2JhY2tncm91bmRfY2FsbChjbGlfaW5mby0+cG9ydCwgJmNtZV9lcnIpIHx8IGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pCisgICAgICAgICAgICAgICAgaWYocmVxX2hhbmd1cF9mb3JlZ3JvdW5kX3Jlc3VtZV9iYWNrZ3JvdW5kX2NhbGwoY2xpX2luZm8tPnNpbV9pZCwgY2xpX2luZm8tPnBvcnQsICZjbWVfZXJyKSB8fCBjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKQogICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgaWYoY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikgewogICAgICAgICAgICAgICAgICAgICAgICAgZXJyID0gTUJUS19SSUxfRVJSX0NNRSArIGNtZV9lcnI7CkBAIC00OTksNyArNTAwLDcgQEAKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgcmlsX3JzcF9wYWNrX3NlbmQoY2xpX2luZm8tPnBvcnQsIGNsaV9pbmZvLT5mZCwgcGFjay0+bXNnX2lkLCBwYWNrLT5tc2dfaW5kZXgsIE5VTEwsIDApOworICAgICAgICAgICAgICAgICAgICByaWxfcnNwX3BhY2tfc2VuZChjbGlfaW5mby0+c2ltX2lkLCBjbGlfaW5mby0+cG9ydCwgY2xpX2luZm8tPmZkLCBwYWNrLT5tc2dfaWQsIHBhY2stPm1zZ19pbmRleCwgTlVMTCwgMCk7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogICAgICAgICAgICAgZWxzZQpAQCAtNTE1LDcgKzUxNiw3IEBACiAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgbWJ0a19jYWxsX2luZm9fdCByZWc7CiAgICAgICAgICAgICAgICAgbWVtc2V0KCZyZWcsIDAsIHNpemVvZihtYnRrX2NhbGxfaW5mb190KSk7Ci0gICAgICAgICAgICAgICAgaWYocmVxX3dhaXRpbl9jYWxsKGNsaV9pbmZvLT5wb3J0LCAmcmVnLCAmY21lX2VycikgfHwgY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikKKyAgICAgICAgICAgICAgICBpZihyZXFfd2FpdGluX2NhbGwoY2xpX2luZm8tPnNpbV9pZCwgY2xpX2luZm8tPnBvcnQsICZyZWcsICZjbWVfZXJyKSB8fCBjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKQogICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgaWYoY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikgewogICAgICAgICAgICAgICAgICAgICAgICAgZXJyID0gTUJUS19SSUxfRVJSX0NNRSArIGNtZV9lcnI7CkBAIC01MjYsNyArNTI3LDcgQEAKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgcmlsX3JzcF9wYWNrX3NlbmQoY2xpX2luZm8tPnBvcnQsIGNsaV9pbmZvLT5mZCwgcGFjay0+bXNnX2lkLCBwYWNrLT5tc2dfaW5kZXgsICZyZWcsIHNpemVvZihtYnRrX2NhbGxfaW5mb190KSk7CisgICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCAmcmVnLCBzaXplb2YobWJ0a19jYWxsX2luZm9fdCkpOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KICAgICAgICAgICAgIGVsc2UgICAgIC8vIFNldApAQCAtNTQxLDcgKzU0Miw3IEBACiAgICAgICAgICAgICBpZihwYWNrLT5kYXRhX2xlbiA9PSAwIHx8IHBhY2stPmRhdGEgPT0gTlVMTCkgICAvLyBHZXQgVm9MVEUgc3RhdGUuCiAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgaW50IHN0YXRlOwotICAgICAgICAgICAgICAgIGlmKHJlcV9tdXRlX2dldChjbGlfaW5mby0+cG9ydCwgJnN0YXRlLCAmY21lX2VycikgfHwgY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikKKyAgICAgICAgICAgICAgICBpZihyZXFfbXV0ZV9nZXQoY2xpX2luZm8tPnNpbV9pZCwgY2xpX2luZm8tPnBvcnQsICZzdGF0ZSwgJmNtZV9lcnIpIHx8IGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pCiAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICBpZihjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBlcnIgPSBNQlRLX1JJTF9FUlJfQ01FICsgY21lX2VycjsKQEAgLTU1Miw3ICs1NTMsNyBAQAogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICByaWxfcnNwX3BhY2tfc2VuZChjbGlfaW5mby0+cG9ydCwgY2xpX2luZm8tPmZkLCBwYWNrLT5tc2dfaWQsIHBhY2stPm1zZ19pbmRleCwgJnN0YXRlLCBzaXplb2YodWludDgpKTsKKyAgICAgICAgICAgICAgICAgICAgcmlsX3JzcF9wYWNrX3NlbmQoY2xpX2luZm8tPnNpbV9pZCwgY2xpX2luZm8tPnBvcnQsIGNsaV9pbmZvLT5mZCwgcGFjay0+bXNnX2lkLCBwYWNrLT5tc2dfaW5kZXgsICZzdGF0ZSwgc2l6ZW9mKHVpbnQ4KSk7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogICAgICAgICAgICAgZWxzZSAgICAgLy8gU2V0IG11dGUgc3RhdGUuCkBAIC01NjUsNyArNTY2LDcgQEAKICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgfQogCi0gICAgICAgICAgICAgICAgaWYocmVxX211dGVfc2V0KGNsaV9pbmZvLT5wb3J0LCBvbiwgJmNtZV9lcnIpIHx8IGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pCisgICAgICAgICAgICAgICAgaWYocmVxX211dGVfc2V0KGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCBvbiwgJmNtZV9lcnIpIHx8IGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pCiAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICBpZihjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBlcnIgPSBNQlRLX1JJTF9FUlJfQ01FICsgY21lX2VycjsKQEAgLTU3Niw3ICs1NzcsNyBAQAogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICByaWxfcnNwX3BhY2tfc2VuZChjbGlfaW5mby0+cG9ydCwgY2xpX2luZm8tPmZkLCBwYWNrLT5tc2dfaWQsIHBhY2stPm1zZ19pbmRleCwgTlVMTCwgMCk7CisgICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCBOVUxMLCAwKTsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBicmVhazsKQEAgLTU5MSw3ICs1OTIsNyBAQAogICAgICAgICAgICAgZWxzZSAgICAgLy8gU2V0CiAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgbWJ0a19jYWxsX2R0bWZfaW5mb190ICpyZWcgPSAobWJ0a19jYWxsX2R0bWZfaW5mb190ICopcGFjay0+ZGF0YTsKLSAgICAgICAgICAgICAgICBpZihyZXFfZHRtZl9zZXQoY2xpX2luZm8tPnBvcnQsIHJlZywgJmNtZV9lcnIpIHx8IGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pCisgICAgICAgICAgICAgICAgaWYocmVxX2R0bWZfc2V0KGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCByZWcsICZjbWVfZXJyKSB8fCBjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKQogICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgaWYoY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikgewogICAgICAgICAgICAgICAgICAgICAgICAgZXJyID0gTUJUS19SSUxfRVJSX0NNRSArIGNtZV9lcnI7CkBAIC02MDIsNyArNjAzLDcgQEAKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgcmlsX3JzcF9wYWNrX3NlbmQoY2xpX2luZm8tPnBvcnQsIGNsaV9pbmZvLT5mZCwgcGFjay0+bXNnX2lkLCBwYWNrLT5tc2dfaW5kZXgsIE5VTEwsIDApOworICAgICAgICAgICAgICAgICAgICByaWxfcnNwX3BhY2tfc2VuZChjbGlfaW5mby0+c2ltX2lkLCBjbGlfaW5mby0+cG9ydCwgY2xpX2luZm8tPmZkLCBwYWNrLT5tc2dfaWQsIHBhY2stPm1zZ19pbmRleCwgTlVMTCwgMCk7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogICAgICAgICAgICAgYnJlYWs7CkBAIC02MTIsNyArNjEzLDcgQEAKICAgICAgICAgICAgIGlmKHBhY2stPmRhdGFfbGVuID09IDAgfHwgcGFjay0+ZGF0YSA9PSBOVUxMKSAgIC8vIEdldCBWb0xURSBzdGF0ZS4KICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICBpbnQgc3RhdGU7Ci0gICAgICAgICAgICAgICAgaWYocmVxX2NlbnRyaWNfZ2V0KGNsaV9pbmZvLT5wb3J0LCAmc3RhdGUsICZjbWVfZXJyKSB8fCBjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKQorICAgICAgICAgICAgICAgIGlmKHJlcV9jZW50cmljX2dldChjbGlfaW5mby0+c2ltX2lkLCBjbGlfaW5mby0+cG9ydCwgJnN0YXRlLCAmY21lX2VycikgfHwgY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikKICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgIGlmKGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pIHsKICAgICAgICAgICAgICAgICAgICAgICAgIGVyciA9IE1CVEtfUklMX0VSUl9DTUUgKyBjbWVfZXJyOwpAQCAtNjIzLDcgKzYyNCw3IEBACiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCAmc3RhdGUsIHNpemVvZihpbnQpKTsKKyAgICAgICAgICAgICAgICAgICAgcmlsX3JzcF9wYWNrX3NlbmQoY2xpX2luZm8tPnNpbV9pZCwgY2xpX2luZm8tPnBvcnQsIGNsaV9pbmZvLT5mZCwgcGFjay0+bXNnX2lkLCBwYWNrLT5tc2dfaW5kZXgsICZzdGF0ZSwgc2l6ZW9mKGludCkpOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KICAgICAgICAgICAgIGVsc2UgICAgIC8vIFNldCBtdXRlIHN0YXRlLgpAQCAtNjM2LDcgKzYzNyw3IEBACiAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgIH0KIAotICAgICAgICAgICAgICAgIGlmKHJlcV9jZW50cmljX3NldChjbGlfaW5mby0+cG9ydCwgb24sICZjbWVfZXJyKSB8fCBjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKQorICAgICAgICAgICAgICAgIGlmKHJlcV9jZW50cmljX3NldChjbGlfaW5mby0+c2ltX2lkLCBjbGlfaW5mby0+cG9ydCwgb24sICZjbWVfZXJyKSB8fCBjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKQogICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgaWYoY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikgewogICAgICAgICAgICAgICAgICAgICAgICAgZXJyID0gTUJUS19SSUxfRVJSX0NNRSArIGNtZV9lcnI7CkBAIC02NDcsNyArNjQ4LDcgQEAKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgIHsKLS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X3N0YXJ0KHNpbV9pZCwgcG9ydCwgY2lkLCAmY21lX2VycikgfHwgY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikKICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMT0dFKCJSZXN0YXJ0IGRhdGEgY2FsbCBmYWlsLiIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKQEAgLTk3OCw3ICs5NzksNyBAQAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIEdldCBJcCBpbmZvcm1hdGlvbnMuCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gbWVtc2V0KCZpcF9pbmZvLCAwLCBzaXplb2YoaXBfaW5mbykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNtZV9lcnIgPSBNQlRLX1JJTF9FUlJfQ01FX05PTjsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZihyZXFfZGF0YV9jYWxsX3N0YXRlX2dldChwb3J0LCBjaWQsICYocGRwX2luZm8uaXBfaW5mbyksICZjbWVfZXJyKSB8fCBjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKHJlcV9kYXRhX2NhbGxfc3RhdGVfZ2V0KHNpbV9pZCwgcG9ydCwgY2lkLCAmKHBkcF9pbmZvLmlwX2luZm8pLCAmY21lX2VycikgfHwgY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExPR0UoIkdldCBuZXQgaW5mb3JtYXRpb25zIGZhaWwuIik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKQEAgLTEwMjAsMTAgKzEwMjEsMTAgQEAKIE9LCiAKICovCi1zdGF0aWMgaW50IHJlcV9hcG5fZ2V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VMTDsKICAgICBjaGFyIGNtZFs0MDBdID0gezB9OwpAQCAtMTEzNCw3ICsxMTM1LDcgQEAKICAgICAvLyBEZWxldGUgYXBuCiAgICAgaWYoc3RyX2VtcHR5KGFwbi0+YXBuKSkgewogICAgICAgICBzcHJpbnRmKGNtZCwgIkFUK0NHRENPTlQ9JWQiLCBhcG4tPmNpZCk7Ci0gICAgICAgIGVyciA9IGF0X3NlbmRfY29tbWFuZChwb3J0LCBjbWQsICZyZXNwb25zZSk7CisgICAgICAgIGVyciA9IGF0X3NlbmRfY29tbWFuZChwb3J0VHlwZV8yX3BvcnRJZChzaW1faWQsIHBvcnQpLCBjbWQsICZyZXNwb25zZSk7CiAgICAgICAgIGlmIChlcnIgPCAwIHx8IHJlc3BvbnNlLT5zdWNjZXNzID09IDApewogICAgICAgICAgICAgaWYoY21lX2VycikgewogICAgICAgICAgICAgICAgICpjbWVfZXJyID0gYXRfZ2V0X2NtZV9lcnJvcihyZXNwb25zZSk7CkBAIC0xMTY1LDcgKzExNjYsNyBAQAogICAgICAgICAgICAgaW5kZXggKz0gc3ByaW50ZihjbWQgKyBpbmRleCwiXCIlc1wiIiwgYXBuLT5hcG4pOwogICAgICAgICB9CiAKLSAgICAgICAgZXJyID0gYXRfc2VuZF9jb21tYW5kKHBvcnQsIGNtZCwgJnJlc3BvbnNlKTsKKyAgICAgICAgZXJyID0gYXRfc2VuZF9jb21tYW5kKHBvcnRUeXBlXzJfcG9ydElkKHNpbV9pZCwgcG9ydCksIGNtZCwgJnJlc3BvbnNlKTsKICAgICAgICAgaWYgKGVyciA8IDAgfHwgcmVzcG9uc2UtPnN1Y2Nlc3MgPT0gMCl7CiAgICAgICAgICAgICBpZihjbWVfZXJyKSB7CiAgICAgICAgICAgICAgICAgKmNtZV9lcnIgPSBhdF9nZXRfY21lX2Vycm9yKHJlc3BvbnNlKTsKQEAgLTExODksNyArMTE5MCw3IEBACiAgICAgICAgICAgICAgICAgZ290byBleGl0OwogCiAgICAgICAgICAgIC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YXRhX2NhbGxfc3RhdGVfY2hhbmdlX2NiKGludCBjaWQsIGJvb2wgYWN0aW9uLCBib29sIGF1dG9fY2hhbmdlLCBpbnQgcmVhc29uKQordm9pZCBkYXRhX2NhbGxfc3RhdGVfY2hhbmdlX2NiKG1idGtfc2ltX3R5cGVfZW51bSBzaW1faWQsIGludCBjaWQsIGJvb2wgYWN0aW9uLCBib29sIGF1dG9fY2hhbmdlLCBpbnQgcmVhc29uKQogewogICAgIC8vIFdpbGwgcmVzdGFydCBkYXRhIGNhbGwuCiAgICAgaWYoYXV0b19jaGFuZ2UgJiYgIWFjdGlvbikgewpAQCAtMTQ2Nyw3ICsxNDY4LDcgQEAKICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICBtYnRrX2Fwbl9pbmZvX2FycmF5X3QgYXBuczsKICAgICAgICAgICAgICAgICBtZW1zZXQoJmFwbnMsIDAsIHNpemVvZihtYnRrX2Fwbl9pbmZvX2FycmF5X3QpKTsKLSAgICAgICAgICAgICAgICBpZihyZXFfYXBuX2dldChjbGlfaW5mby0+cG9ydCwgRkFMU0UsICZhcG5zLCAmY21lX2VycikgfHwgY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikKKyAgICAgICAgICAgICAgICBpZihyZXFfYXBuX2dldChjbGlfaW5mby0+c2ltX2lkLCBjbGlfaW5mby0+cG9ydCwgRkFMU0UsICZhcG5zLCAmY21lX2VycikgfHwgY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikKICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgIGlmKGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pIHsKICAgICAgICAgICAgICAgICAgICAgICAgIGVyciA9IE1CVEtfUklMX0VSUl9DTUUgKyBjbWVfZXJyOwpAQCAtMTQ3OSwxOCArMTQ4MCwxOCBAQAogICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgIExPR0QoInNpemUgLSAlZCIsIHNpemVvZihtYnRrX2Fwbl9pbmZvX2FycmF5X3QpKTsKLSAgICAgICAgICAgICAgICAgICAgcmlsX3JzcF9wYWNrX3NlbmQoY2xpX2luZm8tPnBvcnQsIGNsaV9pbmZvLT5mZCwgcGFjay0+bXNnX2lkLCBwYWNrLT5tc2dfaW5kZXgsICZhcG5zLCBzaXplb2YobWJ0a19hcG5faW5mb19hcnJheV90KSk7CisgICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCAmYXBucywgc2l6ZW9mKG1idGtfYXBuX2luZm9fYXJyYXlfdCkpOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KICAgICAgICAgICAgIGVsc2UgICAgIC8vIFNldAogICAgICAgICAgICAgewogICAgICAgICAgICAgICAgIG1idGtfYXBuX2luZm9fdCAqYXBuID0gKG1idGtfYXBuX2luZm9fdCopcGFjay0+ZGF0YTsKICAgICAgICAgICAgICAgICBtYnRrX3JpbF9jaWRfZW51bSByZXR1cm5fY2lkID0gYXBuLT5jaWQ7Ci0gICAgICAgICAgICAgICAgaWYoYXBuX2NoZWNrX2FuZF9jaWRfcmVzZXQoY2xpX2luZm8tPnBvcnQsIGFwbikpIHsKKyAgICAgICAgICAgICAgICBpZihhcG5fY2hlY2tfYW5kX2NpZF9yZXNldChjbGlfaW5mby0+c2ltX2lkLCBjbGlfaW5mby0+cG9ydCwgYXBuKSkgewogICAgICAgICAgICAgICAgICAgICBlcnIgPSBNQlRLX1JJTF9FUlJfQ0lEOwogICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgIGlmKGFwbl9jb25mX3N1cHBvcnQoYXBuLT5jaWQpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZihyZXFfYXBuX3NldChjbGlfaW5mby0+cG9ydCwgYXBuLCAmY21lX2VycikgfHwgY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmKHJlcV9hcG5fc2V0KGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCBhcG4sICZjbWVfZXJyKSB8fCBjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKQogICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyID0gTUJUS19SSUxfRVJSX0NNRSArIGNtZV9lcnI7CkBAIC0xNTA2LDcgKzE1MDcsNyBAQAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybl9jaWQgPSBhcG4tPmNpZDsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICByaWxfcnNwX3BhY2tfc2VuZChjbGlfaW5mby0+cG9ydCwgY2xpX2luZm8tPmZkLCBwYWNrLT5tc2dfaWQsIHBhY2stPm1zZ19pbmRleCwgJnJldHVybl9jaWQsIHNpemVvZihtYnRrX3JpbF9jaWRfZW51bSkpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCAmcmV0dXJuX2NpZCwgc2l6ZW9mKG1idGtfcmlsX2NpZF9lbnVtKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBlcnIgPSBNQlRLX1JJTF9FUlJfVU5TVVBQT1JURUQ7CkBAIC0xNTU0LDcgKzE1NTUsNyBAQAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBpbmRleCA9IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5mb19saXN0W2NhbGxfaW5mby0+Y2lkIC0gMV0uYWN0X3N0YXRlID0gUklMX0FDVF9TVEFURV9DT05ORUNUSU5HOwogZGF0YV9jYWxsX3JldHJ5OgotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKHJlcV9kYXRhX2NhbGxfc3RhcnQoY2xpX2luZm8tPnBvcnQsIGNhbGxfaW5mby0+Y2lkLCAmY21lX2VycikgfHwgY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZihyZXFfZGF0YV9jYWxsX3N0YXJ0KGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCBjYWxsX2luZm8tPmNpZCwgJmNtZV9lcnIpIHx8IGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZihjYWxsX2luZm8tPnJldHJ5X2ludGVydmFsW2luZGV4XSA+IDApIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExPR0QoIlN0YXJ0IGRhdGEgY2FsbCBmYWlsLCB3aWxsIHJldHJ5IGluICVkIHMuIiwgY2FsbF9pbmZvLT5yZXRyeV9pbnRlcnZhbFtpbmRleF0pOwpAQCAtMTU4MCw3ICsxNTgxLDcgQEAKIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBHZXQgSXAgaW5mb3JtYXRpb25zLgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbWVfZXJyID0gTUJUS19SSUxfRVJSX0NNRV9OT047Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKHJlcV9kYXRhX2NhbGxfc3RhdGVfZ2V0KGNsaV9pbmZvLT5wb3J0LCBjYWxsX2luZm8tPmNpZCAsJmlwX2luZm8sICZjbWVfZXJyKSB8fCBjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZihyZXFfZGF0YV9jYWxsX3N0YXRlX2dldChjbGlfaW5mby0+c2ltX2lkLCBjbGlfaW5mby0+cG9ydCwgY2FsbF9pbmZvLT5jaWQgLCZpcF9pbmZvLCAmY21lX2VycikgfHwgY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTE9HRSgiR2V0IG5ldCBpbmZvcm1hdGlvbnMgZmFpbC4iKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVyciA9IE1CVEtfUklMX0VSUl9ORVRfQ09ORjsKQEAgLTE1OTksNyArMTYwMCw3IEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBEYXRhIGNhbGwgc3VjY2VzcywgdmFsaWQgd2lsbCBiZSB0cnVlLgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5mb19saXN0W2NhbGxfaW5mby0+Y2lkIC0gMV0udmFsaWQgPSBUUlVFOwogCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByaWxfcnNwX3BhY2tfc2VuZChjbGlfaW5mby0+cG9ydCwgY2xpX2luZm8tPmZkLCBwYWNrLT5tc2dfaWQsIHBhY2stPm1zZ19pbmRleCwgJmlwX2luZm8sIHNpemVvZihtYnRrX2lwX2luZm9fdCkpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmlsX3JzcF9wYWNrX3NlbmQoY2xpX2luZm8tPnNpbV9pZCwgY2xpX2luZm8tPnBvcnQsIGNsaV9pbmZvLT5mZCwgcGFjay0+bXNnX2lkLCBwYWNrLT5tc2dfaW5kZXgsICZpcF9pbmZvLCBzaXplb2YobWJ0a19pcF9pbmZvX3QpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgIH0KQEAgLTE2MTIsNyArMTYxMyw3IEBACiAgICAgICAgICAgICAgICAgICAgICAgICB9CiAKICAgICAgICAgICAgICAgICAgICAgICAgIGluZm9fbGlzdFtjYWxsX2luZm8tPmNpZCAtIDFdLmFjdF9zdGF0ZSA9IFJJTF9BQ1RfU1RBVEVfRElTQ09OTkVDVElORzsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmKHJlcV9kYXRhX2NhbGxfc3RvcChjbGlfaW5mby0+cG9ydCwgY2FsbF9pbmZvLT5jaWQsIGNhbGxfaW5mby0+dGltZW91dCwgJmNtZV9lcnIpIHx8IGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pCisgICAgICAgICAgICAgICAgICAgICAgICBpZihyZXFfZGF0YV9jYWxsX3N0b3AoY2xpX2luZm8tPnNpbV9pZCwgY2xpX2luZm8tPnBvcnQsIGNhbGxfaW5mby0+Y2lkLCBjYWxsX2luZm8tPnRpbWVvdXQsICZjbWVfZXJyKSB8fCBjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKQogICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyID0gTUJUS19SSUxfRVJSX0NNRSArIGNtZV9lcnI7CkBAIC0xNjM2LDEyICsxNjM3LDEyIEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5mb19saXN0W2NhbGxfaW5mby0+Y2lkIC0gMV0uYWN0X3N0YXRlID0gUklMX0FDVF9TVEFURV9ESVNDT05ORUNURUQ7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmlsX3JzcF9wYWNrX3NlbmQoY2xpX2luZm8tPnBvcnQsIGNsaV9pbmZvLT5mZCwgcGFjay0+bXNnX2lkLCBwYWNrLT5tc2dfaW5kZXgsIE5VTEwsIDApOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCBOVUxMLCAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgIG1idGtfaXBfaW5mb190IGlwX2luZm87CiAgICAgICAgICAgICAgICAgICAgICAgICBtZW1zZXQoJmlwX2luZm8sIDAsIHNpemVvZihpcF9pbmZvKSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZihyZXFfZGF0YV9jYWxsX3N0YXRlX2dldChjbGlfaW5mby0+cG9ydCwgY2FsbF9pbmZvLT5jaWQgLCZpcF9pbmZvLCAmY21lX2VycikgfHwgY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmKHJlcV9kYXRhX2NhbGxfc3RhdGVfZ2V0KGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCBjYWxsX2luZm8tPmNpZCAsJmlwX2luZm8sICZjbWVfZXJyKSB8fCBjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKQogICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyID0gTUJUS19SSUxfRVJSX0NNRSArIGNtZV9lcnI7CkBAIC0xNjUyLDcgKzE2NTMsNyBAQAogICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCAmaXBfaW5mbywgc2l6ZW9mKG1idGtfaXBfaW5mb190KSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmlsX3JzcF9wYWNrX3NlbmQoY2xpX2luZm8tPnNpbV9pZCwgY2xpX2luZm8tPnBvcnQsIGNsaV9pbmZvLT5mZCwgcGFjay0+bXNnX2lkLCBwYWNrLT5tc2dfaW5kZXgsICZpcF9pbmZvLCBzaXplb2YobWJ0a19pcF9pbmZvX3QpKTsKICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIH0KZGlmZiAtLWdpdCBhL21idGsvbWJ0a19yaWxkX3YyL3NyYy9yaWxfZGV2LmMgYi9tYnRrL21idGtfcmlsZF92Mi9zcmMvcmlsX2Rldi5jCmluZGV4IDc2M2VkNDEuLmQzNDE0M2UgMTAwNzU1Ci0tLSBhL21idGsvbWJ0a19yaWxkX3YyL3NyYy9yaWxfZGV2LmMKKysrIGIvbWJ0ay9tYnRrX3JpbGRfdjIvc3JjL3JpbF9kZXYuYwpAQCAtMTcsNyArMTcsOCBAQAogI2luY2x1ZGUgIm1idGtfdXRpbHMuaCIKICNpbmNsdWRlICJyaW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ICAgICAgICAgICBpZihyZXFfaW1laV9nZXQoY2xpX2luZm8tPnBvcnQsIGltZWksICZjbWVfZXJyKSB8fCBzdHJsZW4oaW1laSkgPT0gMCB8fCBjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKQorICAgICAgICAgICAgICAgIGlmKHJlcV9pbWVpX2dldChjbGlfaW5mby0+c2ltX2lkLCBjbGlfaW5mby0+cG9ydCwgaW1laSwgJmNtZV9lcnIpIHx8IHN0cmxlbihpbWVpKSA9PSAwIHx8IGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pCiAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICBpZihjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBlcnIgPSBNQlRLX1JJTF9FUlJfQ01FICsgY21lX2VycjsKQEAgLTU1Miw3ICs1NTMsNyBAQAogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICByaWxfcnNwX3BhY2tfc2VuZChjbGlfaW5mby0+cG9ydCwgY2xpX2luZm8tPmZkLCBwYWNrLT5tc2dfaWQsIHBhY2stPm1zZ19pbmRleCwgaW1laSwgc3RybGVuKGltZWkpKTsKKyAgICAgICAgICAgICAgICAgICAgcmlsX3JzcF9wYWNrX3NlbmQoY2xpX2luZm8tPnNpbV9pZCwgY2xpX2luZm8tPnBvcnQsIGNsaV9pbmZvLT5mZCwgcGFjay0+bXNnX2lkLCBwYWNrLT5tc2dfaW5kZXgsIGltZWksIHN0cmxlbihpbWVpKSk7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogICAgICAgICAgICAgZWxzZSAgICAgLy8gU2V0IElNRUkoVW5zdXBwb3J0KS4KQEAgLTU2Nyw3ICs1NjgsNyBAQAogICAgICAgICAgICAgaWYocGFjay0+ZGF0YV9sZW4gPT0gMCB8fCBwYWNrLT5kYXRhID09IE5VTEwpCiAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgY2hhciBzblsyMF0gPSB7MH07Ci0gICAgICAgICAgICAgICAgaWYocmVxX3NuX2dldChjbGlfaW5mby0+cG9ydCwgc24sICZjbWVfZXJyKSB8fCBzdHJsZW4oc24pID09IDAgfHwgY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikKKyAgICAgICAgICAgICAgICBpZihyZXFfc25fZ2V0KGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCBzbiwgJmNtZV9lcnIpIHx8IHN0cmxlbihzbikgPT0gMCB8fCBjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKQogICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgaWYoY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikgewogICAgICAgICAgICAgICAgICAgICAgICAgZXJyID0gTUJUS19SSUxfRVJSX0NNRSArIGNtZV9lcnI7CkBAIC01NzgsNyArNTc5LDcgQEAKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgcmlsX3JzcF9wYWNrX3NlbmQoY2xpX2luZm8tPnBvcnQsIGNsaV9pbmZvLT5mZCwgcGFjay0+bXNnX2lkLCBwYWNrLT5tc2dfaW5kZXgsIHNuLCBzdHJsZW4oc24pKTsKKyAgICAgICAgICAgICAgICAgICAgcmlsX3JzcF9wYWNrX3NlbmQoY2xpX2luZm8tPnNpbV9pZCwgY2xpX2luZm8tPnBvcnQsIGNsaV9pbmZvLT5mZCwgcGFjay0+bXNnX2lkLCBwYWNrLT5tc2dfaW5kZXgsIHNuLCBzdHJsZW4oc24pKTsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBlbHNlICAgICAvLyBTZXQKQEAgLTYwNyw3ICs2MDgsNyBAQAogICAgICAgICAgICAgaWYocGFjay0+ZGF0YV9sZW4gPT0gMCB8fCBwYWNrLT5kYXRhID09IE5VTEwpCiAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgY2hhciB2ZXJzaW9uWzUwXSA9IHswfTsKLSAgICAgICAgICAgICAgICBpZihyZXFfdmVyc2lvbl9nZXQoY2xpX2luZm8tPnBvcnQsIHZlcnNpb24sICZjbWVfZXJyKSB8fCBzdHJsZW4odmVyc2lvbikgPT0gMCB8fCBjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKQorICAgICAgICAgICAgICAgIGlmKHJlcV92ZXJzaW9uX2dldChjbGlfaW5mby0+c2ltX2lkLCBjbGlfaW5mby0+cG9ydCwgdmVyc2lvbiwgJmNtZV9lcnIpIHx8IHN0cmxlbih2ZXJzaW9uKSA9PSAwIHx8IGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pCiAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICBpZihjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBlcnIgPSBNQlRLX1JJTF9FUlJfQ01FICsgY21lX2VycjsKQEAgLTYxOCw3ICs2MTksNyBAQAogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICByaWxfcnNwX3BhY2tfc2VuZChjbGlfaW5mby0+cG9ydCwgY2xpX2luZm8tPmZkLCBwYWNrLT5tc2dfaWQsIHBhY2stPm1zZ19pbmRleCwgdmVyc2lvbiwgc3RybGVuKHZlcnNpb24pKTsKKyAgICAgICAgICAgICAgICAgICAgcmlsX3JzcF9wYWNrX3NlbmQoY2xpX2luZm8tPnNpbV9pZCwgY2xpX2luZm8tPnBvcnQsIGNsaV9pbmZvLT5mZCwgcGFjay0+bXNnX2lkLCBwYWNrLT5tc2dfaW5kZXgsIHZlcnNpb24sIHN0cmxlbih2ZXJzaW9uKSk7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogICAgICAgICAgICAgZWxzZSAgICAgLy8gU2V0CkBAIC02MzMsNyArNjM0LDcgQEAKICAgICAgICAgICAgIGlmKHBhY2stPmRhdGFfbGVuID09IDAgfHwgcGFjay0+ZGF0YSA9PSBOVUxMKQogICAgICAgICAgICAgewogICAgICAgICAgICAgICAgIGNoYXIgbW9kZWxbNTBdID0gezB9OwotICAgICAgICAgICAgICAgIGlmKHJlcV9tb2RlbF9nZXQoY2xpX2luZm8tPnBvcnQsIG1vZGVsLCAmY21lX2VycikgfHwgc3RybGVuKG1vZGVsKSA9PSAwIHx8IGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pCisgICAgICAgICAgICAgICAgaWYocmVxX21vZGVsX2dldChjbGlfaW5mby0+c2ltX2lkLCBjbGlfaW5mby0+cG9ydCwgbW9kZWwsICZjbWVfZXJyKSB8fCBzdHJsZW4obW9kZWwpID09IDAgfHwgY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikKICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgIGlmKGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pIHsKICAgICAgICAgICAgICAgICAgICAgICAgIGVyciA9IE1CVEtfUklMX0VSUl9DTUUgKyBjbWVfZXJyOwpAQCAtNjQ0LDcgKzY0NSw3IEBACiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCBtb2RlbCwgc3RybGVuKG1vZGVsKSk7CisgICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCBtb2RlbCwgc3RybGVuKG1vZGVsKSk7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogICAgICAgICAgICAgZWxzZSAgICAgLy8gU2V0CkBAIC02NTksNyArNjYwLDcgQEAKICAgICAgICAgICAgIGlmKHBhY2stPmRhdGFfbGVuID09IDAgfHwgcGFjay0+ZGF0YSA9PSBOVUxMKSAgIC8vIEdldCBWb0xURSBzdGF0ZS4KICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICBpbnQgc3RhdGU7Ci0gICAgICAgICAgICAgICAgaWYocmVxX3ZvbHRlX2dldChjbGlfaW5mby0+cG9ydCwgJnN0YXRlLCAmY21lX2VycikgfHwgY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikKKyAgICAgICAgICAgICAgICBpZihyZXFfdm9sdGVfZ2V0KGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCAmc3RhdGUsICZjbWVfZXJyKSB8fCBjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKQogICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgaWYoY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikgewogICAgICAgICAgICAgICAgICAgICAgICAgZXJyID0gTUJUS19SSUxfRVJSX0NNRSArIGNtZV9lcnI7CkBAIC02NzAsNyArNjcxLDcgQEAKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgcmlsX3JzcF9wYWNrX3NlbmQoY2xpX2luZm8tPnBvcnQsIGNsaV9pbmZvLT5mZCwgcGFjay0+bXNnX2lkLCBwYWNrLT5tc2dfaW5kZXgsICZzdGF0ZSwgc2l6ZW9mKHVpbnQ4KSk7CisgICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCAmc3RhdGUsIHNpemVvZih1aW50OCkpOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KICAgICAgICAgICAgIGVsc2UgICAgIC8vIFNldCBWb0xURSBzdGF0ZS4KQEAgLTY4NCw3ICs2ODUsNyBAQAogICAgICAgICAgICAgICAgIH0KIAogICAgICAgICAgICAgICAgIHVpbnQ4IG9uID0gKihwYWNrLT5kYXRhKTsKLSAgICAgICAgICAgICAgICBpZihyZXFfdm9sdGVfc2V0KGNsaV9pbmZvLT5wb3J0LCBvbiwgJmNtZV9lcnIpIHx8IGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pCisgICAgICAgICAgICAgICAgaWYocmVxX3ZvbHRlX3NldChjbGlfaW5mby0+c2ltX2lkLCBjbGlfaW5mby0+cG9ydCwgb24sICZjbWVfZXJyKSB8fCBjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKQogICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgaWYoY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikgewogICAgICAgICAgICAgICAgICAgICAgICAgZXJyID0gTUJUS19SSUxfRVJSX0NNRSArIGNtZV9lcnI7CkBAIC02OTUsNyArNjk2LDcgQEAKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgcmlsX3JzcF9wYWNrX3NlbmQoY2xpX2luZm8tPnBvcnQsIGNsaV9pbmZvLT5mZCwgcGFjay0+bXNnX2l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TcxOSw3ICs3MjAsNyBAQAogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICByaWxfcnNwX3BhY2tfc2VuZChjbGlfaW5mby0+cG9ydCwgY2xpX2luZm8tPmZkLCBwYWNrLT5tc2dfaWQsIHBhY2stPm1zZ19pbmRleCwgJnRlbXAsIHNpemVvZihpbnQxNikpOworICAgICAgICAgICAgICAgICAgICByaWxfcnNwX3BhY2tfc2VuZChjbGlfaW5mby0+c2ltX2lkLCBjbGlfaW5mby0+cG9ydCwgY2xpX2luZm8tPmZkLCBwYWNrLT5tc2dfaWQsIHBhY2stPm1zZ19pbmRleCwgJnRlbXAsIHNpemVvZihpbnQxNikpOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgZXJyID0gTUJUS19SSUxfRVJSX1VOU1VQUE9SVEVEOwpAQCAtNzMyLDcgKzczMyw3IEBACiAgICAgICAgICAgICBpZihwYWNrLT5kYXRhX2xlbiA9PSAwIHx8IHBhY2stPmRhdGEgPT0gTlVMTCkgICAvLyBHZXQgVGltZQogICAgICAgICAgICAgewogICAgICAgICAgICAgICAgIGNoYXIgdGltZVsxMDBdID0gezB9OwotICAgICAgICAgICAgICAgIGlmKHJlcV9jZWxsX3RpbWVfZ2V0KGNsaV9pbmZvLT5wb3J0LCB0aW1lLCAmY21lX2VycikgfHwgc3RybGVuKHRpbWUpID09IDAgfHwgY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikKKyAgICAgICAgICAgICAgICBpZihyZXFfY2VsbF90aW1lX2dldChjbGlfaW5mby0+c2ltX2lkLCBjbGlfaW5mby0+cG9ydCwgdGltZSwgJmNtZV9lcnIpIHx8IHN0cmxlbih0aW1lKSA9PSAwIHx8IGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pCiAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICBpZihjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBlcnIgPSBNQlRLX1JJTF9FUlJfQ01FICsgY21lX2VycjsKQEAgLTc0Myw3ICs3NDQsNyBAQAogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICByaWxfcnNwX3BhY2tfc2VuZChjbGlfaW5mby0+cG9ydCwgY2xpX2luZm8tPmZkLCBwYWNrLT5tc2dfaWQsIHBhY2stPm1zZ19pbmRleCwgdGltZSwgc3RybGVuKHRpbWUpKTsKKyAgICAgICAgICAgICAgICAgICAgcmlsX3JzcF9wYWNrX3NlbmQoY2xpX2luZm8tPnNpbV9pZCwgY2xpX2luZm8tPnBvcnQsIGNsaV9pbmZvLT5mZCwgcGFjay0+bXNnX2lkLCBwYWNrLT5tc2dfaW5kZXgsIHRpbWUsIHN0cmxlbih0aW1lKSk7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogICAgICAgICAgICAgZWxzZSAgICAgLy8gU2V0IFRpbWUKQEAgLTc1Nyw3ICs3NTgsNyBAQAogICAgICAgICB7CiAgICAgICAgICAgICBpZihwYWNrLT5kYXRhX2xlbiA9PSAwIHx8IHBhY2stPmRhdGEgPT0gTlVMTCkKICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICBtYnRrX3JhZGlvX3N0YXRlX2VudW0gcmFkaW9fc3RhdGUgPSByaWxfcmFkaW9fc3RhdGVfZ2V0KGNsaV9pbmZvLT5wb3J0KTsKKyAgICAgICAgICAgICAgICBtYnRrX3JhZGlvX3N0YXRlX2VudW0gcmFkaW9fc3RhdGUgPSByaWxfcmFkaW9fc3RhdGVfZ2V0KGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0KTsKICAgICAgICAgICAgICAgICBpZihyYWRpb19zdGF0ZSA9PSBNQlRLX1JBRElPX1NUQVRFX1VOS05PV04pCiAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICBlcnIgPSBNQlRLX1JJTF9FUlJfVU5LTk9XTjsKQEAgLTc2NSw3ICs3NjYsNyBAQAogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICByaWxfcnNwX3BhY2tfc2VuZChjbGlfaW5mby0+cG9ydCwgY2xpX2luZm8tPmZkLCBwYWNrLT5tc2dfaWQsIHBhY2stPm1zZ19pbmRleCwgJnJhZGlvX3N0YXRlLCBzaXplb2YodWludDgpKTsKKyAgICAgICAgICAgICAgICAgICAgcmlsX3JzcF9wYWNrX3NlbmQoY2xpX2luZm8tPnNpbV9pZCwgY2xpX2luZm8tPnBvcnQsIGNsaV9pbmZvLT5mZCwgcGFjay0+bXNnX2lkLCBwYWNrLT5tc2dfaW5kZXgsICZyYWRpb19zdGF0ZSwgc2l6ZW9mKHVpbnQ4KSk7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogICAgICAgICAgICAgZWxzZSAgICAgLy8gU2V0CkBAIC03NzQsOSArNzc1LDkgQEAKICAgICAgICAgICAgICAgICBpZihwYWNrLT5kYXRhICYmIHBhY2stPmRhdGFfbGVuID09IDIpIHsKICAgICAgICAgICAgICAgICAgICAgbWJ0a19yYWRpb19zdGF0ZV9lbnVtIHJhZGlvX3N0YXRlID0gKG1idGtfcmFkaW9fc3RhdGVfZW51bSkoKihwYWNrLT5kYXRhKSk7CiAgICAgICAgICAgICAgICAgICAgIGJvb2wgcmVzZXQgPSAqKHBhY2stPmRhdGEgKyAxKTsKLSAgICAgICAgICAgICAgICAgICAgZXJyID0gcmlsX3JhZGlvX3N0YXRlX3NldChjbGlfaW5mby0+cG9ydCwgcmFkaW9fc3RhdGUsIHJlc2V0KTsKKyAgICAgICAgICAgICAgICAgICAgZXJyID0gcmlsX3JhZGlvX3N0YXRlX3NldChjbGlfaW5mby0+c2ltX2lkLCBjbGlfaW5mby0+cG9ydCwgcmFkaW9fc3RhdGUsIHJlc2V0KTsKICAgICAgICAgICAgICAgICAgICAgaWYoTUJUS19SSUxfRVJSX1NVQ0NFU1MgPT0gZXJyKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICByaWxfcnNwX3BhY2tfc2VuZChjbGlfaW5mby0+cG9ydCwgY2xpX2luZm8tPmZkLCBwYWNrLT5tc2dfaWQsIHBhY2stPm1zZ19pbmRleCwgTlVMTCwgMCk7CisgICAgICAgICAgICAgICAgICAgICAgICByaWxfcnNwX3BhY2tfc2VuZChjbGlfaW5mby0+c2ltX2lkLCBjbGlfaW5mby0+cG9ydCwgY2xpX2luZm8tPmZkLCBwYWNrLT5tc2dfaWQsIHBhY2stPm1zZ19pbmRleCwgTlVMTCwgMCk7CiAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICBlcnIgPSBNQlRLX1JJTF9FUlJfRk9STUFUOwpAQCAtNzk0LDcgKzc5NSw3IEBACiAgICAgICAgICAgICBlbHNlICAgICAvLyBTZXQgcG93ZXJpbmQgc3RhdGUuCiAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgdWludDggc3RhdGUgPSAqKHBhY2stPmRhdGEpOwotICAgICAgICAgICAgICAgIGlmKHJlcV9wb3dlcmluZF9zZXQoY2xpX2luZm8tPnBvcnQsIHN0YXRlLCAmY21lX2VycikgfHwgY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikKKyAgICAgICAgICAgICAgICBpZihyZXFfcG93ZXJpbmRfc2V0KGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCBzdGF0ZSwgJmNtZV9lcnIpIHx8IGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pCiAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICBpZihjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBlcnIgPSBNQlRLX1JJTF9FUlJfQ01FICsgY21lX2VycjsKQEAgLTgwNiw3ICs4MDcsNyBAQAogICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgIC8vIHBhY2tfcnNwX3NlbmQoY2xpX2luZm8tPmZkLCBNQlRLX0lORk9fSURfV0FLRVVQX1NUQV9SU1AsIE5VTEwsIDApOwotICAgICAgICAgICAgICAgICAgICByaWxfcnNwX3BhY2tfc2VuZChjbGlfaW5mby0+cG9ydCwgY2xpX2luZm8tPmZkLCBwYWNrLT5tc2dfaWQsIHBhY2stPm1zZ19pbmRleCwgTlVMTCwgMCk7CisgICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCBOVUxMLCAwKTsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBicmVhazsKQEAgLTgxNiw3ICs4MTcsNyBAQAogICAgICAgICAgICAgICAgIGlmKHBhY2stPmRhdGFfbGVuID09IDAgfHwgcGFjay0+ZGF0YSA9PSBOVUxMKSAgIC8vIEdldCBWRVJTSU9OCiAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICBjaGFyIHZlcnNpb25bNTBdID0gezB9OwotICAgICAgICAgICAgICAgICAgICBpZihyZXFfbWRfdmVyc2lvbl9nZXQoY2xpX2luZm8tPnBvcnQsdmVyc2lvbiwgJmNtZV9lcnIpIHx8IHN0cmxlbih2ZXJzaW9uKSA9PSAwIHx8IGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pCisgICAgICAgICAgICAgICAgICAgIGlmKHJlcV9tZF92ZXJzaW9uX2dldChjbGlfaW5mby0+c2ltX2lkLCBjbGlfaW5mby0+cG9ydCx2ZXJzaW9uLCAmY21lX2VycikgfHwgc3RybGVuKHZlcnNpb24pID09IDAgfHwgY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikKICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgaWYoY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVyciA9IE1CVEtfUklMX0VSUl9DTUUgKyBjbWVfZXJyOwpAQCAtODI3LDcgKzgyOCw3IEBACiAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICByaWxfcnNwX3BhY2tfc2VuZChjbGlfaW5mby0+cG9ydCwgY2xpX2luZm8tPmZkLCBwYWNrLT5tc2dfaWQsIHBhY2stPm1zZ19pbmRleCwgdmVyc2lvbiwgc3RybGVuKChjaGFyKil2ZXJzaW9uKSk7CisgICAgICAgICAgICAgICAgICAgICAgICByaWxfcnNwX3BhY2tfc2VuZChjbGlfaW5mby0+c2ltX2lkLCBjbGlfaW5mby0+cG9ydCwgY2xpX2luZm8tPmZkLCBwYWNrLT5tc2dfaWQsIHBhY2stPm1zZ19pbmRleCwgdmVyc2lvbiwgc3RybGVuKChjaGFyKil2ZXJzaW9uKSk7CiAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgYnJlYWs7CmRpZmYgLS1naXQgYS9tYnRrL21idGtfcmlsZF92Mi9zcmMvcmlsX2VjYWxsLmMgYi9tYnRrL21idGtfcmlsZF92Mi9zcmMvcmlsX2VjYWxsLmMKaW5kZXggYWU4ZGNkNy4uM2ExM2I2MSAxMDA3NTU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klMX0VSUl9DTUVfTk9OKQorICAgICAgICAgICAgICAgIGlmKHJlcV9lY2FsbF9tc2RjZmcoY2xpX2luZm8tPnNpbV9pZCwgY2xpX2luZm8tPnBvcnQsIGNmZ19pbmZvLCAmY21lX2VycikgfHwgY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikKICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgIGlmKGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pIHsKICAgICAgICAgICAgICAgICAgICAgICAgIGVyciA9IE1CVEtfUklMX0VSUl9DTUUgKyBjbWVfZXJyOwpAQCAtOTEwLDcgKzkxMiw3IEBACiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCBOVUxMLCAwKTsKKyAgICAgICAgICAgICAgICAgICAgcmlsX3JzcF9wYWNrX3NlbmQoY2xpX2luZm8tPnNpbV9pZCwgY2xpX2luZm8tPnBvcnQsIGNsaV9pbmZvLT5mZCwgcGFjay0+bXNnX2lkLCBwYWNrLT5tc2dfaW5kZXgsIE5VTEwsIDApOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KICAgICAgICAgICAgIGJyZWFrOwpAQCAtOTE5LDcgKzkyMSw3IEBACiAgICAgICAgIHsKICAgICAgICAgICAgIGlmKHBhY2stPmRhdGFfbGVuID09IDAgfHwgcGFjay0+ZGF0YSA9PSBOVUxMKQogICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIGlmKHJlcV9lY2FsbF9tc2RnZW4oY2xpX2luZm8tPnBvcnQsICZjbWVfZXJyKSB8fCBjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKQorICAgICAgICAgICAgICAgIGlmKHJlcV9lY2FsbF9tc2RnZW4oY2xpX2luZm8tPnNpbV9pZCwgY2xpX2luZm8tPnBvcnQsICZjbWVfZXJyKSB8fCBjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKQogICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgaWYoY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikgewogICAgICAgICAgICAgICAgICAgICAgICAgZXJyID0gTUJUS19SSUxfRVJSX0NNRSArIGNtZV9lcnI7CkBAIC05MzAsNyArOTMyLDcgQEAKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgcmlsX3JzcF9wYWNrX3NlbmQoY2xpX2luZm8tPnBvcnQsIGNsaV9pbmZvLT5mZCwgcGFjay0+bXNnX2lkLCBwYWNrLT5tc2dfaW5kZXgsIE5VTEwsIDApOworICAgICAgICAgICAgICAgICAgICByaWxfcnNwX3BhY2tfc2VuZChjbGlfaW5mby0+c2ltX2lkLCBjbGlfaW5mby0+cG9ydCwgY2xpX2luZm8tPmZkLCBwYWNrLT5tc2dfaWQsIHBhY2stPm1zZ19pbmRleCwgTlVMTCwgMCk7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogICAgICAgICAgICAgZWxzZSAgICAgLy8gU2V0CkBAIC05NDUsNyArOTQ3LDcgQEAKICAgICAgICAgICAgIG1lbXNldChtc2QsIDAsIHNpemVvZihtc2QpKTsKICAgICAgICAgICAgIGlmKHBhY2stPmRhdGFfbGVuID09IDAgfHwgcGFjay0+ZGF0YSA9PSBOVUxMKQogICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIGlmKHJlcV9lY2FsbF9tc2RfZ2V0KGNsaV9pbmZvLT5wb3J0LCBtc2QsICZjbWVfZXJyKSB8fCBjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKQorICAgICAgICAgICAgICAgIGlmKHJlcV9lY2FsbF9tc2RfZ2V0KGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCBtc2QsICZjbWVfZXJyKSB8fCBjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKQogICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgaWYoY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikgewogICAgICAgICAgICAgICAgICAgICAgICAgZXJyID0gTUJUS19SSUxfRVJSX0NNRSArIGNtZV9lcnI7CkBAIC05NTYsMTMgKzk1OCwxMyBAQAogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICByaWxfcnNwX3BhY2tfc2VuZChjbGlfaW5mby0+cG9ydCwgY2xpX2luZm8tPmZkLCBwYWNrLT5tc2dfaWQsIHBhY2stPm1zZ19pbmRleCwgbXNkLCBzdHJsZW4oKGNoYXIqKW1zZCkpOworICAgICAgICAgICAgICAgICAgICByaWxfcnNwX3BhY2tfc2VuZChjbGlfaW5mby0+c2ltX2lkLCBjbGlfaW5mby0+cG9ydCwgY2xpX2luZm8tPmZkLCBwYWNrLT5tc2dfaWQsIHBhY2stPm1zZ19pbmRleCwgbXNkLCBzdHJsZW4oKGNoYXIqKW1zZCkpOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KICAgICAgICAgICAgIGVsc2UgICAgIC8vIFNldAogICAgICAgICAgICAgewogICAgICAgICAgICAgICAgIG1lbWNweShtc2QsIHBhY2stPmRhdGEsIHBhY2stPmRhdGFfbGVuKTsKLSAgICAgICAgICAgICAgICBpZihyZXFfZWNhbGxfbXNkX3NldChjbGlfaW5mby0+cG9ydCwgbXNkLCAmY21lX2VycikgfHwgY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikKKyAgICAgICAgICAgICAgICBpZihyZXFfZWNhbGxfbXNkX3NldChjbGlfaW5mby0+c2ltX2lkLCBjbGlfaW5mby0+cG9ydCwgbXNkLCAmY21lX2VycikgfHwgY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikKICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgIGlmKGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pIHsKICAgICAgICAgICAgICAgICAgICAgICAgIGVyciA9IE1CVEtfUklMX0VSUl9DTUUgKyBjbWVfZXJyOwpAQCAtOTczLDcgKzk3NSw3IEBACiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCBOVUxMLCAwKTsKKyAgICAgICAgICAgICAgICAgICAgcmlsX3JzcF9wYWNrX3NlbmQoY2xpX2luZm8tPnNpbV9pZCwgY2xpX2luZm8tPnBvcnQsIGNsaV9pbmZvLT5mZCwgcGFjay0+bXNnX2lkLCBwYWNrLT5tc2dfaW5kZXgsIE5VTEwsIDApOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KICAgICAgICAgICAgIGJyZWFrOwpAQCAtOTgyLDcgKzk4NCw3IEBACiAgICAgICAgIHsKICAgICAgICAgICAgIGlmKHBhY2stPmRhdGFfbGVuID09IDAgfHwgcGFjay0+ZGF0YSA9PSBOVUxMKQogICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIGlmKHJlcV9lY2FsbF9wdXNoKGNsaV9pbmZvLT5wb3J0LCAmY21lX2VycikgfHwgY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikKKyAgICAgICAgICAgICAgICBpZihyZXFfZWNhbGxfcHVzaChjbGlfaW5mby0+c2ltX2lkLCBjbGlfaW5mby0+cG9ydCwgJmNtZV9lcnIpIHx8IGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pCiAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICBpZihjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBlcnIgPSBNQlRLX1JJTF9FUlJfQ01FICsgY21lX2VycjsKQEAgLTk5Myw3ICs5OTUsNyBAQAogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICByaWxfcnNwX3BhY2tfc2VuZChjbGlfaW5mby0+cG9ydCwgY2xpX2luZm8tPmZkLCBwYWNrLT5tc2dfaWQsIHBhY2stPm1zZ19pbmRleCwgTlVMTCwgMCk7CisgICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCBOVUxMLCAwKTsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBlbHNlICAgICAvLyBTZXQKQEAgLTEwMDgsNyArMTAxMCw3IEBACiAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgbWJ0a19lY2FsbF9vbmx5X2luZm9fdCBvbmx5X2luZm87CiAgICAgICAgICAgICAgICAgbWVtc2V0KCZvbmx5X2luZm8sIDAsIHNpemVvZihtYnRrX2VjYWxsX29ubHlfaW5mb190KSk7Ci0gICAgICAgICAgICAgICAgaWYocmVxX2VjYWxsX29ubHlfZ2V0KGNsaV9pbmZvLT5wb3J0LCAmb25seV9pbmZvLCAmY21lX2VycikgfHwgY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikKKyAgICAgICAgICAgICAgICBpZihyZXFfZWNhbGxfb25seV9nZXQoY2xpX2luZm8tPnNpbV9pZCwgY2xpX2luZm8tPnBvcnQsICZvbmx5X2luZm8sICZjbWVfZXJyKSB8fCBjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKQogICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgaWYoY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikgewogICAgICAgICAgICAgICAgICAgICAgICAgZXJyID0gTUJUS19SSUxfRVJSX0NNRSArIGNtZV9lcnI7CkBAIC0xMDE5LDEzICsxMDIxLDEzIEBACiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCAmb25seV9pbmZvLCBzaXplb2YobWJ0a19lY2FsbF9vbmx5X2luZm9fdCkpOworICAgICAgICAgICAgICAgICAgICByaWxfcnNwX3BhY2tfc2VuZChjbGlfaW5mby0+c2ltX2lkLCBjbGlfaW5mby0+cG9ydCwgY2xpX2luZm8tPmZkLCBwYWNrLT5tc2dfaWQsIHBhY2stPm1zZ19pbmRleCwgJm9ubHlfaW5mbywgc2l6ZW9mKG1idGtfZWNhbGxfb25seV9pbmZvX3QpKTsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBlbHNlICAgICAvLyBTZXQKICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICBtYnRrX2VjYWxsX29ubHlfaW5mb190ICpvbmx5X2luZm8gPSAobWJ0a19lY2FsbF9vbmx5X2luZm9fdCopKHBhY2stPmRhdGEpOwotICAgICAgICAgICAgICAgIGlmKHJlcV9lY2FsbF9vbmx5X3NldChjbGlfaW5mby0+cG9ydCwgb25seV9pbmZvLCAmY21lX2VycikgfHwgY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikKKyAgICAgICAgICAgICAgICBpZihyZXFfZWNhbGxfb25seV9zZXQoY2xpX2luZm8tPnNpbV9pZCwgY2xpX2luZm8tPnBvcnQsIG9ubHlfaW5mbywgJmNtZV9lcnIpIHx8IGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pCiAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICBpZihjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBlcnIgPSBNQlRLX1JJTF9FUlJfQ01FICsgY21lX2VycjsKQEAgLTEwMzYsNyArMTAzOCw3IEBACiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCBOVUxMLCAwKTsKKyAgICAgICAgICAgICAgICAgICAgcmlsX3JzcF9wYWNrX3NlbmQoY2xpX2luZm8tPnNpbV9pZCwgY2xpX2luZm8tPnBvcnQsIGNsaV9pbmZvLT5mZCwgcGFjay0+bXNnX2lkLCBwYWNrLT5tc2dfaW5kZXgsIE5VTEwsIDApOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KICAgICAgICAgICAgIGJyZWFrOwpAQCAtMTA1MCw3ICsxMDUyLDcgQEAKICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICB1aW50OCByZWcgPSBwYWNrLT5kYXRhWzBdOwotICAgICAgICAgICAgICAgIGlmKHJlcV9lY2FsbF9yZWdfc2V0KGNsaV9pbmZvLT5wb3J0LCByZWcsICZjbWVfZXJyKSB8fCBjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKQorICAgICAgICAgICAgICAgIGlmKHJlcV9lY2FsbF9yZWdfc2V0KGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCByZWcsICZjbWVfZXJyKSB8fCBjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKQogICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgaWYoY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikgewogICAgICAgICAgICAgICAgICAgICAgICAgZXJyID0gTUJUS19SSUxfRVJSX0NNRSArIGNtZV9lcnI7CkBAIC0xMDYxLDcgKzEwNjMsNyBAQAogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICByaWxfcnNwX3BhY2tfc2VuZChjbGlfaW5mby0+cG9ydCwgY2xpX2luZm8tPmZkLCBwYWNrLT5tc2dfaWQsIHBhY2stPm1zZ19pbmRleCwgTlVMTCwgMCk7CisgICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCBOVUxMLCAwKTsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBicmVhazsKQEAgLTEwNzEsNyArMTA3Myw3IEBACiAgICAgICAgICAgICBpZihwYWNrLT5kYXRhX2xlbiA9PSAwIHx8IHBhY2stPmRhdGEgPT0gTlVMTCkKICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICBtYnRrX2VjYWxsX2RpYWxfdHlwZV9lbnVtIHR5cGU7Ci0gICAgICAgICAgICAgICAgaWYocmVxX2VjYWxsX2RpYWxfc3RhdGVfZ2V0KGNsaV9pbmZvLT5wb3J0LCAmdHlwZSwgJmNtZV9lcnIpIHx8IGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pCisgICAgICAgICAgICAgICAgaWYocmVxX2VjYWxsX2RpYWxfc3RhdGVfZ2V0KGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCAmdHlwZSwgJmNtZV9lcnIpIHx8IGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pCiAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICBpZihjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBlcnIgPSBNQlRLX1JJTF9FUlJfQ01FICsgY21lX2VycjsKQEAgLTEwODIsMTMgKzEwODQsMTMgQEAKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgcmlsX3JzcF9wYWNrX3NlbmQoY2xpX2luZm8tPnBvcnQsIGNsaV9pbmZvLT5mZCwgcGFjay0+bXNnX2lkLCBwYWNrLT5tc2dfaW5kZXgsICZ0eXBlLCBzaXplb2YodWludDgpKTsKKyAgICAgICAgICAgICAgICAgICAgcmlsX3JzcF9wYWNrX3NlbmQoY2xpX2luZm8tPnNpbV9pZCwgY2xpX2luZm8tPnBvcnQsIGNsaV9pbmZvLT5mZCwgcGFjay0+bXNnX2lkLCBwYWNrLT5tc2dfaW5kZXgsICZ0eXBlLCBzaXplb2YodWludDgpKTsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgbWJ0a19lY2FsbF9kaWFsX3R5cGVfZW51bSB0eXBlID0gKG1idGtfZWNhbGxfZGlhbF90eXBlX2VudW0pcGFjay0+ZGF0YVswXTsKLSAgICAgICAgICAgICAgICBpZihyZXFfZWNhbGxfZGlhbF9zdGFydChjbGlfaW5mby0+cG9ydCwgdHlwZSwgJmNtZV9lcnIpIHx8IGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pCisgICAgICAgICAgICAgICAgaWYocmVxX2VjYWxsX2RpYWxfc3RhcnQoY2xpX2luZm8tPnNpbV9pZCwgY2xpX2luZm8tPnBvcnQsIHR5cGUsICZjbWVfZXJyKSB8fCBjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKQogICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgaWYoY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikgewogICAgICAgICAgICAgICAgICAgICAgICAgZXJyID0gTUJUS19SSUxfRVJSX0NNRSArIGNtZV9lcnI7CkBAIC0xMDk5LDcgKzExMDEsNyBAQAogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICByaWxfcnNwX3BhY2tfc2VuZChjbGlfaW5mby0+cG9ydCwgY2xpX2luZm8tPmZkLCBwYWNrLT5tc2dfaWQsIHBhY2stPm1zZ19pbmRleCwgTlVMTCwgMCk7CisgICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCBOVUxMLCAwKTsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBicmVhazsKQEAgLTExMDksNyArMTExMSw3IEBACiAgICAgICAgICAgICBpZihwYWNrLT5kYXRhX2xlbiA9PSAwIHx8IHBhY2stPmRhdGEgPT0gTlVMTCkKICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICBtYnRrX2VjYWxsX21vZGVfdHlwZV9lbnVtIG1vZGU7Ci0gICAgICAgICAgICAgICAgaWYocmVxX2VjYWxsX21vZGVfZ2V0KGNsaV9pbmZvLT5wb3J0LCAmbW9kZSwgJmNtZV9lcnIpIHx8IGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pCisgICAgICAgICAgICAgICAgaWYocmVxX2VjYWxsX21vZGVfZ2V0KGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCAmbW9kZSwgJmNtZV9lcnIpIHx8IGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pCiAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICBpZihjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBlcnIgPSBNQlRLX1JJTF9FUlJfQ01FICsgY21lX2VycjsKQEAgLTExMjAsMTMgKzExMjIsMTMgQEAKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgcmlsX3JzcF9wYWNrX3NlbmQoY2xpX2luZm8tPnBvcnQsIGNsaV9pbmZvLT5mZCwgcGFjay0+bXNnX2lkLCBwYWNrLT5tc2dfaW5kZXgsICZtb2RlLCBzaXplb2YodWludDgpKTsKKyAgICAgICAgICAgICAgICAgICAgcmlsX3JzcF9wYWNrX3NlbmQoY2xpX2luZm8tPnNpbV9pZCwgY2xpX2luZm8tPnBvcnQsIGNsaV9pbmZvLT5mZCwgcGFjay0+bXNnX2lkLCBwYWNrLT5tc2dfaW5kZXgsICZtb2RlLCBzaXplb2YodWludDgpKTsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgbWJ0a19lY2FsbF9tb2RlX3R5cGVfZW51bSBtb2RlID0gKG1idGtfZWNhbGxfbW9kZV90eXBlX2VudW0pcGFjay0+ZGF0YVswXTsKLSAgICAgICAgICAgICAgICBpZihyZXFfZWNhbGxfbW9kZV9zZXQoY2xpX2luZm8tPnBvcnQsIG1vZGUsICZjbWVfZXJyKSB8fCBjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKQorICAgICAgICAgICAgICAgIGlmKHJlcV9lY2FsbF9tb2RlX3NldChjbGlfaW5mby0+c2ltX2lkLCBjbGlfaW5mby0+cG9ydCwgbW9kZSwgJmNtZV9lcnIpIHx8IGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pCiAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICBpZihjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBlcnIgPSBNQlRLX1JJTF9FUlJfQ01FICsgY21lX2VycjsKQEAgLTExMzcsNyArMTEzOSw3IEBACiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCBOVUxMLCAwKTsKKyAgICAgICAgICAgICAgICAgICAgcmlsX3JzcF9wYWNrX3NlbmQoY2xpX2luZm8tPnNpbV9pZCwgY2xpX2luZm8tPnBvcnQsIGNsaV9pbmZvLT5mZCwgcGFjay0+bXNnX2lkLCBwYWNrLT5tc2dfaW5kZXgsIE5VTEwsIDApOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KICAgICAgICAgICAgIGJyZWFrOwpAQCAtMTE1Miw3ICsxMTU0LDcgQEAKICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICBpZihwYWNrLT5kYXRhX2xlbiA9PSBzaXplb2YobWJ0a19lY2FsbF9jZmdfaW5mb190KSkgeyAvLyBTZXQKICAgICAgICAgICAgICAgICAgICAgbWJ0a19lY2FsbF9jZmdfaW5mb190ICpjZmdfaW5mbyA9IChtYnRrX2VjYWxsX2NmZ19pbmZvX3QqKXBhY2stPmRhdGE7Ci0gICAgICAgICAgICAgICAgICAgIGlmKHJlcV9lY2FsbF9jZmdfc2V0KGNsaV9pbmZvLT5wb3J0LCBjZmdfaW5mbywgJmNtZV9lcnIpIHx8IGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pCisgICAgICAgICAgICAgICAgICAgIGlmKHJlcV9lY2FsbF9jZmdfc2V0KGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCBjZmdfaW5mbywgJmNtZV9lcnIpIHx8IGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pCiAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgIGlmKGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnIgPSBNQlRLX1JJTF9FUlJfQ01FICsgY21lX2VycjsKQEAgLTExNjMsMTMgKzExNjUsMTMgQEAKICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCBOVUxMLCAwKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCBOVUxMLCAwKTsKICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIH0gZWxzZSB7IC8vIEdldAogICAgICAgICAgICAgICAgICAgICBtYnRrX2VjYWxsX2NmZ19pbmZvX3QgY2ZnX2luZm87CiAgICAgICAgICAgICAgICAgICAgIG1lbXNldCgmY2ZnX2luZm8sIDAsIHNpemVvZihtYnRrX2VjYWxsX2NmZ19pbmZvX3QpKTsKICAgICAgICAgICAgICAgICAgICAgdWludDMyICp0eXBlID0gKHVpbnQzMiopKHBhY2stPmRhdGEpOwotICAgICAgICAgICAgICAgICAgICBpZihyZXFfZWNhbGxfY2ZnX2dldChjbGlfaW5mby0+cG9ydCwgKnR5cGUsICZjZmdfaW5mbywgJmNtZV9lcnIpIHx8IGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pCisgICAgICAgICAgICAgICAgICAgIGlmKHJlcV9lY2FsbF9jZmdfZ2V0KGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCAqdHlwZSwgJmNmZ19pbmZvLCAmY21lX2VycikgfHwgY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikKICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgaWYoY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVyciA9IE1CVEtfUklMX0VSUl9DTUUgKyBjbWVfZXJyOwpAQCAtMTE4MCw3ICsxMTgyLDcgQEAKICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCAmY2ZnX2luZm8sIHNpemVvZihtYnRrX2VjYWxsX2NmZ19pbmZvX3QpKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCAmY2ZnX2luZm8sIHNpemVvZihtYnRrX2VjYWxsX2NmZ19pbmZvX3QpKTsKICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KQEAgLTExOTIsNyArMTE5NCw3IEBACiAgICAgICAgICAgICBtZW1zZXQobnVtYmVyLCAwLCBzaXplb2YobnVtYmVyKSk7CiAgICAgICAgICAgICBpZihwYWNrLT5kYXRhX2xlbiA9PSAwIHx8IHBhY2stPmRhdGEgPT0gTlVMTCkKICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICBpZihyZXFfZWNhbGxfc21zX251bV9nZXQoY2xpX2luZm8tPnBvcnQsIG51bWJlciwgJmNtZV9lcnIpIHx8IHN0cmxlbigoY2hhciopbnVtYmVyKSA9PSAwIHx8IGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pCisgICAgICAgICAgICAgICAgaWYocmVxX2VjYWxsX3Ntc19udW1fZ2V0KGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCBudW1iZXIsICZjbWVfZXJyKSB8fCBzdHJsZW4oKGNoYXIqKW51bWJlcikgPT0gMCB8fCBjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKQogICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgaWYoY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikgewogICAgICAgICAgICAgICAgICAgICAgICAgZXJyID0gTUJUS19SSUxfRVJSX0NNRSArIGNtZV9lcnI7CkBAIC0xMjAzLDEzICsxMjA1LDEzIEBACiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCBudW1iZXIsIHN0cmxlbigoY2hhciopbnVtYmVyKSk7CisgICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCBudW1iZXIsIHN0cmxlbigoY2hhciopbnVtYmVyKSk7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogICAgICAgICAgICAgZWxzZSAgICAgLy8gU2V0CiAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgbWVtY3B5KG51bWJlciwgcGFjay0+ZGF0YSwgcGFjay0+ZGF0YV9sZW4pOwotICAgICAgICAgICAgICAgIGlmKHJlcV9lY2FsbF9zbXNfbnVtX3NldChjbGlfaW5mby0+cG9ydCwgbnVtYmVyLCAmY21lX2VycikgfHwgY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikKKyAgICAgICAgICAgICAgICBpZihyZXFfZWNhbGxfc21zX251bV9zZXQoY2xpX2luZm8tPnNpbV9pZCwgY2xpX2luZm8tPnBvcnQsIG51bWJlciwgJmNtZV9lcnIpIHx8IGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pCiAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICBpZihjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBlcnIgPSBNQlRLX1JJTF9FUlJfQ01FICsgY21lX2VycjsKQEAgLTEyMjAsNyArMTIyMiw3IEBACiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCBOVUxMLCAwKTsKKyAgICAgICAgICAgICAgICAgICAgcmlsX3JzcF9wYWNrX3NlbmQoY2xpX2luZm8tPnNpbV9pZCwgY2xpX2luZm8tPnBvcnQsIGNsaV9pbmZvLT5mZCwgcGFjay0+bXNnX2lkLCBwYWNrLT5tc2dfaW5kZXgsIE5VTEwsIDApOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KICAgICAgICAgICAgIGJyZWFrOwpAQCAtMTI0MSw3ICsxMjQzLDcgQEAKICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgfQogCi0gICAgICAgICAgICAgICAgaWYocmVxX2VjYWxsX3Nwa211dGVfc2V0KGNsaV9pbmZvLT5wb3J0LCBtdXRlLCAmY21lX2VycikgfHwgY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikKKyAgICAgICAgICAgICAgICBpZihyZXFfZWNhbGxfc3BrbXV0ZV9zZXQoY2xpX2luZm8tPnNpbV9pZCwgY2xpX2luZm8tPnBvcnQsIG11dGUsICZjbWVfZXJyKSB8fCBjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKQogICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgaWYoY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikgewogICAgICAgICAgICAgICAgICAgICAgICAgZXJyID0gTUJUS19SSUxfRVJSX0NNRSArIGNtZV9lcnI7CkBAIC0xMjUyLDcgKzEyNTQsNyBAQAogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICByaWxfcnNwX3BhY2tfc2VuZChjbGlfaW5mby0+cG9ydCwgY2xpX2luZm8tPmZkLCBwYWNrLT5tc2dfaWQsIHBhY2stPm1zZ19pbmRleCwgTlVMTCwgMCk7CisgICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCBOVUxMLCAwKTsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBicmVhazsKQEAgLTEyNjYsNyArMTI2OCw3IEBACiAgICAgICAgICAgICBlbHNlICAgICAvLyBTZXQKICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICBtYnRrX2VjYWxsX2dhaW5faW5mb190ICpnYWluX2luZm8gPSAobWJ0a19lY2FsbF9nYWluX2luZm9fdCAqKXBhY2stPmRhdGE7Ci0gICAgICAgICAgICAgICAgaWYocmVxX2VjYWxsX2dhaW5fc2V0KGNsaV9pbmZvLT5wb3J0LCBnYWluX2luZm8sICZjbWVfZXJyKSB8fCBjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKQorICAgICAgICAgICAgICAgIGlmKHJlcV9lY2FsbF9nYWluX3NldChjbGlfaW5mby0+c2ltX2lkLCBjbGlfaW5mby0+cG9ydCwgZ2Fpbl9pbmZvLCAmY21lX2VycikgfHwgY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikKICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgIGlmKGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pIHsKICAgICAgICAgICAgICAgICAgICAgICAgIGVyciA9IE1CVEtfUklMX0VSUl9DTUUg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nIgPSBhdF9nZXRfY21lX2Vycm9yKHJlc3BvbnNlKTsKQEAgLTE1MDEsNyArMTUwMyw3IEBACiAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgbWJ0a19uZXRfaW5mb19hcnJheV90IG5ldF9hcnJheTsKICAgICAgICAgICAgICAgICBtZW1zZXQoJm5ldF9hcnJheSwgMCwgc2l6ZW9mKG1idGtfbmV0X2luZm9fYXJyYXlfdCkpOwotICAgICAgICAgICAgICAgIGlmKHJlcV9hdmFpbGFibGVfbmV0X2dldChjbGlfaW5mby0+cG9ydCwgJm5ldF9hcnJheSwgJmNtZV9lcnIpIHx8IGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pCisgICAgICAgICAgICAgICAgaWYocmVxX2F2YWlsYWJsZV9uZXRfZ2V0KGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCAmbmV0X2FycmF5LCAmY21lX2VycikgfHwgY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikKICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgIGlmKGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pIHsKICAgICAgICAgICAgICAgICAgICAgICAgIGVyciA9IE1CVEtfUklMX0VSUl9DTUUgKyBjbWVfZXJyOwpAQCAtMTUxMiw3ICsxNTE0LDcgQEAKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgcmlsX3JzcF9wYWNrX3NlbmQoY2xpX2luZm8tPnBvcnQsIGNsaV9pbmZvLT5mZCwgcGFjay0+bXNnX2lkLCBwYWNrLT5tc2dfaW5kZXgsICZuZXRfYXJyYXksIHNpemVvZihtYnRrX25ldF9pbmZvX2FycmF5X3QpKTsKKyAgICAgICAgICAgICAgICAgICAgcmlsX3JzcF9wYWNrX3NlbmQoY2xpX2luZm8tPnNpbV9pZCwgY2xpX2luZm8tPnBvcnQsIGNsaV9pbmZvLT5mZCwgcGFjay0+bXNnX2lkLCBwYWNrLT5tc2dfaW5kZXgsICZuZXRfYXJyYXksIHNpemVvZihtYnRrX25ldF9pbmZvX2FycmF5X3QpKTsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBlbHNlICAgICAvLyBTZXQKQEAgLTE1MjgsNyArMTUzMCw3IEBACiAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgbWJ0a19uZXRfaW5mb190IGluZm87CiAgICAgICAgICAgICAgICAgbWVtc2V0KCZpbmZvLCAwLCBzaXplb2YobWJ0a19uZXRfaW5mb190KSk7Ci0gICAgICAgICAgICAgICAgaWYocmVxX25ldF9zZWxfbW9kZV9nZXQoY2xpX2luZm8tPnBvcnQsICZpbmZvLCAmY21lX2VycikgfHwgY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikKKyAgICAgICAgICAgICAgICBpZihyZXFfbmV0X3NlbF9tb2RlX2dldChjbGlfaW5mby0+c2ltX2lkLCBjbGlfaW5mby0+cG9ydCwgJmluZm8sICZjbWVfZXJyKSB8fCBjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKQogICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgaWYoY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikgewogICAgICAgICAgICAgICAgICAgICAgICAgZXJyID0gTUJUS19SSUxfRVJSX0NNRSArIGNtZV9lcnI7CkBAIC0xNTM5LDEzICsxNTQxLDEzIEBACiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCAmaW5mbywgc2l6ZW9mKG1idGtfbmV0X2luZm9fdCkpOworICAgICAgICAgICAgICAgICAgICByaWxfcnNwX3BhY2tfc2VuZChjbGlfaW5mby0+c2ltX2lkLCBjbGlfaW5mby0+cG9ydCwgY2xpX2luZm8tPmZkLCBwYWNrLT5tc2dfaWQsIHBhY2stPm1zZ19pbmRleCwgJmluZm8sIHNpemVvZihtYnRrX25ldF9pbmZvX3QpKTsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBlbHNlICAgICAvLyBTZXQKICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICBtYnRrX25ldF9pbmZvX3QgKmluZm8gPSAobWJ0a19uZXRfaW5mb190KilwYWNrLT5kYXRhOwotICAgICAgICAgICAgICAgIGlmKHJlcV9uZXRfc2VsX21vZGVfc2V0KGNsaV9pbmZvLT5wb3J0LCBpbmZvLCAmY21lX2VycikgfHwgY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikKKyAgICAgICAgICAgICAgICBpZihyZXFfbmV0X3NlbF9tb2RlX3NldChjbGlfaW5mby0+c2ltX2lkLCBjbGlfaW5mby0+cG9ydCwgaW5mbywgJmNtZV9lcnIpIHx8IGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pCiAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICBpZihjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBlcnIgPSBNQlRLX1JJTF9FUlJfQ01FICsgY21lX2VycjsKQEAgLTE1NTYsNyArMTU1OCw3IEBACiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCBOVUxMLCAwKTsKKyAgICAgICAgICAgICAgICAgICAgcmlsX3JzcF9wYWNrX3NlbmQoY2xpX2luZm8tPnNpbV9pZCwgY2xpX2luZm8tPnBvcnQsIGNsaV9pbmZvLT5mZCwgcGFjay0+bXNnX2lkLCBwYWNrLT5tc2dfaW5kZXgsIE5VTEwsIDApOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KICAgICAgICAgICAgIGJyZWFrOwpAQCAtMTU3NCw3ICsxNTc2LDcgQEAKICAgICAgICAgICAgICAgICAgICAgaWYoKihwYWNrLT5kYXRhKSkgeyAvLyBHZXQgY3VycmVudCBiYW5kcy4KICAgICAgICAgICAgICAgICAgICAgICAgIG1idGtfYmFuZF9pbmZvX3QgYmFuZDsKICAgICAgICAgICAgICAgICAgICAgICAgIG1lbXNldCgmYmFuZCwgMHgwLCBzaXplb2YobWJ0a19iYW5kX2luZm9fdCkpOwotICAgICAgICAgICAgICAgICAgICAgICAgaWYocmVxX2JhbmRfZ2V0KGNsaV9pbmZvLT5wb3J0LCAmYmFuZCwgJmNtZV9lcnIpIHx8IGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pCisgICAgICAgICAgICAgICAgICAgICAgICBpZihyZXFfYmFuZF9nZXQoY2xpX2luZm8tPnNpbV9pZCwgY2xpX2luZm8tPnBvcnQsICZiYW5kLCAmY21lX2VycikgfHwgY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikKICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZihjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVyciA9IE1CVEtfUklMX0VSUl9DTUUgKyBjbWVfZXJyOwpAQCAtMTU4NSwxMCArMTU4NywxMCBAQAogICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCAmYmFuZCwgc2l6ZW9mKG1idGtfYmFuZF9pbmZvX3QpKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICByaWxfcnNwX3BhY2tfc2VuZChjbGlfaW5mby0+c2ltX2lkLCBjbGlfaW5mby0+cG9ydCwgY2xpX2luZm8tPmZkLCBwYWNrLT5tc2dfaWQsIHBhY2stPm1zZ19pbmRleCwgJmJhbmQsIHNpemVvZihtYnRrX2JhbmRfaW5mb190KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7IC8vIEdldCBzdXBwb3J0IGJhbmRzLgotICAgICAgICAgICAgICAgICAgICAgICAgcmlsX3JzcF9wYWNrX3NlbmQoY2xpX2luZm8tPnBvcnQsIGNsaV9pbmZvLT5mZCwgcGFjay0+bXNnX2lkLCBwYWNrLT5tc2dfaW5kZXgsICZiYW5kX2luZm8uYmFuZF9zdXBwb3J0LCBzaXplb2YobWJ0a19iYW5kX2luZm9fdCkpOworICAgICAgICAgICAgICAgICAgICAgICAgcmlsX3JzcF9wYWNrX3NlbmQoY2xpX2luZm8tPnNpbV9pZCwgY2xpX2luZm8tPnBvcnQsIGNsaV9pbmZvLT5mZCwgcGFjay0+bXNnX2lkLCBwYWNrLT5tc2dfaW5kZXgsICZiYW5kX2luZm8uYmFuZF9zdXBwb3J0LCBzaXplb2YobWJ0a19iYW5kX2luZm9fdCkpOwogICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgfSBlbHNlIHsgLy8gU2V0IGN1cnJlbnQgYmFuZHMuCiAgICAgICAgICAgICAgICAgICAgIG1idGtfYmFuZF9pbmZvX3QqIGJhbmQgPSAobWJ0a19iYW5kX2luZm9fdCopcGFjay0+ZGF0YTsKQEAgLTE1OTksNyArMTYwMSw3IEBACiAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgfQogCi0gICAgICAgICAgICAgICAgICAgIGlmKHJlcV9iYW5kX3NldChjbGlfaW5mby0+cG9ydCwgYmFuZCwgJmNtZV9lcnIpIHx8IGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pCisgICAgICAgICAgICAgICAgICAgIGlmKHJlcV9iYW5kX3NldChjbGlfaW5mby0+c2ltX2lkLCBjbGlfaW5mby0+cG9ydCwgYmFuZCwgJmNtZV9lcnIpIHx8IGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pCiAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgIGlmKGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnIgPSBNQlRLX1JJTF9FUlJfQ01FICsgY21lX2VycjsKQEAgLTE2MTAsNyArMTYxMiw3IEBACiAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICByaWxfcnNwX3BhY2tfc2VuZChjbGlfaW5mby0+cG9ydCwgY2xpX2luZm8tPmZkLCBwYWNrLT5tc2dfaWQsIHBhY2stPm1zZ19pbmRleCwgTlVMTCwgMCk7CisgICAgICAgICAgICAgICAgICAgICAgICByaWxfcnNwX3BhY2tfc2VuZChjbGlfaW5mby0+c2ltX2lkLCBjbGlfaW5mby0+cG9ydCwgY2xpX2luZm8tPmZkLCBwYWNrLT5tc2dfaWQsIHBhY2stPm1zZ19pbmRleCwgTlVMTCwgMCk7CiAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CkBAIC0xNjIyLDcgKzE2MjQsNyBAQAogICAgICAgICAgICAgewogICAgICAgICAgICAgICAgIG1idGtfc2lnbmFsX2luZm9fdCBzaWduYWw7CiAgICAgICAgICAgICAgICAgbWVtc2V0KCZzaWduYWwsIDAsIHNpemVvZihtYnRrX3NpZ25hbF9pbmZvX3QpKTsKLSAgICAgICAgICAgICAgICBpZihyZXFfbmV0X3NpZ25hbF9nZXQoY2xpX2luZm8tPnBvcnQsICZzaWduYWwsICZjbWVfZXJyKSB8fCBjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKQorICAgICAgICAgICAgICAgIGlmKHJlcV9uZXRfc2lnbmFsX2dldChjbGlfaW5mby0+c2ltX2lkLCBjbGlfaW5mby0+cG9ydCwgJnNpZ25hbCwgJmNtZV9lcnIpIHx8IGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pCiAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICBpZihjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBlcnIgPSBNQlRLX1JJTF9FUlJfQ01FICsgY21lX2VycjsKQEAgLTE2MzMsNyArMTYzNSw3IEBACiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCAmc2lnbmFsLCBzaXplb2YobWJ0a19zaWduYWxfaW5mb190KSk7CisgICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCAmc2lnbmFsLCBzaXplb2YobWJ0a19zaWduYWxfaW5mb190KSk7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogICAgICAgICAgICAgZWxzZSAgICAgLy8gU2V0CkBAIC0xNjQ5LDcgKzE2NTEsNyBAQAogICAgICAgICAgICAgewogICAgICAgICAgICAgICAgIG1idGtfbmV0X3JlZ19pbmZvX3QgbmV0X3JlZzsKICAgICAgICAgICAgICAgICBtZW1zZXQoJm5ldF9yZWcsIDAsIHNpemVvZihtYnRrX25ldF9yZWdfaW5mb190KSk7Ci0gICAgICAgICAgICAgICAgaWYocmVxX25ldF9yZWdfZ2V0KGNsaV9pbmZvLT5wb3J0LCAmbmV0X3JlZywgJmNtZV9lcnIpIHx8IGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pCisgICAgICAgICAgICAgICAgaWYocmVxX25ldF9yZWdfZ2V0KGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCAmbmV0X3JlZywgJmNtZV9lcnIpIHx8IGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pCiAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICBpZihjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBlcnIgPSBNQlRLX1JJTF9FUlJfQ01FICsgY21lX2VycjsKQEAgLTE2NjAsNyArMTY2Miw3IEBACiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCAmbmV0X3JlZywgc2l6ZW9mKG1idGtfbmV0X3JlZ19pbmZvX3QpKTsKKyAgICAgICAgICAgICAgICAgICAgcmlsX3JzcF9wYWNrX3NlbmQoY2xpX2luZm8tPnNpbV9pZCwgY2xpX2luZm8tPnBvcnQsIGNsaV9pbmZvLT5mZCwgcGFjay0+bXNnX2lkLCBwYWNrLT5tc2dfaW5kZXgsICZuZXRfcmVnLCBzaXplb2YobWJ0a19uZXRfcmVnX2luZm9fdCkpOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KICAgICAgICAgICAgIGVsc2UgICAgIC8vIFNldApAQCAtMTY3NCw3ICsxNjc2LDcgQEAKICAgICAgICAgewogICAgICAgICAgICAgaWYocGFjay0+ZGF0YV9sZW4gPT0gMCB8fCBwYWNrLT5kYXRhID09IE5VTEwpICAgLy8gR2V0IG5ldCBjZWxsLgogICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIGlmKHJlcV9jZWxsX2luZm9fZ2V0KGNsaV9pbmZvLT5wb3J0LCAmY21lX2VycikgfHwgY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikKKyAgICAgICAgICAgICAgICBpZihyZXFfY2VsbF9pbmZvX2dldChjbGlfaW5mby0+c2ltX2lkLCBjbGlfaW5mby0+cG9ydCwgJmNtZV9lcnIpIHx8IGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pCiAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICBpZihjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBlcnIgPSBNQlRLX1JJTF9FUlJfQ01FICsgY21lX2VycjsKQEAgLTE2ODcsNyArMTY4OSw3IEBACiAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICBMT0coInJlcV9jZWxsX2luZm9fZ2V0KCkgc3VjY2VzcyxjZWxsIG51bWJlcjogJWQiLCBjZWxsX2luZm8uY2VsbF9saXN0Lm51bSk7CiAgICAgICAgICAgICAgICAgICAgIExPR0QoImRhdGFfbGVuID0gJWQiLCBzaXplb2YobWJ0a19jZWxsX2luZm9fYXJyYXlfdCkpOwotICAgICAgICAgICAgICAgICAgICByaWxfcnNwX3BhY2tfc2VuZChjbGlfaW5mby0+cG9ydCwgY2xpX2luZm8tPmZkLCBwYWNrLT5tc2dfaWQsIHBhY2stPm1zZ19pbmRleCwgJmNlbGxfaW5mby5jZWxsX2xpc3QsIHNpemVvZihtYnRrX2NlbGxfaW5mb19hcnJheV90KSk7CisgICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCAmY2VsbF9pbmZvLmNlbGxfbGlzdCwgc2l6ZW9mKG1idGtfY2VsbF9pbmZvX2FycmF5X3QpKTsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBlbHNlICAgICAvLyBMb2NrIGNlbGwKQEAgLTE2OTUsNyArMTY5Nyw3IEBACiAgICAgICAgICAgICAgICAgY2hhciAqbWVtID0gKGNoYXIqKShwYWNrLT5kYXRhKTsKICAgICAgICAgICAgICAgICBpbnQgbGVuID0gcGFjay0+ZGF0YV9sZW47CiAgICAgICAgICAgICAgICAgY2hhciByZWdbMTAwXSA9IHswfTsKLSAgICAgICAgICAgICAgICBpZihyZXFfY2VsbF9pbmZvX3NldChjbGlfaW5mby0+cG9ydCwgbWVtLCByZWcsIGxlbiwgJmNtZV9lcnIpIHx8IGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pCisgICAgICAgICAgICAgICAgaWYocmVxX2NlbGxfaW5mb19zZXQoY2xpX2luZm8tPnNpbV9pZCwgY2xpX2luZm8tPnBvcnQsIG1lbSwgcmVnLCBsZW4sICZjbWVfZXJyKSB8fCBjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKQogICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgaWYoY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikgewogICAgICAgICAgICAgICAgICAgICAgICAgZXJyID0gTUJUS19SSUxfRVJSX0NNRSArIGNtZV9lcnI7CkBAIC0xNzA1LDcgKzE3MDcsNyBAQAogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICByaWxfcnNwX3BhY2tfc2VuZChjbGlfaW5mby0+cG9ydCwgY2xpX2luZm8tPmZkLCBwYWNrLT5tc2dfaWQsIHBhY2stPm1zZ19pbmRleCwgcmVnLCBzdHJsZW4ocmVnKSk7CisgICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCByZWcsIHN0cmxlbihyZWcpKTsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBicmVhazsKQEAgLTE3MTYsNyArMTcxOCw3IEBACiAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgbWJ0a19yaWxfb29zX2luZm9fdCBvb3NfaW5mbzsKICAgICAgICAgICAgICAgICBtZW1zZXQoJm9vc19pbmZvLCAwLCBzaXplb2YobWJ0a19yaWxfb29zX2luZm9fdCkpOwotICAgICAgICAgICAgICAgIGlmKHJlcV9vb3NfZ2V0KGNsaV9pbmZvLT5wb3J0LCAmb29zX2luZm8sICZjbWVfZXJyKSB8fCBjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKQorICAgICAgICAgICAgICAgIGlmKHJlcV9vb3NfZ2V0KGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCAmb29zX2luZm8sICZjbWVfZXJyKSB8fCBjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKQogICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgaWYoY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikgewogICAgICAgICAgICAgICAgICAgICAgICAgZXJyID0gTUJUS19SSUxfRVJSX0NNRSArIGNtZV9lcnI7CkBAIC0xNzI4LDEzICsxNzMwLDEzIEBACiAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgTE9HKCJyZXFfb29zX2dldCgpIHN1Y2Nlc3MsY2VsbCBudW1iZXI6ICVkIiwgb29zX2luZm8uc3RhdGUpOwotICAgICAgICAgICAgICAgICAgICByaWxfcnNwX3BhY2tfc2VuZChjbGlfaW5mby0+cG9ydCwgY2xpX2luZm8tPmZkLCBwYWNrLT5tc2dfaWQsIHBhY2stPm1zZ19pbmRleCwgJm9vc19pbmZvLCBzaXplb2YobWJ0a19yaWxfb29zX2luZm9fdCkpOworICAgICAgICAgICAgICAgICAgICByaWxfcnNwX3BhY2tfc2VuZChjbGlfaW5mby0+c2ltX2lkLCBjbGlfaW5mby0+cG9ydCwgY2xpX2luZm8tPmZkLCBwYWNrLT5tc2dfaWQsIHBhY2stPm1zZ19pbmRleCwgJm9vc19pbmZvLCBzaXplb2YobWJ0a19yaWxfb29zX2luZm9fdCkpOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KICAgICAgICAgICAgIGVsc2UgICAgIC8vIFNldCBuZXQgb29zLgogICAgICAgICAgICAgewogICAgICAgICAgICAgICAgIG1idGtfcmlsX29vc19pbmZvX3QgKm9vc19pbmZvID0gKG1idGtfcmlsX29vc19pbmZvX3QqKShwYWNrLT5kYXRhKTsKLSAgICAgICAgICAgICAgICBpZihyZXFfb29zX3NldChjbGlfaW5mby0+cG9ydCwgb29zX2luZm8sICZjbWVfZXJy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U46CiAgICAgICAgIHsKLSAgICAgICAgICAgIHJldHVybiByZXFfc2ltX3Bpbl92ZXJpZnkocG9ydCwgbG9ja19pbmZvLT5waW4xLCBjbWVfZXJyKTsKKyAgICAgICAgICAgIHJldHVybiByZXFfc2ltX3Bpbl92ZXJpZnkoc2ltX2lkLCBwb3J0LCBsb2NrX2luZm8tPnBpbjEsIGNtZV9lcnIpOwogICAgICAgICB9CiAgICAgICAgIGNhc2UgTUJUS19TSU1fTE9DS19UWVBFX1ZFUklGWV9QVUs6CiAgICAgICAgIHsKLSAgICAgICAgICAgIHJldHVybiByZXFfc2ltX3B1a192ZXJpZnkocG9ydCwgbG9ja19pbmZvLT5wdWssIGxvY2tfaW5mby0+cGluMSwgY21lX2Vycik7CisgICAgICAgICAgICByZXR1cm4gcmVxX3NpbV9wdWtfdmVyaWZ5KHNpbV9pZCwgcG9ydCwgbG9ja19pbmZvLT5wdWssIGxvY2tfaW5mby0+cGluMSwgY21lX2Vycik7CiAgICAgICAgIH0KICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgewpAQCAtNDk4LDEyICs0OTksMTIgQEAKIAogT0sKICovCi1zdGF0aWMgaW50IHJlcV9waW5fcHVrX2xhc3RfdGltZXNfZ2V0KEFUUG9ydFR5cGVfZW51bSBwb3J0LCBtYnRrX3Bpbl9wdWtfbGFzdF90aW1lc190ICp0aW1lcywgaW50ICpjbWVfZXJyKQorc3RhdGljIGludCByZXFfcGluX3B1a19sYXN0X3RpbWVzX2dldChtYnRrX3NpbV90eXBlX2VudW0gc2ltX2lkLCBBVFBvcnRUeXBlX2VudW0gcG9ydCwgbWJ0a19waW5fcHVrX2xhc3RfdGltZXNfdCAqdGltZXMsIGludCAqY21lX2VycikKIHsKICAgICBBVFJlc3BvbnNlICpyZXNwb25zZSA9IE5VTEw7CiAvLyAgICBjaGFyICp0bXBfcHRyID0gTlVMTDsKICAgICBpbnQgdG1wX2ludDsKLSAgICBpbnQgZXJyID0gYXRfc2VuZF9jb21tYW5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C4KIC8vIE90aGVyd2lzZSwgZG8gbm90IGNhbGwgcGFja19lcnJvcl9zZW5kKCkuCkBAIC02MjcsNyArNjkxLDcgQEAKICAgICAgICAgewogICAgICAgICAgICAgaWYocGFjay0+ZGF0YV9sZW4gPT0gMCB8fCBwYWNrLT5kYXRhID09IE5VTEwpCiAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgbWJ0a19zaW1fc3RhdGVfZW51bSBzdGF0ZSA9IHJpbF9zaW1fc3RhdGVfZ2V0KGNsaV9pbmZvLT5wb3J0KTsKKyAgICAgICAgICAgICAgICBtYnRrX3NpbV9zdGF0ZV9lbnVtIHN0YXRlID0gcmlsX3NpbV9zdGF0ZV9nZXQoY2xpX2luZm8tPnNpbV9pZCwgY2xpX2luZm8tPnBvcnQpOwogICAgICAgICAgICAgICAgIGlmKHN0YXRlID09IE1CVEtfU0lNX1NUQVRFX1VOS05PV04pCiAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICBlcnIgPSBNQlRLX1JJTF9FUlJfVU5LTk9XTjsKQEAgLTYzNSw3ICs2OTksNyBAQAogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICByaWxfcnNwX3BhY2tfc2VuZChjbGlfaW5mby0+cG9ydCwgY2xpX2luZm8tPmZkLCBwYWNrLT5tc2dfaWQsIHBhY2stPm1zZ19pbmRleCwgJnN0YXRlLCBzaXplb2YodWludDgpKTsKKyAgICAgICAgICAgICAgICAgICAgcmlsX3JzcF9wYWNrX3NlbmQoY2xpX2luZm8tPnNpbV9pZCwgY2xpX2luZm8tPnBvcnQsIGNsaV9pbmZvLT5mZCwgcGFjay0+bXNnX2lkLCBwYWNrLT5tc2dfaW5kZXgsICZzdGF0ZSwgc2l6ZW9mKHVpbnQ4KSk7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogICAgICAgICAgICAgZWxzZSAgICAgLy8gU2V0CkBAIC02NTAsNyArNzE0LDcgQEAKICAgICAgICAgICAgIGlmKHBhY2stPmRhdGFfbGVuID09IDAgfHwgcGFjay0+ZGF0YSA9PSBOVUxMKQogICAgICAgICAgICAgewogICAgICAgICAgICAgICAgIHVpbnQ4IHNpbV9jYXJkX3R5cGU7Ci0gICAgICAgICAgICAgICAgaWYocmVxX3NpbV90eXBlX2dldChjbGlfaW5mby0+cG9ydCwgJnNpbV9jYXJkX3R5cGUsICZjbWVfZXJyKSB8fCBjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKQorICAgICAgICAgICAgICAgIGlmKHJlcV9zaW1fdHlwZV9nZXQoY2xpX2luZm8tPnNpbV9pZCwgY2xpX2luZm8tPnBvcnQsICZzaW1fY2FyZF90eXBlLCAmY21lX2VycikgfHwgY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikKICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgIGlmKGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pIHsKICAgICAgICAgICAgICAgICAgICAgICAgIGVyciA9IE1CVEtfUklMX0VSUl9DTUUgKyBjbWVfZXJyOwpAQCAtNjYxLDcgKzcyNSw3IEBACiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCAmc2ltX2NhcmRfdHlwZSwgc2l6ZW9mKHVpbnQ4KSk7CisgICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCAmc2ltX2NhcmRfdHlwZSwgc2l6ZW9mKHVpbnQ4KSk7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogICAgICAgICAgICAgZWxzZSAgICAgLy8gU2V0CkBAIC02NzYsNyArNzQwLDcgQEAKICAgICAgICAgICAgIGlmKHBhY2stPmRhdGFfbGVuID09IDAgfHwgcGFjay0+ZGF0YSA9PSBOVUxMKQogICAgICAgICAgICAgewogICAgICAgICAgICAgICAgIGNoYXIgaW1zaVsyMF0gPSB7MH07Ci0gICAgICAgICAgICAgICAgaWYocmVxX2ltc2lfZ2V0KGNsaV9pbmZvLT5wb3J0LCBpbXNpLCAmY21lX2VycikgfHwgY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikKKyAgICAgICAgICAgICAgICBpZihyZXFfaW1zaV9nZXQoY2xpX2luZm8tPnNpbV9pZCwgY2xpX2luZm8tPnBvcnQsIGltc2ksICZjbWVfZXJyKSB8fCBjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKQogICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgaWYoY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikgewogICAgICAgICAgICAgICAgICAgICAgICAgZXJyID0gTUJUS19SSUxfRVJSX0NNRSArIGNtZV9lcnI7CkBAIC02ODcsNyArNzUxLDcgQEAKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgcmlsX3JzcF9wYWNrX3NlbmQoY2xpX2luZm8tPnBvcnQsIGNsaV9pbmZvLT5mZCwgcGFjay0+bXNnX2lkLCBwYWNrLT5tc2dfaW5kZXgsIGltc2ksIHN0cmxlbihpbXNpKSk7CisgICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCBpbXNpLCBzdHJsZW4oaW1zaSkpOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KICAgICAgICAgICAgIGVsc2UgICAgIC8vIFNldApAQCAtNzAyLDcgKzc2Niw3IEBACiAgICAgICAgICAgICBpZihwYWNrLT5kYXRhX2xlbiA9PSAwIHx8IHBhY2stPmRhdGEgPT0gTlVMTCkKICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICBjaGFyIHBuWzUwXSA9IHswfTsKLSAgICAgICAgICAgICAgICBpZihyZXFfcGhvbmVfbnVtYmVyX2dldChjbGlfaW5mby0+cG9ydCwgcG4sICZjbWVfZXJyKSB8fCBjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKQorICAgICAgICAgICAgICAgIGlmKHJlcV9waG9uZV9udW1iZXJfZ2V0KGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCBwbiwgJmNtZV9lcnIpIHx8IGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pCiAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICBpZihjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBlcnIgPSBNQlRLX1JJTF9FUlJfQ01FICsgY21lX2VycjsKQEAgLTcxMyw3ICs3NzcsNyBAQAogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICByaWxfcnNwX3BhY2tfc2VuZChjbGlfaW5mby0+cG9ydCwgY2xpX2luZm8tPmZkLCBwYWNrLT5tc2dfaWQsIHBhY2stPm1zZ19pbmRleCwgcG4sIHN0cmxlbihwbikpOworICAgICAgICAgICAgICAgICAgICByaWxfcnNwX3BhY2tfc2VuZChjbGlfaW5mby0+c2ltX2lkLCBjbGlfaW5mby0+cG9ydCwgY2xpX2luZm8tPmZkLCBwYWNrLT5tc2dfaWQsIHBhY2stPm1zZ19pbmRleCwgcG4sIHN0cmxlbihwbikpOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KICAgICAgICAgICAgIGVsc2UgICAgIC8vIFNldApAQCAtNzI4LDcgKzc5Miw3IEBACiAgICAgICAgICAgICBpZihwYWNrLT5kYXRhX2xlbiA9PSAwIHx8IHBhY2stPmRhdGEgPT0gTlVMTCkKICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICBjaGFyIGljY2lkWzUwXSA9IHswfTsKLSAgICAgICAgICAgICAgICBpZihyZXFfaWNjaWRfZ2V0KGNsaV9pbmZvLT5wb3J0LCBpY2NpZCwgJmNtZV9lcnIpIHx8IGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pCisgICAgICAgICAgICAgICAgaWYocmVxX2ljY2lkX2dldChjbGlfaW5mby0+c2ltX2lkLCBjbGlfaW5mby0+cG9ydCwgaWNjaWQsICZjbWVfZXJyKSB8fCBjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKQogICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgaWYoY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikgewogICAgICAgICAgICAgICAgICAgICAgICAgZXJyID0gTUJUS19SSUxfRVJSX0NNRSArIGNtZV9lcnI7CkBAIC03MzksNyArODAzLDcgQEAKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgcmlsX3JzcF9wYWNrX3NlbmQoY2xpX2luZm8tPnBvcnQsIGNsaV9pbmZvLT5mZCwgcGFjay0+bXNnX2lkLCBwYWNrLT5tc2dfaW5kZXgsIGljY2lkLCBzdHJsZW4oaWNjaWQpKTsKKyAgICAgICAgICAgICAgICAgICAgcmlsX3JzcF9wYWNrX3NlbmQoY2xpX2luZm8tPnNpbV9pZCwgY2xpX2luZm8tPnBvcnQsIGNsaV9pbmZvLT5mZCwgcGFjay0+bXNnX2lkLCBwYWNrLT5tc2dfaW5kZXgsIGljY2lkLCBzdHJsZW4oaWNjaWQpKTsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBlbHNlICAgICAvLyBTZXQKQEAgLTc1NCw3ICs4MTgsNyBAQAogICAgICAgICAgICAgaWYocGFjay0+ZGF0YV9sZW4gPT0gMCB8fCBwYWNrLT5kYXRhID09IE5VTEwpCiAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgaW50IHN0YXRlOwotICAgICAgICAgICAgICAgIGlmKHJlcV9zaW1fbG9ja19zdGF0ZV9nZXQoY2xpX2luZm8tPnBvcnQsICZzdGF0ZSwgJmNtZV9lcnIpIHx8IGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pCisgICAgICAgICAgICAgICAgaWYocmVxX3NpbV9sb2NrX3N0YXRlX2dldChjbGlfaW5mby0+c2ltX2lkLCBjbGlfaW5mby0+cG9ydCwgJnN0YXRlLCAmY21lX2VycikgfHwgY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikKICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgIGlmKGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pIHsKICAgICAgICAgICAgICAgICAgICAgICAgIGVyciA9IE1CVEtfUklMX0VSUl9DTUUgKyBjbWVfZXJyOwpAQCAtNzY1LDEzICs4MjksMTMgQEAKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgcmlsX3JzcF9wYWNrX3NlbmQoY2xpX2luZm8tPnBvcnQsIGNsaV9pbmZvLT5mZCwgcGFjay0+bXNnX2lkLCBwYWNrLT5tc2dfaW5kZXgsICZzdGF0ZSwgc2l6ZW9mKHVpbnQ4KSk7CisgICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCAmc3RhdGUsIHNpemVvZih1aW50OCkpOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KICAgICAgICAgICAgIGVsc2UgICAgIC8vIFNldAogICAgICAgICAgICAgewogICAgICAgICAgICAgICAgIG1idGtfc2ltX2xvY2tfaW5mb190ICpsb2NrX2luZm8gPSAobWJ0a19zaW1fbG9ja19pbmZvX3QqKXBhY2stPmRhdGE7Ci0gICAgICAgICAgICAgICAgaWYocmVxX3NpbV9sb2NrX3NldChjbGlfaW5mby0+cG9ydCwgbG9ja19pbmZvLCAmY21lX2VycikgfHwgY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikKKyAgICAgICAgICAgICAgICBpZihyZXFfc2ltX2xvY2tfc2V0KGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCBsb2NrX2luZm8sICZjbWVfZXJyKSB8fCBjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKQogICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgaWYoY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikgewogICAgICAgICAgICAgICAgICAgICAgICAgZXJyID0gTUJUS19SSUxfRVJSX0NNRSArIGNtZV9lcnI7CkBAIC03ODIsNyArODQ2LDcgQEAKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgcmlsX3JzcF9wYWNrX3NlbmQoY2xpX2luZm8tPnBvcnQsIGNsaV9pbmZvLT5mZCwgcGFjay0+bXNnX2lkLCBwYWNrLT5tc2dfaW5kZXgsIE5VTEwsIDApOworICAgICAgICAgICAgICAgICAgICByaWxfcnNwX3BhY2tfc2VuZChjbGlfaW5mby0+c2ltX2lkLCBjbGlfaW5mby0+cG9ydCwgY2xpX2luZm8tPmZkLCBwYWNrLT5tc2dfaWQsIHBhY2stPm1zZ19pbmRleCwgTlVMTCwgMCk7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogICAgICAgICAgICAgYnJlYWs7CkBAIC03OTIsNyArODU2LDcgQEAKICAgICAgICAgICAgIGlmKHBhY2stPmRhdGFfbGVuID09IDAgfHwgcGFjay0+ZGF0YSA9PSBOVUxMKQogICAgICAgICAgICAgewogICAgICAgICAgICAgICAgIG1idGtfcGluX3B1a19sYXN0X3RpbWVzX3QgbGFzdF90aW1lczsKLSAgICAgICAgICAgICAgICBpZihyZXFfcGluX3B1a19sYXN0X3RpbWVzX2dldChjbGlfaW5mby0+cG9ydCwgJmxhc3RfdGltZXMsICZjbWVfZXJyKSB8fCBjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKQorICAgICAgICAgICAgICAgIGlmKHJlcV9waW5fcHVrX2xhc3RfdGltZXNfZ2V0KGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCAmbGFzdF90aW1lcywgJmNtZV9lcnIpIHx8IGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pCiAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICBpZihjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBlcnIgPSBNQlRLX1JJTF9FUlJfQ01FICsgY21lX2VycjsKQEAgLTgwMyw3ICs4NjcsNyBAQAogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICByaWxfcnNwX3BhY2tfc2VuZChjbGlfaW5mby0+cG9ydCwgY2xpX2luZm8tPmZkLCBwYWNrLT5tc2dfaWQsIHBhY2stPm1zZ19pbmRleCwgJmxhc3RfdGltZXMsIHNpemVvZihtYnRrX3Bpbl9wdWtfbGFzdF90aW1lc190KSk7CisgICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCAmbGFzdF90aW1lcywgc2l6ZW9mKG1idGtfcGluX3B1a19sYXN0X3RpbWVzX3QpKTsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBlbHNlICAgICAvLyBTZXQKQEAgLTgxOSw3ICs4ODMsNyBAQAogICAgICAgICAgICAgewogICAgICAgICAgICAgICAgIG1idGtfcGxtbl9pbmZvIGluZm87CiAgICAgICAgICAgICAgICAgbWVtc2V0KCZpbmZvLCAwLCBzaXplb2YobWJ0a19wbG1uX2luZm8pKTsKLSAgICAgICAgICAgICAgICBpZihyZXFfcGxtbl9nZXQoY2xpX2luZm8tPnBvcnQsICZpbmZvLCAmY21lX2VycikgfHwgY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikKKyAgICAgICAgICAgICAgICBpZihyZXFfcGxtbl9nZXQoY2xpX2luZm8tPnNpbV9pZCwgY2xpX2luZm8tPnBvcnQsICZpbmZvLCAmY21lX2VycikgfHwgY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikKICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgIGlmKGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pIHsKICAgICAgICAgICAgICAgICAgICAgICAgIGVyciA9IE1CVEtfUklMX0VSUl9DTUUgKyBjbWVfZXJyOwpAQCAtODMwLDcgKzg5NCw3IEBACiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCAmaW5mbywgc2l6ZW9mKG1idGtfcGxtbl9pbmZvKSk7CisgICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCAmaW5mbywgc2l6ZW9mKG1idGtfcGxtbl9pbmZvKSk7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogICAgICAgICAgICAgZWxzZSAgICAgLy8gU2V0CkBAIC04NDAsNiArOTA0LDQ1IEBACiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBicmVhazsKICAgICAgICAgfQorICAgICAgICBjYXNlIFJJTF9NU0dfSURfU0lNX1NXSVRDSDoKKyAgICAgICAgeworICAgICAgICAgICAgaWYocGFjay0+ZGF0YV9sZW4gPT0gMCB8fCBwYWNrLT5kYXRhID09IE5VTEwpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgbWJ0a19zaW1fdHlwZV9lbnVtIHNpbV9pZDsKKyAgICAgICAgICAgICAgICBpZihyZXFfZHVhbF9zaW1fZ2V0KGNsaV9pbmZvLT5wb3J0LCAmc2ltX2lkLCAmY21lX2VycikgfHwgY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIGlmKGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGVyciA9IE1CVEtfUklMX0VSUl9DTUUgKyBjbWVfZXJyOworICAgICAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAgICAgZXJyID0gTUJUS19SSUxfRVJSX1VOS05PV047CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgTE9HKCJHZXQgU1dJVENIU0lNIGZhaWwuIik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCAmc2ltX2lkLCBzaXplb2YobWJ0a19zaW1fdHlwZV9lbnVtKSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgZWxzZSAgICAgLy8gU2V0CisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgbWJ0a19zaW1fdHlwZV9lbnVtICpzaW1faWQgPSAobWJ0a19zaW1fdHlwZV9lbnVtKilwYWNrLT5kYXRhOworICAgICAgICAgICAgICAgIGlmKHJlcV9kdWFsX3NpbV9zZXQoY2xpX2luZm8tPnBvcnQsICpzaW1faWQsICZjbWVfZXJyKSB8fCBjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgaWYoY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikgeworICAgICAgICAgICAgICAgICAgICAgICAgZXJyID0gTUJUS19SSUxfRVJSX0NNRSArIGNtZV9lcnI7CisgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICBlcnIgPSBNQlRLX1JJTF9FUlJfVU5LTk9XTjsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBMT0coIlNldCBTV0lUQ0hTSU0gZmFpbC4iKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgcmlsX2luZm8uY3VyX3NpbV9pZCA9ICpzaW1faWQ7CisgICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCBOVUxMLCAwKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQogICAgICAgICBkZWZhdWx0OgogICAgICAgICB7CiAgICAgICAgICAgICBlcnIgPSBNQlRLX1JJTF9FUlJfUkVRX1VOS05PV047CmRpZmYgLS1naXQgYS9tYnRrL21idGtfcmlsZF92Mi9zcmMvcmlsX3Ntcy5jIGIvbWJ0ay9tYnRrX3JpbGRfdjIvc3JjL3JpbF9zbXMuYwppbmRleCA4ZWQzMGY0Li41MGM3YWNkIDEwMDc1NQotLS0gYS9tYnRrL21idGtfcmlsZF92Mi9zcmMvcmlsX3Ntcy5jCisrKyBiL21idGsvbWJ0a19yaWxkX3YyL3NyYy9yaWxfc21zLmMKQEAgLTE3LDcgKzE3LDggQEAKICNpbmNsdWRlICJtYnRrX3V0aWxzLmgiCiAjaW5jbHVkZSAicmlsX2luZm8uaCIKIAotdm9pZCByaWxfcnNwX3BhY2tfc2VuZChBVFBvcnRUeXBlX2VudW0gcG9ydCwgaW50IGZkLCBpbnQgcmlsX2lkLCBpbnQgbXNnX2luZGV4LCBjb25zdCB2b2lkKiBkYXRhLCBpbnQgZGF0YV9sZW4pOwordm9pZCByaWxfcnNwX3BhY2tfc2VuZChtYnRrX3NpbV90eXBlX2VudW0gc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sICZzdGF0ZSwgJmNtZV9lcnIpIHx8IGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pCisgICAgICAgICAgICAgICAgaWYocmVxX2NtZ2ZfZ2V0KGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCAmc3RhdGUsICZjbWVfZXJyKSB8fCBjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKQogICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgaWYoY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikgewogICAgICAgICAgICAgICAgICAgICAgICAgZXJyID0gTUJUS19SSUxfRVJSX0NNRSArIGNtZV9lcnI7CkBAIC04MTEsNyArODEyLDcgQEAKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgcmlsX3JzcF9wYWNrX3NlbmQoY2xpX2luZm8tPnBvcnQsIGNsaV9pbmZvLT5mZCwgcGFjay0+bXNnX2lkLCBwYWNrLT5tc2dfaW5kZXgsICZzdGF0ZSwgc2l6ZW9mKHVpbnQ4KSk7CisgICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCAmc3RhdGUsIHNpemVvZih1aW50OCkpOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KICAgICAgICAgICAgIGVsc2UgICAgIC8vIFNldCBWb0xURSBzdGF0ZS4KQEAgLTgyNCw3ICs4MjUsNyBAQAogICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICB9CiAKLSAgICAgICAgICAgICAgICBpZihyZXFfY21nZl9zZXQoY2xpX2luZm8tPnBvcnQsIG1vZGUsICZjbWVfZXJyKSB8fCBjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKQorICAgICAgICAgICAgICAgIGlmKHJlcV9jbWdmX3NldChjbGlfaW5mby0+c2ltX2lkLCBjbGlfaW5mby0+cG9ydCwgbW9kZSwgJmNtZV9lcnIpIHx8IGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pCiAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICBpZihjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBlcnIgPSBNQlRLX1JJTF9FUlJfQ01FICsgY21lX2VycjsKQEAgLTgzNSw3ICs4MzYsNyBAQAogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICByaWxfcnNwX3BhY2tfc2VuZChjbGlfaW5mby0+cG9ydCwgY2xpX2luZm8tPmZkLCBwYWNrLT5tc2dfaWQsIHBhY2stPm1zZ19pbmRleCwgTlVMTCwgMCk7CisgICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCBOVUxMLCAwKTsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBicmVhazsKQEAgLTg0NSw3ICs4NDYsNyBAQAogICAgICAgICAgICAgaWYocGFjay0+ZGF0YV9sZW4gPT0gMCB8fCBwYWNrLT5kYXRhID09IE5VTEwpICAgLy8gU0VUIGF0K2NubWk9MSwyLgogICAgICAgICAgICAgewogLy8gICAgICAgICAgICAgICAgaW50IHN0YXRlOwotICAgICAgICAgICAgICAgIGlmKHJlcV9jbm1pX3NldChjbGlfaW5mby0+cG9ydCwgJmNtZV9lcnIpIHx8IGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pCisgICAgICAgICAgICAgICAgaWYocmVxX2NubWlfc2V0KGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCAmY21lX2VycikgfHwgY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikKICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgIGlmKGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pIHsKICAgICAgICAgICAgICAgICAgICAgICAgIGVyciA9IE1CVEtfUklMX0VSUl9DTUUgKyBjbWVfZXJyOwpAQCAtODU2LDcgKzg1Nyw3IEBACiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCBOVUxMLCAwKTsKKyAgICAgICAgICAgICAgICAgICAgcmlsX3JzcF9wYWNrX3NlbmQoY2xpX2luZm8tPnNpbV9pZCwgY2xpX2luZm8tPnBvcnQsIGNsaV9pbmZvLT5mZCwgcGFjay0+bXNnX2lkLCBwYWNrLT5tc2dfaW5kZXgsIE5VTEwsIDApOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KIAkJCWJyZWFrOwpAQCAtODY2LDcgKzg2Nyw3IEBACiAgICAgICAgICAgICBpZihwYWNrLT5kYXRhX2xlbiA9PSAwIHx8IHBhY2stPmRhdGEgPT0gTlVMTCkgICAvLyBHZXQgVm9MVEUgc3RhdGUuCiAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgY2hhciByZWdbMTAwXSA9IHswfTsKLSAgICAgICAgICAgICAgICBpZihyZXFfY3Btc19nZXQoY2xpX2luZm8tPnBvcnQsIHJlZywgJmNtZV9lcnIpIHx8IGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pCisgICAgICAgICAgICAgICAgaWYocmVxX2NwbXNfZ2V0KGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCByZWcsICZjbWVfZXJyKSB8fCBjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKQogICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgaWYoY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikgewogICAgICAgICAgICAgICAgICAgICAgICAgZXJyID0gTUJUS19SSUxfRVJSX0NNRSArIGNtZV9lcnI7CkBAIC04NzcsNyArODc4LDcgQEAKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgcmlsX3JzcF9wYWNrX3NlbmQoY2xpX2luZm8tPnBvcnQsIGNsaV9pbmZvLT5mZCwgcGFjay0+bXNnX2lkLCBwYWNrLT5tc2dfaW5kZXgsIHJlZywgc3RybGVuKHJlZykpOworICAgICAgICAgICAgICAgICAgICByaWxfcnNwX3BhY2tfc2VuZChjbGlfaW5mby0+c2ltX2lkLCBjbGlfaW5mby0+cG9ydCwgY2xpX2luZm8tPmZkLCBwYWNrLT5tc2dfaWQsIHBhY2stPm1zZ19pbmRleCwgcmVnLCBzdHJsZW4ocmVnKSk7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogICAgICAgICAgICAgZWxzZSAgICAgLy8gU2V0IFZvTFRFIHN0YXRlLgpAQCAtODg3LDcgKzg4OCw3IEBACiAgICAgICAgICAgICAgICAgY2hhciByZWdbMTAwXSA9IHswfTsKICAgICAgICAgICAgICAgICBMT0dEKCJtZW06JXMsIGxlbjolZCIsIHBhY2stPmRhdGEsIHBhY2stPmRhdGFfbGVuKTsKIAotICAgICAgICAgICAgICAgIGlmKHJlcV9jcG1zX3NldChjbGlfaW5mby0+cG9ydCwgbWVtLCByZWcsIGxlbiwgJmNtZV9lcnIpIHx8IGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pCisgICAgICAgICAgICAgICAgaWYocmVxX2NwbXNfc2V0KGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCBtZW0sIHJlZywgbGVuLCAmY21lX2VycikgfHwgY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikKICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgIGlmKGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pIHsKICAgICAgICAgICAgICAgICAgICAgICAgIGVyciA9IE1CVEtfUklMX0VSUl9DTUUgKyBjbWVfZXJyOwpAQCAtODk5LDcgKzkwMCw3IEBACiAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgTE9HRCgiY3Btc19zZXQgc3VjY2VzcywgcmVnOiVzIiwgcmVnKTsKLSAgICAgICAgICAgICAgICAgICAgcmlsX3JzcF9wYWNrX3NlbmQoY2xpX2luZm8tPnBvcnQsIGNsaV9pbmZvLT5mZCwgcGFjay0+bXNnX2lkLCBwYWNrLT5tc2dfaW5kZXgsIHJlZywgc3RybGVuKHJlZykpOworICAgICAgICAgICAgICAgICAgICByaWxfcnNwX3BhY2tfc2VuZChjbGlfaW5mby0+c2ltX2lkLCBjbGlfaW5mby0+cG9ydCwgY2xpX2luZm8tPmZkLCBwYWNrLT5tc2dfaWQsIHBhY2stPm1zZ19pbmRleCwgcmVnLCBzdHJsZW4ocmVnKSk7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogICAgICAgICAgICAgYnJlYWs7CkBAIC05MTcsNyArOTE4LDcgQEAKIAkJCQljaGFyIHJlZ1s1MF0gPXswfTsKICAgICAgICAgICAgICAgICBMT0dEKCJtYnRrX3NtcyxjbWdzOiVzLGxlbjolZCIsIGNtZ3MsIGxlbik7CiAKLSAgICAgICAgICAgICAgICBpZihyZXFfY21nc19zZXQoY2xpX2luZm8tPnBvcnQsIGNtZ3MscmVnLGxlbiwgJmNtZV9lcnIpIHx8IGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pCisgICAgICAgICAgICAgICAgaWYocmVxX2NtZ3Nfc2V0KGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCBjbWdzLHJlZyxsZW4sICZjbWVfZXJyKSB8fCBjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKQogICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgaWYoY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikgewogICAgICAgICAgICAgICAgICAgICAgICAgZXJyID0gTUJUS19SSUxfRVJSX0NNRSArIGNtZV9lcnI7CkBAIC05MjgsNyArOTI5LDcgQEAKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgcmlsX3JzcF9wYWNrX3NlbmQoY2xpX2luZm8tPnBvcnQsIGNsaV9pbmZvLT5mZCwgcGFjay0+bXNnX2lkLCBwYWNrLT5tc2dfaW5kZXgsIHJlZywgc3RybGVuKHJlZykpOworICAgICAgICAgICAgICAgICAgICByaWxfcnNwX3BhY2tfc2VuZChjbGlfaW5mby0+c2ltX2lkLCBjbGlfaW5mby0+cG9ydCwgY2xpX2luZm8tPmZkLCBwYWNrLT5tc2dfaWQsIHBhY2stPm1zZ19pbmRleCwgcmVnLCBzdHJsZW4ocmVnKSk7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogICAgICAgICAgICAgYnJlYWs7CkBAIC05NDYsNyArOTQ3LDcgQEAKICAgICAgICAgICAgICAgICBjaGFyIHJlZ1sxMjhdID0gezB9OwogICAgICAgICAgICAgICAgIExPR0QoIm1idGtfc21zLGNtZ3M6JXMsIGxlbjolZCIsIGNtc3MsIGxlbik7CiAKLSAgICAgICAgICAgICAgICBpZihyZXFfY21zc19zZXQoY2xpX2luZm8tPnBvcnQsIGNtc3MscmVnLCBsZW4sICZjbWVfZXJyKSB8fCBjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKQorICAgICAgICAgICAgICAgIGlmKHJlcV9jbXNzX3NldChjbGlfaW5mby0+c2ltX2lkLCBjbGlfaW5mby0+cG9ydCwgY21zcyxyZWcsIGxlbiwgJmNtZV9lcnIpIHx8IGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pCiAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICBpZihjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBlcnIgPSBNQlRLX1JJTF9FUlJfQ01FICsgY21lX2VycjsKQEAgLTk1OCw3ICs5NTksNyBAQAogICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgIExPR0QoInJlcV9jbXNzX3NldCBzdWNjZXNzLCByZWc6JXMiLCByZWcpOwotICAgICAgICAgICAgICAgICAgICByaWxfcnNwX3BhY2tfc2VuZChjbGlfaW5mby0+cG9ydCwgY2xpX2luZm8tPmZkLCBwYWNrLT5tc2dfaWQsIHBhY2stPm1zZ19pbmRleCwgTlVMTCwgMCk7CisgICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCBOVUxMLCAwKTsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBicmVhazsKQEAgLTk4MCw3ICs5ODEsNyBAQAogICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICB9CiAKLSAgICAgICAgICAgICAgICBpZihyZXFfY21ncl9zZXQoY2xpX2luZm8tPnBvcnQsIGluZGV4LCByZWcsICZjbWVfZXJyKSB8fCBjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKQorICAgICAgICAgICAgICAgIGlmKHJlcV9jbWdyX3NldChjbGlfaW5mby0+c2ltX2lkLCBjbGlfaW5mby0+cG9ydCwgaW5kZXgsIHJlZywgJmNtZV9lcnIpIHx8IGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pCiAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICBpZihjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBlcnIgPSBNQlRLX1JJTF9FUlJfQ01FICsgY21lX2VycjsKQEAgLTk5MSw3ICs5OTIsNyBAQAogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICByaWxfcnNwX3BhY2tfc2VuZChjbGlfaW5mby0+cG9ydCwgY2xpX2luZm8tPmZkLCBwYWNrLT5tc2dfaWQsIHBhY2stPm1zZ19pbmRleCwgcmVnLCBzdHJsZW4ocmVnKSk7CisgICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCByZWcsIHN0cmxlbihyZWcpKTsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBicmVhazsKQEAgLTEwMDgsNyArMTAwOSw3IEBACiAJCQkJaW50IGxlbiA9IHBhY2stPmRhdGFfbGVuOwogICAgICAgICAgICAgICAgIExPR0QoIm1idGtfc21zLGNtZ3c6JXMsbGVuOiVkIiwgY21ndywgbGVuKTsKIAotICAgICAgICAgICAgICAgIGlmKHJlcV9jbWd3X3NldChjbGlfaW5mby0+cG9ydCwgY21ndywgbGVuLCAmY21lX2VycikgfHwgY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikKKyAgICAgICAgICAgICAgICBpZihyZXFfY21nd19zZXQoY2xpX2luZm8tPnNpbV9pZCwgY2xpX2luZm8tPnBvcnQsIGNtZ3csIGxlbiwgJmNtZV9lcnIpIHx8IGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pCiAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICBpZihjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBlcnIgPSBNQlRLX1JJTF9FUlJfQ01FICsgY21lX2VycjsKQEAgLTEwMTksNyArMTAyMCw3IEBACiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCBOVUxMLCAwKTsKKyAgICAgICAgICAgICAgICAgICAgcmlsX3JzcF9wYWNrX3NlbmQoY2xpX2luZm8tPnNpbV9pZCwgY2xpX2luZm8tPnBvcnQsIGNsaV9pbmZvLT5mZCwgcGFjay0+bXNnX2lkLCBwYWNrLT5tc2dfaW5kZXgsIE5VTEwsIDApOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KICAgICAgICAgICAgIGJyZWFrOwpAQCAtMTAyOSw3ICsxMDMwLDcgQEAKICAgICAgICAgICAgIGlmKHBhY2stPmRhdGFfbGVuID09IDAgfHwgcGFjay0+ZGF0YSA9PSBOVUxMKSAgIC8vIEdldCBWb0xURSBzdGF0ZS4KICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICBjaGFyIHJlZ1sxMDI0XSA9IHswfTsKLSAgICAgICAgICAgICAgICBpZihyZXFfY21nZF9nZXQoY2xpX2luZm8tPnBvcnQsIHJlZywgJmNtZV9lcnIpIHx8IGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pCisgICAgICAgICAgICAgICAgaWYocmVxX2NtZ2RfZ2V0KGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCByZWcsICZjbWVfZXJyKSB8fCBjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKQogICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgaWYoY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikgewogICAgICAgICAgICAgICAgICAgICAgICAgZXJyID0gTUJUS19SSUxfRVJSX0NNRSArIGNtZV9lcnI7CkBAIC0xMDQwLDcgKzEwNDEsNyBAQAogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICByaWxfcnNwX3BhY2tfc2VuZChjbGlfaW5mby0+cG9ydCwgY2xpX2luZm8tPmZkLCBwYWNrLT5tc2dfaWQsIHBhY2stPm1zZ19pbmRleCwgcmVnLCBzdHJsZW4ocmVnKSk7CisgICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCByZWcsIHN0cmxlbihyZWcpKTsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBlbHNlICAgICAvLyBTZXQgVm9MVEUgc3RhdGUuCkBAIC0xMDQ5LDcgKzEwNTAsNyBAQAogCQkJCWludCBsZW4gPSBwYWNrLT5kYXRhX2xlbjsKICAgICAgICAgICAgICAgICBMT0dEKCJtYnRrX3NtcyxjbWdzOiVzLGxlbjolZCIsIGNtZ2QsIGxlbik7CiAKLSAgICAgICAgICAgICAgICBpZihyZXFfY21nZF9zZXQoY2xpX2luZm8tPnBvcnQsIGNtZ2QsbGVuLCAmY21lX2VycikgfHwgY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikKKyAgICAgICAgICAgICAgICBpZihyZXFfY21nZF9zZXQoY2xpX2luZm8tPnNpbV9pZCwgY2xpX2luZm8tPnBvcnQsIGNtZ2QsbGVuLCAmY21lX2VycikgfHwgY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikKICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgIGlmKGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pIHsKICAgICAgICAgICAgICAgICAgICAgICAgIGVyciA9IE1CVEtfUklMX0VSUl9DTUUgKyBjbWVfZXJyOwpAQCAtMTA2MCw3ICsxMDYxLDcgQEAKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgcmlsX3JzcF9wYWNrX3NlbmQoY2xpX2luZm8tPnBvcnQsIGNsaV9pbmZvLT5mZCwgcGFjay0+bXNnX2lkLCBwYWNrLT5tc2dfaW5kZXgsIE5VTEwsIDApOworICAgICAgICAgICAgICAgICAgICByaWxfcnNwX3BhY2tfc2VuZChjbGlfaW5mby0+c2ltX2lkLCBjbGlfaW5mby0+cG9ydCwgY2xpX2luZm8tPmZkLCBwYWNrLT5tc2dfaWQsIHBhY2stPm1zZ19pbmRleCwgTlVMTCwgMCk7CiAgICAgICAgICAgICAgICAgfQogCiAgICAgICAgICAgICB9CkBAIC0xMDc5LDcgKzEwODAsNyBAQAogICAgICAgICAgICAgICAgIGNoYXIgcmVnWzUqMTAyNF0gPSB7MH07CiAgICAgICAgICAgICAgICAgY2hhciByZWcxWzEwMjQrMV0gPSB7MH07CiAKLSAgICAgICAgICAgICAgICBpZihyZXFfY21nbF9zZXQoY2xpX2luZm8tPnBvcnQsIGNtZ2wsIHJlZywgbGVuLCAmY21lX2VycikgfHwgY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikKKyAgICAgICAgICAgICAgICBpZihyZXFfY21nbF9zZXQoY2xpX2luZm8tPnNpbV9pZCwgY2xpX2luZm8tPnBvcnQsIGNtZ2wsIHJlZywgbGVuLCAmY21lX2VycikgfHwgY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikKICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgIGlmKGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pIHsKICAgICAgICAgICAgICAgICAgICAgICAgIGVyciA9IE1CVEtfUklMX0VSUl9DTUUgKyBjbWVfZXJyOwpAQCAtMTA5MSw3ICsxMDkyLDcgQEAKICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICBtZW1jcHkocmVnMSwgcmVnLCAxMDI0KTsKLSAgICAgICAgICAgICAgICAgICAgcmlsX3JzcF9wYWNrX3NlbmQoY2xpX2luZm8tPnBvcnQsIGNsaV9pbmZvLT5mZCwgcGFjay0+bXNnX2lkLCBwYWNrLT5tc2dfaW5kZXgsIHJlZzEsIHN0cmxlbihyZWcxKSk7CisgICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5zaW1faWQsIGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCByZWcxLCBzdHJsZW4ocmVnMSkpOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KICAgICAgICAgICAgIGJyZWFrOwpAQCAtMTEwMSw3ICsxMTAyLDcgQEAKICAgICAgICAgICAgIGlmKHBhY2stPmRhdGFfbGVuID09IDAgfHwgcGFjay0+ZGF0YSA9PSBOVUxMKSAgIC8vIEdldCBWb0xURSBzdGF0ZS4KICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICBjaGFyIGNzY2FbNTBdPXswfTsKLSAgICAgICAgICAgICAgICBpZihyZXFfY3NjYV9nZXQoY2xpX2luZm8tPnBvcnQsIGNzY2EsICZjbWVfZXJyKSB8fCBjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKQorICAgICAgICAgICAgICAgIGlmKHJlcV9jc2NhX2dldChjbGlfaW5mby0+c2ltX2lkLCBjbGlfaW5mby0+cG9ydCwgY3NjYSwgJmNtZV9lcnIpIHx8IGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pCiAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICBpZihjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBlcnIgPSBNQlRLX1JJTF9FUlJfQ01FICsgY21lX2VycjsKQEAgLTExMTIsNyArMTExMyw3IEBACiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIHJpbF9yc3BfcGFja19zZW5kKGNsaV9pbmZvLT5wb3J0LCBjbGlfaW5mby0+ZmQsIHBhY2stPm1zZ19pZCwgcGFjay0+bXNnX2luZGV4LCBjc2NhLCBzdHJsZW4oY3NjYSkpOworICAgICAgICAgICAgICAgICAgICByaWxfcnNwX3BhY2tfc2VuZChjbGlfaW5mby0+c2ltX2lkLCBjbGlfaW5mby0+cG9ydCwgY2xpX2luZm8tPmZkLCBwYWNrLT5tc2dfaWQsIHBhY2stPm1zZ19pbmRleCwgY3NjYSwgc3RybGVuKGNzY2EpKTsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgZXJyID0gTUJUS19SSUxfRVJSX1VOU1VQUE9SVEVEOwogICAgICAgICAgICAgfQpAQCAtMTEyMSw3ICsxMTIyLDcgQEAKIAkJCQljaGFyICpjc2NhID0gKGNoYXIqKXBhY2stPmRhdGE7CiAJCQkJaW50IGxlbiA9IHBhY2stPmRhdGFfbGVuOwogCi0gICAgICAgICAgICAgICAgaWYocmVxX2NzY2Ffc2V0KGNsaV9pbmZvLT5wb3J0LCBjc2NhLCBsZW4sICZjbWVfZXJyKSB8fCBjbWVfZXJyICE9IE1CVEtfUklMX0VSUl9DTUVfTk9OKQorICAgICAgICAgICAgICAgIGlmKHJlcV9jc2NhX3NldChjbGlfaW5mby0+c2ltX2lkLCBjbGlfaW5mby0+cG9ydCwgY3NjYSwgbGVuLCAmY21lX2VycikgfHwgY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikKICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgIGlmKGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pIHsKICAgICAgICAgICAgICAgICAgICAgICAgIGVyciA9IE1CVEtfUklMX0VSUl9DTUUgKyBjbWVfZXJyOwpAQCAtMTEzMiw3ICsxMTMzLDcgQEAKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgcmlsX3JzcF9wYWNrX3NlbmQoY2xpX2luZm8tPnBvcnQsIGNsaV9pbmZvLT5mZCwgcGFjay0+bXNnX2lkLCBwYWNrLT5tc2dfaW5kZXgsIE5VTEwsIDApOworICAgICAgICAgICAgICAgICAgICByaWxfcnNwX3BhY2tfc2VuZChjbGlfaW5mby0+c2ltX2lkLCBjbGlfaW5mby0+cG9ydCwgY2xpX2luZm8tPmZkLCBwYWNrLT5tc2dfaWQsIHBhY2stPm1zZ19pbmRleCwgTlVMTCwgMCk7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogICAgICAgICAgICAgYnJlYWs7CkBAIC0xMTQ4LDcgKzExNDksNyBAQAogCQkJCWNoYXIgKmNzbXAgPSAoY2hhciopcGFjay0+ZGF0YTsKIAkJCQlpbnQgbGVuID0gcGFjay0+ZGF0YV9sZW47CiAKLSAgICAgICAgICAgICAgICBpZihyZXFfY3NtcF9zZXQoY2xpX2luZm8tPnBvcnQsIGNzbXAsbGVuLCAmY21lX2VycikgfHwgY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikKKyAgICAgICAgICAgICAgICBpZihyZXFfY3NtcF9zZXQoY2xpX2luZm8tPnNpbV9pZCwgY2xpX2luZm8tPnBvcnQsIGNzbXAsbGVuLCAmY21lX2VycikgfHwgY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikKICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgIGlmKGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pIHsKICAgICAgICAgICAgICAgICAgICAgICAgIGVyciA9IE1CVEtfUklMX0VSUl9DTUUgKyBjbWVfZXJyOwpAQCAtMTE1OSw3ICsxMTYwLDcgQEAKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgcmlsX3JzcF9wYWNrX3NlbmQoY2xpX2luZm8tPnBvcnQsIGNsaV9pbmZvLT5mZCwgcGFjay0+bXNnX2lkLCBwYWNrLT5tc2dfaW5kZXgsIE5VTEwsIDApOworICAgICAgICAgICAgICAgICAgICByaWxfcnNwX3BhY2tfc2VuZChjbGlfaW5mby0+c2ltX2lkLCBjbGlfaW5mby0+cG9ydCwgY2xpX2luZm8tPmZkLCBwYWNrLT5tc2dfaWQsIHBhY2stPm1zZ19pbmRleCwgTlVMTCwgMCk7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogICAgICAgICAgICAgYnJlYWs7CkBAIC0xMTc1LDcgKzExNzYsNyBAQAogCQkJCWNoYXIgKmNzY2IgPSAoY2hhciopcGFjay0+ZGF0YTsKIAkJCQlpbnQgbGVuID0gcGFjay0+ZGF0YV9sZW47CiAKLSAgICAgICAgICAgICAgICBpZihyZXFfY3NjYl9zZXQoY2xpX2luZm8tPnBvcnQsIGNzY2IsbGVuLCAmY21lX2VycikgfHwgY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikKKyAgICAgICAgICAgICAgICBpZihyZXFfY3NjYl9zZXQoY2xpX2luZm8tPnNpbV9pZCwgY2xpX2luZm8tPnBvcnQsIGNzY2IsbGVuLCAmY21lX2VycikgfHwgY21lX2VyciAhPSBNQlRLX1JJTF9FUlJfQ01FX05PTikKICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgIGlmKGNtZV9lcnIgIT0gTUJUS19SSUxfRVJSX0NNRV9OT04pIHsKICAgICAgICAgICAgICAgICAgICAgICAgIGVyciA9IE1CVEtfUklMX0VSUl9DTUUgKyBjbWVfZXJyOwpAQCAtMTE4Niw3ICsxMTg3LDcgQEAKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgcmlsX3JzcF9wYWNrX3NlbmQoY2xpX2luZm8tPnBvcnQsIGNsaV9pbmZvLT5mZCwgcGFjay0+bXNnX2lkLCBwYWNrLT5tc2dfaW5kZXgsIE5VTEwsIDApOworICAgICAgICAgICAgICAgICAgICByaWxfcnNwX3BhY2tfc2VuZChjbGlfaW5mby0+c2ltX2lkLCBjbGlfaW5mby0+cG9ydCwgY2xpX2luZm8tPmZkLCBwYWNrLT5tc2dfaWQsIHBhY2stPm1zZ19pbmRleCwgTlVMTCwgMCk7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogICAgICAgICAgICAgYnJlYWs7Cg==