Skip to content

Commit

Permalink
Prepare next release 0.4.4
Browse files Browse the repository at this point in the history
  • Loading branch information
MikhailMS committed Sep 29, 2024
1 parent efa53f4 commit 581e514
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 23 deletions.
25 changes: 23 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,29 @@
=============
# v0.4.4 (29 Sep 2024)

This release:
* fixes issue reported in [#8](/../../issues/8)
* includes a [PR](/../../pull/31) (thanks to @jacobneiltaylor for proposing the PR)

## What's new
* [PR](/../../pull/31) added new functions to work with `Dictionary`:
* `from_str` - creates an intsance of `Dictionary` from dictionary string
* `add_str` - reads dictionary string and adds it to an existing instance of `Dictionary`
* Added `1.77.1, 1.77.2, 1.78.0, 1.79.0, 1.80.0, 1.80.1, 1.81.0` Rust versions to Action pipeline

## What's removed or deprecated
* Removed `1.65.0` Rust version from Github Actions (this version is still supported by library)

## What's changed
* [PR](/../../pull/31) also improves line parsing logic of `Dictionary` to be more generic
* [Reworked](/../../issues/8) `decrypt_data` & `salt_decrypt_data` functions - extracted shared code into `decrypt_helper`


=============
# v0.4.3 (24 Mar 2024)

This release fixes issues reported in:
* [#28](/../../issues/28) (thanks to CoderChristopher for reporting and suggesting the solution)
* [#28](/../../issues/28) (thanks to @CoderChristopher for reporting and suggesting the solution)
* [#27](/../../issues/27)

## What's new
Expand Down Expand Up @@ -110,7 +131,7 @@ users to decide on the crates they want to use to get UdpSockets, async and runt
## What's changed
* Breaking change - **client** module now only has Generic RADIUS Client implementation
* Breaking change - **server** module now only has Generic RADIUS Server implementation
* Breaking change - **RadiusMsgType** code as been moved from **servers** module into **radius_packet** module
* Breaking change - **RadiusMsgType** code has been moved from **servers** module into **radius_packet** module
* Breaking change - **get** prefix was removed for all functions where it was used before ([C-GETTER Rust convention](https://rust-lang.github.io/api-guidelines/naming.html#c-getter))
* Breaking change - **client** & **server** implementations now require related traits to be implemented. For more information have a look into `examples/`
* All RADIUS defined errors now have *Error* suffix, ie **MalformedPacketError**
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
authors = ["MikhailMS <[email protected]>"]
categories = ["network-programming"]
description = "Pure Rust implementation of RADIUS Server/Client"
documentation = "https://docs.rs/radius-rust/0.4.3"
documentation = "https://docs.rs/radius-rust/0.4.4"
edition = "2018"
include = [
"Cargo.toml",
Expand All @@ -20,7 +20,7 @@ license = "MIT"
name = "radius-rust"
readme = "README.md"
repository = "https://github.com/MikhailMS/rust-radius"
version = "0.4.3"
version = "0.4.4"

[features]
# Default doesn\t include anythin - keep it simple
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ Rationale behind this project:
## Installation
```
[dependencies]
radius-rust = "0.4.3"
radius-rust = "0.4.4"
OR if you are planning to build Async RADIUS Client/Server
[dependencies]
radius-rust = { version = "0.4.3", features = ["async-radius"] }
radius-rust = { version = "0.4.4", features = ["async-radius"] }
```


Expand Down
33 changes: 16 additions & 17 deletions src/protocol/dictionary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,18 +127,7 @@ pub struct Dictionary {

#[allow(unused)]
impl Dictionary {
fn from_lines(lines: StringIterator) -> Result<Dictionary, RadiusError> {
let mut attributes: Vec<DictionaryAttribute> = Vec::new();
let mut values: Vec<DictionaryValue> = Vec::new();
let mut vendors: Vec<DictionaryVendor> = Vec::new();

match parse_lines(lines, &mut attributes, &mut values, &mut vendors) {
Ok(()) => Ok(Dictionary { attributes, values, vendors }),
Err(error) => Err(error),
}
}

/// Creates Dictionary from a string
/// Creates Dictionary from a RADIUS dictionary string
pub fn from_str(dictionary_str: &str) -> Result<Dictionary, RadiusError> {
let lines = read_str(dictionary_str);
Dictionary::from_lines(lines)
Expand All @@ -152,16 +141,15 @@ impl Dictionary {
}
}

/// The add functions process attributes, values and vendors from a supplied dictionary file
/// and merge them into an existing set of attributes, values and vendors

/// Adds a dictionary string to existing Dictionary
/// Processes attributes, values and vendors from a supplied dictionary string and
/// adds those to attributes, values and vendors of an existing Dictionary
pub fn add_str(&mut self, dictionary_str: &str) -> Result<(), RadiusError> {
let lines = read_str(dictionary_str);
parse_lines(lines, &mut self.attributes, &mut self.values, &mut self.vendors)
}

/// Adds a dictionary file to existing Dictionary
/// Processes attributes, values and vendors from a supplied dictionary file and
/// adds those to attributes, values and vendors of an existing Dictionary
pub fn add_file(&mut self, file_path: &str) -> Result<(), RadiusError> {
match read_file(file_path) {
Ok(lines) => parse_lines(
Expand All @@ -185,6 +173,17 @@ impl Dictionary {
pub fn vendors(&self) -> &[DictionaryVendor] {
&self.vendors
}

fn from_lines(lines: StringIterator) -> Result<Dictionary, RadiusError> {
let mut attributes: Vec<DictionaryAttribute> = Vec::new();
let mut values: Vec<DictionaryValue> = Vec::new();
let mut vendors: Vec<DictionaryVendor> = Vec::new();

match parse_lines(lines, &mut attributes, &mut values, &mut vendors) {
Ok(()) => Ok(Dictionary { attributes, values, vendors }),
Err(error) => Err(error),
}
}
}

fn assign_attribute_type(code_type: &str) -> Option<SupportedAttributeTypes> {
Expand Down

0 comments on commit 581e514

Please sign in to comment.