Revision 1035fe77 src/vnm/VirtualNetworkPool.cc

View differences:

src/vnm/VirtualNetworkPool.cc
16 16

  
17 17
#include "VirtualNetworkPool.h"
18 18
#include "NebulaLog.h"
19
#include "AuthManager.h"
20 19

  
21 20
#include <sstream>
22 21
#include <ctype.h>
......
220 219
/* -------------------------------------------------------------------------- */
221 220

  
222 221
int VirtualNetworkPool::nic_attribute(VectorAttribute * nic,
223
                                      int               vid,
224
                                      AuthRequest *     ar)
222
                                      int               vid)
225 223
{
226 224
    string           network;
227
    VirtualNetwork * vnet;
225
    VirtualNetwork * vnet = 0;
228 226

  
229 227
    network = nic->vector_value("NETWORK");
230 228

  
231 229
    if (network.empty())
232 230
    {
231
        istringstream   is;
232
        int             network_id;
233

  
234
        network = nic->vector_value("NETWORK_ID");
235

  
236
        if(network.empty())
237
        {
238
            return -2;
239
        }
240

  
241
        is.str(network);
242
        is >> network_id;
243

  
244
        if( !is.fail() )
245
        {
246
            vnet = get(network_id,true);
247
        }
248

  
233 249
        return -2;
234 250
    }
235

  
236
    vnet = get(network,true);
251
    else
252
    {
253
        vnet = get(network,true);
254
    }
237 255

  
238 256
    if (vnet == 0)
239 257
    {
......
242 260

  
243 261
    int rc = vnet->nic_attribute(nic,vid);
244 262

  
245
    ar->add_auth(AuthRequest::NET,
246
                 vnet->get_vnid(),
247
                 AuthRequest::USE,
248
                 vnet->get_uid(),
249
                 vnet->isPublic());
250

  
251 263
    vnet->unlock();
252 264

  
253 265
    return rc;
254
}
266
}
267

  

Also available in: Unified diff