]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
oci-util: Don't fall back to default registry for explicit registries
authorKai Lüke <kai@amutable.com>
Wed, 15 Jul 2026 07:09:13 +0000 (16:09 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 15 Jul 2026 16:34:11 +0000 (01:34 +0900)
When a reference specifies a registry like ghcr.io or quay.io for which
we don't have a registry config file, the fallback forced the default
registry which is wrong.

Only use the default as fallback when there is no explicit registry.

src/import/oci-util.c

index a3c5782e98938505b32912c9e38054297de51df9..d727bade97875a6343d32789bf8d1f259c72a1ab 100644 (file)
@@ -216,7 +216,7 @@ int oci_ref_normalize(char **protocol, char **registry, char **image, char **tag
         _cleanup_fclose_ FILE *f = NULL;
         _cleanup_free_ char *path = NULL;
         r = search_and_fopen_nulstr(fn, "re", /* root= */ NULL, CONF_PATHS_NULSTR("systemd/oci-registry"), &f, &path);
-        if (r == -ENOENT)
+        if (r == -ENOENT && isempty(*registry))
                 r = search_and_fopen_nulstr("default.oci-registry", "re", /* root= */ NULL, CONF_PATHS_NULSTR("systemd/oci-registry"), &f, &path);
         if (r < 0 && r != -ENOENT)
                 return log_debug_errno(r, "Failed to find suitable OCI registry file: %m");