Revision 1035fe77 src/image/ImagePool.cc

View differences:

src/image/ImagePool.cc
19 19
/* ************************************************************************** */
20 20

  
21 21
#include "ImagePool.h"
22
#include "AuthManager.h"
23 22

  
24 23
/* -------------------------------------------------------------------------- */
25 24
/* -------------------------------------------------------------------------- */
......
190 189
/* -------------------------------------------------------------------------- */
191 190

  
192 191
int ImagePool::disk_attribute(VectorAttribute * disk,
193
                              int *             index,
194
                              AuthRequest *     ar)
192
                              int *             index)
195 193
{
196 194
    string  source;
197
    Image * img;
195
    Image * img = 0;
198 196

  
199
    source = disk->vector_value("NAME");
197
    source = disk->vector_value("IMAGE");
200 198

  
201 199
    if (source.empty())
202 200
    {
203
        return -2;
204
    }
201
        istringstream   is;
202
        int             image_id;
203

  
204
        source = disk->vector_value("IMAGE_ID");
205 205

  
206
    img = get(source,true);
206
        if (source.empty())
207
        {
208
            return -2;
209
        }
210

  
211
        is.str(source);
212
        is >> image_id;
213

  
214
        if( !is.fail() )
215
        {
216
            img = get(image_id,true);
217
        }
218
    }
219
    else
220
    {
221
        img = get(source,true);
222
    }
207 223

  
208 224
    if (img == 0)
209 225
    {
......
212 228

  
213 229
    int rc = img->disk_attribute(disk,index);
214 230

  
215
    ar->add_auth(AuthRequest::IMAGE,
216
                 img->get_iid(),
217
                 AuthRequest::USE,
218
                 img->get_uid(),
219
                 img->isPublic());
220

  
221 231
    img->unlock();
222 232

  
223 233
    return rc;

Also available in: Unified diff