Revision 4c8b82e2 src/vm/VirtualMachine.cc

View differences:

src/vm/VirtualMachine.cc
2223 2223
        bool            keep_restricted,
2224 2224
        string&         error)
2225 2225
{
2226
    string ra;
2227

  
2226 2228
    VirtualMachineTemplate * new_tmpl =
2227 2229
            new VirtualMachineTemplate(false,'=',"USER_TEMPLATE");
2228 2230

  
......
2238 2240
        return -1;
2239 2241
    }
2240 2242

  
2241
    if (keep_restricted)
2243
    if (user_obj_template != 0)
2242 2244
    {
2243
        new_tmpl->remove_restricted();
2244

  
2245
        if (user_obj_template != 0)
2245
        if (keep_restricted && new_tmpl->check_restricted(ra, user_obj_template))
2246 2246
        {
2247
            user_obj_template->remove_all_except_restricted();
2247
            error = "Tried to change restricted attribute: " + ra;
2248 2248

  
2249
            new_tmpl->merge(user_obj_template);
2249
            delete new_tmpl;
2250
            return -1;
2250 2251
        }
2251 2252
    }
2253
    else if (keep_restricted && new_tmpl->check_restricted(ra))
2254
    {
2255
        error = "Tried to set restricted attribute: " + ra;
2256

  
2257
        delete new_tmpl;
2258
        return -1;
2259
    }
2252 2260

  
2253 2261
    delete user_obj_template;
2254 2262

  

Also available in: Unified diff