anchor.diff:  p_new_lease(KeyId, Path, Public, Secret, _State) ->
       {ok, MaxLeaseTime} = application:get_env(cvmfs_gateway, max_lease_time),
   
  +    {Repo, Subpath} = cvmfs_path_util:split_repo_path(Path),
  +
       %% Match statement that selects all rows with a given repo,
       %% returning a list of {Path, Time} pairs
  -    MS = ets:fun2ms(fun(#lease{path = P} = Lease) when P =:= Path ->
  +    MS = ets:fun2ms(fun(#lease{path = {R, _}} = Lease) when R =:= Repo ->
                               Lease
                       end),
   
  -    AreOverlapping = fun(#lease{path = P}) ->
  -                             cvmfs_path_util:are_overlapping(P, Path)
  +    AreOverlapping = fun(#lease{path = {_, P}}) ->
  +                             cvmfs_path_util:are_overlapping(P, Subpath)
                        end,
   
       T = fun() ->
  
positive.code:                                 {busy, RemainingTime};
                              %% The old lease is expired. Delete it and insert the new one
                              false ->
                                  mnesia:delete({lease, Path}),
                                  p_write_row(KeyId, Path, Public, Secret)
                          end;
                      %% No overlapping paths were found; just insert the new entry
                      _ ->
                          p_write_row(KeyId, Path, Public, Secret)
                  end
          end,
      {atomic, Result} = mnesia:sync_transaction(T),
  
negative.code: 
  -define(SERVER, ?MODULE).
  
  -record(lease, { path   :: {binary(), binary()}  % repository with subpath which is locked
                 , key_id :: binary()  % user identifier
                 , public :: binary()  % public string used for token generation
                 , secret :: binary()  % secret used for token generation
                 , time   :: integer() % timestamp (time when lease acquired)
                 }).
  -type lease() :: #lease{}.
  
  