It's probably best to use basename(3) here like for the cert file
instead of incorrectly handrolling the functionality ;)
OK?
diff --git main.c main.c
index f8dc22c8756..9a7c3c5568c 100644
--- main.c
+++ main.c
@@ -128,23 +128,19 @@ main(int argc, char *argv[])
}
if(domain->chain != NULL) {
- if ((chainfile = strstr(domain->chain, certdir)) != NULL)
- chainfile = domain->chain + strlen(certdir);
- else
- chainfile = domain->chain;
-
- if ((chainfile = strdup(chainfile)) == NULL)
- err(EXIT_FAILURE, "strdup");
+ if ((chainfile = basename(domain->chain)) != NULL) {
+ if ((chainfile = strdup(chainfile)) == NULL)
+ err(EXIT_FAILURE, "strdup");
+ } else
+ err(EXIT_FAILURE, "basename");
}
if(domain->fullchain != NULL) {
- if ((fullchainfile = strstr(domain->fullchain, certdir)) !=
NULL)
- fullchainfile = domain->fullchain + strlen(certdir);
- else
- fullchainfile = domain->fullchain;
-
- if ((fullchainfile = strdup(fullchainfile)) == NULL)
- err(EXIT_FAILURE, "strdup");
+ if ((fullchainfile = basename(domain->fullchain)) != NULL) {
+ if ((fullchainfile = strdup(fullchainfile)) == NULL)
+ err(EXIT_FAILURE, "strdup");
+ } else
+ err(EXIT_FAILURE, "basename");
}
if ((auth = domain->auth) == NULL) {
On Sat, May 20, 2017 at 06:56:34AM +0100, Raf Czlonka wrote:
> Hi all,
>
> A minor thing - I'm not sure it warrants an email to bugs@
>
> Something I had noticed only today:
>
> # acme-client -vD domain.org
> [...]
> acme-client: /etc/ssl//domain.org.chain.pem: created
> acme-client: /etc/ssl/domain.org.crt: created
> acme-client: /etc/ssl//domain.org.fullchain.pem: created
>
> Please notice the double slash ('//') in chain and fullchain.
>
> Before you ask, yes my config file does *not* contain those :^)
>
> Regards,
>
> Raf
>
--
I'm not entirely sure you are real.