Loading client/CMakeLists.txt +1 −1 Changes for client/CMakeLists.txt: 1 added line, 1 removed line. Original line number Diff line number Diff line add_library(client SHARED client.cpp ../src/uuid.cpp ../src/session.cpp) add_library(client SHARED client.cpp ../src/uuid.cpp ../src/session.cpp ../src/hash.cpp ../src/hash/sha512.cpp) target_link_libraries(client PUBLIC netplus::netplus) client/client.cpp +35 −0 Changes for client/client.cpp: 35 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -26,3 +26,38 @@ *******************************************************************************/ #include "client.h" #include "../src/hash/sha512.h" authdb::ClientConnection::ClientConnection(){ _Socket=nullptr; } authdb::ClientConnection::~ClientConnection(){ delete _Socket; } void authdb::ClientConnection::setUrl(const char *url){ _Url=url; } void authdb::ClientConnection::setClientname(const char *name){ _CltName=name; } void authdb::ClientConnection::setClientSecret(const char *secret){ _CltSecret=secret; } void authdb::ClientConnection::setUsername(const char *username){ _UserName=username; } void authdb::ClientConnection::setUserPassword(const char *password){ sha512 sha; sha.hash(password,_UserPasswordHash); } authdb::Client::Client(ClientConnection& clt){ _Con=clt; } client/client.h +4 −2 Changes for client/client.h: 4 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -37,6 +37,8 @@ namespace authdb { class ClientConnection { public: ClientConnection(); ~ClientConnection(); void setUrl(const char *url); void setClientname(const char *name); void setClientSecret(const char *secret); Loading @@ -47,9 +49,9 @@ namespace authdb { std::string _CltName; std::string _CltSecret; std::string _UserName; std::string _UserPassword; std::string _UserPasswordHash; netplus::socket *Socket; netplus::socket *_Socket; uuid _SessionID; uuid _ClientId; friend class Client; Loading src/admin.cpp +25 −25 Changes for src/admin.cpp: 25 added lines, 25 removed lines. Original line number Diff line number Diff line Loading @@ -69,7 +69,7 @@ namespace authdb { char cdid[255]; uuid_t did; if(sscanf(curreq->getRequestURL(),"/settings/%[^/]",cdid)<0){ if(sscanf(curreq->getRequestURL().c_str(),"/settings/%[^/]",cdid)<0){ throw AuthBackendError("listUsers: wrong url!"); } Loading Loading @@ -153,7 +153,7 @@ namespace authdb { char cdid[255]; uuid_t did; if(sscanf(curreq->getRequestURL(),"/settings/%[^/]/*",cdid)<0){ if(sscanf(curreq->getRequestURL().c_str(),"/settings/%[^/]/*",cdid)<0){ throw AuthBackendError("createUser: wrong url!"); } Loading Loading @@ -328,7 +328,7 @@ namespace authdb { char cdid[128],uid[255]; uuid_t did; if(sscanf(curreq->getRequestURL(),"/settings/%[^/]/removeuser/%s",cdid,uid)<0){ if(sscanf(curreq->getRequestURL().c_str(),"/settings/%[^/]/removeuser/%s",cdid,uid)<0){ throw AuthBackendError("listUsers: wrong url!"); } Loading Loading @@ -366,7 +366,7 @@ namespace authdb { char cdid[128],cuid[255]; uuid_t did; if(sscanf(curreq->getRequestURL(),"/settings/%[^/]/edituser/%s",cdid,cuid)<0){ if(sscanf(curreq->getRequestURL().c_str(),"/settings/%[^/]/edituser/%s",cdid,cuid)<0){ throw AuthBackendError("listUsers: wrong url!"); } Loading Loading @@ -557,12 +557,12 @@ namespace authdb { rep.send(curreq,out.c_str(),out.size()); } libhtmlpp::HtmlElement *DomainChangeForm(libhttppp::HttpRequest *curreq,const char *url,AuthBackend &backend,libhtmlpp::HtmlString &dest){ libhtmlpp::HtmlElement *DomainChangeForm(libhttppp::HttpRequest *curreq,const std::string &url,AuthBackend &backend,libhtmlpp::HtmlString &dest){ libhttppp::HttpForm form; form.parse(curreq); char cdid[255],suburl[128]; if(sscanf(url,"/settings/%[^/]/%s",cdid,suburl)<0) if(sscanf(url.c_str(),"/settings/%[^/]/%s",cdid,suburl)<0) cdid[0]='\0'; for (libhttppp::HttpForm::UrlcodedForm::Data* cururlform = form.UrlFormData.getFormData(); cururlform; Loading Loading @@ -816,7 +816,7 @@ namespace authdb { void removeDomain(libhttppp::HttpRequest *curreq, const int tid, ULONG_PTR args){ char did[255]; sscanf(curreq->getRequestURL(),"/settings/%[^/]/removedomain",did); sscanf(curreq->getRequestURL().c_str(),"/settings/%[^/]/removedomain",did); Domain domain; Loading Loading @@ -852,7 +852,7 @@ namespace authdb { char cdid[255]; uuid_t did; if(sscanf(curreq->getRequestURL(),"/settings/%[^/]",cdid)<0){ if(sscanf(curreq->getRequestURL().c_str(),"/settings/%[^/]",cdid)<0){ throw AuthBackendError("listGroups: wrong url!"); } Loading Loading @@ -929,7 +929,7 @@ namespace authdb { char cdid[255]; uuid_t did; if(sscanf(curreq->getRequestURL(),"/settings/%[^/]",cdid)<0){ if(sscanf(curreq->getRequestURL().c_str(),"/settings/%[^/]",cdid)<0){ throw AuthBackendError("createGroups: wrong url!"); } Loading Loading @@ -1074,7 +1074,7 @@ namespace authdb { char cdid[128],gid[255]; uuid_t did; if(sscanf(curreq->getRequestURL(),"/settings/%[^/]/removegroup/%s",cdid,gid)<0){ if(sscanf(curreq->getRequestURL().c_str(),"/settings/%[^/]/removegroup/%s",cdid,gid)<0){ throw AuthBackendError("removeGroup: wrong url!"); } Loading Loading @@ -1112,7 +1112,7 @@ namespace authdb { char cdid[128],cgid[255]; uuid_t did; if(sscanf(curreq->getRequestURL(),"/settings/%[^/]/editgroup/%s",cdid,cgid)<0){ if(sscanf(curreq->getRequestURL().c_str(),"/settings/%[^/]/editgroup/%s",cdid,cgid)<0){ throw AuthBackendError("listUsers: wrong url!"); } Loading Loading @@ -1381,7 +1381,7 @@ namespace authdb { char cdid[255]; uuid did; if(sscanf(curreq->getRequestURL(),"/settings/%[^/]/*",cdid)<0){ if(sscanf(curreq->getRequestURL().c_str(),"/settings/%[^/]/*",cdid)<0){ throw AuthBackendError("listSessions: wrong url!"); } Loading Loading @@ -1433,7 +1433,7 @@ namespace authdb { uuid_clear(sid); if(sscanf(curreq->getRequestURL(),"/settings/%*[^/]/removesession/%s",csid)<0){ if(sscanf(curreq->getRequestURL().c_str(),"/settings/%*[^/]/removesession/%s",csid)<0){ throw AuthBackendError("removeSession: wrong url!"); } Loading @@ -1455,7 +1455,7 @@ namespace authdb { uuid_clear(sid); if(sscanf(curreq->getRequestURL(),"/settings/%[^/]/reloadsession/%s",cdid,csid)<0){ if(sscanf(curreq->getRequestURL().c_str(),"/settings/%[^/]/reloadsession/%s",cdid,csid)<0){ throw AuthBackendError("removeSession: wrong url!"); } Loading Loading @@ -1492,7 +1492,7 @@ namespace authdb { uuid_clear(did); if(sscanf(curreq->getRequestURL(),"/settings/%[^/]/creategpo",cdid)<0){ if(sscanf(curreq->getRequestURL().c_str(),"/settings/%[^/]/creategpo",cdid)<0){ throw AuthBackendError("creatGPO: wrong url!"); } Loading Loading @@ -1669,7 +1669,7 @@ namespace authdb { uuid_clear(did); if(sscanf(curreq->getRequestURL(),"/settings/%[^/]/editgpo/%s",cdid,cgpid)<0){ if(sscanf(curreq->getRequestURL().c_str(),"/settings/%[^/]/editgpo/%s",cdid,cgpid)<0){ throw AuthBackendError("creatGPO: wrong url!"); } Loading Loading @@ -1869,7 +1869,7 @@ namespace authdb { uuid_clear(did); if(sscanf(curreq->getRequestURL(),"/settings/%[^/]/listgpos",cdid)<0){ if(sscanf(curreq->getRequestURL().c_str(),"/settings/%[^/]/listgpos",cdid)<0){ throw AuthBackendError("removeSession: wrong url!"); } Loading Loading @@ -1983,7 +1983,7 @@ namespace authdb { uuid_clear(gpid); uuid_clear(did); if(sscanf(curreq->getRequestURL(),"/settings/%[^/]/removegpo/%s",cdid,cgpid)<0){ if(sscanf(curreq->getRequestURL().c_str(),"/settings/%[^/]/removegpo/%s",cdid,cgpid)<0){ throw AuthBackendError("removeGPO: wrong url!"); } Loading Loading @@ -2107,7 +2107,7 @@ namespace authdb { char cdid[255]; uuid_t did; if(sscanf(curreq->getRequestURL(),"/settings/%[^/]",cdid)<0){ if(sscanf(curreq->getRequestURL().c_str(),"/settings/%[^/]",cdid)<0){ throw AuthBackendError("listUsers: wrong url!"); } Loading Loading @@ -2226,7 +2226,7 @@ namespace authdb { char cdid[255]; uuid_t did; if(sscanf(curreq->getRequestURL(),"/settings/%[^/]",cdid)<0){ if(sscanf(curreq->getRequestURL().c_str(),"/settings/%[^/]",cdid)<0){ throw AuthBackendError("listUsers: wrong url!"); } Loading Loading @@ -2329,7 +2329,7 @@ namespace authdb { char cdid[255],ccldid[255]; uuid_t did,cldid; if(sscanf(curreq->getRequestURL(),"/settings/%[^/]/removeclient/%s",cdid,ccldid)<0){ if(sscanf(curreq->getRequestURL().c_str(),"/settings/%[^/]/removeclient/%s",cdid,ccldid)<0){ throw AuthBackendError("remove client: wrong url!"); } Loading Loading @@ -2366,7 +2366,7 @@ namespace authdb { char cdid[255],cclid[255]; uuid_t did,clid; if(sscanf(curreq->getRequestURL(),"/settings/%[^/]/editclient/%s",cdid,cclid)<0){ if(sscanf(curreq->getRequestURL().c_str(),"/settings/%[^/]/editclient/%s",cdid,cclid)<0){ throw AuthBackendError("editclient: wrong url!"); } Loading Loading @@ -2474,7 +2474,7 @@ namespace authdb { } } if(strncmp("/settings/logout",curreq->getRequestURL(),15)==0){ if(curreq->getRequestURL().compare(0,15,"/settings/logout")==0){ AuthSession.remSession(ssid); libhttppp::HttpResponse rep; rep.setState(HTTP303); Loading Loading @@ -2549,7 +2549,7 @@ namespace authdb { char domain[255]={},url[255]={}; if(sscanf(curreq->getRequestURL(),"/settings/%[^/]/%s",domain,url)<0) if(sscanf(curreq->getRequestURL().c_str(),"/settings/%[^/]/%s",domain,url)<0) goto URLNOTFOUND; if(strncmp("listusers",url,9)==0){ Loading Loading @@ -2637,7 +2637,7 @@ URLNOTFOUND: } void AdminInterface::Request(libhttppp::HttpRequest *curreq, const int tid, ULONG_PTR args){ if(strncmp("/settings",curreq->getRequestURL(),9)==0){ if(curreq->getRequestURL().compare(0,10,"/settings")==0){ _ctl->SettingsController(curreq,tid,args); }else{ libhttppp::HttpResponse rep; Loading src/authdb.cpp +7 −7 Changes for src/authdb.cpp: 7 added lines, 7 removed lines. Original line number Diff line number Diff line Loading @@ -162,13 +162,13 @@ namespace authdb { } void RequestEvent(libhttppp::HttpRequest * curreq, const int tid, ULONG_PTR args){ if(strncmp("/authdb.js",curreq->getRequestURL(),9)==0){ if(curreq->getRequestURL().compare(0,9,"/authdb.js")==0){ libhttppp::HttpResponse rep; rep.setState(HTTP200); rep.setContentType("text/javascript"); rep.send(curreq,_AuthJs.data(),_AuthJs.size()); return; }else if(strncmp("/style.css",curreq->getRequestURL(),9)==0){ }else if(curreq->getRequestURL().compare(0,9,"/style.css")==0){ libhttppp::HttpResponse rep; rep.setState(HTTP200); rep.setContentType("text/css"); Loading @@ -193,7 +193,7 @@ namespace authdb { } if(strncmp("/settings",curreq->getRequestURL(),9)==0){ if(curreq->getRequestURL().compare(0,10,"/settings")==0){ _AdminBackend.lock(); try{ _AdminInterface.Request(curreq,tid,args); Loading @@ -204,7 +204,7 @@ namespace authdb { rep.send(curreq,e.what(),strlen(e.what())); } _AdminBackend.unlock(); }if(strncmp("/api",curreq->getRequestURL(),4)==0){ }if(curreq->getRequestURL().compare(0,4,"/api")==0){ _AdminBackend.lock(); DomainBackend db(_AdminBackend); Loading @@ -213,7 +213,7 @@ namespace authdb { char domain[255]={0}; if(sscanf(curreq->getRequestURL(),"/api/%254[^/]s",domain)<0){ if(sscanf(curreq->getRequestURL().c_str(),"/api/%254[^/]s",domain)<0){ libhttppp::HttpResponse rep; rep.setState(HTTP500); rep.setContentType("text/html"); Loading Loading @@ -257,7 +257,7 @@ namespace authdb { rep.setContentType("text/html"); rep.send(curreq,"uuid not found!",12); } }else if(strncmp("/getavatar",curreq->getRequestURL(),9)==0){ }else if(curreq->getRequestURL().compare(0,11,"/getavatar")==0){ _AdminBackend.lock(); try{ getAvatar(curreq,tid,args); Loading Loading @@ -286,7 +286,7 @@ namespace authdb { AuthBackend *backend=nullptr; char domain[255],cuid[255],ext[16]; if(sscanf(curreq->getRequestURL(),"/getavatar/%[^/]/%[^.].%s",domain,cuid,ext)<0) if(sscanf(curreq->getRequestURL().c_str(),"/getavatar/%[^/]/%[^.].%s",domain,cuid,ext)<0) return; uuid_t did; Loading Loading
client/CMakeLists.txt +1 −1 Changes for client/CMakeLists.txt: 1 added line, 1 removed line. Original line number Diff line number Diff line add_library(client SHARED client.cpp ../src/uuid.cpp ../src/session.cpp) add_library(client SHARED client.cpp ../src/uuid.cpp ../src/session.cpp ../src/hash.cpp ../src/hash/sha512.cpp) target_link_libraries(client PUBLIC netplus::netplus)
client/client.cpp +35 −0 Changes for client/client.cpp: 35 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -26,3 +26,38 @@ *******************************************************************************/ #include "client.h" #include "../src/hash/sha512.h" authdb::ClientConnection::ClientConnection(){ _Socket=nullptr; } authdb::ClientConnection::~ClientConnection(){ delete _Socket; } void authdb::ClientConnection::setUrl(const char *url){ _Url=url; } void authdb::ClientConnection::setClientname(const char *name){ _CltName=name; } void authdb::ClientConnection::setClientSecret(const char *secret){ _CltSecret=secret; } void authdb::ClientConnection::setUsername(const char *username){ _UserName=username; } void authdb::ClientConnection::setUserPassword(const char *password){ sha512 sha; sha.hash(password,_UserPasswordHash); } authdb::Client::Client(ClientConnection& clt){ _Con=clt; }
client/client.h +4 −2 Changes for client/client.h: 4 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -37,6 +37,8 @@ namespace authdb { class ClientConnection { public: ClientConnection(); ~ClientConnection(); void setUrl(const char *url); void setClientname(const char *name); void setClientSecret(const char *secret); Loading @@ -47,9 +49,9 @@ namespace authdb { std::string _CltName; std::string _CltSecret; std::string _UserName; std::string _UserPassword; std::string _UserPasswordHash; netplus::socket *Socket; netplus::socket *_Socket; uuid _SessionID; uuid _ClientId; friend class Client; Loading
src/admin.cpp +25 −25 Changes for src/admin.cpp: 25 added lines, 25 removed lines. Original line number Diff line number Diff line Loading @@ -69,7 +69,7 @@ namespace authdb { char cdid[255]; uuid_t did; if(sscanf(curreq->getRequestURL(),"/settings/%[^/]",cdid)<0){ if(sscanf(curreq->getRequestURL().c_str(),"/settings/%[^/]",cdid)<0){ throw AuthBackendError("listUsers: wrong url!"); } Loading Loading @@ -153,7 +153,7 @@ namespace authdb { char cdid[255]; uuid_t did; if(sscanf(curreq->getRequestURL(),"/settings/%[^/]/*",cdid)<0){ if(sscanf(curreq->getRequestURL().c_str(),"/settings/%[^/]/*",cdid)<0){ throw AuthBackendError("createUser: wrong url!"); } Loading Loading @@ -328,7 +328,7 @@ namespace authdb { char cdid[128],uid[255]; uuid_t did; if(sscanf(curreq->getRequestURL(),"/settings/%[^/]/removeuser/%s",cdid,uid)<0){ if(sscanf(curreq->getRequestURL().c_str(),"/settings/%[^/]/removeuser/%s",cdid,uid)<0){ throw AuthBackendError("listUsers: wrong url!"); } Loading Loading @@ -366,7 +366,7 @@ namespace authdb { char cdid[128],cuid[255]; uuid_t did; if(sscanf(curreq->getRequestURL(),"/settings/%[^/]/edituser/%s",cdid,cuid)<0){ if(sscanf(curreq->getRequestURL().c_str(),"/settings/%[^/]/edituser/%s",cdid,cuid)<0){ throw AuthBackendError("listUsers: wrong url!"); } Loading Loading @@ -557,12 +557,12 @@ namespace authdb { rep.send(curreq,out.c_str(),out.size()); } libhtmlpp::HtmlElement *DomainChangeForm(libhttppp::HttpRequest *curreq,const char *url,AuthBackend &backend,libhtmlpp::HtmlString &dest){ libhtmlpp::HtmlElement *DomainChangeForm(libhttppp::HttpRequest *curreq,const std::string &url,AuthBackend &backend,libhtmlpp::HtmlString &dest){ libhttppp::HttpForm form; form.parse(curreq); char cdid[255],suburl[128]; if(sscanf(url,"/settings/%[^/]/%s",cdid,suburl)<0) if(sscanf(url.c_str(),"/settings/%[^/]/%s",cdid,suburl)<0) cdid[0]='\0'; for (libhttppp::HttpForm::UrlcodedForm::Data* cururlform = form.UrlFormData.getFormData(); cururlform; Loading Loading @@ -816,7 +816,7 @@ namespace authdb { void removeDomain(libhttppp::HttpRequest *curreq, const int tid, ULONG_PTR args){ char did[255]; sscanf(curreq->getRequestURL(),"/settings/%[^/]/removedomain",did); sscanf(curreq->getRequestURL().c_str(),"/settings/%[^/]/removedomain",did); Domain domain; Loading Loading @@ -852,7 +852,7 @@ namespace authdb { char cdid[255]; uuid_t did; if(sscanf(curreq->getRequestURL(),"/settings/%[^/]",cdid)<0){ if(sscanf(curreq->getRequestURL().c_str(),"/settings/%[^/]",cdid)<0){ throw AuthBackendError("listGroups: wrong url!"); } Loading Loading @@ -929,7 +929,7 @@ namespace authdb { char cdid[255]; uuid_t did; if(sscanf(curreq->getRequestURL(),"/settings/%[^/]",cdid)<0){ if(sscanf(curreq->getRequestURL().c_str(),"/settings/%[^/]",cdid)<0){ throw AuthBackendError("createGroups: wrong url!"); } Loading Loading @@ -1074,7 +1074,7 @@ namespace authdb { char cdid[128],gid[255]; uuid_t did; if(sscanf(curreq->getRequestURL(),"/settings/%[^/]/removegroup/%s",cdid,gid)<0){ if(sscanf(curreq->getRequestURL().c_str(),"/settings/%[^/]/removegroup/%s",cdid,gid)<0){ throw AuthBackendError("removeGroup: wrong url!"); } Loading Loading @@ -1112,7 +1112,7 @@ namespace authdb { char cdid[128],cgid[255]; uuid_t did; if(sscanf(curreq->getRequestURL(),"/settings/%[^/]/editgroup/%s",cdid,cgid)<0){ if(sscanf(curreq->getRequestURL().c_str(),"/settings/%[^/]/editgroup/%s",cdid,cgid)<0){ throw AuthBackendError("listUsers: wrong url!"); } Loading Loading @@ -1381,7 +1381,7 @@ namespace authdb { char cdid[255]; uuid did; if(sscanf(curreq->getRequestURL(),"/settings/%[^/]/*",cdid)<0){ if(sscanf(curreq->getRequestURL().c_str(),"/settings/%[^/]/*",cdid)<0){ throw AuthBackendError("listSessions: wrong url!"); } Loading Loading @@ -1433,7 +1433,7 @@ namespace authdb { uuid_clear(sid); if(sscanf(curreq->getRequestURL(),"/settings/%*[^/]/removesession/%s",csid)<0){ if(sscanf(curreq->getRequestURL().c_str(),"/settings/%*[^/]/removesession/%s",csid)<0){ throw AuthBackendError("removeSession: wrong url!"); } Loading @@ -1455,7 +1455,7 @@ namespace authdb { uuid_clear(sid); if(sscanf(curreq->getRequestURL(),"/settings/%[^/]/reloadsession/%s",cdid,csid)<0){ if(sscanf(curreq->getRequestURL().c_str(),"/settings/%[^/]/reloadsession/%s",cdid,csid)<0){ throw AuthBackendError("removeSession: wrong url!"); } Loading Loading @@ -1492,7 +1492,7 @@ namespace authdb { uuid_clear(did); if(sscanf(curreq->getRequestURL(),"/settings/%[^/]/creategpo",cdid)<0){ if(sscanf(curreq->getRequestURL().c_str(),"/settings/%[^/]/creategpo",cdid)<0){ throw AuthBackendError("creatGPO: wrong url!"); } Loading Loading @@ -1669,7 +1669,7 @@ namespace authdb { uuid_clear(did); if(sscanf(curreq->getRequestURL(),"/settings/%[^/]/editgpo/%s",cdid,cgpid)<0){ if(sscanf(curreq->getRequestURL().c_str(),"/settings/%[^/]/editgpo/%s",cdid,cgpid)<0){ throw AuthBackendError("creatGPO: wrong url!"); } Loading Loading @@ -1869,7 +1869,7 @@ namespace authdb { uuid_clear(did); if(sscanf(curreq->getRequestURL(),"/settings/%[^/]/listgpos",cdid)<0){ if(sscanf(curreq->getRequestURL().c_str(),"/settings/%[^/]/listgpos",cdid)<0){ throw AuthBackendError("removeSession: wrong url!"); } Loading Loading @@ -1983,7 +1983,7 @@ namespace authdb { uuid_clear(gpid); uuid_clear(did); if(sscanf(curreq->getRequestURL(),"/settings/%[^/]/removegpo/%s",cdid,cgpid)<0){ if(sscanf(curreq->getRequestURL().c_str(),"/settings/%[^/]/removegpo/%s",cdid,cgpid)<0){ throw AuthBackendError("removeGPO: wrong url!"); } Loading Loading @@ -2107,7 +2107,7 @@ namespace authdb { char cdid[255]; uuid_t did; if(sscanf(curreq->getRequestURL(),"/settings/%[^/]",cdid)<0){ if(sscanf(curreq->getRequestURL().c_str(),"/settings/%[^/]",cdid)<0){ throw AuthBackendError("listUsers: wrong url!"); } Loading Loading @@ -2226,7 +2226,7 @@ namespace authdb { char cdid[255]; uuid_t did; if(sscanf(curreq->getRequestURL(),"/settings/%[^/]",cdid)<0){ if(sscanf(curreq->getRequestURL().c_str(),"/settings/%[^/]",cdid)<0){ throw AuthBackendError("listUsers: wrong url!"); } Loading Loading @@ -2329,7 +2329,7 @@ namespace authdb { char cdid[255],ccldid[255]; uuid_t did,cldid; if(sscanf(curreq->getRequestURL(),"/settings/%[^/]/removeclient/%s",cdid,ccldid)<0){ if(sscanf(curreq->getRequestURL().c_str(),"/settings/%[^/]/removeclient/%s",cdid,ccldid)<0){ throw AuthBackendError("remove client: wrong url!"); } Loading Loading @@ -2366,7 +2366,7 @@ namespace authdb { char cdid[255],cclid[255]; uuid_t did,clid; if(sscanf(curreq->getRequestURL(),"/settings/%[^/]/editclient/%s",cdid,cclid)<0){ if(sscanf(curreq->getRequestURL().c_str(),"/settings/%[^/]/editclient/%s",cdid,cclid)<0){ throw AuthBackendError("editclient: wrong url!"); } Loading Loading @@ -2474,7 +2474,7 @@ namespace authdb { } } if(strncmp("/settings/logout",curreq->getRequestURL(),15)==0){ if(curreq->getRequestURL().compare(0,15,"/settings/logout")==0){ AuthSession.remSession(ssid); libhttppp::HttpResponse rep; rep.setState(HTTP303); Loading Loading @@ -2549,7 +2549,7 @@ namespace authdb { char domain[255]={},url[255]={}; if(sscanf(curreq->getRequestURL(),"/settings/%[^/]/%s",domain,url)<0) if(sscanf(curreq->getRequestURL().c_str(),"/settings/%[^/]/%s",domain,url)<0) goto URLNOTFOUND; if(strncmp("listusers",url,9)==0){ Loading Loading @@ -2637,7 +2637,7 @@ URLNOTFOUND: } void AdminInterface::Request(libhttppp::HttpRequest *curreq, const int tid, ULONG_PTR args){ if(strncmp("/settings",curreq->getRequestURL(),9)==0){ if(curreq->getRequestURL().compare(0,10,"/settings")==0){ _ctl->SettingsController(curreq,tid,args); }else{ libhttppp::HttpResponse rep; Loading
src/authdb.cpp +7 −7 Changes for src/authdb.cpp: 7 added lines, 7 removed lines. Original line number Diff line number Diff line Loading @@ -162,13 +162,13 @@ namespace authdb { } void RequestEvent(libhttppp::HttpRequest * curreq, const int tid, ULONG_PTR args){ if(strncmp("/authdb.js",curreq->getRequestURL(),9)==0){ if(curreq->getRequestURL().compare(0,9,"/authdb.js")==0){ libhttppp::HttpResponse rep; rep.setState(HTTP200); rep.setContentType("text/javascript"); rep.send(curreq,_AuthJs.data(),_AuthJs.size()); return; }else if(strncmp("/style.css",curreq->getRequestURL(),9)==0){ }else if(curreq->getRequestURL().compare(0,9,"/style.css")==0){ libhttppp::HttpResponse rep; rep.setState(HTTP200); rep.setContentType("text/css"); Loading @@ -193,7 +193,7 @@ namespace authdb { } if(strncmp("/settings",curreq->getRequestURL(),9)==0){ if(curreq->getRequestURL().compare(0,10,"/settings")==0){ _AdminBackend.lock(); try{ _AdminInterface.Request(curreq,tid,args); Loading @@ -204,7 +204,7 @@ namespace authdb { rep.send(curreq,e.what(),strlen(e.what())); } _AdminBackend.unlock(); }if(strncmp("/api",curreq->getRequestURL(),4)==0){ }if(curreq->getRequestURL().compare(0,4,"/api")==0){ _AdminBackend.lock(); DomainBackend db(_AdminBackend); Loading @@ -213,7 +213,7 @@ namespace authdb { char domain[255]={0}; if(sscanf(curreq->getRequestURL(),"/api/%254[^/]s",domain)<0){ if(sscanf(curreq->getRequestURL().c_str(),"/api/%254[^/]s",domain)<0){ libhttppp::HttpResponse rep; rep.setState(HTTP500); rep.setContentType("text/html"); Loading Loading @@ -257,7 +257,7 @@ namespace authdb { rep.setContentType("text/html"); rep.send(curreq,"uuid not found!",12); } }else if(strncmp("/getavatar",curreq->getRequestURL(),9)==0){ }else if(curreq->getRequestURL().compare(0,11,"/getavatar")==0){ _AdminBackend.lock(); try{ getAvatar(curreq,tid,args); Loading Loading @@ -286,7 +286,7 @@ namespace authdb { AuthBackend *backend=nullptr; char domain[255],cuid[255],ext[16]; if(sscanf(curreq->getRequestURL(),"/getavatar/%[^/]/%[^.].%s",domain,cuid,ext)<0) if(sscanf(curreq->getRequestURL().c_str(),"/getavatar/%[^/]/%[^.].%s",domain,cuid,ext)<0) return; uuid_t did; Loading