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

fixed session.cpp

parent e11addf7
No related branches found
No related tags found
No related merge requests found
Pipeline #162 failed
......@@ -424,19 +424,16 @@ VALUEFOUND:
bool getRecord(authdb::AuthBackend &backend,AuthData &rec,int type){
bool found=false;
int rd=sizeof(authdb::AuthHeader),end=backend.end();
AuthData *curec=&rec;
while(rd<end){
AuthData::Record cur;
memset(&cur,0,sizeof(AuthData::Record));
std::shared_ptr<AuthData::Record> cur(new AuthData::Record());
backend.setPos(rd);
backend.read((unsigned char*)&cur,sizeof(AuthData::Record));
rd=backend.getPos()+cur.datasize;
if(uuid_compare(cur.uuid,rec.Data->uuid) == 0 && cur.type == type){
cur.data=new char[cur.datasize];
backend.read((unsigned char*)cur.data,cur.datasize);
rec.append(cur);
delete[] cur.data;
backend.read(reinterpret_cast<unsigned char*>(cur.get()),sizeof(AuthData::Record));
rd=backend.getPos()+cur->datasize;
if(uuid_compare(cur->uuid,rec.Data->uuid) == 0 && cur->type == type){
cur->data=new char[cur->datasize];
backend.read((unsigned char*)cur->data,cur->datasize);
rec.append(*cur);
found=true;
}
}
......
......@@ -167,9 +167,9 @@ void authdb::User::info(AuthBackend &backend, class UserData& dat, size_t &pos){
throw AuthBackendError("user info uid required!");
while(pos<end){
authdb::AuthData::Record *cur=new AuthData::Record;
std::shared_ptr<authdb::AuthData::Record> cur(new AuthData::Record);
backend.setPos(pos);
backend.read((unsigned char*)cur,sizeof(AuthData::Record));
backend.read(reinterpret_cast<unsigned char*>(cur.get()),sizeof(AuthData::Record));
pos=backend.getPos()+cur->datasize;
if(cur->type == UserData && uuid_compare(dat.uid,cur->uuid) == 0
&& strcmp(cur->fieldname,"username")==0
......@@ -192,7 +192,6 @@ void authdb::User::info(AuthBackend &backend, class UserData& dat, size_t &pos){
dat.avatar=dat.Data;
}
}
delete cur;
}
}
......
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