Thread: Remove unnecessary code rom be_lo_put()

Remove unnecessary code rom be_lo_put()

From
Yugo NAGATA
Date:
Hi,

I noticed that a permission check is performed in be_lo_put()
just after returning inv_open(), but teh permission should be
already checked in inv_open(), so I think we can remove this
part of codes. I attached a patch for this fix.

Regards,
Yugo Nagata

-- 
Yugo NAGATA <nagata@sraoss.co.jp>

Attachment

Re: Remove unnecessary code rom be_lo_put()

From
Peter Eisentraut
Date:
On 24.04.24 11:59, Yugo NAGATA wrote:
> I noticed that a permission check is performed in be_lo_put()
> just after returning inv_open(), but teh permission should be
> already checked in inv_open(), so I think we can remove this
> part of codes. I attached a patch for this fix.

Yes, I think you are right.

This check was added in 8d9881911f0, but then the refactoring in 
ae20b23a9e7 should probably have removed it.




Re: Remove unnecessary code rom be_lo_put()

From
Tom Lane
Date:
Peter Eisentraut <peter@eisentraut.org> writes:
> On 24.04.24 11:59, Yugo NAGATA wrote:
>> I noticed that a permission check is performed in be_lo_put()
>> just after returning inv_open(), but teh permission should be
>> already checked in inv_open(), so I think we can remove this
>> part of codes. I attached a patch for this fix.

> Yes, I think you are right.

I agree.  Do you want to do the honors?

            regards, tom lane



Re: Remove unnecessary code rom be_lo_put()

From
Michael Paquier
Date:
On Wed, Apr 24, 2024 at 09:25:09AM -0400, Tom Lane wrote:
> I agree.  Do you want to do the honors?

Good catch.  The same check happens when the object is opened.  Note
that you should be able to remove utils/acl.h at the top of
be-fsstubs.c as this would remove the last piece of code that does an
ACL check in this file.  No objections with doing that now, removing
this code.
--
Michael

Attachment

Re: Remove unnecessary code rom be_lo_put()

From
Peter Eisentraut
Date:
On 25.04.24 01:50, Michael Paquier wrote:
> On Wed, Apr 24, 2024 at 09:25:09AM -0400, Tom Lane wrote:
>> I agree.  Do you want to do the honors?
> 
> Good catch.  The same check happens when the object is opened.  Note
> that you should be able to remove utils/acl.h at the top of
> be-fsstubs.c as this would remove the last piece of code that does an
> ACL check in this file.  No objections with doing that now, removing
> this code.

utils/acl.h is still needed for object_ownercheck() called in 
be_lo_unlink().




Re: Remove unnecessary code rom be_lo_put()

From
Peter Eisentraut
Date:
On 24.04.24 15:25, Tom Lane wrote:
> Peter Eisentraut <peter@eisentraut.org> writes:
>> On 24.04.24 11:59, Yugo NAGATA wrote:
>>> I noticed that a permission check is performed in be_lo_put()
>>> just after returning inv_open(), but teh permission should be
>>> already checked in inv_open(), so I think we can remove this
>>> part of codes. I attached a patch for this fix.
> 
>> Yes, I think you are right.
> 
> I agree.  Do you want to do the honors?

done




Re: Remove unnecessary code rom be_lo_put()

From
Yugo NAGATA
Date:
On Thu, 25 Apr 2024 10:26:41 +0200
Peter Eisentraut <peter@eisentraut.org> wrote:

> On 24.04.24 15:25, Tom Lane wrote:
> > Peter Eisentraut <peter@eisentraut.org> writes:
> >> On 24.04.24 11:59, Yugo NAGATA wrote:
> >>> I noticed that a permission check is performed in be_lo_put()
> >>> just after returning inv_open(), but teh permission should be
> >>> already checked in inv_open(), so I think we can remove this
> >>> part of codes. I attached a patch for this fix.
> > 
> >> Yes, I think you are right.
> > 
> > I agree.  Do you want to do the honors?
> 
> done
> 

Thank you!

Regards,
Yugo Nagata


-- 
Yugo NAGATA <nagata@sraoss.co.jp>