Skip to content

Commit

Permalink
Fix MSSP Config for Server-side along with basic logging.
Browse files Browse the repository at this point in the history
  • Loading branch information
HarryCordewener committed Jan 2, 2024
1 parent 8aac7ed commit 8d27ded
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions TelnetNegotiationCore/Interpreters/TelnetMSSPInterpreter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -253,14 +253,15 @@ private IEnumerable<byte> ReportMSSP(MSSPConfig config)
public TelnetInterpreter RegisterMSSPConfig(Func<MSSPConfig> config)
{
_msspConfig = config;
_Logger.Debug("Registering MSSP Config. Currently evaluates to: {@msspConfig}", config());
return this;
}

private IEnumerable<byte> MSSPReadConfig(MSSPConfig config)
{
IEnumerable<byte> msspBytes = Array.Empty<byte>();

var fields = typeof(MSSPConfig).GetFields();
var fields = typeof(MSSPConfig).GetProperties();
var knownFields = fields.Where(field => Attribute.IsDefined(field, typeof(NameAttribute)));

foreach (var field in knownFields)
Expand All @@ -276,7 +277,7 @@ private IEnumerable<byte> MSSPReadConfig(MSSPConfig config)
foreach (var item in config.Extended ?? new Dictionary<string, dynamic>())
{
if (item.Value == null) continue;
msspBytes = msspBytes.Concat(ConvertToMSSP(item.Key, item.Value()) as IEnumerable<byte>);
msspBytes = msspBytes.Concat(ConvertToMSSP(item.Key, item.Value) as IEnumerable<byte>);
}

return msspBytes;
Expand Down

0 comments on commit 8d27ded

Please sign in to comment.