Revision 0659115f src/rm/RequestManagerImageUpdate.cc

View differences:

src/rm/RequestManagerImageUpdate.cc
35 35
    string              name;
36 36
    string              value;
37 37
    int                 rc;
38
    
39
    int                 image_owner;
40
    bool                is_public;
38 41

  
39 42
    Image             * image;
40 43

  
......
53 56
    value    = xmlrpc_c::value_string(paramList.getString(3));
54 57

  
55 58
    // First, we need to authenticate the user
56
    rc = ImageUpdate::upool->authenticate(session);
59
    uid = ImageUpdate::upool->authenticate(session);
57 60

  
58
    if ( rc == -1 )
61
    if ( uid == -1 )
59 62
    {
60 63
        goto error_authenticate;
61 64
    }
65
    
66
    // Get image from the ImagePool
67
    image = ImageUpdate::ipool->get(iid,true);
62 68

  
63
    uid = rc;
69
    if ( image == 0 )
70
    {
71
        goto error_image_get;
72
    }
73
    
74
    image_owner = image->get_uid();
75
    is_public   = image->isPublic();
76
    
77
    image->unlock();    
64 78
    
65 79
    //Authorize the operation
66 80
    if ( uid != 0 ) // uid == 0 means oneadmin
......
70 84
        ar.add_auth(AuthRequest::IMAGE,
71 85
                    iid,
72 86
                    AuthRequest::MANAGE,
73
                    0,
74
                    image->isPublic());
87
                    image_owner,
88
                    is_public);
75 89

  
76 90
        if (UserPool::authorize(ar) == -1)
77 91
        {

Also available in: Unified diff