]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
cryptsetup: do not print (null) if pkcs11 uri not set
authorAntonio Alvarez Feijoo <antonio.feijoo@suse.com>
Fri, 3 Nov 2023 15:28:14 +0000 (16:28 +0100)
committerLuca Boccassi <luca.boccassi@gmail.com>
Fri, 3 Nov 2023 19:10:55 +0000 (19:10 +0000)
The pkcs11 uri is no set if the smart card is not inserted while using
`pkcs11-uri=auto` with libcryptsetup plugins.

```
> systemd-cryptsetup attach cr_data /dev/sda1 - pkcs11-uri=auto
Set cipher aes, mode xts-plain64, key size 512 bits for device /dev/sda1.
Security token (null) not present for unlocking volume Linux filesystem (cr_data), please plug it in.
```

src/cryptsetup/cryptsetup.c

index 1da7bff0499fe8e8c6b5e6615c10768496fcb4fb..6d927ef8dd8ccb15f03a9b2a6a0dd189a25a1841 100644 (file)
@@ -1503,8 +1503,8 @@ static int attach_luks_or_plain_or_bitlk_by_pkcs11(
                         if (r < 0)
                                 return r;
 
-                        log_notice("Security token %s not present for unlocking volume %s, please plug it in.",
-                                   uri, friendly);
+                        log_notice("Security token%s%s not present for unlocking volume %s, please plug it in.",
+                                   uri ? " " : "", strempty(uri), friendly);
 
                         /* Let's immediately rescan in case the token appeared in the time we needed
                          * to create and configure the monitor */