From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id B7BF21FF15C for ; Wed, 27 Nov 2024 15:12:01 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id EACE6181E4; Wed, 27 Nov 2024 15:12:02 +0100 (CET) From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= To: pbs-devel@lists.proxmox.com Date: Wed, 27 Nov 2024 15:11:27 +0100 Message-Id: <20241127141128.1123925-1-f.gruenbichler@proxmox.com> X-Mailer: git-send-email 2.39.5 MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.048 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pbs-devel] [PATCH proxmox-backup 1/2] datastore: extract nesting check into helper X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Backup Server development discussion Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Errors-To: pbs-devel-bounces@lists.proxmox.com Sender: "pbs-devel" YW5kIGltcHJvdmUgdGhlIHZhcmlhYmxlIG5hbWlnbiB3aGlsZSB3ZSBhcmUgYXQgaXQuIHRoaXMg YWxsb3dzIHRoZSBjaGVjayB0byBiZQpyZS11c2VkIGluIG90aGVyIGNvZGUgcGF0aHMsIGxpa2Ug d2hlbiBzdGFydGluZyBhIGdhcmJhZ2UgY29sbGVjdGlvbi4KClNpZ25lZC1vZmYt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HsKKyAgICAgICAgICAgIGlmIHNlbGYgPT0gb3RoZXJfc3RvcmUgeworICAgICAg ICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgfTsKKworICAgICAgICAgICAgLy8gUmVs YXRpdmUgcGF0aHMgbXVzdCBub3QgYmUgbmVzdGVkIG9uIHRoZSBiYWNraW5nIGRldmljZSBvZiBy ZW1vdmFibGUgZGF0YXN0b3JlcworICAgICAgICAgICAgaWYgcmVtb3ZhYmxlICYmIG90aGVyX3N0 b3JlLmJhY2tpbmdfZGV2aWNlID09IHNlbGYuYmFja2luZ19kZXZpY2UgeworICAgICAgICAgICAg ICAgIGxldCBvdXJfcmVsYXRpdmVfcGF0aCA9IFBhdGg6Om5ldygmc2VsZi5wYXRoKTsKKyAgICAg ICAgICAgICAgICBsZXQgb3RoZXJfcmVsYXRpdmVfcGF0aCA9IFBhdGg6Om5ldygmb3RoZXJfc3Rv cmUucGF0aCk7CisgICAgICAgICAgICAgICAgaWYgb3VyX3JlbGF0aXZlX3BhdGguc3RhcnRzX3dp dGgob3RoZXJfcmVsYXRpdmVfcGF0aCkKKyAgICAgICAgICAgICAgICAgICAgfHwgb3RoZXJfcmVs YXRpdmVfcGF0aC5zdGFydHNfd2l0aChvdXJfcmVsYXRpdmVfcGF0aCkKKyAgICAgICAgICAgICAg ICB7CisgICAgICAgICAgICAgICAgICAgIGJhaWwhKAorICAgICAgICAgICAgICAgICAgICAgICAg InBhdGhzIG9uIGJhY2tpbmcgZGV2aWNlIG11c3Qgbm90IGJlIG5lc3RlZCAtIHtwYXRoOj99IGFs cmVhZHkgdXNlZCBieSAne3N0b3JlfSchIiwKKyAgICAgICAgICAgICAgICAgICAgICAgIHBhdGgg PSBvdGhlcl9yZWxhdGl2ZV9wYXRoLAorICAgICAgICAgICAgICAgICAgICAgICAgc3RvcmUgPSBv dGhlcl9zdG9yZS5uYW1lLAorICAgICAgICAgICAgICAgICAgICApOworICAgICAgICAgICAgICAg IH0KKyAgICAgICAgICAgI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AgICAgICAgIH0KLSAgICAgICAgfQotCi0gICAgICAgIC8vIE5v IHR3byBkYXRhc3RvcmVzIHNob3VsZCBoYXZlIGEgbmVzdGVkIGFic29sdXRlIHBhdGgKLSAgICAg ICAgbGV0IHN0b3JlX3BhdGggPSBQYXRoQnVmOjpmcm9tKHN0b3JlLmFic29sdXRlX3BhdGgoKSk7 Ci0gICAgICAgIGlmIHN0b3JlX3BhdGguc3RhcnRzX3dpdGgoJm5ld19zdG9yZV9wYXRoKSB8fCBu ZXdfc3RvcmVfcGF0aC5zdGFydHNfd2l0aCgmc3RvcmVfcGF0aCkgewotICAgICAgICAgICAgcGFy YW1fYmFpbCEoCi0gICAgICAgICAgICAgICAgInBhdGgiLAotICAgICAgICAgICAgICAgICJuZXN0 ZWQgZGF0YXN0b3JlcyBub3QgYWxsb3dlZDogJ3t9JyBhbHJlYWR5IGluIHs6P30iLAotICAgICAg ICAgICAgICAgIHN0b3JlLm5hbWUsCi0gICAgICAgICAgICAgICAgc3RvcmVfcGF0aCwKLSAgICAg ICAgICAgICk7Ci0gICAgICAgIH0KKyAgICBsZXQgZXhpc3Rpbmdfc3RvcmVzID0gY29uZmlnLmNv bnZlcnRfdG9fdHlwZWRfYXJyYXkoImRhdGFzdG9yZSIpPzsKKyAgICBpZiBsZXQgRXJyKGVycikg PSBkYXRhc3RvcmUuZW5zdXJlX25vdF9uZXN0ZWQoJmV4aXN0aW5nX3N0b3JlcykgeworICAgICAg ICBwYXJhbV9iYWlsISgicGF0aCIsIGVycik7CiAgICAgfQogCiAgICAgbGV0IG5lZWRfdW5tb3Vu dCA9IGRhdGFzdG9yZS5iYWNraW5nX2RldmljZS5pc19zb21lKCk7Ci0tIAoyLjM5LjUKCgoKX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KcGJzLWRldmVsIG1h aWxpbmcgbGlzdApwYnMtZGV2ZWxAbGlzdHMucHJveG1veC5jb20KaHR0cHM6Ly9saXN0cy5wcm94 bW94LmNvbS9jZ2ktYmluL21haWxtYW4vbGlzdGluZm8vcGJzLWRldmVsCg==