Commit 4db8ad74 authored by jan.koester's avatar jan.koester
Browse files

bugfixes

parent b45d262c
Loading
Loading
Loading
Loading
Loading
+7 −6
Changes for client/client.cpp: 7 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -116,7 +116,7 @@ bool authdb::client::Client::ClientAuth(){

    resp.push_back('\0');

    std::cout <<resp.data() <<std::endl;
    // std::cout <<resp.data() <<std::endl;

    json_object_put(jresponse);

@@ -191,7 +191,7 @@ bool authdb::client::Client::UserAuth(){
    int fcount = json_object_array_length(jrequest);
    for(int i =0; i<fcount; ++i) {
        json_object_object_foreach(json_object_array_get_idx(jrequest,i), key, val) {
                 if(strcmp(key,"sessionid")==0){
                 if(strcmp("sessionid",key)==0){
                         _Con._SessionID=json_object_get_string(val);
                         if(!_Con._SessionID.empty()){
                             json_object_put(jrequest);
@@ -210,15 +210,18 @@ void authdb::client::Client::SessionInfo(class SessionData& sdat){
    json_object *jresponse = json_object_new_object();
    json_object *cmd=json_object_new_array();
    json_object *obj=json_object_new_object();
    json_object *sinfo=json_object_new_object();

    json_object_object_add(obj,"clientsession", json_object_new_string(_Con.getClientId().c_str()));
    json_object_object_add(obj,"usersession", json_object_new_string(_Con.getSessionID().c_str()));
    json_object_object_add(obj,"sessioninfo",json_object_new_string(""));
    json_object_object_add(sinfo,"sessioninfo",json_object_new_string(""));

    json_object_array_add(cmd,obj);
    json_object_array_add(cmd,sinfo);

    json_object_object_add(jresponse,"commands",cmd);


    size_t outsize=0;

    std::vector<char> out;
@@ -246,15 +249,13 @@ void authdb::client::Client::SessionInfo(class SessionData& sdat){
        throw(authdb::AuthBackendError("Invalid Api Commands"));

    sdat._username.clear();
    sdat._uid.clear();
    sdat._did.clear();

    int fcount = json_object_array_length(jrequest);
    for(int i =0; i<fcount; ++i) {
        json_object_object_foreach(json_object_array_get_idx(jrequest,i), key, val) {
                 if(strcmp(key,"sessioninfo")==0){
                 if(strcmp("sessioninfo",key)==0){
                          sdat._username= json_object_get_string(json_object_object_get(val,"username"));
                          sdat._uid= json_object_get_string(json_object_object_get(val,"userid"));
                          sdat._did= json_object_get_string(json_object_object_get(val,"domainid"));
                 }
        }
+1 −1
Changes for src/api.cpp: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -329,7 +329,7 @@ namespace authdb {
            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,"sessioninfo")==0){
                    if(strcmp("sessioninfo",key)==0){
                        uuid tmp;
                        json_object *respid=json_object_new_object();
                        json_object_object_add(respid,"username", json_object_new_string(_SessionData->getUsername()));