Commit c1895f6c authored by jan.koester's avatar jan.koester
Browse files

some bugfixes

parent 658c31c1
Loading
Loading
Loading
Loading
Loading
+5 −3
Changes for src/api.cpp: 5 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -53,17 +53,19 @@ namespace authdb {
        }

        bool Login(json_object *request,json_object *response,const char *type){
            json_object *cmd=json_tokener_parse("commands");
            json_object *cmd=json_object_object_get(request,"commands");
            if(!cmd)
                throw(AuthBackendError("Invalid Api Commands"));
            int fcount = json_object_array_length(cmd);
            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;
                                int ocount = json_object_array_length(cmd);
                                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 )
                                                if( strcmp(json_object_get_string(oval),"client")!=0 || strcmp(json_object_get_string(oval),"user")!=0 )
                                                    continue;
                                        }else if(strcmp(okey,"name")==0){
                                                name=json_object_get_string(oval);