Fix tiny warning

This commit is contained in:
BlubbFish 2020-01-19 23:16:16 +01:00
parent 0a60a82b8c
commit c4c8f6164b
2 changed files with 17 additions and 15 deletions

View File

@ -45,7 +45,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
tag_name: ${{ steps.create_deb.outputs.builddaterelease }} tag_name: ${{ steps.create_deb.outputs.builddaterelease }}
release_name: Nightly from master release_name: Nightly from ${{ steps.create_deb.outputs.builddaterelease }}
body: This is a nightly release. It may be not working properly. body: This is a nightly release. It may be not working properly.
draft: false draft: false
prerelease: true prerelease: true

View File

@ -44,7 +44,7 @@ namespace Fraunhofer.Fit.IoT.LoraMap.Model.Admin {
cont.Request.InputStream.Close(); cont.Request.InputStream.Close();
reader.Close(); reader.Close();
try { try {
JsonMapper.ToObject(rawData); _ = JsonMapper.ToObject(rawData);
} catch (Exception) { } catch (Exception) {
Helper.WriteError("501 - Error recieving " + filename + ", no valid json " + cont.Request.Url.PathAndQuery); Helper.WriteError("501 - Error recieving " + filename + ", no valid json " + cont.Request.Url.PathAndQuery);
cont.Response.StatusCode = 501; cont.Response.StatusCode = 501;
@ -74,7 +74,7 @@ namespace Fraunhofer.Fit.IoT.LoraMap.Model.Admin {
private Boolean Login(HttpListenerContext cont) { private Boolean Login(HttpListenerContext cont) {
Dictionary<String, String> POST = Webserver.GetPostParams(cont.Request); Dictionary<String, String> POST = Webserver.GetPostParams(cont.Request);
if(POST.ContainsKey("user") && POST["user"] == this.settings["admin_user"] && POST.ContainsKey("pass") && POST["pass"] == this.settings["admin_pass"]) { if(POST.ContainsKey("user") && POST["user"] == this.settings["admin_user"] && POST.ContainsKey("pass") && POST["pass"] == this.settings["admin_pass"]) {
Int64 sessionid = 0; Int64 sessionid;
while(true) { while(true) {
sessionid = AdminSession.GetRandomSessionid(); sessionid = AdminSession.GetRandomSessionid();
if(!this.session.ContainsKey(sessionid)) { if(!this.session.ContainsKey(sessionid)) {
@ -110,22 +110,24 @@ namespace Fraunhofer.Fit.IoT.LoraMap.Model.Admin {
private Boolean CheckAuth(HttpListenerContext cont) { private Boolean CheckAuth(HttpListenerContext cont) {
#if DEBUG #if DEBUG
Helper.WriteError("200 - AUTH-Bypassed!");
return true; return true;
#endif #else
if(cont.Request.Url.PathAndQuery.StartsWith("/admin/login.html")) { if(cont.Request.Url.PathAndQuery.StartsWith("/admin/login.html")) {
return true; return true;
} else { } else {
if(cont.Request.Cookies["loramapsession"] != null) { if(cont.Request.Cookies["loramapsession"] != null) {
if(Int64.TryParse(cont.Request.Cookies["loramapsession"].Value, out Int64 sessionid)) { if(Int64.TryParse(cont.Request.Cookies["loramapsession"].Value, out Int64 sessionid)) {
if(this.session.ContainsKey(sessionid)) { if(this.session.ContainsKey(sessionid)) {
return this.session[sessionid].IsLoggedin; return this.session[sessionid].IsLoggedin;
}
} }
} }
cont.Response.StatusCode = 403;
Helper.WriteError("403 - " + cont.Request.Url.PathAndQuery);
} }
cont.Response.StatusCode = 403; return false;
Helper.WriteError("403 - " + cont.Request.Url.PathAndQuery); #endif
}
return false;
} }
} }
} }