Commit 42c91c91 authored by jan.koester's avatar jan.koester
Browse files

fixes

parent 6179fe7f
Loading
Loading
Loading
Loading
Loading
+7 −2
Changes for api/curl.sh: 7 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -4,18 +4,23 @@

clientlogin=$(sed  -e 's/$clientname/'$(echo $clientname)'/g' -e 's/$clientkey/'$(echo $clientsecret)'/g' clientlogin.json)


echo $clientlogin

ret=$(curl -d "$(echo $clientlogin)" "http://$host:$port/api/$domainid" -s --output - )

echo $ret

conid=$(echo $ret | grep -oP '"connectionid"\s*:\s*"\K[^"]*' )

userlogin=$(sed  -e 's/$username/'$(echo $username)'/g' -e 's/$userpassword/'$(echo $userpassword)'/g' -e  's/$clientsession/'$(echo $conid)'/g' userlogin.json)

ret=$(curl -d "$(echo $userlogin)" "http://$host:$port/api/$domainid" -s --output - )

echo $ret

sessionid=$(echo $ret | grep -oP '"sessionid"\s*:\s*"\K[^"]*' )

echo $ret

echo "conid:" $conid
echo "sessionid:" $sessionid

+2 −1
Changes for src/admin.cpp: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -1706,11 +1706,12 @@ namespace authdb {

            GpoData::Allow allow;

            gpodat.getAlowed(allow);

            if(GPOForm.getBoundary()){

                gpo.remove(*backend,gpid);

                GpoData::Allow allow;
                allow.count=0;

                for (libhttppp::HttpForm::MultipartForm::Data* curformdat = GPOForm.MultipartFormData.getFormData();
+10 −10
Changes for src/api.cpp: 10 added lines, 10 removed lines.
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ namespace authdb {
    public:

        void checkGPO(json_object *request,json_object *response){
            std::lock_guard<std::mutex> lock(AuthSessionLock);
            // std::lock_guard<std::mutex> lock(AuthSessionLock);
            json_object *cmd=json_object_object_get(request,"commands");
            if(!cmd)
                throw(AuthBackendError("Invalid Api Commands"));
@@ -220,16 +220,12 @@ namespace authdb {
            for(int i =0; i<fcount; ++i) {
                json_object_object_foreach(json_object_array_get_idx(cmd,i), key, val) {
                    if(strcmp(key,"login")==0){
                        std::string name,pw,pwsalt;
                        std::string name,pw,pwsalt,atype;
                        int ocount = json_object_object_length(val);
                        for(int ii =0; ii<ocount; ++ii) {
                            json_object_object_foreach(val,okey,oval){
                                if(strcmp(okey,"type")==0){
                                    if( strcmp(json_object_get_string(oval),"client")!=0){
                                        name.clear();
                                        pw.clear();
                                        continue;
                                    }
                                    atype=json_object_get_string(oval);
                                }else if(strcmp(okey,"name")==0){
                                    name=json_object_get_string(oval);
                                }else if(strcmp(okey,"key")==0){
@@ -238,8 +234,12 @@ namespace authdb {
                            }
                        }

                        if(name.empty() || pw.empty())
                            return nullptr;
                        if(name.empty() || pw.empty() || atype!="client"){
                            name.clear();
                            pw.clear();
                            atype.clear();
                            continue;
                        }

                        sha512 sha;
                        sha.hash(pw,pwsalt);
@@ -253,11 +253,11 @@ namespace authdb {
                            _Backend.setPos(rd);
                            _Backend.read((unsigned char*)&cur,sizeof(AuthData::Record));
                            rd=_Backend.getPos()+cur.datasize;
                                                            std::cout << cur.fieldname << std::endl;
                            if(cur.type == ClientData && strcmp(cur.fieldname,"clientname")==0){
                                class ClientData cdat(cur.uuid);
                                size_t upos = sizeof(AuthHeader);
                                AuthClient.info(_Backend,cdat,upos);

                                if(name==cdat.getName() ){
                                    if(pwsalt==cdat.getKey() ){
                                        ClientConnections *cid=AuthClient.addConnection(_Backend,cdat);
+5 −0
Changes for src/authdb.cpp: 5 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -553,6 +553,11 @@ VALUEFOUND:
            if(uuid_compare(uid,cur->uuid) == 0 && type == cur->type){
                size_t dsize=cur->datasize;
                cur->start = 0xFE;
                memset(cur->data,0,dsize);
                memset(&cur->fieldname,0,255);
                memset(cur->uuid,0,sizeof(uuid_t));
                cur->storage=StorageType::EmptyStorage;
                cur->type=DataType::EmptyData;
                cur->datasize=dsize;
                backend.setPos(wr);
                backend.write(reinterpret_cast<unsigned char*>(cur.get()),sizeof(AuthData::Record));
+1 −1
Changes for src/authdb.h: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -73,7 +73,7 @@ namespace authdb {
            uuid_t uuid;
            int    type = EmptyData;
            int    storage = EmptyStorage;
            char   fieldname[255];
            char   fieldname[255] = {0};
            size_t datasize = 0;
            char  *data = nullptr;
            size_t count = 0;