FreeBSD/contrib/subversion/subversion/svnserve/serve.c
/* Add the LOCK_TOKENS (if any) to the filesystem access context,
 * checking path authorizations using the state in SB as we go.
 * LOCK_TOKENS is an array of svn_ra_svn_item_t structs.  Return a
 * client error if LOCK_TOKENS is not a list of lists.  If a lock
 * violates the authz configuration, return SVN_ERR_RA_NOT_AUTHORIZED
 * to the client.  Use POOL for temporary allocations only.
 */
Add the LOCK_TOKENS (if any) to the filesystem access context,
checking path authorizations using the state in SB as we go.
LOCK_TOKENS is an array of svn_ra_svn_item_t structs.  Return a
client error if LOCK_TOKENS is not a list of lists.  If a lock
violates the authz configuration, return SVN_ERR_RA_NOT_AUTHORIZED
to the client.  Use POOL for temporary allocations only.
Add the LOCK_TOKENS ( if any ) to the filesystem access context checking path authorizations using the state in SB as we go . LOCK_TOKENS is an array of svn_ra_svn_item_t structs . Return a client error if LOCK_TOKENS is not a list of lists . If a lock violates the authz configuration return SVN_ERR_RA_NOT_AUTHORIZED to the client . Use POOL for temporary allocations only .
static svn_error_t *add_lock_tokens(const apr_array_header_t *lock_tokens,
                                    server_baton_t *sb,
                                    apr_pool_t *pool)
{
  int i;
  svn_fs_access_t *fs_access;
  SVN_ERR(svn_fs_get_access(&fs_access, sb->repository->fs));
  if (! fs_access)
    return SVN_NO_ERROR;
  for (i = 0; i < lock_tokens->nelts; ++i)
    {
      const char *path, *token, *full_path;
      svn_ra_svn_item_t *path_item, *token_item;
      svn_ra_svn_item_t *item = &APR_ARRAY_IDX(lock_tokens, i,
                                               svn_ra_svn_item_t);
      if (item->kind != SVN_RA_SVN_LIST)
        return svn_error_create(SVN_ERR_RA_SVN_MALFORMED_DATA, NULL,
                                "Lock tokens aren't a list of lists");
      path_item = &APR_ARRAY_IDX(item->u.list, 0, svn_ra_svn_item_t);
      if (path_item->kind != SVN_RA_SVN_STRING)
        return svn_error_create(SVN_ERR_RA_SVN_MALFORMED_DATA, NULL,
                                "Lock path isn't a string");
      token_item = &APR_ARRAY_IDX(item->u.list, 1, svn_ra_svn_item_t);
      if (token_item->kind != SVN_RA_SVN_STRING)
        return svn_error_create(SVN_ERR_RA_SVN_MALFORMED_DATA, NULL,
                                "Lock token isn't a string");
      path = path_item->u.string->data;
      full_path = svn_fspath__join(sb->repository->fs_path->data,
                                   svn_relpath_canonicalize(path, pool),
                                   pool);
      if (! lookup_access(pool, sb, svn_authz_write, full_path, TRUE))
        return error_create_and_log(SVN_ERR_RA_NOT_AUTHORIZED, NULL, NULL,
                                    sb);
      token = token_item->u.string->data;
      SVN_ERR(svn_fs_access_add_lock_token2(fs_access, path, token));
    }
  return SVN_NO_ERROR;
}
static svn_error_t * add_lock_tokens ( const apr_array_header_t * lock_tokens , server_baton_t * sb , apr_pool_t * pool ) { int i ; svn_fs_access_t * fs_access ; SVN_ERR ( svn_fs_get_access ( & fs_access , sb -> repository -> fs ) ) ; if ( ! fs_access ) return SVN_NO_ERROR ; for ( i = 0 ; i < lock_tokens -> nelts ; ++ i ) { const char * path , * token , * full_path ; svn_ra_svn_item_t * path_item , * token_item ; svn_ra_svn_item_t * item = & APR_ARRAY_IDX ( lock_tokens , i , svn_ra_svn_item_t ) ; if ( item -> kind != SVN_RA_SVN_LIST ) return svn_error_create ( SVN_ERR_RA_SVN_MALFORMED_DATA , NULL , " " ) ; path_item = & APR_ARRAY_IDX ( item -> u . list , 0 , svn_ra_svn_item_t ) ; if ( path_item -> kind != SVN_RA_SVN_STRING ) return svn_error_create ( SVN_ERR_RA_SVN_MALFORMED_DATA , NULL , " " ) ; token_item = & APR_ARRAY_IDX ( item -> u . list , 1 , svn_ra_svn_item_t ) ; if ( token_item -> kind != SVN_RA_SVN_STRING ) return svn_error_create ( SVN_ERR_RA_SVN_MALFORMED_DATA , NULL , " " ) ; path = path_item -> u . string -> data ; full_path = svn_fspath__join ( sb -> repository -> fs_path -> data , svn_relpath_canonicalize ( path , pool ) , pool ) ; if ( ! lookup_access ( pool , sb , svn_authz_write , full_path , TRUE ) ) return error_create_and_log ( SVN_ERR_RA_NOT_AUTHORIZED , NULL , NULL , sb ) ; token = token_item -> u . string -> data ; SVN_ERR ( svn_fs_access_add_lock_token2 ( fs_access , path , token ) ) ; } return SVN_NO_ERROR ; }
Add the LOCK_TOKENS (if any) to the filesystem access context,
 checking path authorizations using the state in SB as we go.
Add the LOCK_TOKENS ( if any ) to the filesystem access context checking path authorizations using the state in SB as we go .
/* If there is no access context, nowhere to add the tokens. */