From 69865e005bc38020b072d893a1547ce5ed92c0dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Sat, 6 Jan 2024 09:23:03 +0100 Subject: [PATCH] Register operatorURL only when certificate from operator is fetched --- src/libgourou.cpp | 44 +++++++++++++++++++------------------------- 1 file changed, 19 insertions(+), 25 deletions(-) diff --git a/src/libgourou.cpp b/src/libgourou.cpp index 2bbc201..9d5e3f2 100644 --- a/src/libgourou.cpp +++ b/src/libgourou.cpp @@ -398,31 +398,7 @@ namespace gourou } } - doOperatorAuth(operatorURL); - - // Add new operatorURL to list - pugi::xml_document activationDoc; - user->readActivation(activationDoc); - - pugi::xml_node root; - pugi::xpath_node xpathRes = activationDoc.select_node("//adept:operatorURLList"); - - // Create adept:operatorURLList if it doesn't exists - if (!xpathRes) - { - xpathRes = activationDoc.select_node("/activationInfo"); - root = xpathRes.node(); - root = root.append_child("adept:operatorURLList"); - root.append_attribute("xmlns:adept") = ADOBE_ADEPT_NS; - - appendTextElem(root, "adept:user", user->getUUID()); - } - else - root = xpathRes.node(); - - appendTextElem(root, "adept:operatorURL", operatorURL); - - user->updateActivationFile(activationDoc); + doOperatorAuth(operatorURL); } void DRMProcessor::buildFulfillRequest(pugi::xml_document& acsmDoc, pugi::xml_document& fulfillReq) @@ -492,6 +468,24 @@ namespace gourou appendTextElem(root, "adept:licenseURL", licenseURL); appendTextElem(root, "adept:certificate", certificate); + // Add new operatorURL to list + xpathRes = activationDoc.select_node("//adept:operatorURLList"); + + // Create adept:operatorURLList if it doesn't exists + if (!xpathRes) + { + xpathRes = activationDoc.select_node("/activationInfo"); + root = xpathRes.node(); + root = root.append_child("adept:operatorURLList"); + root.append_attribute("xmlns:adept") = ADOBE_ADEPT_NS; + + appendTextElem(root, "adept:user", user->getUUID()); + } + else + root = xpathRes.node(); + + appendTextElem(root, "adept:operatorURL", operatorURL); + user->updateActivationFile(activationDoc); }