Hoernchen has uploaded this change for review.

View Change

pySim-shell: enable apdu_strict by default

I think it's time to tame the wild west of mixed tpdu/apdu commands.

Change-Id: Ic413e12e2792e8cd9d455b1b0d6791bdf757c80e
---
M pySim-shell.py
M tests/pySim-shell_test/apdu/test_apdu_legacy.script
M tests/pySim-shell_test/apdu/test_apdu_legacy_scp02.template
M tests/pySim-shell_test/apdu/test_apdu_legacy_scp03.template
4 files changed, 4 insertions(+), 8 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/26/43726/1
diff --git a/pySim-shell.py b/pySim-shell.py
index 3a0dedd..0169f38 100755
--- a/pySim-shell.py
+++ b/pySim-shell.py
@@ -102,7 +102,7 @@
self.conserve_write = True
self.json_pretty_print = True
self.apdu_trace = getattr(sl, 'apdu_tracer', None) is not None
- self.apdu_strict = False
+ self.apdu_strict = True

self.add_settable(cmd2.Settable('numeric_path', bool,
'Print File IDs instead of names',
@@ -266,13 +266,6 @@
tracked. Depending on the raw APDU sent, pySim-shell may not continue to work as expected if you e.g. select
a different file."""

- if not hasattr(self, 'apdu_strict_warning_displayed') and self.apdu_strict is False:
- self.poutput("Warning: The default for the setable parameter `apdu_strict` will be changed from")
- self.poutput(" `False` to `True` in future pySim-shell releases. In case you are using")
- self.poutput(" the `apdu` command from a script that still mixes APDUs with TPDUs, consider")
- self.poutput(" fixing or adding a `set apdu_strict false` line at the beginning.")
- self.apdu_strict_warning_displayed = True;
-
# When sending raw APDUs we access the scc object through _scc member of the card object. It should also be
# noted that the apdu command plays an exceptional role since it is the only card accessing command that
# can be executed without the presence of a runtime state (self.rs) object. However, this also means that
diff --git a/tests/pySim-shell_test/apdu/test_apdu_legacy.script b/tests/pySim-shell_test/apdu/test_apdu_legacy.script
index c3dfb1b..2359e51 100644
--- a/tests/pySim-shell_test/apdu/test_apdu_legacy.script
+++ b/tests/pySim-shell_test/apdu/test_apdu_legacy.script
@@ -1,6 +1,7 @@
set debug true
set echo true
set apdu_trace true
+set apdu_strict false

# Case #1: (open channel #1)
# No command data field, No response data field present
diff --git a/tests/pySim-shell_test/apdu/test_apdu_legacy_scp02.template b/tests/pySim-shell_test/apdu/test_apdu_legacy_scp02.template
index 51497ed..92e402b 100644
--- a/tests/pySim-shell_test/apdu/test_apdu_legacy_scp02.template
+++ b/tests/pySim-shell_test/apdu/test_apdu_legacy_scp02.template
@@ -1,6 +1,7 @@
set debug true
set echo true
set apdu_trace true
+set apdu_strict false

# Establish secure channel:
select ADF.ISD
diff --git a/tests/pySim-shell_test/apdu/test_apdu_legacy_scp03.template b/tests/pySim-shell_test/apdu/test_apdu_legacy_scp03.template
index b41620b..bdfa861 100644
--- a/tests/pySim-shell_test/apdu/test_apdu_legacy_scp03.template
+++ b/tests/pySim-shell_test/apdu/test_apdu_legacy_scp03.template
@@ -1,6 +1,7 @@
set debug true
set echo true
set apdu_trace true
+set apdu_strict false

# Establish secure channel:
select ADF.ISD-R

To view, visit change 43726. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Ic413e12e2792e8cd9d455b1b0d6791bdf757c80e
Gerrit-Change-Number: 43726
Gerrit-PatchSet: 1
Gerrit-Owner: Hoernchen <ewild@sysmocom.de>