1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-10 21:33:38 +00:00

1. Fixed bug with Authenticode URI parsing

2. Fixed bug with Http Uri parsing
This commit is contained in:
Bryan Roe
2022-01-31 18:42:40 -08:00
parent 9ecb0ad760
commit 2a39934cee
3 changed files with 29 additions and 5 deletions

View File

@@ -3913,7 +3913,7 @@ duk_ret_t ILibDuktape_httpStream_parseUri(duk_context *ctx)
char *path, *addr; char *path, *addr;
unsigned short port; unsigned short port;
int protocolIndex; int protocolIndex, i;
char *username = NULL; char *username = NULL;
char *password = NULL; char *password = NULL;
@@ -3980,6 +3980,16 @@ duk_ret_t ILibDuktape_httpStream_parseUri(duk_context *ctx)
duk_push_null(ctx); duk_push_null(ctx);
} }
password = NULL; password = NULL;
// [options]
uri = Duktape_GetStringPropertyValueEx(ctx, -1, "host", NULL, &uriLen);
if ((i = ILibString_IndexOf(uri, uriLen, "?", 1)) >= 0)
{
duk_push_sprintf(ctx, "/%s", uri + i); // [options][newpath]
duk_put_prop_string(ctx, -2, "path"); // [options]
duk_push_lstring(ctx, uri, i); // [options][newhost]
duk_put_prop_string(ctx, -2, "host"); // [options]
}
return 1; return 1;
} }

File diff suppressed because one or more lines are too long

View File

@@ -114,7 +114,17 @@ function locked(uri)
function checkMSH() function checkMSH()
{ {
var value = module.exports(process.execPath); var value = module.exports(process.execPath);
if (value != null) { value = module.exports.locked(value.url); } if (value != null)
{
if (value.url != null)
{
value = module.exports.locked(value.url);
}
else
{
value = null;
}
}
if(value!=null) if(value!=null)
{ {
var msh = _MSH(); var msh = _MSH();
@@ -125,9 +135,13 @@ function checkMSH()
var res1 = require('http').parseUri(msh.MeshServer); var res1 = require('http').parseUri(msh.MeshServer);
if(res1!=null) if(res1!=null)
{ {
if(res1.host.toLowerCase() != value.dns.toLowerCase() || msh.ServerID.toLowerCase() != value.id.toLowerCase()) if(res1.host.toLowerCase() != value.dns.toLowerCase())
{ {
throw ('Server Configuration MISMATCH'); throw ('DNS MISMATCH in Configuration, LOCKED to: ' + value.dns);
}
if(msh.ServerID.toLowerCase() != value.id.toLowerCase())
{
throw ('ServerID MISMATCH in Configuration, LOCKED to: ' + value.id);
} }
} }
} }