~ubuntu-branches/ubuntu/quantal/open-vm-tools/quantal-201210021442

« back to all changes in this revision

Viewing changes to lib/hgfsServer/hgfsServerParameters.c

  • Committer: Package Import Robot
  • Author(s): Nate Muench
  • Date: 2012-01-23 16:09:45 UTC
  • mfrom: (1.4.6) (2.4.26 sid)
  • Revision ID: package-import@ubuntu.com-20120123160945-b6s0r1vkcovucpf3
Tags: 2011.12.20-562307-0ubuntu1
* Merge latest upstream git tag. Fixes building on Precise
  (LP: #898289, LP: #905612)

* Items merged from Debian unstable:
  - debian/control:
    + open-vm-tools recommends open-vm-dkms. (LP: #598933)
    + open-vm-tools now suggests open-vm-toolbox. (LP: #604998)
  (From 2011.08.21-471295-1 release)
  - Updating maintainer and uploaders fields.
  - Removing vcs fields.
  - Removing references to Daniel's old email address.
  - Updating years in copyright file.
  - Updating to standards version 3.9.2.
  - Updating to debhelper version 8.
  - Switching to source format 3.0 (quilt).
  - Removing manual chrpath setting.
  - Removing exclusion from plugins from debhelper shlibs.
  - Rediffing kvers.patch.
  (From 2011.09.23-491607-1 release)
  - Marking binary architecture-dependend packages as linux and kfreebsd
  only.
  - Removing liburiparser-dev from build-depends as upstream dropped
  unity support.
  - Building with libproc-dev on amd64 again.
  - Dropping disabling of dnet support.
  (From 2011.09.23-491607-2 release)
  - Adding doxygen to build-depends for api documentation.
  - Adding libcunit1-dev to build-depends for test suites.
  - Minimizing rules file.
  - Adding open-vm-tools-dev package, containing only the api
    documentation for now.
  (From 2011.09.23-491607-3 release)
  - Sorting overrides in rules alphabetically.
  - Compacting copyright file.
  - Adding udev rule to set timeout for vmware scsi devices
  (From 2011.12.20-562307-1 release)
  - Adding patch to correct typo in upstreams dkms configuration

* Remaining Changes:
  - Remove Stable part of version numbering.
  - debian folder:
    + Re-added open-vm-dkms.postinst & open-vm-dkms.prerm.
      * Allows dkms modules to compile upon installation.
  - debian/control:
    + Re-add open-vm-source and make into a transitional package
      for open-vm-toolbox.
    + Return dependancies that were moved to open-vm-tools back to
      open-vm-toolbox.
  - debian/rules and debian/open-vm-toolbox.lintian-overrides:
    + Make vmware-user-suid-wrapper suid-root
  - debian/rules:
    + Added CFLAGS field with -Wno-deprecated-declarations
      * Will suppress issues with glib 2.31 or later.
    + Add line to copy vmware-xdg-detect-de into place.
    + Install vmware-user.desktop through toolbox package.
  - debian/open-vm-tools.init:
    + Re-add 'modprobe [-r] vmblock'.
    + Add 'modprobe [-r] vmxnet'.
      * Incase it's not loaded during boot.
    + Remove and re-add pcnet32 module
      * Will be done before (remove) and after (readd) vmxnet module
        is added.
      * If vmxnet doesn't exist (aka modules fail to build), pcnet32 can be
        still used for network connectivity.
      * Workaround until a better fix can be done.
  - Re-add gnome-session to debian/local/xautostart.conf
  - Manpages removed (from debian/manpages):
    + vmmemctl.9
    + vmxnet3.9
    + Remove references to manpages that have been removed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
267
267
 
268
268
Bool
269
269
HgfsParseRequest(HgfsPacket *packet,         // IN: request packet
270
 
                 HgfsSessionInfo *session,   // IN: current session
 
270
                 HgfsTransportSessionInfo *transportSession,   // IN: current session
271
271
                 HgfsInputParam **input,     // OUT: request parameters
272
272
                 HgfsInternalStatus *status) // OUT: error code
273
273
{
275
275
   size_t packetSize;
276
276
   HgfsInternalStatus result = HGFS_ERROR_SUCCESS;
277
277
   HgfsInputParam *localInput;
 
278
   HgfsSessionInfo *session = NULL;
278
279
 
279
 
   request = (HgfsRequest *) HSPU_GetMetaPacket(packet, &packetSize, session);
 
280
   request = (HgfsRequest *) HSPU_GetMetaPacket(packet, &packetSize, transportSession);
280
281
   ASSERT_DEVEL(request);
281
282
 
 
283
   LOG(4, ("%s: Recieved a request with opcode %d.\n", __FUNCTION__, (int) request->op));
 
284
 
282
285
   if (!request) {
283
286
      /*
284
287
       * How can I return error back to the client, clearly the client is either broken or
293
296
   memset(localInput, 0, sizeof *localInput);
294
297
   localInput->metaPacket = (char *)request;
295
298
   localInput->metaPacketSize = packetSize;
296
 
   localInput->session = session;
 
299
   localInput->transportSession = transportSession;
297
300
   localInput->packet = packet;
 
301
   localInput->session = NULL;
298
302
 
299
303
   /*
300
304
    * Error out if less than HgfsRequest size.
304
308
         localInput->id = request->id;
305
309
      }
306
310
      ASSERT_DEVEL(0);
307
 
      return HGFS_ERROR_PROTOCOL;
 
311
      return FALSE;
308
312
   }
309
313
 
310
314
   if (request->op < HGFS_OP_OPEN_V3) {
327
331
      HgfsHeader *header = (HgfsHeader *)request;
328
332
      localInput->v4header = TRUE;
329
333
      localInput->id = header->requestId;
 
334
      localInput->op = header->op;
330
335
 
331
336
      if (packetSize >= offsetof(HgfsHeader, sessionId) + sizeof header->sessionId) {
332
 
         if (header->sessionId != session->sessionId &&
333
 
            header->op != HGFS_OP_CREATE_SESSION_V4) {
 
337
         if (packetSize < header->packetSize ||
 
338
            header->packetSize < header->headerSize) {
 
339
            LOG(4, ("%s: Malformed HGFS packet received - inconsistent header"
 
340
               " and packet sizes!\n", __FUNCTION__));
 
341
            result = HGFS_ERROR_PROTOCOL;
 
342
         }
 
343
 
 
344
         if ((HGFS_ERROR_SUCCESS == result) &&
 
345
             (header->op != HGFS_OP_CREATE_SESSION_V4)) {
 
346
            session = HgfsServerTransportGetSessionInfo(transportSession,
 
347
                                                        header->sessionId);
 
348
            if (!session || session->state != HGFS_SESSION_STATE_OPEN) {
334
349
               LOG(4, ("%s: HGFS packet with invalid session id!\n", __FUNCTION__));
335
350
               result = HGFS_ERROR_STALE_SESSION;
336
 
         } else if (packetSize < header->packetSize ||
337
 
            header->packetSize < header->headerSize) {
338
 
               LOG(4, ("%s: Malformed HGFS packet received - inconsistent header"
339
 
                  " and packet sizes!\n", __FUNCTION__));
340
 
               result = HGFS_ERROR_PROTOCOL;
 
351
            }
341
352
         }
342
353
      } else {
343
354
         LOG(4, ("%s: Malformed HGFS packet received - header is too small!\n",
346
357
      }
347
358
 
348
359
      if (HGFS_ERROR_SUCCESS == result) { // Passed all tests
349
 
         localInput->op = header->op;
350
360
         localInput->payload = (char *)request + header->headerSize;
351
361
         localInput->payloadSize = header->packetSize - header->headerSize;
352
362
      }
355
365
              __FUNCTION__));
356
366
      result = HGFS_ERROR_PROTOCOL;
357
367
   }
 
368
 
358
369
   if (HGFS_ERROR_SUCCESS != result) {
359
370
      LOG(4, ("%s: Malformed HGFS packet received!\n", __FUNCTION__));
 
371
   } else if ((NULL == session) && (!localInput->v4header)) {
 
372
      session = HgfsServerTransportGetSessionInfo(transportSession,
 
373
                                                  transportSession->defaultSessionId);
 
374
      if (NULL == session) {
 
375
         /*
 
376
          * Create a new session if the default session doesn't exist.
 
377
          */
 
378
         if (!HgfsServerAllocateSession(transportSession,
 
379
                                        transportSession->channelCapabilities,
 
380
                                        &session)) {
 
381
            result = HGFS_ERROR_NOT_ENOUGH_MEMORY;
 
382
         } else {
 
383
            result = HgfsServerTransportAddSessionToList(transportSession,
 
384
                                                         session);
 
385
            if (HGFS_ERROR_SUCCESS != result) {
 
386
               LOG(4, ("%s: Could not add session to the list.\n", __FUNCTION__));
 
387
            } else {
 
388
               transportSession->defaultSessionId = session->sessionId;
 
389
               HgfsServerSessionGet(session);
 
390
            }
 
391
         }
 
392
      }
360
393
   }
361
394
 
 
395
   if (session) {
 
396
      session->isInactive = FALSE;
 
397
   }
 
398
   localInput->session = session;
362
399
   localInput->payloadOffset = (char *)localInput->payload -
363
400
                               (char *)localInput->metaPacket;
364
401
   *status = result;
4321
4358
         if (result) {
4322
4359
            *data = HSPU_GetDataPacketBuf(input->packet,
4323
4360
                                          BUF_READABLE,
4324
 
                                          input->session);
 
4361
                                          input->transportSession);
4325
4362
            if (NULL == *data) {
4326
4363
               LOG(4, ("%s: Failed to get data in guest memory\n", __FUNCTION__));
4327
4364
               result = FALSE;