diff options
author | elie <elie> | 2012-08-09 15:17:46 +0000 |
---|---|---|
committer | elie <elie> | 2012-08-09 15:17:46 +0000 |
commit | e00c17d7c154f0862d144144eddecd993e48345a (patch) | |
tree | 00872922acd20ac86d33ca7e10eadaf0f72a8130 /pysnmp | |
parent | 95127203c857006065e1d8e65471067d27c495b3 (diff) | |
download | pysnmp-git-e00c17d7c154f0862d144144eddecd993e48345a.tar.gz |
better input check for IpAddress
Diffstat (limited to 'pysnmp')
-rw-r--r-- | pysnmp/proto/rfc1902.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/pysnmp/proto/rfc1902.py b/pysnmp/proto/rfc1902.py index b12df7a2..121a4d64 100644 --- a/pysnmp/proto/rfc1902.py +++ b/pysnmp/proto/rfc1902.py @@ -46,15 +46,16 @@ class IpAddress(univ.OctetString): value = [ int(x) for x in value.split('.') ] except: raise error.ProtocolError('Bad IP address syntax %s' % value) + value = univ.OctetString.prettyIn(self, value) if len(value) != 4: raise error.ProtocolError('Bad IP address syntax') - return univ.OctetString.prettyIn(self, value) + return value def prettyOut(self, value): if value: return '.'.join( [ '%d' % x for x in self.__class__(value).asNumbers() ] - ) + ) else: return '' |