laforge has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/pysim/+/35730?usp=email )


Change subject: saip.personalization: Fix ICCID fillFileContent replacement
......................................................................

saip.personalization: Fix ICCID fillFileContent replacement

Change-Id: Ic267fdde3b648b376ea6814783df1e90ea9bb9ad
---
M pySim/esim/saip/personalization.py
1 file changed, 13 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/30/35730/1

diff --git a/pySim/esim/saip/personalization.py 
b/pySim/esim/saip/personalization.py
index bde7ce6..cb3edc1 100644
--- a/pySim/esim/saip/personalization.py
+++ b/pySim/esim/saip/personalization.py
@@ -26,7 +26,8 @@

 def file_replace_content(file: List[Tuple], new_content: bytes):
     """Completely replace all fillFileContent of a decoded 'File' with the 
new_content."""
-    file = remove_unwanted_tuples_from_list(file, ['fillFileContent', 
'fillFileOffset'])
+    # use [:] to avoid making a copy, as we're doing in-place modification of 
the list here
+    file[:] = remove_unwanted_tuples_from_list(file, ['fillFileContent', 
'fillFileOffset'])
     file.append(('fillFileContent', new_content))
     return file

@@ -54,9 +55,9 @@
     name = 'iccid'
     def apply(self, pes: ProfileElementSequence):
         # patch the header; FIXME: swap nibbles!
-        pes.get_pe_by_type('header').decoded['iccid'] = self.value
+        pes.get_pe_for_type('header').decoded['iccid'] = self.value
         # patch MF/EF.ICCID
-        file_replace_content(pes.get_pe_by_type('mf').decoded['ef-iccid'], 
self.value)
+        file_replace_content(pes.get_pe_for_type('mf').decoded['ef-iccid'], 
bytes(self.value))

 class Imsi(ConfigurableParameter):
     """Configurable IMSI. Expects value to be n EF.IMSI format."""

--
To view, visit https://gerrit.osmocom.org/c/pysim/+/35730?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Ic267fdde3b648b376ea6814783df1e90ea9bb9ad
Gerrit-Change-Number: 35730
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <[email protected]>
Gerrit-MessageType: newchange

Reply via email to