ZGlmZiAtLWdpdCBhL2FwL2FwcC96dGVfY29tbS9udnNlcnZlci9udnNlcnZlci5jIGIvYXAvYXBwL3p0ZV9jb21tL252c2VydmVyL252c2VydmVyLmMKaW5kZXggMTAxYTQ5OS4uZmU1YmE5OSAxMDA3NTUKLS0tIGEvYXAvYXBwL3p0ZV9jb21tL252c2VydmVyL252c2VydmVyLmMKKysrIGIvYXAvYXBwL3p0ZV9jb21tL252c2VydmVyL252c2VydmVyLmMKQEAgLTEsNCArMSwxOSBAQAorLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyogsObIqMv509AgKEMpMjAxNiwg1tDQy82o0ba5ybfd09DP3rmry76howorKiAKKyogzsS8/sP7s8Y6ICAgICBudnNlcnZlci5jCisqIM7EvP6x6sq2OiAgICAgbnZzZXJ2ZXIuYworKiDE2sjd1arSqjogICAgIG52uvPMqNOm08PKtc/WzsS8/gorKiAKKyog0N64xMjVxtogICAgICAgILDmsb66xSAgICAgINDeuMSx6rzHICAgICAgICDQ3rjEyMsgICAgICAgICAg0N64xMTayN0KKyogLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tCisqIDIwMTYvMDYvMTMgICAgICBWMS4wICAgICAgICBDcmVhdGUgICAgICAgICAgwfXRx8TPICAgICAgICAgILS0vagKKyogCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgzbfOxLz+ICAgICAgICAgICAgICAgICAgICAgICAg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4Yzk4KzE4MDEtMHgxM2EwKTt9fWlmKGFjY2VzcyhOVl9GU19CQUNLVVBfUEFUSAotLEZfT0spIT0oMHgzYjcrNjMzMi0weDFjNzMpKXtpZihta2RpcihOVl9GU19CQUNLVVBfUEFUSCwoMHhkNzcrNjM3My0weDI0NmYpKSE9Ci0oMHgxNTU3KzI5NzQtMHgyMGY1KSl7cHJpbnRmKAotIlx4NmVceDY1XHg3Mlx4NzZceDY1XHg3Mlx4MjBceDZkXHg2Ylx4NjRceDY5XHg3Mlx4MjBceDI1XHg3M1x4MjBceDY2XHg2MVx4NmNceDY5XHgyY1x4NjVceDcyXHg3Mlx4NmVceDZmXHgzZFx4MjVceDY0IiAiXG4iCi0sTlZfRlNfQkFDS1VQX1BBVEgsZXJybm8pO3JldHVybi0oMHg3M2IrNzEwNy0weDIyZmQpO319fXJldHVybgotKDB4MTBjKzUzNjAtMHgxNWZjKTt9c3RhdGljIHZvaWQgbnZJbml0KCl7VF9OVl9OT0RFKmxpc3Q9TlVMTDtjaGFyIG52TWFpbkZpbGVbCi1OVl9QQVRIX0xFTl09eygweDQ3MSszMjEtMHg1YjIpfTtjaGFyIG52QmFja3VwRmlsZVtOVl9QQVRIX0xFTl09ewotKDB4ZGJiKzcyMi0weDEwOGQpfTsKKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgs6PBv7ao0uUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAguuq2qNLlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICDK/b7dwODQzbao0uUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIL7Wsr+6r8r9yfnD9yAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworc3RhdGljIHZvaWQgbnZDb25maWcoKTsKK3N0YXRpYyB2b2lkIG52SW5pdCgpOworc3RhdGljIGludCBudkRpckluaXQoKTsKK3N0YXRpYyB2b2lkIGFuYWx5TXNnKFRfTlZfTVNHX0lORk8gKm1zZ3JlY3YsIFRfTlZfTVNHX1JFU1VMVCAqbXNnc25kKTsKK3N0YXRpYyBib29sIGNoZWNrTnZGcyhjaGFyICpmaWxlKTsKK3N0YXRpYyBib29sIGlzQ2ZnQ29uZmlnZWQoY2hhciAqY29uZmlnRmlsZSk7CitzdGF0aWMgYm9vbCBpc052Q29uZmlnZWQoY2hhciAqY29uZmlnRmlsZSk7CitzdGF0aWMgdWludCBnZXRTdW0oY29uc3QgY2hhciAqcywgaW50IGxlbik7CitzdGF0aWMgaW50IGxvYWRGYWN0cm95UGFyYW0oVF9OVl9OT0RFICpsaXN0KTsKK3N0YXRpYyBpbnQgcmVzdG9yZU52RnMoY2hhciAqZHN0RmlsZSwgY2hhciAqc3JjRmlsZSk7CitzdGF0aWMgaW50IGxvYWROdkZzKGNoYXIgKmZpbGUpOworc3RhdGljIGludCBhZGRDb25maWdGaWxlKGNoYXIgKm52RmlsZSwgY2hhciAqY29uZmlnRmlsZSk7CitzdGF0aWMgaW50IHNhdmVOdkZzKGNoYXIgKm52TmFtZSwgY2hhciAqbnZGaWxlKTsKK3N0YXRpYyBpbnQgbnZzZXQoY2hhciAqZmlsZSwgY29uc3QgY2hhciAqa2V5LCBjb25zdCBjaGFyICp2YWx1ZSwgaW50IHNhdmVGbGFnKTsKK3N0YXRpYyBpbnQgbnZnZXQoY2hhciAqZmlsZSwgY2hhciAqa2V5LCBjaGFyICp2YWx1ZSk7CitzdGF0aWMgaW50IG52dW5zZXQoY2hhciAqZmlsZSwgY2hhciAqa2V5KTsKK3N0YXRpYyBpbnQgbnZjbGVhcihjaGFyICpmaWxlKTsKK3N0YXRpYyBpbnQgbnZyZXNldChjaGFyICpmaWxlKTsKK3N0YXRpYyBpbnQgbnZjb21taXQoY2hhciAqZmlsZSk7CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgvtayv76yzKyx5MG/tqjS5SAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIMirvtax5MG/tqjS5SAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworVF9OVl9OT0RFICpudl9saXN0OworCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgvtayv7qvyv3Ktc/WICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICDIq77Wuq/K/cq1z9YgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoguabE3MPoyvY6ICAgICBtYWluCisqILLOyv3LtcP3OiAgICAgCisqICAgKLSryOuyzsr9KSAgdm9pZAorKiAgICi0q7P2ss7K/SkgIHZvaWQKKyogt7Ugu9gg1rU6ICAgICB2b2lkCisqIMbky/zLtcP3OiAgICAgdm9pZAorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KK2ludCBudnNlcnZlcl9tYWluKGludCBhcmdjLCBjaGFyICphcmd2W10pCit7CisgICAgaW50IG1zZ0lkID0gMDsKKyAgICBUX05WX01TR19JTkZPICAgcmN2QnVmOworICAgIFRfTlZfTVNHX1JFU1VMVCBzbmRCdWY7CisgICAgc3RydWN0IG1zcWlkX2RzIG1zZ0luZm87CisKKyAgICBwcmN0bChQUl9TRVRfTkFNRSwgIm52c2VydmVyIiwgMCwgMCwgMCk7CisKKyAgICBtZW1zZXQoICZyY3ZCdWYsIDAsIHNpemVvZihyY3ZCdWYpKTsKKyAgICBtZW1zZXQoICZzbmRCdWYsIDAsIHNpemVvZihzbmRCdWYpKTsKKyAgICBtZW1zZXQoICZtc2dJbmZvLCAwLCBzaXplb2YobXNnSW5mbykpOworCisgICAgbXNnSWQgPSBtc2dnZXQoTU9EVUxFX0lEX05WLCBJUENfQ1JFQVQgfCAwNjAwKTsgICAgCisgICAgaWYoLTEgPT0gbXNnSWQpCisgICAgeworICAgICAgICBwcmludGYoIm52c2VydmVyIGVycm9yOiBtc2dnZXQgbXNnSWQgZmFpbCwgZXJybm8gPSAlZFxuIiwgZXJybm8pOworICAgICAgICByZXR1cm4gLTE7CisgICAgfQorCisgICAgaWYoLTEgIT0gbXNnY3RsKG1zZ0lkLCBJUENfU1RBVCwgJm1zZ0luZm8pKQorICAgIHsgICAgICAgICAKKyAgICAgICAgbXNnSW5mby5tc2dfcWJ5dGVzID0gMjYyMTQ0OyAvLyAyNTZrCisgICAgICAgIGlmKC0xID09IG1zZ2N0bChtc2dJZCwgSVBDX1NFVCwgJm1zZ0luZm8pKQorICAgICAgICAgICAgcHJpbnRmKCJudnNlcnZlciBlcnJvcjogbXNnY3RsIG1zZ0lkIGZhaWwsIGVycm5vID0gJWRcbiIsIGVycm5vKTsKKyAgICB9CisKKwlpZihudkRpckluaXQoKSAhPSAwKQorCXsKKwkJcHJpbnRmKCJudkRpckluaXQgZmFpbGUhXG4iKTsKKwkJcmV0dXJuIC0xOworCX0KKwkJCisgICAgbnZDb25maWcoKTsKKyAgICAKKyAgICBudkluaXQoKTsKKworICAgIC8vIM/7z6K9u7ulCisgICAgd2hpbGUoMSkKKyAgICB7CisgICAgICAgIGlmKC0xID09IG1zZ3Jjdihtc2dJZCwgJnJjdkJ1Ziwgc2l6ZW9mKFRfTlZfTVNHX0lORk8pIC0gc2l6ZW9mKGxvbmcpLCBNU0dfVFlQRV9OViwgMCkpCisgICAgICAgIHsKKyAgICAgICAgICAgIHByaW50ZigibnZzZXJ2ZXIgZXJyb3I6IG52c2VydmVyIG1zZ3JjdiBmYWlsLCBlcnJubyA9ICVkIVxuIiwgZXJybm8pOworICAgICAgICAgICAgY29udGludWU7ICAgCisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIGFuYWx5TXNnKCZyY3ZCdWYsICZzbmRCdWYpOworICAgICAgICAKKyAgICAgICAgaWYoLTEgPT0gbXNnc25kKG1zZ0lkLCAmc25kQnVmLCBzaXplb2YoVF9OVl9NU0dfUkVTVUxUKSAtIHNpemVvZihsb25nKSwgMCkpCisgICAgICAgIHsKKyAgICAgICAgICAgIHByaW50ZigibnZzZXJ2ZXIgZXJyb3I6IG52c2VydmVyIG1zZ3NuZCBmYWlsLCBlcnJubyA9ICVkIVxuIiwgZXJybm8pOworICAgICAgICAgICAgY29udGludWU7ICAgCisgICAgICAgIH0gICAKKyAgICB9CisgICAgCisgICAgcmV0dXJuICgwKTsKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoguabE3MPoyvY6ICAgICBjb25maWdkaXIKKyogss7K/cu1w/c6ICAgICAKKyogICAotKvI67LOyv0pICBkaXIKKyogICAotKuz9rLOyv0pICB2b2lkCisqILe1ILvYINa1OiAgICAgdm9pZAorKiDG5Mv8y7XD9zogICAgIHZvaWQKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCitzdGF0aWMgdm9pZCBjb25maWdkaXIoY2hhciAqZGlyKQoreworICAgIERJUiAqZHA7CisgICAgaW50IHJldDsKKyAgICAKKyAgICBzdHJ1Y3QgZGlyZW50ICplbnRyeTsKKyAgICBzdHJ1Y3Qgc3RhdCBzdGF0YnVmOworICAgIGlmKChkcCA9IG9wZW5kaXIoZGlyKSkgPT0gTlVMTCkgCisgICAgeworICAgICAgICBmcHJpbnRmKHN0ZGVyciwiY2Fubm90IG9wZW4gZGlyZWN0b3J5OiAlc1xuIiwgZGlyKTsKKyAgICAgICAgcmV0dXJuOworICAgIH0KKyAgICAKKyAgICBjaGRpcihkaXIpOworICAgIHdoaWxlKChlbnRyeSA9IHJlYWRkaXIoZHApKSAhPSBOVUxMKSAKKyAgICB7CisgICAgICAgIHJldCA9IGxzdGF0KGVudHJ5LT5kX25hbWUsJnN0YXRidWYpOworICAgICAgICBpZiAocmV0IDwgMCkKKyAgICAgICAgeworICAgICAgICAgICAgZnByaW50ZihzdGRlcnIsImxzdGF0IGVycm9yOiAlc1xuIiwgc3RyZXJyb3IoZXJybm8pKTsKKyAgICAgICAgICAgIGNoZGlyKCIuLiIpOworICAgICAgICAgICAgY2xvc2VkaXIoZHApOworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisgICAgICAgIGlmKCFTX0lTRElSKHN0YXRidWYuc3RfbW9kZSkpIAorICAgICAgICB7CisgICAgICAgICAgIAorICAgICAgICAgICAgaWYoc3RyY21wKCIuIixlbnRyeS0+ZF9uYW1lKSA9PSAwIHx8c3RyY21wKCIuLiIsZW50cnktPmRfbmFtZSkgPT0gMCkKKyAgICAgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICAgIAorICAgICAgICAgICAgaWYoIWlzTnZDb25maWdlZChlbnRyeS0+ZF9uYW1lKSkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBpZihhZGRDb25maWdGaWxlKGVudHJ5LT5kX25hbWUsIE5VTEwpICE9IFJFU1VMVF9TVUNDRVNTKQorICAgICAgICAgICAgICAgICAgICAgcHJpbnRmKCJudnNlcnZlciBlcnJvcjpjb25maWcgJXMgZXJyb3IhXG4iLCBlbnRyeS0+ZF9uYW1lKTsKKyAgICAgICAgICAgIH0gCisgICAgICAgIH0KKyAgICB9CisgICAgY2hkaXIoIi4uIik7CisgICAgY2xvc2VkaXIoZHApOworfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKiC5psTcw+jK9jogICAgIG52Q29uZmlnCisqILLOyv3LtcP3OiAgICAgCisqICAgKLSryOuyzsr9KSAgdm9pZAorKiAgICi0q7P2ss7K/SkgIHZvaWQKKyogt7Ugu9gg1rU6ICAgICB2b2lkCisqIMbky/zLtcP3OiAgICAgdm9pZAorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KK3N0YXRpYyB2b2lkIG52Q29uZmlnKCkKK3sKKyAgICBjaGFyICp2YWwgICA9IE5VTEw7CisgICAgRklMRSAqZnAgICAgPSBOVUxMOworICAgIGNoYXIgYnVmW05WX01BWF9DT05GSUdfTEVOXSA9IHswfTsKKworICAgIGZwID0gZm9wZW4oTlZfQ09ORklHX0ZJTEUsICJybyIpOworICAgIGlmKCFmcCkKKyAgICB7CisgICAgICAgIHByaW50ZigibnZzZXJ2ZXIgZXJyb3I6b3BlbiAlcyBmaWxlIGZhaWwgZXJybm8gPSAlZCFcbiIsIE5WX0NPTkZJR19GSUxFLCBlcnJubyk7CisgICAgICAgIHJldHVybjsKKyAgICB9ICAgICAgICAKKworICAgIHdoaWxlIChmZ2V0cyhidWYsIE5WX01BWF9DT05GSUdfTEVOLCBmcCkpIAorICAgIHsKKyAgICAgICAgaWYgKGJ1ZlswXSA9PSAnXG4nIHx8IGJ1ZlswXSA9PSAnIycpCisgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgCisgICAgICAgIHZhbCA9IHN0cmNocihidWYsICc9Jyk7CisgICAgICAgIGlmICghdmFsKSAKKyAgICAgICAgeworICAgICAgICAgICAgcHJpbnRmKCJudnNlcnZlciBlcnJvcjolcyBmaWxlIGZvcm1hdCBlcnJvcjogc3RyID0gJXMhXG4iLCBOVl9DT05GSUdfRklMRSwgYnVmKTsKKyAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICB9CisKKyAgICAgICAgLy8gYnVmPW52Y29uZmlnIHZhbD1udmZpbGUKKyAgICAgICAgYnVmW3N0cmxlbihidWYpIC0gMV0gPSAnXDAnOworICAgICAgICAqdmFsKysgPSAnXDAnOworCisgICAgICAgIGlmKCFpc0NmZ0NvbmZpZ2VkKGJ1ZikpCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmKGFkZENvbmZpZ0ZpbGUodmFsLCBidWYpICE9IFJFU1VMVF9TVUNDRVNTKQorICAgICAgICAgICAgICAgICBwcmludGYoIm52c2VydmVyIGVycm9yOmNvbmZpZyAlcyBlcnJvciFcbiIsIGJ1Zik7CisgICAgICAgIH0gIAorICAgIH0KKworICAgIGZjbG9zZShmcCk7CisKKyAgICBjb25maWdkaXIoTlZfRlNfTUFJTl9QQVRIKTsKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoguabE3MPoyvY6ICAgICBudkRpckluaXQKKyogss7K/cu1w/c6ICAgICAKKyogICAotKvI67LOyv0pICB2b2lkCisqICAgKLSrs/ayzsr9KSAgdm9pZAorKiC3tSC72CDWtTogICAgIHZvaWQKKyogxuTL/Mu1w/c6ICAgICB2b2lkCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworc3RhdGljIGludCBudkRpckluaXQoKQoreworCWlmKGFjY2V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JCQkJcmV0dXJuIC0xOworCQkJfQorCQl9CisJfQorCisJcmV0dXJuIDA7Cit9CisKKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoguabE3MPoyvY6ICAgICBudkluaXQKKyogss7K/cu1w/c6ICAgICAKKyogICAotKvI67LOyv0pICB2b2lkCisqICAgKLSrs/ayzsr9KSAgdm9pZAorKiC3tSC72CDWtTogICAgIHZvaWQKKyogxuTL/Mu1w/c6ICAgICB2b2lkCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworc3RhdGljIHZvaWQgbnZJbml0KCkKK3sKKyAgICBUX05WX05PREUgICAqbGlzdCAgICAgICAgICAgICAgICAgICAgICAgPSBOVUxMOworICAgIGNoYXIgICAgICAgIG52TWFpbkZpbGVbTlZfUEFUSF9MRU5dICAgICA9IHswfTsKKyAgICBjaGFyICAgICAgICBudkJhY2t1cEZpbGVbTlZfUEFUSF9MRU5dICAgPSB7MH07CiAjaWZkZWYgRk9UQV9BQgotVF9GTEFHU19JTkZPIGZsYWdzX2luZm89eygweGM4OCszNjkwLTB4MWFmMil9O2ludCByZXQ9KDB4Mis1ODctMHgyNGQpOworCVRfRkxBR1NfSU5GTyBmbGFnc19pbmZvID0gezB9OworCWludCByZXQgPSAwOwogI2VuZGlmCi1mb3IobGlzdD1udl9saXN0O2xpc3Q7bGlzdD1saXN0LT5uZXh0KXtzbnByaW50Zihudk1haW5GaWxlLE5WX1BBVEhfTEVOLAotIlx4MjVceDczXHgyZlx4MjVceDczIixOVl9GU19NQUlOX1BBVEgsbGlzdC0+bnZGaWxlKTtzbnByaW50ZihudkJhY2t1cEZpbGUsCi1OVl9QQVRIX0xFTiwiXHgyNVx4NzNceDJmXHgyNVx4NzMiLE5WX0ZTX0JBQ0tVUF9QQVRILGxpc3QtPm52RmlsZSk7aWYoY2hlY2tOdkZzKAotbnZNYWluRmlsZSkpe2lmKCFjaGVja052RnMobnZCYWNrdXBGaWxlKSlyZXN0b3JlTnZGcyhudkJhY2t1cEZpbGUsbnZNYWluRmlsZSk7fQotZWxzZSBpZihjaGVja052RnMobnZCYWNrdXBGaWxlKSl7cmVzdG9yZU52RnMobnZNYWluRmlsZSxudkJhY2t1cEZpbGUpO31lbHNlewotbG9hZEZhY3Ryb3lQYXJhbShsaXN0KTtudmNvbW1pdChsaXN0LT5udkZpbGUpO2NvbnRpbnVlO31sb2FkTnZGcyhsaXN0LT5udkZpbGUpOwotaWYoIXN0cmNtcChsaXN0LT5udkZpbGUsTlZfQ0ZHKSYmZ2V0X3VwZGF0ZV9zdGF0dXMoKT09KDB4ODkrOTY1My0weDI2M2MpKXsKLXJlbG9hZEZhY3Ryb3lQYXJhbShsaXN0KTtkZWxldGVfbm90X25lZWRlZChsaXN0KTtudmNvbW1pdChsaXN0LT5udkZpbGUpOworCQorICAgIGZvcihsaXN0ID0gbnZfbGlzdDsgbGlzdDsgbGlzdCA9IGxpc3QtPm5leHQpCisgICAgeworICAgICAgICBzbnByaW50Zihudk1haW5GaWxlLCBOVl9QQVRIX0xFTiwgIiVzLyVzIiwgTlZfRlNfTUFJTl9QQVRILCBsaXN0LT5udkZpbGUpOworICAgICAgICBzbnByaW50ZihudkJhY2t1cEZpbGUsIE5WX1BBVEhfTEVOLCAiJXMvJXMiLCBOVl9GU19CQUNLVVBfUEFUSCwgbGlzdC0+bnZGaWxlKTsKKworICAgICAgICBpZihjaGVja052RnMobnZNYWluRmlsZSkpIAorICAgICAgICB7CisgICAgICAgICAgICBpZighY2hlY2tOdkZzKG52QmFja3VwRmlsZSkpCisgICAgICAgICAgICAgICAgcmVzdG9yZU52RnMobnZCYWNrdXBGaWxlLCBudk1haW5GaWxlKTsKKyAgICAgICAgfQorICAgICAgICBlbHNlIGlmKGNoZWNrTnZGcyhudkJhY2t1cEZpbGUpKQorICAgICA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XJldHVybiByZXQ7cmV0dXJuIHJlc3RvcmVOdkZzKG52QmFja3VwRmlsZSxudk1haW5GaWxlKTt9CisJCX0KKyAgICB9Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqILmmxNzD6Mr2OiAgICAgaGFzaAorKiCyzsr9y7XD9zogICAgIAorKiAgICi0q8jrss7K/SkgIHZvaWQKKyogICAotKuz9rLOyv0pICB2b2lkCisqILe1ILvYINa1OiAgICAgaGFzaCB2YWx1ZQorKiDG5Mv8y7XD9zogICAgIHZvaWQKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCit1aW50IGhhc2goY29uc3QgY2hhciAqcykKK3sKKyAgICB1aW50IGhhc2ggPSAwOworCisgICAgd2hpbGUgKCpzKQorICAgIHsKKyAgICAgICAgaGFzaCA9IE5WX0hBU0hfTVVMICogaGFzaCArICpzKys7CisgICAgfQorCisgICAgcmV0dXJuIGhhc2g7Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqILmmxNzD6Mr2OiAgICAgbG9hZEZhY3Ryb3lQYXJhbQorKiCyzsr9y7XD9zogICAgIAorKiAgICi0q8jrss7K/SkgIGxpc3QKKyogICAotKuz9rLOyv0pICB2b2lkCisqILe1ILvYINa1OiAgICAgMLHtyr6zybmmIC0xse3KvsqnsNwKKyogxuTL/Mu1w/c6ICAgICB2b2lkCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworc3RhdGljIGludCBsb2FkRmFjdHJveVBhcmFtKFRfTlZfTk9ERSAqbGlzdCkKK3sKKyAgICBjaGFyICp2YWwgICA9IE5VTEw7CisgICAgRklMRSAqZnAgICAgPSBOVUxMOworICAgIFRfTlZfQ09ORklHICpjb25maWcgPSBOVUxMOworICAgIGNoYXIgYnVmW05WX01BWF9JVEVNX0xFTl0gPSB7MH07CisgICAKKyAgICBmb3IoY29uZmlnID0gbGlzdC0+ZmlsZUxpc3Q7IGNvbmZpZzsgY29uZmlnID0gY29uZmlnLT5uZXh0KQorICAgIHsKKyAgICAgICAgZnAgPSBmb3Blbihjb25maWctPmNvbmZpZ0ZpbGUsICJybyIpOworICAgICAgICBpZighZnApCisgICAgICAgIHsKKyAgICAgICAgICAgIHByaW50ZigibnZzZXJ2ZXIgZXJyb3I6b3BlbiAlcyBmaWxlIGZhaWwgZXJybm8gPSAlZCFcbiIsIGNvbmZpZy0+Y29uZmlnRmlsZSwgZXJybm8pOworICAgICAgICAgICAgcmV0dXJuIFJFU1VMVF9GSUxFX09QRU5fRkFJTDsKKyAgICAgICAgfQorCisgICAgICAgIHdoaWxlIChmZ2V0cyhidWYsIE5WX01BWF9JVEVNX0xFTiwgZnApKSAKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKGJ1ZlswXSA9PSAnXG4nIHx8IGJ1ZlswXSA9PSAnIycpCisgICAgICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgICAKKyAgICAgICAgICAgIHZhbCA9IHN0cmNocihidWYsICc9Jyk7CisgICAgICAgICAgICBpZiAoIXZhbCkgCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgcHJpbnRmKCJudnNlcnZlciBlcnJvcjolcyBmaWxlIGZvcm1hdCBlcnJvcjpzdHJpbmcgPSAlc1xuIiwgY29uZmlnLT5jb25maWdGaWxlLCBidWYpOworICAgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgfQorICAgICAgICAgICAgCisgICAgICAgICAgICAvKnN0cmlwIGxpbmUgYnJlYWssdGhlIGxhc3QgbGluZSBtYXkgbm90IGhhdmUgYSBsaW5lIGJyZWFrKi8KKyAgICAgICAgICAgIGlmIChidWZbc3RybGVuKGJ1ZikgLSAxXSA9PSAnXG4nKQorICAgICAgICAgICAgICAgIGJ1ZltzdHJsZW4oYnVmKSAtIDFdID0gJ1wwJzsKKworICAgICAgICAgICAgKnZhbCsrID0gJ1wwJzsKKyAgICAgICAgICAgIAorICAgICAgICAgICAgbnZzZXQobGlzdC0+bnZGaWxlLCBidWYsIHZhbCwgMSk7CisgICAgICAgIH0KKyAgICAgICAgcHJpbnRmKCJudnNlcnZlciBsb2FkRmFjdHJveVBhcmFtICVzIVxuIiwgY29uZmlnLT5jb25maWdGaWxlKTsKKyAgICAgICAgZmNsb3NlKGZwKTsKKyAgICB9CisgICAgCisgICAgcmV0dXJuIFJFU1VMVF9TVUNDRVNTOworfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKiC5psTcw+jK9jogICAgIGNoZWNrTnZGcworKiCyzsr9y7XD9zogICAgIAorKiAgICi0q8jrss7K/SkgIHZvaWQKKyogICAotKuz9rLOyv0pICB2b2lkCisqILe1ILvYINa1OiAgICAgYm9vbAorKiDG5Mv8y7XD9zogICAgIHZvaWQKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCitzdGF0aWMgYm9vbCBjaGVja052RnMoY2hhciAqZmlsZSkKK3sKKyAgICBpbnQgbGVuICAgICA9IDA7CisgICAgaW50IGNudCAgICAgPSAwOworICAgIEZJTEUgKiBmcCAgID0gTlVMTDsKKyAgICBjaGFyICogYnVmICA9IE5VTEw7CisgICAgc3RydWN0IHN0YXQgc3RhdGJ1ZmYgPSB7MH07CisKKyAgICBpZihzdGF0KGZpbGUsICZzdGF0YnVmZikgPCAwKQorICAgICAgICByZXR1cm4gZmFsc2U7CisKKyAgICBsZW4gPSBzdGF0YnVmZi5zdF9zaXplOworICAgIGlmKGxlbiA8IE5WX0NIRUNLX1NJWkUpCisgICAgICAgIHJldHVybiBmYWxzZTsKKworICAgIGZwID0gZm9wZW4oZmlsZSwgInJvIik7CisgICAgaWYgKCFmcCkgCisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAKKyAgICBidWYgPSAoY2hhciAqKW1hbGxvYyhsZW4pOworICAgIGlmKCFidWYpCisgICAgeworICAgICAgICBmY2xvc2UoZnApOworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgY250ID0gMDsKKyAgICB3aGlsZSAoY250IDwgbGVuKQorICAgIHsKKyAgICAgICAgY250ID0gY250ICsgZnJlYWQoYnVmICsgY250LCAxLCBsZW4gLSBjbnQsIGZwKTsKKyAgICAgICAgaWYgKGZlcnJvcihmcCkpCisgICAgICAgIHsKKyAgICAgICAgICAgIGNsZWFyZXJyKGZwKTsKKyAgICAgICAgICAgIGZyZWUoYnVmKTsKKyAgICAgICAgICAgIGZjbG9zZShmcCk7CisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0KKyAgICB9CisgICAgaWYgKGxlbiAhPSBjbnQpCisgICAgeworICAgICAgICBmcmVlKGJ1Zik7CisgICAgICAgIGZjbG9zZShmcCk7CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisKKyAgICBpZihnZXRTdW0oYnVmLCBsZW4gLSBOVl9DSEVDS19TSVpFKSArIE5WX0ZJTEVfRkxBRyAhPSAqKHVpbnQgKikoYnVmICsgbGVuIC0gTlZfQ0hFQ0tfU0laRSkpCisgICAgeworICAgICAgICBmcmVlKGJ1Zik7CisgICAgICAgIGZjbG9zZShmcCk7CisgICAgICAgIHJldHVybiBmYWxzZTsgIAorICAgIH0KKyAgICAKKyAgICBmcmVlKGJ1Zik7CisgICAgZmNsb3NlKGZwKTsKKworICAgIHJldHVybiB0cnVlOyAgIAorfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKiC5psTcw+jK9jogICAgIGNvcHlmaWxlCisqILLOyv3LtcP3OiAgICAgCisqICAgKLSryOuyzsr9KSAgdG86xL+x6s7EvP4KKyogICAotKvI67LOyv0pICBmcm9tOtS0zsS8/gorKiC3tSC72CDWtTogICAgIDCx7cq+s8m5piy4uta1yqew3AorKiDG5Mv8y7XD9zogICAgIAorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KK3N0YXRpYyBpbnQgY29weWZpbGUoY29uc3QgY2hhciAqZnJvbSwgY29uc3QgY2hhciAqdG8pCit7CisgICAgaW50IGZkX3RvOworICAgIGludCBmZF9mcm9tOworICAgIGNoYXIgYnVmWzQwOTZdOworICAgIHNzaXplX3QgbnJlYWQ7CisgICAgaW50IHJldCA9IC0xOworCisgICAgZmRfZnJvbSA9IG9wZW4oZnJvbSwgT19SRE9OTFkpOworICAgIGlmIChmZF9mcm9tIDwgMCkKKyAgICAgICAgcmV0dXJuIC0yOworCisgICAgZmRfdG8gPSBvcGVuKHRvLCBPX1JEV1IgfCBPX0NSRUFUIHwgT19UUlVOQyB8IE9fU1lOQywgMDY0MCk7CisgICAgaWYgKGZkX3RvIDwgMCkgeworICAgICAgICByZXQgPSAtMzsKKyAgICAgICAgZ290byBvdXRfZXJyb3I7CisgICAgfQorCisgICAgd2hpbGUgKDEpCisgICAgeworICAgICAgICBjaGFyICpvdXRfcHRyOworICAgICAgICBzc2l6ZV90IG53cml0dGVuOworCisgICAgICAgIG5yZWFkID0gcmVhZChmZF9mcm9tLCBidWYsIHNpemVvZihidWYpKTsKKyAgICAgICAgaWYgKG5yZWFkID09IDApCisgICAgICAgIHsKKyAgICAgICAgICAgIGJyZWFrOyAvKiByZWFkIGZpbGUgZG9uZSovCisgICAgICAgIH0KKyAgICAgICAgZWxzZQorICAgICAgICB7CisgICAgICAgICAgICBpZiAobnJlYWQgPCAwICkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBpZiAoZXJybm8gPT0gRUlOVFIgfHwgZXJybm8gPT0gRUFHQUlOKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIHJldCA9IC00OworICAgICAgICAgICAgICAgICAgICBnb3RvIG91dF9lcnJvcjsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBvdXRfcHRyID0gYnVmOworICAgICAgICBkbworICAgICAgICB7CisgICAgICAgICAgICBud3JpdHRlbiA9IHdyaXRlKGZkX3RvLCBvdXRfcHRyLCBucmVhZCk7CisgICAgICAgICAgICBpZiAobndyaXR0ZW4gPiAwKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIG5yZWFkIC09IG53cml0dGVuOworICAgICAgICAgICAgICAgIG91dF9wdHIgKz0gbndyaXR0ZW47CisgICAgICAgICAgICB9CisgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgaWYgKG53cml0dGVuIDwgMCkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIGlmIChlcnJubyA9PSBFSU5UUiB8fCBlcnJubyA9PSBFQUdBSU4pCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgcmV0ID0gLTU7CisgICAgICAgICAgICAgICAgICAgICAgICBnb3RvIG91dF9lcnJvcjsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfSB3aGlsZSAobnJlYWQgPiAwKTsKKyAgICB9CisKKyAgICByZXQgPSBmc3luYyhmZF90byk7CisJaWYgKHJldCA8IDApIHsKKwkJcHJpbnRmKCJTeW5jIEZhaWxlZDolcywgZmlsZSBwYXRoOiVzIiwgc3RyZXJyb3IoZXJybm8pLCB0byk7CisJCWdvdG8gb3V0X2Vycm9yOworCX0KKwkKKyAgICBpZiAoY2xvc2UoZmRfdG8pIDwgMCkKKyAgICB7CisgICAgICAgIGZkX3RvID0gLTE7CisgICAgICAgIHJldCA9IC02OworICAgICAgICBnb3RvIG91dF9lcnJvcjsKKyAgICB9CisgICAgY2xvc2UoZmRfZnJvbSk7CisKKyAgICAvKiBTdWNjZXNzISAqLworICAgIHJldHVybiAwOworCitvdXRfZXJyb3I6CisgICAgcHJpbnRmKCJjb3B5ZmlsZSAlcyB0byAlcyBlcnJvcjolZFxuIiwgZnJvbSwgdG8sIHJldCk7CisgICAgY2xvc2UoZmRfZnJvbSk7CisgICAgaWYgKGZkX3RvID49IDApCisgICAgICAgIGNsb3NlKGZkX3RvKTsKKworICAgIHJldHVybiByZXQ7Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqILmmxNzD6Mr2OiAgICAgcmVzdG9yZU52RnMKKyogss7K/cu1w/c6ICAgICAKKyogICAotKvI67LOyv0pICBkc3RGaWxlOsS/serOxLz+CisqICAgKLSryOuyzsr9KSAgc3JjRmlsZTrUtM7EvP4KKyogt7Ugu9gg1rU6ICAgICAwse3KvrPJuaYKKyogxuTL/Mu1w/c6ICAgICB2b2lkCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworc3RhdGljIGludCByZXN0b3JlTnZGcyhjaGFyICpkc3RGaWxlLCBjaGFyICpzcmNGaWxlKQoreworICAgIGlmIChjb3B5ZmlsZShzcmNGaWxlLCBkc3RGaWxlKSAhPSAwKQorICAgICAgICByZXR1cm4gUkVTVUxUX0ZBSUw7CisgICAgCisgICAgcmV0dXJuIFJFU1VMVF9TVUNDRVNTOworfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKiC5psTcw+jK9jogICAgIGxvYWROdkZzCisqILLOyv3LtcP3OiAgICAgCisqICAgKLSryOuyzsr9KSAgZmlsZTpuds7EvP4KKyogICAotKuz9rLOyv0pICB2b2lkCisqILe1ILvYINa1OiAgICAgMLHtyr6zybmmCisqIMbky/zLtcP3OiAgICAgdm9pZAorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KK3N0YXRpYyBpbnQgbG9hZE52RnMoY2hhciAqZmlsZSkKK3sKKyAgICBpbnQgICAgIGxlbiAgICA9IDA7CisgICAgaW50ICAgICBjbnQgICAgPSAwOworICAgIEZJTEUgICAgKmZwICAgID0gTlVMTDsKKyAgICBjaGFyICAgICpidWYgICA9IE5VTEw7CisgICAgY2hhciAgICAqbmFtZSAgPSBOVUxMOworICAgIGNoYXIgICAgKnZhbHVlID0gTlVMTDsKKyAgICBjaGFyICAgICplcSAgICA9IE5VTEw7CisgICAgCisgICAgc3RydWN0IHN0YXQgc3RhdGJ1ZmYgICAgICAgICAgICA9IHswfTsKKyAgICBjaGFyICAgICAgICBudkZpbGVbTlZfUEFUSF9MRU5dID0gezB9OworCisgICAgc3ByaW50ZihudkZpbGUsICIlcy8lcyIsIE5WX0ZTX01BSU5fUEFUSCwgZmlsZSk7CisKKyAgICBpZihzdGF0KG52RmlsZSwgJnN0YXRidWZmKSA8IDApCisgICAgICAgIHJldHVybiBSRVNVTFRfRkFJTDsKKworICAgIGxlbiA9IHN0YXRidWZmLnN0X3NpemU7CisgICAgaWYoTlZfQ0hFQ0tfU0laRSA+IGxlbikKKyAgICAgICAgcmV0dXJuIFJFU1VMVF9GQUlMOworICAgIAorICAgIGZwID0gZm9wZW4obnZGaWxlLCAicm8iKTsKKyAgICBpZiAoIWZwKSAKKyAgICAgICAgcmV0dXJuIFJFU1VMVF9GSUxFX09QRU5fRkFJTDsKKworICAgIGxlbiA9IGxlbiAtIE5WX0NIRUNLX1NJWkU7CisgICAgYnVmID0gKGNoYXIgKiltYWxsb2MobGVuICsgMSk7CisgICAgaWYoIWJ1ZikKKyAgICB7CisgICAgICAgIGZjbG9zZShmcCk7CisgICAgICAgIHJldHVybiBSRVNVTFRfTUFMTE9DX0ZBSUw7CisgICAgfQorICAgIG1lbXNldChidWYsIDAsIGxlbiArIDEpOworCisgICAgY250ID0gMDsKKyAgICB3aGlsZSAoY250IDwgbGVuKQorICAgIHsKKyAgICAgICAgY250ID0gY250ICsgZnJlYWQoYnVmICsgY250LCAxLCBsZW4gLSBjbnQsIGZwKTsKKyAgICAgICAgaWYgKGZlcnJvcihmcCkpCisgICAgICAgIHsKKyAgICAgICAgICAgIGNsZWFyZXJyKGZwKTsKKyAgICAgICAgICAgIGZjbG9zZShmcCk7CisgICAgICAgICAgICBmcmVlKGJ1Zik7CisgICAgICAgICAgICByZXR1cm4gUkVTVUxUX0ZJTEVfUkVBRF9GQUlMOworICAgICAgICB9CisgICAgfQorICAgIGlmIChjbnQgIT0gbGVuKQorICAgIHsKKyAgICAgICAgZmNsb3NlKGZwKTsKKyAgICAgICAgZnJlZShidWYpOworICAgICAgICByZXR1cm4gUkVTVUxUX0ZJTEVfUkVBRF9GQUlMOworICAgIH0KKworICAgIGJ1ZltsZW5dID0gJ1wwJzsgLyogZml4IHdhcm5pbmcgZm9yIGNvdmVyaXR5ICovCisgICAgbmFtZSA9IGJ1ZjsKKyAgICB3aGlsZSgqbmFtZSkKKyAgICB7CisgICAgICAgIGlmICghKGVxID0gc3RyY2hyKG5hbWUsICc9JykpKQorICAgICAgICB7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorICAgICAgICAqZXEgPSAnXDAnOworICAgICAgICB2YWx1ZSA9IGVxICsgMTsKKworICAgICAgICBudnNldChmaWxlLCBuYW1lLCB2YWx1ZSwgMSk7CisKKyAgICAgICAgKmVxID0gJz0nOworICAgICAgICBuYW1lID0gdmFsdWUgKyBzdHJsZW4odmFsdWUpICsgMTsKKyAgICB9CisKKyAgICBmcmVlKGJ1Zik7CisgICAgZmNsb3NlKGZwKTsKKworICAgIHJldHVybiBSRVNVTFRfU1VDQ0VTUzsKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoguabE3MPoyvY6ICAgICBhbmFseU1zZworKiCyzsr9y7XD9zogICAgIAorKiAgICi0q8jrss7K/SkgIG1zZ3JlY3Y6vdPK1c/7z6IKKyogICAotKuz9rLOyv0pICBtc2dzbmQ6t6LLzc/7z6IKKyogt7Ugu9gg1rU6ICAgICAwse3KvrPJuaYKKyogxuTL/Mu1w/c6ICAgICB2b2lkCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworc3RhdGljIHZvaWQgYW5hbHlNc2coVF9OVl9NU0dfSU5GTyAqbXNncmVjdiwgVF9OVl9NU0dfUkVTVUxUICptc2dzbmQpCit7ICAgIAorICAgIHN3aXRjaChtc2dyZWN2LT5udlR5cGUpCisgICAgeworICAgIGNhc2UgTVNHX0dFVDoKKyAgICAgICAgbXNnc25kLT5yZXN1bHQgPSBudmdldChtc2dyZWN2LT5maWxlLCBtc2dyZWN2LT5rZXksIG1zZ3NuZC0+dmFsdWUpOworICAgICAgICBicmVhazsKKyAgICBjYXNlIE1TR19TRVQ6ICAgCisgICAgICAgIG1zZ3NuZC0+cmVzdWx0ID0gbnZzZXQobXNncmVjdi0+ZmlsZSwgbXNncmVjdi0+a2V5LCBtc2dyZWN2LT52YWx1ZSwgbXNncmVjdi0+c2F2ZWZsYWcpOworICAgICAgICBicmVhazsKKyAgICBjYXNlIE1TR19VTlNFVDoKKyAgICAgICAgbXNnc25kLT5yZXN1bHQgPSBudnVuc2V0KG1zZ3JlY3YtPmZpbGUsIG1zZ3JlY3YtPmtleSk7CisgICAgICAgIGJyZWFrOworICAgIGNhc2UgTVNHX0NMRUFSOgorICAgICAgICBtc2dzbmQtPnJlc3VsdCA9IG52Y2xlYXIobXNncmVjdi0+ZmlsZSk7CisgICAgICAgIGJyZWFrOworICAgIGNhc2UgTVNHX1JFU0VUOgorICAgICAgICBtc2dzbmQtPnJlc3VsdCA9IG52cmVzZXQobXNncmVjdi0+ZmlsZSk7CisgICAgICAgIGJyZWFrOworICAgIGNhc2UgTVNHX1NIT1c6CisgICAgICAgIG1zZ3NuZC0+cmVzdWx0ID0gc2F2ZU52RnMobXNncmVjdi0+ZmlsZSwgTlZfRlNfU0hPVyk7OworICAgICAgICBicmVhazsKKyAgICBjYXNlIE1TR19DT01NSVQ6CisgICAgICAgIG1zZ3NuZC0+cmVzdWx0ID0gbnZjb21taXQobXNncmVjdi0+ZmlsZSk7CisgICAgICAgIGJyZWFrOworICAgIGRlZmF1bHQ6CisgICAgICAgIGJyZWFrOworICAgIH0KKworICAgIG1zZ3NuZC0+bXNnVHlwZSA9IG1zZ3JlY3YtPnBpZDsKKwltc2dzbmQtPm1zZ0luZGV4ID0gbXNncmVjdi0+bXNnSW5kZXg7Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqILmmxNzD6Mr2OiAgICAgYWRkQ29uZmlnRmlsZQorKiCyzsr9y7XD9zogICAgIAorKiAgICi0q8jrss7K/SkgIG52RmlsZTpuds7EvP4KKyogICAotKvI67LOyv0pICBjb25maWdGaWxlOsXk1sPOxLz+CisqILe1ILvYINa1OiAgICAgMLHtyr6zybmmCisqIMbky/zLtcP3OiAgICAgdm9pZAorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KK3N0YXRpYyBpbnQgYWRkQ29uZmlnRmlsZShjaGFyICpudkZpbGUsIGNoYXIgKmNvbmZpZ0ZpbGUpCit7CisgICAgVF9OVl9OT0RFICAgKmxpc3QgICAgICA9IE5VTEw7CisgICAgVF9OVl9OT0RFICAgKm5ld0xpc3QgICA9IE5VTEw7CisgICAgVF9OVl9DT05GSUcgKm5ld0NvbmZpZyA9IE5VTEw7CisgICAgICAgIAorICAgIGlmKCFudkZpbGUpCisgICAgeworICAgICAgICBwcmludGYoIm52c2VydmVyIGVycm9yOiBwYXJhbSBpbGxlZ2FsIVxuIik7CisgICAgICAgIHJldHVybiBSRVNVTFRfSU5WQUw7CisgICAgfQorCisgICAgaWYoY29uZmlnRmlsZSkvLyBudiBoYXMgbm8gY29uZmlnIGZpbGUKKyAgICB7CisgICAgICAgIG5ld0NvbmZpZyA9IChUX05WX0NPTkZJRyAqICltYWxsb2Moc2l6ZW9mKFRfTlZfQ09ORklHKSk7CisgICAgICAgIGlmKCFuZXdDb25maWcpCisgICAgICAgICAgICByZXR1cm4gUkVTVUxUX01BTExPQ19GQUlMOworCisgICAgICAgIHN0cm5jcHkobmV3Q29uZmlnLT5jb25maWdGaWxlLCBjb25maWdGaWxlLCBOVl9QQVRIX0xFTiAtIDEpOworICAgICAgICBuZXdDb25maWctPmNvbmZpZ0ZpbGVbTlZfUEFUSF9MRU4gLSAxXSA9ICdcMCc7CisgICAgICAgIG5ld0NvbmZpZy0+bmV4dCA9IE5VTEw7CisgICAgfQorCisgICAgZm9yKGxpc3QgPSBudl9saXN0OyBsaXN0OyBsaXN0ID1saXN0LT5uZXh0KQorICAgIHsKKyAgICAgICAgaWYoc3RyY21wKGxpc3QtPm52RmlsZSwgbnZGaWxlKSA9PSAwKQorICAgICAgICAgICAgYnJlYWs7CisgICAgfQorCisgICAgaWYoIWxpc3QpIC8vY2FuJ3QgZmluZSB0aGUgbnYKKyAgICB7CisgICAgICAgIG5ld0xpc3QgPSAoVF9OVl9OT0RFICopbWFsbG9jKHNpemVvZihUX05WX05PREUpKTsKKyAgICAgICAgaWYoIW5ld0xpc3QpCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmKG5ld0NvbmZpZykKKyAgICAgICAgICAgICAgICBmcmVlKG5ld0NvbmZpZyk7CisgICAgICAgICAgICByZXR1cm4gUkVTVUxUX01BTExPQ19GQUlMOworICAgICAgICB9CisKKyAgICAgICAgbmV3TGlzdC0+bmV4dCA9IE5VTEw7CisgICAgICAgIHN0cm5jcHkobmV3TGlzdC0+bnZGaWxlLCBudkZpbGUsIE5WX1BBVEhfTEVOIC0gMSk7CisgICAgICAgIG5ld0xpc3QtPm52RmlsZVtOVl9QQVRIX0xFTiAtIDFdID0gJ1wwJzsKKyAgICAgICAgbWVtc2V0KG5ld0xpc3QtPm52VGFibGUsIDAsIE5WX0hBU0hfTEVOICogNCk7IAorICAgICAgICAKKyAgICAgICAgbmV3TGlzdC0+ZmlsZUxpc3QgPSBuZXdDb25maWc7CisKKyAgICAgICAgaWYoIW52X2xpc3QpCisgICAgICAgICAgICBudl9saXN0ID0gbmV3TGlzdDsKKyAgICAgICAgZWxzZQorICAgICAgICB7CisgICAgICAgICAgICBuZXdMaXN0LT5uZXh0ID0gbnZfbGlzdC0+bmV4dDsKKyAgICAgICAgICAgIG52X2xpc3QtPm5leHQgPSBuZXdMaXN0OworICAgICAgICB9CisgICAgfQorICAgIGVsc2UgaWYoIWxpc3QtPmZpbGVMaXN0KSAvL2Nhbid0IGZpbmUgdGhlIGZpbGVsaXN0CisgICAgICAgIGxpc3QtPmZpbGVMaXN0ID0gbmV3Q29uZmlnOworICAgIGVsc2UgICAgICAgICAgICAgICAgICAgIC8vY2FuJ3QgZmluZSB0aGUgZmlsZQorICAgIHsKKyAgICAgICAgaWYobmV3Q29uZmlnID09IE5VTEwpCisgICAgICAgICAgICByZXR1cm4gUkVTVUxUX0ZBSUw7CisgICAgICAgIG5ld0NvbmZpZy0+bmV4dCA9IGxpc3QtPmZpbGVMaXN0LT5uZXh0OworICAgICAgICBsaXN0LT5maWxlTGlzdC0+bmV4dCA9IG5ld0NvbmZpZzsKKyAgICB9CisKKyAgICByZXR1cm4gUkVTVUxUX1NVQ0NFU1M7Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqILmmxNzD6Mr2OiAgICAgaXNDb25maWdlZAorKiCyzsr9y7XD9zogICAgIAorKiAgICi0q8jrss7K/SkgIGNvbmZpZ0ZpbGU6xeTWw87EvP7D+worKiC3tSC72CDWtTogICAgIHZvaWQKKyogxuTL/Mu1w/c6ICAgICB2b2lkCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworc3RhdGljIGJvb2wgaXNDZmdDb25maWdlZChjaGFyICpjb25maWdGaWxlKQoreworICAgIFRfTlZfTk9ERSAgICpsaXN0ICAgICAgPSBOVUxMOworICAgIFRfTlZfQ09ORklHICpjb25maWcgICAgPSBOVUxMOworCisgICAgZm9yKGxpc3QgPSBudl9saXN0OyBsaXN0OyBsaXN0ID0gbGlzdC0+bmV4dCkKKyAgICB7CisgICAgICAgIGZvcihjb25maWcgPSBsaXN0LT5maWxlTGlzdDsgY29uZmlnOyBjb25maWcgPSBjb25maWctPm5leHQpCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmKCFzdHJjbXAoY29uZmlnLT5jb25maWdGaWxlLCBjb25maWdGaWxlKSkKKyAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgfQorICAgIH0KKyAgICByZXR1cm4gZmFsc2U7Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqILmmxNzD6Mr2OiAgICAgaXNOdkNvbmZpZ2VkCisqILLOyv3LtcP3OiAgICAgCisqICAgKLSryOuyzsr9KSAgY29uZmlnRmlsZTrF5NbDzsS8/sP7CisqILe1ILvYINa1OiAgICAgdm9pZAorKiDG5Mv8y7XD9zogICAgIHZvaWQKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCitzdGF0aWMgYm9vbCBpc052Q29uZmlnZWQoY2hhciAqbnZGaWxlKQoreworICAgIFRfTlZfTk9ERSAgICpsaXN0ICAgICAgPSBOVUxMOworCisgICAgZm9yKGxpc3QgPSBudl9saXN0OyBsaXN0OyBsaXN0ID0gbGlzdC0+bmV4dCkKKyAgICB7CisgICAgICAgIGlmKCFzdHJjbXAobGlzdC0+bnZGaWxlLCBudkZpbGUpKQorICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgfQorICAgIHJldHVybiBmYWxzZTsKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoguabE3MPoyvY6ICAgICBnZXRTdW0KKyogss7K/cu1w/c6ICAgICAKKyogICAotKvI67LOyv0pICBzOtfWt/u0rru6s+UKKyogt7Ugu9gg1rU6ICAgICBzdW3K/da1CisqIMbky/zLtcP3OiAgICAgdm9pZAorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KK3N0YXRpYyB1aW50IGdldFN1bShjb25zdCBjaGFyICpzLCBpbnQgbGVuKQoreworICAgIHVpbnQgc3VtID0gMDsKKyAgICBjaGFyICpkYXRhID0gKGNoYXIqKXM7CisgICAgCisgICAgd2hpbGUgKGxlbi0tID4gMCkKKyAgICB7CisgICAgICAgIHN1bSArPSAoKmRhdGErKyk7CisgICAgfQorICAgIAorICAgIHJldHVybiBzdW07Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqILmmxNzD6Mr2OiAgICAgc2F2ZU52RnMKKyogss7K/cu1w/c6ICAgICAKKyogICAotKvI67LOyv0pICBudk5hbWU6bnbOxLz+w/sKKyogICAotKvI67LOyv0pICBudkZpbGU6bnaxo7TmzsS8/gorKiC3tSC72CDWtTogICAgICAgICAwse3KvrPJuaYKKyogxuTL/Mu1w/c6ICAgICB2b2lkCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworc3RhdGljIGludCBzYXZlTnZGcyhjaGFyICpudk5hbWUsIGNoYXIgKm52RmlsZSkKK3sKKyAgICBpbnQgaSAgICAgICAgICAgPSAwOworICAgIGludCBzdW0gICAgICAgICA9IDA7CisgICAgaW50IGJ1ZlNpemUgICAgID0gMDsKKyAgICBpbnQgaXRlbVNpemUgICAgPSAwOworICAgIGludCByZXQgICAgICAgICA9IDA7CisgICAgaW50IGZwID0gMDsKKyAgICBjaGFyICpidWYgPSBOVUxMOworICAgIFRfTlZfTk9ERSAqIGxpc3QgPSBOVUxMOworICAgIFRfTlZfSVRFTSAqIGl0ZW0gPSBOVUxMOworCisgICAgZm9yKGxpc3QgPSBudl9saXN0OyBsaXN0OyBsaXN0ID0gbGlzdC0+bmV4dCkKKyAgICB7CisgICAgICAgIGlmKHN0cmNtcChsaXN0LT5udkZpbGUsIG52TmFtZSkpCisgICAgICAgICAgICBjb250aW51ZTsKKworICAgICAgICBmcD0gb3BlbihudkZpbGUsIE9fU1lOQyB8IE9fUkRXUiB8IE9fQ1JFQVQgfCBPX1RSVU5DLCAwNjQwKTsKKyAgICAgICAgaWYoZnAgPT0gLTEpIAorICAgICAgICB7CisgICAgICAgICAgICBwcmludGYoIm9wZW4gJXMgZmFpbCxlcnJubyA9ICVkXG4iLCBudkZpbGUsIGVycm5vKTsKKyAgICAgICAgICAgIHJldHVybiBSRVNVTFRfRklMRV9PUEVOX0ZBSUw7CisgICAgICAgIH0KKworICAgICAgICBidWYgPSAoY2hhciAqKW1hbGxvYyhOVl9CTE9DS19TSVpFKTsKKyAgICAgICAgaWYoIWJ1ZikKKyAgICAgICAgeworICAgICAgICAgICAgY2xvc2UoZnApOworICAgICAgICAgICAgcmV0dXJuIFJFU1VMVF9NQUxMT0NfRkFJTDsKKyAgICAgICAgfQorICAgICAgICAKKyAgICAgICAgZm9yKGkgPSAwOyBpIDwgTlZfSEFTSF9MRU47IGkgKyspCisgICAgICAgIHsKKyAgICAgICAgICAgIGZvcihpdGVtID0gbGlzdC0+bnZUYWJsZVtpXTsgaXRlbTsgaXRlbSA9IGl0ZW0tPm5leHQpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgaWYoc3RyY21wKG52RmlsZSwgTlZfRlNfU0hPVykgJiYgIWl0ZW0tPnNhdmVGbGFnKQorICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICAgICAgICAKKyAgICAgICAgICAgICAgICBpdGVtU2l6ZSA9IHN0cmxlbihpdGVtLT5rZXkpICsgc3RybGVuKGl0ZW0tPnZhbHVlKSArIDI7CisgICAgICAgICAgICAgICAgaWYoYnVmU2l6ZSArIGl0ZW1TaXplID4gTlZfQkxPQ0tfU0laRSkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIGlmKHdyaXRlKGZwLCBidWYsIGJ1ZlNpemUpIDwgMCkKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgcHJpbnRmKCJlcnJvciAlcyAlZDogd3JpdGUgZmFpbCBlcnJubyA9ICVkXG4iLCBfX0ZJTEVfXywgIF9fTElORV9fLCBlcnJubyk7CisgICAgICAgICAgICAgICAgICAgICAgICBjbG9zZShmcCk7CisgICAgICAgICAgICAgICAgICAgICAgICBmcmVlKGJ1Zik7CisgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gUkVTVUxUX0ZJTEVfV1JJVEVfRkFJTDsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBzdW0gKz0gZ2V0U3VtKGJ1ZiwgYnVmU2l6ZSk7CisgICAgICAgICAgICAgICAgICAgIGJ1ZlNpemUgPSAwOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAKKyAgICAgICAgICAgICAgICBzcHJpbnRmKGJ1ZiArIGJ1ZlNpemUsICIlcz0lcyIsIGl0ZW0tPmtleSwgaXRlbS0+dmFsdWUpOworICAgICAgICAgICAgICAgIGJ1ZlNpemUgKz0gaXRlbVNpemU7ICAgICAgICAgICAgIAorICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgLy8gbGFzdCBibG9jaworICAgICAgICBpZihidWZTaXplICE9IDApCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmKHdyaXRlKGZwLCBidWYsIGJ1ZlNpemUpIDwgMCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBwcmludGYoIm52c2VydmVyIGVycm9yOiB3cml0ZSBmYWlsIGVycm5vID0gJWRcbiIsIGVycm5vKTsKKyAgICAgICAgICAgICAgICBjbG9zZShmcCk7CisgICAgICAgICAgICAgICAgZnJlZShidWYpOworICAgICAgICAgICAgICAgIHJldHVybiBSRVNVTFRfRklMRV9XUklURV9GQUlMOworICAgICAgICAgICAgfQorICAgICAgICAgICAgc3VtICs9IGdldFN1bShidWYsIGJ1ZlNpemUpOworICAgICAgICB9CisgICAgICAgIHN1bSArPSBOVl9GSUxFX0ZMQUc7CisKKyAgICAgICAgLy8gd3JpdGUgc3VtCisgICAgICAgIGlmKHdyaXRlKGZwLCAmc3VtLCBOVl9DSEVDS19TSVpFKSA8IDApCisgICAgICAgIHsKKyAgICAgICAgICAgIHByaW50ZigibnZzZXJ2ZXIgZXJyb3I6IHdyaXRlIGZhaWwgZXJybm8gPSAlZFxuIiwgZXJybm8pOworICAgICAgICAgICAgY2xvc2UoZnApOworICAgICAgICAgICAgZnJlZShidWYpOworICAgICAgICAgICAgcmV0dXJuIFJFU1VMVF9GSUxFX1dSSVRFX0ZBSUw7CisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIHJldCA9IGZzeW5jKGZwKTsKKwkJCisgICAgICAgIGZyZWUoYnVmKTsKKyAgICAgICAgY2xvc2UoZnApOworCQkKKyAgICAgICAgaWYgKHJldCA8IDApIHsKKyAgICAgICAgICAgIHByaW50ZigiU3luYyBGYWlsZWQ6JXMsIGZpbGUgcGF0aDolcyIsIHN0cmVycm9yKGVycm5vKSwgbnZGaWxlKTsKKyAgICAgICAgICAgIHJldHVybiByZXQ7CisgICAgICAgIH0KKyAgICAgIAorICAgICAgICByZXR1cm4gUkVTVUxUX1NVQ0NFU1M7CisgICAgfQorCisgICAgcmV0dXJuIFJFU1VMVF9OT19GSUxFOworfQorCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqILmmxNzD6Mr2OiAgICAgbnZnZXQKKyogss7K/cu1w/c6ICAgICAKKyogICAotKvI67LOyv0pICBmaWxlOm52zsS8/gorKiAgICi0q8jrss7K/SkgIGtleTpuds/uw/sKKyogICAotKuz9rLOyv0pICB2YWx1ZTpudta1CisqILe1ILvYINa1OiAgICAgIDCx7cq+s8m5pgorKiDG5Mv8y7XD9zogICAgIHZvaWQKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCitzdGF0aWMgaW50IG52Z2V0KGNoYXIgKmZpbGUsIGNoYXIgKmtleSwgY2hhciAqdmFsdWUpCit7CisgICAgaW50IGluZGV4ID0gMDsKKyAgICBUX05WX05PREUgKmxpc3QgPSBOVUxMOworICAgIFRfTlZfSVRFTSAqaXRlbSA9IE5VTEw7CisKKyAgICBmb3IobGlzdCA9IG52X2xpc3Q7IGxpc3Q7IGxpc3QgPSBsaXN0LT5uZXh0KQorICAgIHsKKyAgICAgICAgaWYoc3RyY21wKGxpc3QtPm52RmlsZSwgZmlsZSkpCisgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgCisgICAgICAgIGluZGV4ID0gaGFzaChrZXkpICUgTlZfSEFTSF9MRU47CisgICAgICAgIGZvcihpdGVtID0gbGlzdC0+bnZUYWJsZVtpbmRleF07IGl0ZW07IGl0ZW0gPSBpdGVtLT5uZXh0KQorICAgICAgICB7CisgICAgICAgICAgICBpZihzdHJjbXAoaXRlbS0+a2V5LCBrZXkpKQorICAgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgCisgICAgICAgICAgICBzdHJuY3B5KHZhbHVlLCBpdGVtLT52YWx1ZSwgTlZfTUFYX1ZBTF9MRU4gLSAxKTsKKyAgICAgICAgICAgIHZhbHVlW05WX01BWF9WQUxfTEVOIC0gMV0gPSAnXDAnOworICAgICAgICAgICAgcmV0dXJuIFJFU1VMVF9TVUNDRVNTOworICAgICAgICB9CisgICAgfQorCisgICAgcmV0dXJuIFJFU1VMVF9OT19JVEVNOworfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKiC5psTcw+jK9jogICAgIG52c2V0CisqILLOyv3LtcP3OiAgICAgCisqICAgKLSryOuyzsr9KSAgZmlsZTpuds7EvP4KKyogICAotKvI67LOyv0pICBrZXk6bnbP7sP7CisqICAgKLSryOuyzsr9KSAgdmFsdWU6bnbWtQorKiAgICi0q8jrss7K/SkgIHNhdmVGbGFnOrGjtOax6ta+CisqILe1ILvYINa1OiAgICAgICAgMLHtyr6zybmmCisqIMbky/zLtcP3OiAgICAgdm9pZAorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KK3N0YXRpYyBpbnQgbnZzZXQoY2hhciAqZmlsZSwgY29uc3QgY2hhciAqa2V5LCBjb25zdCBjaGFyICp2YWx1ZSwgaW50IHNhdmVGbGFnKQoreworICAgIGludCBpbmRleCAgICAgICAgICAgPSAwOworICAgIGludCByZXQgICAgICAgICAgICAgPSAwOworICAgIGludCBrZXlfYnVmX2xlbiAgICAgPSAwOworICAgIGludCB2YWx1ZV9idWZfbGVuICAgPSAwOworICAgIFRfTlZfTk9ERSAqbGlzdCAgICAgPSBOVUxMOworICAgIFRfTlZfSVRFTSAqaXRlbSAgICAgPSBOVUxMOworICAgIFRfTlZfSVRFTSAqbmV3SXRlbSAgPSBOVUxMOworCisgICAgaWYgKE5VTEwgPT0ga2V5IHx8IE5VTEwgPT0gdmFsdWUpCisgICAgICAgIHJldHVybiBSRVNVTFRfRkFJTDsKKworICAgIGtleV9idWZfbGVuICAgID0gc3RybGVuKGtleSkgKyAxOworICAgIHZhbHVlX2J1Zl9sZW4gID0gc3RybGVuKHZhbHVlKSArIDE7CisKKyAgICBmb3IobGlzdCA9IG52X2xpc3Q7IGxpc3Q7IGxpc3QgPSBsaXN0LT5uZXh0KQorICAgIHsKKyAgICAgICAgaWYoc3RyY21wKGxpc3QtPm52RmlsZSwgZmlsZSkpCisgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgCisgICAgICAgIGluZGV4ID0gaGFzaChrZXkpICUgTlZfSEFTSF9MRU47CisgICAgICAgIGZvcihpdGVtID0gbGlzdC0+bnZUYWJsZVtpbmRleF07IGl0ZW07IGl0ZW0gPSBpdGVtLT5uZXh0KQorICAgICAgICB7CisgICAgICAgICAgICAvLyBjaGFuZ2UgaXRlbQorICAgICAgICAgICAgaWYoc3RyY21wKGl0ZW0tPmtleSwga2V5KSkKKyAgICAgICAgICAgICAgICBjb250aW51ZTsKKyAKKyAgICAgICAgICAgIGlmKHNhdmVGbGFnKQorICAgICAgICAgICAgICAgIGl0ZW0tPnNhdmVGbGFnID0gc2F2ZUZsYWc7CisJCQkJCisgICAgICAgICAgICBpZighc3RyY21wKGl0ZW0tPnZhbHVlLCB2YWx1ZSkpCisgICAgICAgICAgICAgICAgcmV0dXJuIFJFU1VMVF9TVUNDRVNTOworICAgICAgICAgICAgCisgICAgICAgICAgICBmcmVlKGl0ZW0tPnZhbHVlKTsKKyAgICAgICAgICAgIGl0ZW0tPnZhbHVlID0gKGNoYXIgKiltYWxsb2ModmFsdWVfYnVmX2xlbik7CisgICAgICAgICAgICBpZighaXRlbS0+dmFsdWUpCisgICAgICAgICAgICAgICAgcmV0dXJuIFJFU1VMVF9NQUxMT0NfRkFJTDsKKyAgICAgICAgICAgIAorICAgICAgICAgICAgc3RybmNweShpdGVtLT52YWx1ZSwgdmFsdWUsIHZhbHVlX2J1Zl9sZW4gLSAxKTsKKyAgICAgICAgICAgIGl0ZW0tPnZhbHVlW3ZhbHVlX2J1Zl9sZW4gLSAxXSA9ICdcMCc7CisKKyAgICAgICAgICAgIHJldHVybiBSRVNVTFRfU1VDQ0VTUzsKKyAgICAgICAgfQorCisgICAgICAgIC8vIGFkZCBpdGVtCisgICAgICAgIG5ld0l0ZW0gPSAoVF9OVl9JVEVNICopbWFsbG9jKHNpemVvZihUX05WX0lURU0gKSk7CisgICAgICAgIGlmKCFuZXdJdGVtKQorICAgICAgICAgICAgcmV0dXJuIFJFU1VMVF9NQUxMT0NfRkFJTDsKKworICAgICAgICBuZXdJdGVtLT5rZXkgPSAoY2hhciAqKW1hbGxvYyhrZXlfYnVmX2xlbik7CisgICAgICAgIGlmKCFuZXdJdGVtLT5rZXkpCisgICAgICAgIHsKKyAgICAgICAgICAgIGZyZWUobmV3SXRlbSk7CisgICAgICAgICAgICByZXR1cm4gUkVTVUxUX01BTExPQ19GQUlMOworICAgICAgICB9CisgICAgICAgIAorICAgICAgICBuZXdJdGVtLT52YWx1ZSA9IChjaGFyICopbWFsbG9jKHZhbHVlX2J1Zl9sZW4pOworICAgICAgICBpZighbmV3SXRlbS0+dmFsdWUpCisgICAgICAgIHsKKyAgICAgICAgICAgIGZyZWUobmV3SXRlbS0+a2V5KTsKKyAgICAgICAgICAgIGZyZWUobmV3SXRlbSk7CisgICAgICAgICAgICByZXR1cm4gUkVTVUxUX01BTExPQ19GQUlMOworICAgICAgICB9CisKKyAgICAgICAgc3RybmNweShuZXdJdGVtLT5rZXksIGtleSwga2V5X2J1Zl9sZW4gLSAxKTsKKyAgICAgICAgbmV3SXRlbS0+a2V5W2tleV9idWZfbGVuIC0gMV0gPSAnXDAnOworICAgICAgICBzdHJuY3B5KG5ld0l0ZW0tPnZhbHVlLCB2YWx1ZSwgdmFsdWVfYnVmX2xlbiAtIDEpOworICAgICAgICBuZXdJdGVtLT52YWx1ZVt2YWx1ZV9idWZfbGVuIC0gMV0gPSAnXDAnOworCisgICAgICAgIG5ld0l0ZW0tPm5leHQgPSBOVUxMOworICAgICAgICBuZXdJdGVtLT5zYXZlRmxhZyA9IHNhdmVGbGFnOworICAgICAgICBuZXdJdGVtLT51cGRhdGVfZmxhZz0wOy8vIDA6IG5vdCB1cGRhdGUgLCAxOiB1cGRhdGVkCisgICAgICAgIAorICAgICAgICBpZighbGlzdC0+bnZUYWJsZVtpbmRleF0pCisgICAgICAgICAgICBsaXN0LT5udlRhYmxlW2luZGV4XSA9IG5ld0l0ZW07CisgICAgICAgIGVsc2UKKyAgICAgICAgeworICAgICAgICAgICAgbmV3SXRlbS0+bmV4dCA9IGxpc3QtPm52VGFibGVbaW5kZXhdLT5uZXh0OworICAgICAgICAgICAgbGlzdC0+bnZUYWJsZVtpbmRleF0tPm5leHQgPSBuZXdJdGVtOworICAgICAgICB9CisgICAgICAgICAgICAKKyAgICAgICAgcmV0dXJuIFJFU1VMVF9TVUNDRVNTOworICAgIH0KKworICAgIC8vIGFkZCBudgorICAgIHJldCA9IGFkZENvbmZpZ0ZpbGUoZmlsZSwgTlVMTCk7CisgICAgaWYocmV0ID09IFJFU1VMVF9TVUNDRVNTKQorICAgICAgICByZXR1cm4gbnZzZXQoZmlsZSwga2V5LCB2YWx1ZSwgc2F2ZUZsYWcpOworICAgIGVsc2UKKyAgICAgICAgcmV0dXJuIHJldDsKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoguabE3MPoyvY6ICAgICBudnVuc2V0CisqILLOyv3LtcP3OiAgICAgCisqICAgKLSryOuyzsr9KSAgZmlsZTpuds7EvP4KKyogICAotKvI67LOyv0pICBrZXk6bnbP7sP7CisqILe1ILvYINa1OiAgICAgICAgMLHtyr6zybmmCisqIMbky/zLtcP3OiAgICAgdm9pZAorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KK3N0YXRpYyBpbnQgbnZ1bnNldChjaGFyICogZmlsZSwgY2hhciAqa2V5KQoreworICAgIGludCBpbmRleCA9IDA7CisgICAgVF9OVl9OT0RFICpsaXN0ID0gTlVMTDsKKyAgICBUX05WX0lURU0gKml0ZW0gPSBOVUxMOworICAgIFRfTlZfSVRFTSAqcHJldiA9IE5VTEw7CisKKyAgICBmb3IobGlzdCA9IG52X2xpc3Q7IGxpc3Q7IGxpc3QgPSBsaXN0LT5uZXh0KQorICAgIHsKKyAgICAgICAgaWYoc3RyY21wKGxpc3QtPm52RmlsZSwgZmlsZSkpCisgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgCisgICAgICAgIGluZGV4ID0gaGFzaChrZXkpICUgTlZfSEFTSF9MRU47CisgICAgICAgIGZvcihpdGVtID0gbGlzdC0+bnZUYWJsZVtpbmRleF07IGl0ZW07IHByZXYgPSBpdGVtLCBpdGVtID0gaXRlbS0+bmV4dCkKKyAgICAgICAgeworICAgICAgICAgICAgaWYoc3RyY21wKGl0ZW0tPmtleSwga2V5KSkKKyAgICAgICAgICAgICAgICBjb250aW51ZTsKKworICAgICAgICAgICAgaWYoIXByZXYpCisJCQkJbGlzdC0+bnZUYWJsZVtpbmRleF0gPSBpdGVtLT5uZXh0OworICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgIHByZXYtPm5leHQgPSBpdGVtLT5uZXh0OworICAgICAgICAgICAgCisgICAgICAgICAgICBmcmVlKGl0ZW0tPmtleSk7CisgICAgICAgICAgICBmcmVlKGl0ZW0tPnZhbHVlKTsKKyAgICAgICAgICAgIGZyZWUoaXRlbSk7CisgICAgICAgICAgICAKKyAgICAgICAgICAgIHJldHVybiBSRVNVTFRfU1VDQ0VTUzsKKyAgICAgICAgfQorICAgIH0KKworICAgIHJldHVybiBSRVNVTFRfTk9fSVRFTTsKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyoguabE3MPoyvY6ICAgICBudnJlc2V0CisqILLOyv3LtcP3OiAgICAgCisqICAgKLSryOuyzsr9KSAgZmlsZTpuds7EvP4KKyogt7Ugu9gg1rU6ICAgICAgICAgMLHtyr6zybmmCisqIMbky/zLtcP3OiAgICAgyb6z/W52zsS8/gorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KK3N0YXRpYyBpbnQgbnZyZXNldChjaGFyICpmaWxlKQoreyAKKyAgICBpbnQgcmV0ID0gMDsKKyAgICBUX05WX05PREUgKmxpc3QgPSBOVUxMOworCisgICAgZm9yKGxpc3QgPSBudl9saXN0OyBsaXN0OyBsaXN0ID0gbGlzdC0+bmV4dCkKKyAgICB7CisgICAgICAgIGlmKHN0cmNtcChsaXN0LT5udkZpbGUsIGZpbGUpKQorICAgICAgICAgICAgY29udGludWU7CisKKyAgICAgICAgcmV0ID0gbnZjbGVhcihmaWxlKTsKKyAgICAgICAgaWYocmV0ICE9IFJFU1VMVF9TVUNDRVNTKQorICAgICAgICAgICAgcmV0dXJuIHJldDsKKworICAgICAgICBpZihsb2FkRmFjdHJveVBhcmFtKGxpc3QpICE9IFJFU1VMVF9TVUNDRVNTKQorICAgICAgICAgICAgcmV0dXJuIFJFU1VMVF9GQUlMOworCisgICAgICAgIHJldHVybiBudmNvbW1pdChmaWxlKTsKKyAgICAgfQorCisgICAgcmV0dXJuIFJFU1VMVF9OT19GSUxFOworfQorCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKiC5psTcw+jK9jogICAgIG52Y2xlYXIKKyogss7K/cu1w/c6ICAgICAKKyogICAotKvI67LOyv0pICBmaWxlOm52zsS8/gorKiC3tSC72CDWtTogICAgICAgICAwse3KvrPJuaYKKyogxuTL/Mu1w/c6ICAgICCywbP9xNq05m52CisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworc3RhdGljIGludCBudmNsZWFyKGNoYXIgKmZpbGUpCit7CisgICAgaW50IGkgPSAwOworICAgIFRfTlZfTk9ERSAqbGlzdCAgICA9IE5VTEw7CisgICAgVF9OVl9JVEVNICpjdXIgICAgID0gTlVMTDsKKyAgICBUX05WX0lURU0gKml0ZW0gICAgPSBOVUxMOworICAgIAorICAgIGZvcihsaXN0ID0gbnZfbGlzdDsgbGlzdDsgbGlzdCA9IGxpc3QtPm5leHQpCisgICAgeworICAgICAgICBpZihzdHJjbXAobGlzdC0+bnZGaWxlLCBmaWxlKSkKKyAgICAgICAgICAgIGNvbnRpbnVlOworCisgICAgICAgIGZvcihpID0gMDsgaSA8IE5WX0hBU0hfTEVOOyBpICsrKQorICAgICAgICB7CisgICAgICAgICAgICBmb3IoaXRlbSA9IGxpc3QtPm52VGFibGVbaV07IGl0ZW07ICkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBjdXIgPSBpdGVtOworICAgICAgICAgICAgICAgIGl0ZW0gPSBpdGVtLT5uZXh0OworCisgICAgICAgICAgICAgICAgZnJlZShjdXItPmtleSk7CisgICAgICAgICAgICAgICAgZnJlZShjdXItPnZhbHVlKTsKKyAgICAgICAgICAgICAgICBmcmVlKGN1cik7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBsaXN0LT5udlRhYmxlW2ldID0gTlVMTDsKKyAgICAgICAgfQorICAgICAgICAKKyAgICAgICAgcmV0dXJuIFJFU1VMVF9TVUNDRVNTOworICAgIH0KKyAgICAKKyAgICByZXR1cm4gUkVTVUxUX05PX0ZJTEU7Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqILmmxNzD6Mr2OiAgICAgbnZjb21taXQKKyogss7K/cu1w/c6ICAgICAKKyogICAotKvI67LOyv0pICBmaWxlOm52zsS8/gorKiC3tSC72CDWtTogICAgIFJFU1VMVF9TVUNDRVNTse3KvrPJuaYKKyogxuTL/Mu1w/c6ICAgICB2b2lkCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworc3RhdGljIGludCBudmNvbW1pdChjaGFyICpmaWxlKQoreworICAgIGludCByZXQgPSAwOworICAgIGNoYXIgbnZNYWluRmlsZVtOVl9QQVRIX0xFTl0gICAgPSB7MH07CisgICAgY2hhciBudkJhY2t1cEZpbGVbTlZfUEFUSF9MRU5dICA9IHswfTsKKworICAgIHNwcmludGYobnZNYWluRmlsZSwgIiVzLyVzIiwgTlZfRlNfTUFJTl9QQVRILCBmaWxlKTsKKyAgICBzcHJpbnRmKG52QmFja3VwRmlsZSwgIiVzLyVzIiwgTlZfRlNfQkFDS1VQX1BBVEgsIGZpbGUpOworCisgICAgcmV0ID0gc2F2ZU52RnMoZmlsZSwgbnZNYWluRmlsZSk7CisgICAgaWYocmV0ICE9IFJFU1VMVF9TVUNDRVNTKQorICAgICAgICByZXR1cm4gcmV0OworICAgIAorICAgIHJldHVybiByZXN0b3JlTnZGcyhudkJhY2t1cEZpbGUsIG52TWFpbkZpbGUpOworfQorCiAjaWZkZWYgX19jcGx1c3BsdXMKIH0KICNlbmRpZgo=