Skip to content
Snippets Groups Projects
Commit 3b03bad6 authored by jan.koester's avatar jan.koester
Browse files

fixed session.cpp

parent 98326ee9
No related branches found
No related tags found
No related merge requests found
Pipeline #148 canceled
...@@ -103,10 +103,9 @@ const authdb::SessionData * authdb::Session::addSession(AuthBackend &backend,uui ...@@ -103,10 +103,9 @@ const authdb::SessionData * authdb::Session::addSession(AuthBackend &backend,uui
if(cur.type == UserData && strcmp(cur.fieldname,"username")==0 if(cur.type == UserData && strcmp(cur.fieldname,"username")==0
&& uuid_compare(cur.uuid,userid)==0){ && uuid_compare(cur.uuid,userid)==0){
char *tmp=new char[cur.datasize]; std::shared_ptr<unsigned char> tmp(new unsigned char[cur.datasize]);
backend.read((unsigned char*)tmp,cur.datasize); backend.read(tmp.get(),cur.datasize);
username=tmp; username=reinterpret_cast<char*>(tmp.get());
delete[] tmp;
} }
} }
...@@ -214,10 +213,9 @@ void authdb::Session::relSession(AuthBackend &backend,uuid_t sessionid){ ...@@ -214,10 +213,9 @@ void authdb::Session::relSession(AuthBackend &backend,uuid_t sessionid){
if(cur.type == UserData && strcmp(cur.fieldname,"username")==0 if(cur.type == UserData && strcmp(cur.fieldname,"username")==0
&& uuid_compare(cur.uuid,cursess->_uid)==0){ && uuid_compare(cur.uuid,cursess->_uid)==0){
char *tmp=new char[cur.datasize]; std::shared_ptr<unsigned char>tmp(new unsigned char[cur.datasize]);
backend.read(reinterpret_cast<unsigned char*>(tmp),cur.datasize); backend.read(tmp.get(),cur.datasize);
username=tmp; username=reinterpret_cast<char*>(tmp.get());
delete[] tmp;
} }
if(cur.type == GroupData && strcmp(cur.fieldname,"groupname")==0){ if(cur.type == GroupData && strcmp(cur.fieldname,"groupname")==0){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment