Remove unnecessary code rom be_lo_put()

Started by Yugo Nagataalmost 2 years ago7 messageshackers
Jump to latest
#1Yugo Nagata
nagata@sraoss.co.jp

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>

Attachments:

remove_unnecessary_code_from_be_lo_put.patchtext/x-diff; name=remove_unnecessary_code_from_be_lo_put.patchDownload+0-11
#2Peter Eisentraut
peter_e@gmx.net
In reply to: Yugo Nagata (#1)
Re: Remove unnecessary code rom be_lo_put()

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.

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Peter Eisentraut (#2)
Re: Remove unnecessary code rom be_lo_put()

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

#4Michael Paquier
michael@paquier.xyz
In reply to: Tom Lane (#3)
Re: Remove unnecessary code rom be_lo_put()

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

#5Peter Eisentraut
peter_e@gmx.net
In reply to: Michael Paquier (#4)
Re: Remove unnecessary code rom be_lo_put()

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().

#6Peter Eisentraut
peter_e@gmx.net
In reply to: Tom Lane (#3)
Re: Remove unnecessary code rom be_lo_put()

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

#7Yugo Nagata
nagata@sraoss.co.jp
In reply to: Peter Eisentraut (#6)
Re: Remove unnecessary code rom be_lo_put()

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>