Skip to content

Commit 07e1cac

Browse files
committed
Fix false enforcement of tboot-nixos-install key/cert flags
1 parent 485210b commit 07e1cac

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

src/tboot-nixos-install.zig

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,12 @@ pub fn main() !void {
303303
return clap.help(std.io.getStdErr().writer(), clap.Help, &params, .{});
304304
}
305305

306-
if (res.positionals[0] == null or res.args.@"private-key" == null or res.args.certificate == null) {
306+
if (res.positionals[0] == null or
307+
// If a private or public key is provided but the other corresponding
308+
// key is not provided, error out.
309+
((res.args.@"private-key" == null) !=
310+
(res.args.certificate == null)))
311+
{
307312
try diag.report(stderr, error.InvalidArgument);
308313
try clap.usage(stderr, clap.Help, &params);
309314
return;
@@ -313,16 +318,6 @@ pub fn main() !void {
313318
.default_nixos_system_closure = res.positionals[0].?,
314319
};
315320

316-
// If a private or public key is provided but the other corresponding key
317-
// is not provided, error out.
318-
if ((res.args.@"private-key" == null) !=
319-
(res.args.certificate == null))
320-
{
321-
try diag.report(stderr, error.InvalidArgument);
322-
try clap.usage(stderr, clap.Help, &params);
323-
return;
324-
}
325-
326321
if (res.args.@"private-key" != null and
327322
res.args.certificate != null)
328323
{

0 commit comments

Comments
 (0)