Alien-SVN

 view release on metacpan or  search on metacpan

src/subversion/subversion/mod_dav_svn/repos.c  view on Meta::CPAN

      svn_hash_sets(fs_config, SVN_FS_CONFIG_FSFS_CACHE_DELTAS,
                    dav_svn__get_txdelta_cache_flag(r) ? "1" :"0");
      svn_hash_sets(fs_config, SVN_FS_CONFIG_FSFS_CACHE_FULLTEXTS,
                    dav_svn__get_fulltext_cache_flag(r) ? "1" :"0");
      svn_hash_sets(fs_config, SVN_FS_CONFIG_FSFS_CACHE_REVPROPS,
                    dav_svn__get_revprop_cache_flag(r) ? "1" :"0");

      /* Disallow BDB/event until issue 4157 is fixed. */
      if (!strcmp(ap_show_mpm(), "event"))
        {
          serr = svn_repos__fs_type(&fs_type, fs_path, r->connection->pool);
          if (serr)
            {
              /* svn_repos_open2 is going to fail, use that error. */
              svn_error_clear(serr);
              serr = NULL;
            }
          else if (!strcmp(fs_type, "bdb"))
            serr = svn_error_createf(SVN_ERR_UNSUPPORTED_FEATURE, NULL,
                                     "BDB repository at '%s' is not compatible "
                                     "with event MPM",
                                     fs_path);
        }
      else
        serr = NULL;

      /* open the FS */
      if (!serr)
        serr = svn_repos_open2(&(repos->repos), fs_path, fs_config,
                               r->connection->pool);
      if (serr != NULL)
        {
          /* The error returned by svn_repos_open2 might contain the
             actual path to the failed repository.  We don't want to
             leak that path back to the client, because that would be
             a security risk, but we do want to log the real error on
             the server side. */
          return dav_svn__sanitize_error(serr, "Could not open the requested "
                                         "SVN filesystem",
                                         HTTP_INTERNAL_SERVER_ERROR, r);
        }

      /* Cache the open repos for the next request on this connection */
      apr_pool_userdata_set(repos->repos, repos_key,
                            NULL, r->connection->pool);

      /* Store the capabilities of the current connection, making sure
         to use the same pool repos->repos itself was created in. */
      serr = svn_repos_remember_client_capabilities
        (repos->repos, capabilities_as_list(repos->client_capabilities,
                                            r->connection->pool));
      if (serr != NULL)
        {
          return dav_svn__sanitize_error(serr,
                                         "Error storing client capabilities "
                                         "in repos object",
                                         HTTP_INTERNAL_SERVER_ERROR, r);
        }

      /* Configure hook script environment variables. */
      serr = svn_repos_hooks_setenv(repos->repos, dav_svn__get_hooks_env(r),
                                    r->pool);
      if (serr)
        return dav_svn__sanitize_error(serr,
                                       "Error settings hooks environment",
                                       HTTP_INTERNAL_SERVER_ERROR, r);
    }

  /* cache the filesystem object */
  repos->fs = svn_repos_fs(repos->repos);

  /* capture warnings during cleanup of the FS */
  svn_fs_set_warning_func(repos->fs, log_warning, r);

  /* if an authenticated username is present, attach it to the FS */
  if (r->user)
    {
      svn_fs_access_t *access_ctx;

      /* The fs is cached in connection->pool, but the fs access
         context lives in r->pool.  Because the username or token
         could change on each request, we need to make sure that the
         fs points to a NULL access context after the request is gone. */
      cleanup_baton = apr_pcalloc(r->pool, sizeof(*cleanup_baton));
      cleanup_baton->pool = r->pool;
      cleanup_baton->fs = repos->fs;
      apr_pool_cleanup_register(r->pool, cleanup_baton, cleanup_fs_access,
                                apr_pool_cleanup_null);

      /* Create an access context based on the authenticated username. */
      serr = svn_fs_create_access(&access_ctx, r->user, r->pool);
      if (serr)
        {
          return dav_svn__sanitize_error(serr,
                                         "Could not create fs access context",
                                         HTTP_INTERNAL_SERVER_ERROR, r);
        }

      /* Attach the access context to the fs. */
      serr = svn_fs_set_access(repos->fs, access_ctx);
      if (serr)
        {
          return dav_svn__sanitize_error(serr, "Could not attach access "
                                         "context to fs",
                                         HTTP_INTERNAL_SERVER_ERROR, r);
        }
    }

  /* Look for locktokens in the "If:" request header. */
  err = dav_get_locktoken_list(r, &ltl);

  /* dav_get_locktoken_list claims to return a NULL list when no
     locktokens are present.  But it actually throws this error
     instead!  So we're deliberately trapping/ignoring it.

     This is a workaround for a bug in mod_dav.  Remove this when the
     bug is fixed in mod_dav.  See Subversion Issue #2248 */
  if (err && (err->error_id != DAV_ERR_IF_ABSENT))
    return err;

  /* If one or more locktokens are present in the header, push them



( run in 0.588 second using v1.01-cache-2.11-cpan-754626df90b )