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


Change subject: pySim-shell: prevent opening/closing logical channel 0
......................................................................

pySim-shell: prevent opening/closing logical channel 0

The basic logical channel 0 is always present. It cannot be created or
closed. In case someone tries to create or close it anyway, we should
reject such a command immediately since it might cause unexpected
effects.

Related: OS#6531
Change-Id: I4eebd9f15fadd18e1caeb033fda36c59446fcab8
---
M pySim-shell.py
1 file changed, 4 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/39/37839/1

diff --git a/pySim-shell.py b/pySim-shell.py
index 630d54a..5d99d48 100755
--- a/pySim-shell.py
+++ b/pySim-shell.py
@@ -970,6 +970,8 @@
     @cmd2.with_argparser(open_chan_parser)
     def do_open_channel(self, opts):
         """Open a logical channel."""
+        if opts.chan_nr == 0:
+            raise RuntimeError("Cannot create (always existing) basic logical 
lchan 0")
         (data, sw) = self._cmd.lchan.scc.manage_channel(
             mode='open', lchan_nr=opts.chan_nr)
         # this is executed only in successful case, as unsuccessful raises 
exception
@@ -982,6 +984,8 @@
     @cmd2.with_argparser(close_chan_parser)
     def do_close_channel(self, opts):
         """Close a logical channel."""
+        if opts.chan_nr == 0:
+            raise RuntimeError("Cannot close (always existing) basic logical 
lchan 0")
         (data, sw) = self._cmd.lchan.scc.manage_channel(
             mode='close', lchan_nr=opts.chan_nr)
         # this is executed only in successful case, as unsuccessful raises 
exception

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

Gerrit-MessageType: newchange
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I4eebd9f15fadd18e1caeb033fda36c59446fcab8
Gerrit-Change-Number: 37839
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <[email protected]>

Reply via email to