Skip to content
Snippets Groups Projects
  • Vladimir Davydov's avatar
    52fd97ec
    box: separate access check and function call in box_process_call · 52fd97ec
    Vladimir Davydov authored
    box_process_call() uses func_call(), which not only calls the given
    function, but also checks that the current user has the right to execute
    it. As a result, we can't add auditing for only those function calls
    that passed the access check (apparently, there's no reason to log
    function calls that failed with an 'access denied' error - we have a
    separate audit event for this).
    
    To fix this, let's introduce func_call_no_access_check() helper, which
    calls a function without checking access rights, and use it along with
    existing func_access_check() in box_process_call(). func_call() is now
    an inline function that calls func_access_check() and then on success
    func_call_no_access_check().
    
    It's probably wrong that func_call() checks access rights, because this
    means that to use a space with a functional index/constraint, the user
    needs not only read/write access to the space itself, but also execute
    access to the function. I think we should check the right to execute
    such function only once - on functional index/constraint creation, not
    on every call, but I'm not going to change this now, because nobody's
    complained so far, and a change like this needs a proper discussion
    anyway.
    
    NO_TEST=refactoring
    NO_DOC=refactoring
    NO_CHANGELOG=refactoring
    52fd97ec
    History
    box: separate access check and function call in box_process_call
    Vladimir Davydov authored
    box_process_call() uses func_call(), which not only calls the given
    function, but also checks that the current user has the right to execute
    it. As a result, we can't add auditing for only those function calls
    that passed the access check (apparently, there's no reason to log
    function calls that failed with an 'access denied' error - we have a
    separate audit event for this).
    
    To fix this, let's introduce func_call_no_access_check() helper, which
    calls a function without checking access rights, and use it along with
    existing func_access_check() in box_process_call(). func_call() is now
    an inline function that calls func_access_check() and then on success
    func_call_no_access_check().
    
    It's probably wrong that func_call() checks access rights, because this
    means that to use a space with a functional index/constraint, the user
    needs not only read/write access to the space itself, but also execute
    access to the function. I think we should check the right to execute
    such function only once - on functional index/constraint creation, not
    on every call, but I'm not going to change this now, because nobody's
    complained so far, and a change like this needs a proper discussion
    anyway.
    
    NO_TEST=refactoring
    NO_DOC=refactoring
    NO_CHANGELOG=refactoring