mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-09-14 08:21:02 +03:00
fix(custom-client): validate portable exclusion and MSI action data
Fail when --exclude-exe does not match a file, and propagate MSI CustomActionData read failures while preserving legacy fallback behavior. Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
@@ -25,6 +25,7 @@ def normalize(path: str) -> str:
|
|||||||
def generate_md5_table(folder: str, level, exclude: str = None) -> dict:
|
def generate_md5_table(folder: str, level, exclude: str = None) -> dict:
|
||||||
res: dict = dict()
|
res: dict = dict()
|
||||||
skip = normalize(exclude) if exclude else None
|
skip = normalize(exclude) if exclude else None
|
||||||
|
excluded = False
|
||||||
# os.curdir is the literal ".", so restoring it left us inside `folder`.
|
# os.curdir is the literal ".", so restoring it left us inside `folder`.
|
||||||
curdir = os.getcwd()
|
curdir = os.getcwd()
|
||||||
os.chdir(folder)
|
os.chdir(folder)
|
||||||
@@ -35,6 +36,7 @@ def generate_md5_table(folder: str, level, exclude: str = None) -> dict:
|
|||||||
full_path = os.path.join(root, f)
|
full_path = os.path.join(root, f)
|
||||||
if skip and normalize(full_path) == skip:
|
if skip and normalize(full_path) == skip:
|
||||||
print(f"Excluding {full_path}...")
|
print(f"Excluding {full_path}...")
|
||||||
|
excluded = True
|
||||||
continue
|
continue
|
||||||
print(f"Processing {full_path}...")
|
print(f"Processing {full_path}...")
|
||||||
f = open(full_path, "rb")
|
f = open(full_path, "rb")
|
||||||
@@ -45,6 +47,8 @@ def generate_md5_table(folder: str, level, exclude: str = None) -> dict:
|
|||||||
md5_code = md5_generator.hexdigest().encode(encoding=encoding)
|
md5_code = md5_generator.hexdigest().encode(encoding=encoding)
|
||||||
res[full_path] = (content_compressed, md5_code)
|
res[full_path] = (content_compressed, md5_code)
|
||||||
os.chdir(curdir)
|
os.chdir(curdir)
|
||||||
|
if skip and not excluded:
|
||||||
|
raise ValueError(f"excluded file was not found in {folder}: {exclude}")
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1077,7 +1077,9 @@ UINT __stdcall UninstallPrinter(
|
|||||||
|
|
||||||
// Must match the name install used, otherwise the printer is left behind. Absent
|
// Must match the name install used, otherwise the printer is left behind. Absent
|
||||||
// on packages built before this was passed in, where it was the stock name.
|
// on packages built before this was passed in, where it was the stock name.
|
||||||
if (SUCCEEDED(WcaGetProperty(L"CustomActionData", &pwzData)) && pwzData)
|
hr = WcaGetProperty(L"CustomActionData", &pwzData);
|
||||||
|
ExitOnFailure(hr, "failed to get CustomActionData");
|
||||||
|
if (pwzData)
|
||||||
{
|
{
|
||||||
appNameValue = pwzData;
|
appNameValue = pwzData;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user