ust_service_check: proper treatment of files in sub-directories

We must not only consider files in the current directory (ADF.USIM)
but also in its sub-directories.  This requires us to be able to
determine the path we need to traverse between the currently selected
file (EF.UST) and the respective file in some other directory,
which is implemented via CardFile.build_select_path_to().

Change-Id: I61797fefa9dafa36a8a62c11aa2cfaeecb015740
This commit is contained in:
Harald Welte
2022-02-12 21:41:59 +01:00
parent 419bb496e1
commit aceb2a548a
2 changed files with 71 additions and 15 deletions

View File

@@ -608,12 +608,8 @@ class EF_UServiceTable(TransparentEF):
for f in files_by_service[s]:
should_exist = f.should_exist_for_services(active_services)
try:
(data, sw) = cmd.card._scc.select_file(f.fid)
cmd.rs.select_file(f)
exists = True
fcp = f.decode_select_response(data)
# if we just selected a directory, go back
if fcp['file_descriptor']['file_type'] == 'df':
cmd.card._scc.select_parent_df()
except SwMatchError as e:
sw = str(e)
exists = False
@@ -625,7 +621,7 @@ class EF_UServiceTable(TransparentEF):
cmd.perror(" ERROR: File %s is not selectable (%s) but should!" % (f, sw))
finally:
# re-select the EF.UST
cmd.card._scc.select_file(self.fid)
cmd.rs.select_file(self)
return num_problems
class EF_UST(EF_UServiceTable):