private static RadiusAttribute attr(long type) throws InstantiationException, IllegalAccessException { RadiusAttribute attr = null; Class<?> c = attributeMap.get(new Long(type)); if (c != null) { attr = (RadiusAttribute) c.newInstance(); } else { RadiusLog.warn("Unknown Attribute: " + type); attr = new Attr_UnknownAttribute(type); } return attr; }
private static RadiusAttribute attr(long type) throws InstantiationException, IllegalAccessException { RadiusAttribute attr = null; Class<?> c = attributeMap.get(new Long(type)); if (c != null) { attr = (RadiusAttribute) c.newInstance(); } else { RadiusLog.warn("Unknown Attribute: " + type); attr = new Attr_UnknownAttribute(type); } return attr; }
private static RadiusAttribute vsa(long vendor, long type) throws InstantiationException, IllegalAccessException { RadiusAttribute attr = null; VendorValue v = vendorValueMap.get(new Long(vendor)); Class<?> c = null; if (v != null) { c = v.typeMap.get(new Long(type)); } if (c != null) { attr = (RadiusAttribute) c.newInstance(); } else { RadiusLog.warn("Unknown Vendor Specific Attribute: " + vendor+":"+type); attr = new Attr_UnknownVSAttribute(vendor, type); } return attr; }
private static RadiusAttribute vsa(long vendor, long type) throws InstantiationException, IllegalAccessException { RadiusAttribute attr = null; VendorValue v = vendorValueMap.get(new Long(vendor)); Class<?> c = null; if (v != null) { c = v.typeMap.get(new Long(type)); } if (c != null) { attr = (RadiusAttribute) c.newInstance(); } else { RadiusLog.warn("Unknown Vendor Specific Attribute: " + vendor+":"+type); attr = new Attr_UnknownVSAttribute(vendor, type); } return attr; }
private static void DesEncrypt(byte[] Clear, int clearOffset, byte[] Key, int keyOffset, byte[] Cypher, int cypherOffset) { byte szParityKey[] = new byte[8]; parity_key(szParityKey, Key, keyOffset); try { KeySpec ks = new DESKeySpec(szParityKey); SecretKeyFactory skf = SecretKeyFactory.getInstance("DES"); SecretKey sk = skf.generateSecret(ks); Cipher c = Cipher.getInstance("DES/CBC/NoPadding"); IvParameterSpec ips = new IvParameterSpec(new byte[] {0,0,0,0,0,0,0,0}); c.init(Cipher.ENCRYPT_MODE, sk, ips); c.doFinal(Clear, clearOffset, Clear.length - clearOffset, Cypher, cypherOffset); } catch (Exception e) { RadiusLog.warn(e.getMessage(), e); } }
private static void DesEncrypt(byte[] Clear, int clearOffset, byte[] Key, int keyOffset, byte[] Cypher, int cypherOffset) { byte szParityKey[] = new byte[8]; parity_key(szParityKey, Key, keyOffset); try { KeySpec ks = new DESKeySpec(szParityKey); SecretKeyFactory skf = SecretKeyFactory.getInstance("DES"); SecretKey sk = skf.generateSecret(ks); Cipher c = Cipher.getInstance("DES/CBC/NoPadding"); IvParameterSpec ips = new IvParameterSpec(new byte[] {0,0,0,0,0,0,0,0}); c.init(Cipher.ENCRYPT_MODE, sk, ips); c.doFinal(Clear, clearOffset, Clear.length - clearOffset, Cypher, cypherOffset); } catch (Exception e) { RadiusLog.warn(e.getMessage(), e); } }
public void packPacket(RadiusPacket packet, String sharedSecret, ByteBuffer buffer, boolean onWire) throws IOException { if (packet == null) { throw new IllegalArgumentException("Packet is null."); } int initialPosition = buffer.position(); buffer.position(initialPosition + 12); packAttributeList(packet.getAttributes(), buffer, onWire); int finalPosition = buffer.position(); int totalLength = finalPosition - initialPosition; int attributesLength = totalLength - 12; try { buffer.position(initialPosition); packHeader(buffer, packet, attributesLength, sharedSecret); buffer.position(finalPosition); } catch(Exception e) { RadiusLog.warn(e.getMessage(), e); } }
public void packPacket(RadiusPacket packet, String sharedSecret, ByteBuffer buffer, boolean onWire) throws IOException { if (packet == null) { throw new IllegalArgumentException("Packet is null."); } int initialPosition = buffer.position(); buffer.position(initialPosition + 12); packAttributeList(packet.getAttributes(), buffer, onWire); int finalPosition = buffer.position(); int totalLength = finalPosition - initialPosition; int attributesLength = totalLength - 12; try { buffer.position(initialPosition); packHeader(buffer, packet, attributesLength, sharedSecret); buffer.position(finalPosition); } catch(Exception e) { RadiusLog.warn(e.getMessage(), e); } }
protected void send(RadiusRequest req, int attempt) throws Exception { int port = req instanceof AccountingRequest ? acctPort : authPort; if (statusListener != null) { statusListener.onBeforeSend(this, req); } if (attempt > 1) { RadiusLog.warn("RadiusClient retrying request (attempt " + attempt + ")..."); } ByteBuffer buffer = ByteBuffer.allocate(4096); format.packPacket(req, sharedSecret, buffer, true); DatagramPacket request = new DatagramPacket(buffer.array(), buffer.position(), getRemoteInetAddress(), port); socket.send(request); if (statusListener != null) { statusListener.onAfterSend(this); } }
protected void send(RadiusRequest req, int attempt) throws Exception { int port = req instanceof AccountingRequest ? acctPort : authPort; if (statusListener != null) { statusListener.onBeforeSend(this, req); } if (attempt > 1) { RadiusLog.warn("RadiusClient retrying request (attempt " + attempt + ")..."); } ByteBuffer buffer = ByteBuffer.allocate(4096); format.packPacket(req, sharedSecret, buffer, true); DatagramPacket request = new DatagramPacket(buffer.array(), buffer.position(), getRemoteInetAddress(), port); socket.send(request); if (statusListener != null) { statusListener.onAfterSend(this); } }
public void setValueObject(Serializable o) { if (o instanceof InetAddress) { setInetAddress((InetAddress)o); } else if (o instanceof byte[]) { setValue((byte[])o); } else { try { setInetAddress(InetAddress.getByName(o.toString())); } catch(Exception e) { RadiusLog.warn(e.getMessage()); } } } }
public void setValueObject(Serializable o) { if (o instanceof InetAddress) { setInetAddress((InetAddress)o); } else if (o instanceof byte[]) { setValue((byte[])o); } else { try { setInetAddress(InetAddress.getByName(o.toString())); } catch(Exception e) { RadiusLog.warn(e.getMessage()); } } } }
public void onAcctStarted(SessionExpiredEvent event) { JRadiusSession session = event.getSession(); String error = "Session Expired in Accounting-Started state, Accounting never stopped"; RadiusLog.warn(session.getSessionKey() + ": " + error); JRadiusLogEntry logEntry = session.getLogEntry(event, "0"); logEntry.setType("error"); logEntry.addMessage(error); }
public void onAcctStarted(SessionExpiredEvent event) { JRadiusSession session = event.getSession(); String error = "Session Expired in Accounting-Started state, Accounting never stopped"; RadiusLog.warn(session.getSessionKey() + ": " + error); JRadiusLogEntry logEntry = session.getLogEntry(event, "0"); logEntry.setType("error"); logEntry.addMessage(error); }
public void onAcctStarted(SessionExpiredEvent event) { JRadiusSession session = event.getSession(); String error = "Session Expired in Accounting-Started state, Accounting never stopped"; RadiusLog.warn(session.getSessionKey() + ": " + error); JRadiusLogEntry logEntry = session.getLogEntry(event, "0"); logEntry.setType("error"); logEntry.addMessage(error); }
public void onAuthAccepted(SessionExpiredEvent event) { JRadiusSession session = event.getSession(); String error = "Session Expired in Auth-Accepted state, Accounting never started"; RadiusLog.warn(session.getSessionKey() + ": " + error); JRadiusLogEntry logEntry = session.getLogEntry(event, "0"); logEntry.setType("error"); logEntry.addMessage(error); session.commitLogEntries(JRadiusServer.RLM_MODULE_FAIL); }
public void onAuthAccepted(SessionExpiredEvent event) { JRadiusSession session = event.getSession(); String error = "Session Expired in Auth-Accepted state, Accounting never started"; RadiusLog.warn(session.getSessionKey() + ": " + error); JRadiusLogEntry logEntry = session.getLogEntry(event, "0"); logEntry.setType("error"); logEntry.addMessage(error); session.commitLogEntries(JRadiusServer.RLM_MODULE_FAIL); }
public void onAuthAccepted(SessionExpiredEvent event) { JRadiusSession session = event.getSession(); String error = "Session Expired in Auth-Accepted state, Accounting never started"; RadiusLog.warn(session.getSessionKey() + ": " + error); JRadiusLogEntry logEntry = session.getLogEntry(event, "0"); logEntry.setType("error"); logEntry.addMessage(error); session.commitLogEntries(JRadiusServer.RLM_MODULE_FAIL); }
protected int handleRadiusException(JRadiusRequest request, RadiusException e) { JRadiusSession session = request.getSession(); String error = e.getMessage(); RadiusLog.warn(error); if (session != null) { try { session.getLogEntry(request).addMessage(error); } catch (RadiusException re) { RadiusLog.problem(request, session, re, re.getMessage()); } // lets not remove the session and let it expire, or maybe // this was a RADIUS retransmission that should simply be forgotten //session.setSessionState(JRadiusSession.RADIUS_ERROR); //sessionManager.removeSession(session); } return (e instanceof RadiusSecurityException) ? JRadiusServer.RLM_MODULE_REJECT : JRadiusServer.RLM_MODULE_FAIL; }
protected int handleRadiusException(JRadiusRequest request, RadiusException e) { JRadiusSession session = request.getSession(); String error = e.getMessage(); RadiusLog.warn(error); if (session != null) { try { session.getLogEntry(request).addMessage(error); } catch (RadiusException re) { RadiusLog.problem(request, session, re, re.getMessage()); } // lets not remove the session and let it expire, or maybe // this was a RADIUS retransmission that should simply be forgotten //session.setSessionState(JRadiusSession.RADIUS_ERROR); //sessionManager.removeSession(session); } return (e instanceof RadiusSecurityException) ? JRadiusServer.RLM_MODULE_REJECT : JRadiusServer.RLM_MODULE_FAIL; }