Page MenuHomeFreeBSD

certctl: Restore distbase
ClosedPublic

Authored by des on Thu, Aug 14, 10:19 AM.
Tags
None
Referenced Files
F126585487: D51896.diff
Thu, Aug 21, 8:34 AM
F126585030: D51896.diff
Thu, Aug 21, 8:26 AM
F126577676: D51896.diff
Thu, Aug 21, 6:08 AM
F126559133: D51896.diff
Thu, Aug 21, 12:13 AM
F126514992: D51896.diff
Wed, Aug 20, 11:00 AM
Unknown Object (File)
Wed, Aug 20, 6:23 AM
Unknown Object (File)
Mon, Aug 18, 2:47 PM
Unknown Object (File)
Mon, Aug 18, 1:25 PM

Details

Summary

This turns out to be required to produce correct metalog output.

While here,

  • Don't rely on X509_NAME_oneline() if we can avoid it.
  • Fix metalog output to be relative to DESTDIR.
  • Rework the tests so they're agnostic to DISTBASE.
  • Account for a recent change in openssl storeutl.
  • Add several new tests.

Reported by: jrtc27, kp
Fixes: 81d8827ad875 ("certctl: Reimplement in C")

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 66248
Build 63131: arc lint + arc unit

Event Timeline

des requested review of this revision.Thu, Aug 14, 10:19 AM
markj added inline comments.
usr.sbin/certctl/certctl.c
958

end might be pointing into an environment variable buffer, we should avoid modifying it.

Fix metalog output to be relative to DESTDIR.

Is this referring to being ./foo/bar/baz rather than /foo/bar/baz? If so might be clearer as something more like:

Fix metalog output to be a relative path, with leading . component, relative to DESTDIR, rather than an absolute path within DESTDIR

Not sure about the wording for the last part though. Maybe you know of a better way to describe it. What gets produced today is an absolute path, but it's an absolute path whose root is DESTDIR, and so in some sense is "relative" to DESTDIR, just not an actual relative path.

usr.sbin/certctl/certctl.c
150

Not quite true, LOCALBASE doesn't include DISTBASE. Not clear to me whether it should or not, bit of a weird interaction that doesn't really make sense to combine, so I don't really care which way it goes (I just happened to not include it for LOCALBASE in my original commit), but the comment should be consistent with the implementation.

183

read_cert also uses this for cert->path, is that a problem?

usr.sbin/certctl/certctl.c
113

If the string doesn't have a trailing slash, won't this return an unterminated string?

des marked 3 inline comments as done.Thu, Aug 14, 8:26 PM
des added inline comments.
usr.sbin/certctl/certctl.c
113

You're right, thank you.

183

That path is never used.

des marked 2 inline comments as done.Thu, Aug 14, 8:26 PM

Looks ok to me with the inline comment addressed.

usr.sbin/certctl/certctl.8
128

Presumably we should check this?

usr.sbin/certctl/certctl.c
111
des retitled this revision from certctl: Restore distbase. to certctl: Restore distbase.Fri, Aug 15, 12:15 AM
des marked 2 inline comments as done.Fri, Aug 15, 12:16 AM
usr.sbin/certctl/certctl.c
117–118

Will happen automatically thanks to the loop condition. And makes a difference, because otherwise dst doesn't get incremented, and you'll truncate paths that end in a /. In practice you probably don't expect that case, and it still means the same thing, but still.

183

You sure about that? It looks a lot like list and untrusted at least will.

des marked 3 inline comments as done.Fri, Aug 15, 7:21 AM
des added inline comments.
usr.sbin/certctl/certctl.c
117–118

Did you bother to read the comment at the top of the function?

183

Ah, you're right, but they only print the basename, so it makes no difference.

des marked 2 inline comments as done.Fri, Aug 15, 7:22 AM

@des Please commit this ASAP. Any further issues can be resolved later. The tree has been broken for 65 hours now; if that hits 72 hours I'm going to back out 81d8827ad875 until the bits are ready.

usr.sbin/certctl/certctl.c
325
markj added inline comments.
usr.sbin/certctl/certctl.c
960
This revision is now accepted and ready to land.Mon, Aug 18, 1:24 PM
usr.sbin/certctl/certctl.c
960

On the contrary, DISTBASE _must_ begin with a slash.

des marked an inline comment as done.Mon, Aug 18, 2:30 PM