mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 08:37:25 -05:00
Co-authored-by: Dennis Sheirer <dsheirer@github.com>
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
/*
|
||||
* ******************************************************************************
|
||||
* sdrtrunk
|
||||
* Copyright (C) 2014-2018 Dennis Sheirer
|
||||
* *****************************************************************************
|
||||
* Copyright (C) 2014-2023 Dennis Sheirer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -15,7 +14,7 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
* *****************************************************************************
|
||||
* ****************************************************************************
|
||||
*/
|
||||
|
||||
package io.github.dsheirer.module.decode.ip.ars;
|
||||
@@ -25,11 +24,10 @@ import io.github.dsheirer.identifier.Identifier;
|
||||
import io.github.dsheirer.module.decode.ip.ars.identifier.ARSDevice;
|
||||
import io.github.dsheirer.module.decode.ip.ars.identifier.ARSPassword;
|
||||
import io.github.dsheirer.module.decode.ip.ars.identifier.ARSUser;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Automatic Registration Service - Device Registration
|
||||
@@ -176,7 +174,7 @@ public class DeviceRegistration extends ARSHeader
|
||||
|
||||
pointer += 8;
|
||||
|
||||
if(deviceIdentifierSize > 0)
|
||||
if(deviceIdentifierSize > 0 && deviceIdentifierSize < 8)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
@@ -186,21 +184,13 @@ public class DeviceRegistration extends ARSHeader
|
||||
pointer += 8;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
int device = Integer.parseInt(sb.toString());
|
||||
mDevice = ARSDevice.createFrom(device);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
mLog.error("Error parsing ARS device identifier from value [" + sb.toString() + "]");
|
||||
}
|
||||
mDevice = ARSDevice.createFrom(sb.toString());
|
||||
}
|
||||
|
||||
int userIdentifierSize = getMessage().getInt(BYTE_VALUE, pointer);
|
||||
pointer += 8;
|
||||
|
||||
if(userIdentifierSize > 0)
|
||||
if(userIdentifierSize > 0 && userIdentifierSize < 8)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
@@ -216,7 +206,7 @@ public class DeviceRegistration extends ARSHeader
|
||||
int passwordSize = getMessage().getInt(BYTE_VALUE, pointer);
|
||||
pointer += 8;
|
||||
|
||||
if(passwordSize > 0)
|
||||
if(passwordSize > 0 && passwordSize < 8)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
/*
|
||||
* ******************************************************************************
|
||||
* sdrtrunk
|
||||
* Copyright (C) 2014-2018 Dennis Sheirer
|
||||
* *****************************************************************************
|
||||
* Copyright (C) 2014-2023 Dennis Sheirer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -15,7 +14,7 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
* *****************************************************************************
|
||||
* ****************************************************************************
|
||||
*/
|
||||
|
||||
package io.github.dsheirer.module.decode.ip.ars;
|
||||
@@ -25,11 +24,10 @@ import io.github.dsheirer.identifier.Identifier;
|
||||
import io.github.dsheirer.module.decode.ip.ars.identifier.ARSDevice;
|
||||
import io.github.dsheirer.module.decode.ip.ars.identifier.ARSPassword;
|
||||
import io.github.dsheirer.module.decode.ip.ars.identifier.ARSUser;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class UserRegistration extends ARSHeader
|
||||
{
|
||||
@@ -108,7 +106,7 @@ public class UserRegistration extends ARSHeader
|
||||
|
||||
pointer += 8;
|
||||
|
||||
if(deviceIdentifierSize > 0)
|
||||
if(deviceIdentifierSize > 0 && deviceIdentifierSize < 8)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
@@ -118,22 +116,13 @@ public class UserRegistration extends ARSHeader
|
||||
pointer += 8;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
int device = Integer.parseInt(sb.toString());
|
||||
mDevice = ARSDevice.createFrom(device);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
//Abort processing
|
||||
return;
|
||||
}
|
||||
mDevice = ARSDevice.createFrom(sb.toString());
|
||||
}
|
||||
|
||||
int userIdentifierSize = getMessage().getInt(BYTE_VALUE, pointer);
|
||||
pointer += 8;
|
||||
|
||||
if(userIdentifierSize > 0)
|
||||
if(userIdentifierSize > 0 && deviceIdentifierSize < 8)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
@@ -149,7 +138,7 @@ public class UserRegistration extends ARSHeader
|
||||
int passwordSize = getMessage().getInt(BYTE_VALUE, pointer);
|
||||
pointer += 8;
|
||||
|
||||
if(passwordSize > 0)
|
||||
if(passwordSize > 0 && passwordSize < 8)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* *****************************************************************************
|
||||
* Copyright (C) 2014-2020 Dennis Sheirer
|
||||
* Copyright (C) 2014-2023 Dennis Sheirer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -22,20 +22,20 @@ package io.github.dsheirer.module.decode.ip.ars.identifier;
|
||||
import io.github.dsheirer.identifier.Form;
|
||||
import io.github.dsheirer.identifier.IdentifierClass;
|
||||
import io.github.dsheirer.identifier.Role;
|
||||
import io.github.dsheirer.identifier.integer.IntegerIdentifier;
|
||||
import io.github.dsheirer.identifier.string.StringIdentifier;
|
||||
import io.github.dsheirer.protocol.Protocol;
|
||||
|
||||
/**
|
||||
* Automatic Registration Service - Device Identifier
|
||||
*/
|
||||
public class ARSDevice extends IntegerIdentifier
|
||||
public class ARSDevice extends StringIdentifier
|
||||
{
|
||||
/**
|
||||
* Constructs an instance
|
||||
* @param value of the device identifier
|
||||
* @param role of the device (TO/FROM)
|
||||
*/
|
||||
public ARSDevice(int value, Role role)
|
||||
public ARSDevice(String value, Role role)
|
||||
{
|
||||
super(value, IdentifierClass.USER, Form.ARS_DEVICE, role);
|
||||
}
|
||||
@@ -49,7 +49,7 @@ public class ARSDevice extends IntegerIdentifier
|
||||
/**
|
||||
* Creates an ARS device with a FROM role
|
||||
*/
|
||||
public static ARSDevice createFrom(int value)
|
||||
public static ARSDevice createFrom(String value)
|
||||
{
|
||||
return new ARSDevice(value, Role.FROM);
|
||||
}
|
||||
@@ -57,7 +57,7 @@ public class ARSDevice extends IntegerIdentifier
|
||||
/**
|
||||
* Creates an ARS device with a TO role
|
||||
*/
|
||||
public static ARSDevice createTo(int value)
|
||||
public static ARSDevice createTo(String value)
|
||||
{
|
||||
return new ARSDevice(value, Role.TO);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user