~ubuntu-branches/debian/sid/subversion/sid

« back to all changes in this revision

Viewing changes to subversion/libsvn_ra_serf/locks.c

  • Committer: Package Import Robot
  • Author(s): James McCoy
  • Date: 2014-05-20 22:45:32 UTC
  • mfrom: (0.2.12)
  • Revision ID: package-import@ubuntu.com-20140520224532-4fec3gohdzyy692g
Tags: 1.8.9-1
* New upstream release
* Merge changes from Ubuntu:
  - Add DEB-8 test for Apache functionality
  - debian/rules: Create pot file on build.
  - debian/rules: Ensure the doxygen output directory exists
  - Move svn2cl to subversion-tools' Suggests on Ubuntu.

Show diffs side-by-side

added added

removed removed

Lines of Context:
156
156
 
157
157
  if (leaving_state == TIMEOUT)
158
158
    {
159
 
      if (strcmp(cdata->data, "Infinite") == 0)
 
159
      if (strcasecmp(cdata->data, "Infinite") == 0)
160
160
        lock_ctx->lock->expiration_date = 0;
 
161
      else if (strncasecmp(cdata->data, "Second-", 7) == 0)
 
162
        {
 
163
          unsigned n;
 
164
          SVN_ERR(svn_cstring_atoui(&n, cdata->data+7));
 
165
 
 
166
          lock_ctx->lock->expiration_date = apr_time_now() +
 
167
                                            apr_time_from_sec(n);
 
168
        }
161
169
      else
162
 
        SVN_ERR(svn_time_from_cstring(&lock_ctx->lock->creation_date,
163
 
                                      cdata->data, lock_ctx->pool));
 
170
        return svn_error_createf(SVN_ERR_RA_DAV_MALFORMED_DATA, NULL,
 
171
                                 _("Invalid LOCK timeout value '%s'"),
 
172
                                 cdata->data);
164
173
    }
165
174
  else if (leaving_state == HREF)
166
175
    {
362
371
svn_ra_serf__get_lock(svn_ra_session_t *ra_session,
363
372
                      svn_lock_t **lock,
364
373
                      const char *path,
365
 
                      apr_pool_t *pool)
 
374
                      apr_pool_t *result_pool)
366
375
{
367
376
  svn_ra_serf__session_t *session = ra_session->priv;
368
377
  svn_ra_serf__handler_t *handler;
369
378
  svn_ra_serf__xml_context_t *xmlctx;
 
379
  apr_pool_t *scratch_pool = svn_pool_create(result_pool);
370
380
  lock_info_t *lock_ctx;
371
381
  const char *req_url;
372
382
  svn_error_t *err;
373
383
 
374
 
  req_url = svn_path_url_add_component2(session->session_url.path, path, pool);
375
 
 
376
 
  lock_ctx = apr_pcalloc(pool, sizeof(*lock_ctx));
377
 
 
378
 
  lock_ctx->pool = pool;
 
384
  req_url = svn_path_url_add_component2(session->session_url.path, path,
 
385
                                        scratch_pool);
 
386
 
 
387
  lock_ctx = apr_pcalloc(scratch_pool, sizeof(*lock_ctx));
 
388
  lock_ctx->pool = result_pool;
379
389
  lock_ctx->path = req_url;
380
 
  lock_ctx->lock = svn_lock_create(pool);
381
 
  lock_ctx->lock->path = apr_pstrdup(pool, path); /* be sure  */
 
390
  lock_ctx->lock = svn_lock_create(result_pool);
 
391
  lock_ctx->lock->path = apr_pstrdup(result_pool, path);
382
392
 
383
393
  xmlctx = svn_ra_serf__xml_context_create(locks_ttable,
384
394
                                           NULL, locks_closed, NULL,
385
395
                                           lock_ctx,
386
 
                                           pool);
387
 
  handler = svn_ra_serf__create_expat_handler(xmlctx, pool);
 
396
                                           scratch_pool);
 
397
  handler = svn_ra_serf__create_expat_handler(xmlctx, scratch_pool);
388
398
 
389
399
  handler->method = "PROPFIND";
390
400
  handler->path = req_url;
405
415
 
406
416
  lock_ctx->handler = handler;
407
417
 
408
 
  err = svn_ra_serf__context_run_one(handler, pool);
 
418
  err = svn_ra_serf__context_run_one(handler, scratch_pool);
409
419
  err = determine_error(handler, err);
410
420
 
411
421
  if (handler->sline.code == 404)
420
430
                              _("Server does not support locking features"));
421
431
    }
422
432
 
423
 
  *lock = lock_ctx->lock;
 
433
  if (lock_ctx->lock && lock_ctx->lock->token)
 
434
    *lock = lock_ctx->lock;
 
435
  else
 
436
    *lock = NULL;
 
437
 
 
438
  svn_pool_destroy(scratch_pool);
424
439
 
425
440
  return SVN_NO_ERROR;
426
441
}
574
589
        {
575
590
          SVN_ERR(svn_ra_serf__get_lock(ra_session, &existing_lock, path,
576
591
                                        iterpool));
577
 
          token = existing_lock->token;
 
592
          token = existing_lock ? existing_lock->token : NULL;
578
593
          if (!token)
579
594
            {
580
595
              err = svn_error_createf(SVN_ERR_RA_NOT_LOCKED, NULL,