-/* $OpenBSD: cert.c,v 1.128 2024/03/19 05:04:13 tb Exp $ */
+/* $OpenBSD: cert.c,v 1.129 2024/03/22 03:38:12 job Exp $ */
/*
* Copyright (c) 2022 Theo Buehler <tb@openbsd.org>
* Copyright (c) 2021 Job Snijders <job@openbsd.org>
if (OBJ_cmp(oid, carepo_oid) == 0) {
if (!x509_location(fn, "SIA: caRepository",
- "rsync://", ad->location, &cert->repo))
+ RSYNC_PROTO, ad->location, &cert->repo))
goto out;
} else if (OBJ_cmp(oid, manifest_oid) == 0) {
if (!x509_location(fn, "SIA: rpkiManifest",
- "rsync://", ad->location, &cert->mft))
+ RSYNC_PROTO, ad->location, &cert->mft))
goto out;
} else if (OBJ_cmp(oid, notify_oid) == 0) {
if (!x509_location(fn, "SIA: rpkiNotify",
- "https://", ad->location, &cert->notify))
+ HTTPS_PROTO, ad->location, &cert->notify))
goto out;
}
}
-/* $OpenBSD: extern.h,v 1.212 2024/03/19 05:04:13 tb Exp $ */
+/* $OpenBSD: extern.h,v 1.213 2024/03/22 03:38:12 job Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
/* Maximum number of delegated hosting locations (repositories) for each TAL. */
#define MAX_REPO_PER_TAL 1000
+#define HTTP_PROTO "http://"
+#define HTTP_PROTO_LEN (sizeof(HTTP_PROTO) - 1)
+#define HTTPS_PROTO "https://"
+#define HTTPS_PROTO_LEN (sizeof(HTTPS_PROTO) - 1)
+#define RSYNC_PROTO "rsync://"
+#define RSYNC_PROTO_LEN (sizeof(RSYNC_PROTO) - 1)
+
#endif /* ! EXTERN_H */
-/* $OpenBSD: filemode.c,v 1.39 2024/03/19 05:04:13 tb Exp $ */
+/* $OpenBSD: filemode.c,v 1.40 2024/03/22 03:38:12 job Exp $ */
/*
* Copyright (c) 2019 Claudio Jeker <claudio@openbsd.org>
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
if (uri == NULL)
return;
- if (strncmp(uri, "rsync://", strlen("rsync://")) != 0) {
+ if (strncmp(uri, RSYNC_PROTO, RSYNC_PROTO_LEN) != 0) {
warnx("bad CRL distribution point URI %s", uri);
return;
}
- uri += strlen("rsync://");
+ uri += RSYNC_PROTO_LEN;
f = load_file(uri, &flen);
if (f == NULL) {
if (uri == NULL)
return NULL;
- if (strncmp(uri, "rsync://", strlen("rsync://")) != 0) {
+ if (strncmp(uri, RSYNC_PROTO, RSYNC_PROTO_LEN) != 0) {
warnx("bad authority information access URI %s", uri);
return NULL;
}
- uri += strlen("rsync://");
+ uri += RSYNC_PROTO_LEN;
f = load_file(uri, &flen);
if (f == NULL) {
printf("--\n");
}
- if (strncmp(file, "rsync://", strlen("rsync://")) == 0) {
- file += strlen("rsync://");
+ if (strncmp(file, RSYNC_PROTO, RSYNC_PROTO_LEN) == 0) {
+ file += RSYNC_PROTO_LEN;
buf = load_file(file, &len);
if (buf == NULL) {
warn("parse file %s", file);
-/* $OpenBSD: http.c,v 1.81 2024/03/12 16:02:30 job Exp $ */
+/* $OpenBSD: http.c,v 1.82 2024/03/22 03:38:12 job Exp $ */
/*
* Copyright (c) 2020 Nils Fisher <nils_fisher@hotmail.com>
* Copyright (c) 2020 Claudio Jeker <claudio@openbsd.org>
if (uri == NULL)
return;
- if (strncasecmp(uri, "http://", 7) != 0)
+ if (strncasecmp(uri, HTTP_PROTO, HTTP_PROTO_LEN) != 0)
errx(1, "%s: http_proxy not using http schema", http_info(uri));
host = uri + 7;
char *host, *port = NULL, *path;
char *hosttail;
- if (strncasecmp(uri, "https://", 8) != 0) {
+ if (strncasecmp(uri, HTTPS_PROTO, HTTPS_PROTO_LEN) != 0) {
warnx("%s: not using https schema", http_info(uri));
return -1;
}
-/* $OpenBSD: main.c,v 1.254 2024/03/01 09:36:55 job Exp $ */
+/* $OpenBSD: main.c,v 1.255 2024/03/22 03:38:12 job Exp $ */
/*
* Copyright (c) 2021 Claudio Jeker <claudio@openbsd.org>
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
char *nfile;
size_t len = 0;
- if (!filemode || strncmp(file, "rsync://", strlen("rsync://")) != 0) {
+ if (!filemode || strncmp(file, RSYNC_PROTO, RSYNC_PROTO_LEN) != 0) {
buf = load_file(file, &len);
if (buf == NULL)
err(1, "%s", file);
size_t repourisz;
int shortlisted = 0;
- if (strncmp(cert->repo, "rsync://", 8) != 0)
+ if (strncmp(cert->repo, RSYNC_PROTO, RSYNC_PROTO_LEN) != 0)
errx(1, "unexpected protocol");
host = cert->repo + 8;
-/* $OpenBSD: repo.c,v 1.54 2024/02/26 15:40:33 job Exp $ */
+/* $OpenBSD: repo.c,v 1.55 2024/03/22 03:38:12 job Exp $ */
/*
* Copyright (c) 2021 Claudio Jeker <claudio@openbsd.org>
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
if (!rrdpon) {
for (; tr->uriidx < tr->urisz; tr->uriidx++) {
if (strncasecmp(tr->uri[tr->uriidx],
- "rsync://", 8) == 0)
+ RSYNC_PROTO, RSYNC_PROTO_LEN) == 0)
break;
}
}
logx("ta/%s: pulling from %s", tr->descr, tr->uri[tr->uriidx]);
- if (strncasecmp(tr->uri[tr->uriidx], "rsync://", 8) == 0) {
+ if (strncasecmp(tr->uri[tr->uriidx], RSYNC_PROTO,
+ RSYNC_PROTO_LEN) == 0) {
/*
* Create destination location.
* Build up the tree to this point.
char *nfile;
const char *dir = rr->basedir;
- if (!valid_uri(uri, strlen(uri), "rsync://"))
+ if (!valid_uri(uri, strlen(uri), RSYNC_PROTO))
errx(1, "%s: bad URI %s", rr->basedir, uri);
- uri += strlen("rsync://"); /* skip proto */
+ uri += RSYNC_PROTO_LEN; /* skip proto */
if (valid) {
if ((nfile = strdup(uri)) == NULL)
err(1, NULL);
if (rp->ta != NULL) {
const struct tarepo *tr = rp->ta;
if (tr->uriidx < tr->urisz &&
- strncasecmp(tr->uri[tr->uriidx], "rsync://", 8) == 0)
+ strncasecmp(tr->uri[tr->uriidx], RSYNC_PROTO,
+ RSYNC_PROTO_LEN) == 0)
return "rsync";
else
return "https";
-/* $OpenBSD: rrdp_delta.c,v 1.12 2023/12/27 07:17:39 tb Exp $ */
+/* $OpenBSD: rrdp_delta.c,v 1.13 2024/03/22 03:38:12 job Exp $ */
/*
* Copyright (c) 2020 Nils Fisher <nils_fisher@hotmail.com>
* Copyright (c) 2021 Claudio Jeker <claudio@openbsd.org>
for (i = 0; attr[i]; i += 2) {
if (strcmp("uri", attr[i]) == 0 && hasUri++ == 0) {
if (valid_uri(attr[i + 1], strlen(attr[i + 1]),
- "rsync://")) {
+ RSYNC_PROTO)) {
uri = xstrdup(attr[i + 1]);
continue;
}
-/* $OpenBSD: rrdp_notification.c,v 1.19 2023/12/27 07:17:39 tb Exp $ */
+/* $OpenBSD: rrdp_notification.c,v 1.20 2024/03/22 03:38:12 job Exp $ */
/*
* Copyright (c) 2020 Nils Fisher <nils_fisher@hotmail.com>
* Copyright (c) 2021 Claudio Jeker <claudio@openbsd.org>
for (i = 0; attr[i]; i += 2) {
if (strcmp("uri", attr[i]) == 0 && hasUri++ == 0) {
if (valid_uri(attr[i + 1], strlen(attr[i + 1]),
- "https://") &&
+ HTTPS_PROTO) &&
valid_origin(attr[i + 1], nxml->notifyuri)) {
nxml->snapshot_uri = xstrdup(attr[i + 1]);
continue;
for (i = 0; attr[i]; i += 2) {
if (strcmp("uri", attr[i]) == 0 && hasUri++ == 0) {
if (valid_uri(attr[i + 1], strlen(attr[i + 1]),
- "https://") &&
+ HTTPS_PROTO) &&
valid_origin(attr[i + 1], nxml->notifyuri)) {
delta_uri = attr[i + 1];
continue;
-/* $OpenBSD: rrdp_snapshot.c,v 1.8 2023/12/27 07:17:39 tb Exp $ */
+/* $OpenBSD: rrdp_snapshot.c,v 1.9 2024/03/22 03:38:12 job Exp $ */
/*
* Copyright (c) 2020 Nils Fisher <nils_fisher@hotmail.com>
* Copyright (c) 2021 Claudio Jeker <claudio@openbsd.org>
for (i = 0; attr[i]; i += 2) {
if (strcmp("uri", attr[i]) == 0 && hasUri++ == 0) {
if (valid_uri(attr[i + 1], strlen(attr[i + 1]),
- "rsync://")) {
+ RSYNC_PROTO)) {
uri = xstrdup(attr[i + 1]);
continue;
}
-/* $OpenBSD: rsync.c,v 1.49 2024/02/26 20:37:27 job Exp $ */
+/* $OpenBSD: rsync.c,v 1.50 2024/03/22 03:38:12 job Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
char *base_uri;
/* Case-insensitive rsync URI. */
- if (strncasecmp(uri, "rsync://", 8) != 0) {
+ if (strncasecmp(uri, RSYNC_PROTO, RSYNC_PROTO_LEN) != 0) {
warnx("%s: not using rsync schema", uri);
return NULL;
}
-/* $OpenBSD: tal.c,v 1.39 2023/06/29 10:28:25 tb Exp $ */
+/* $OpenBSD: tal.c,v 1.40 2024/03/22 03:38:12 job Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
goto out;
}
/* Check that the URI is sensible */
- if (!(strncasecmp(line, "https://", 8) == 0 ||
- strncasecmp(line, "rsync://", 8) == 0)) {
+ if (!(strncasecmp(line, HTTPS_PROTO, HTTPS_PROTO_LEN) == 0 ||
+ strncasecmp(line, RSYNC_PROTO, RSYNC_PROTO_LEN) == 0)) {
warnx("%s: unsupported URL schema: %s", fn, line);
goto out;
}
-/* $OpenBSD: x509.c,v 1.83 2024/03/20 04:36:30 job Exp $ */
+/* $OpenBSD: x509.c,v 1.84 2024/03/22 03:38:12 job Exp $ */
/*
* Copyright (c) 2022 Theo Buehler <tb@openbsd.org>
* Copyright (c) 2021 Claudio Jeker <claudio@openbsd.org>
if (rsync_found)
continue;
- if (strncasecmp(*sia, "rsync://", 8) == 0) {
- const char *p = *sia + strlen("rsync://");
+ if (strncasecmp(*sia, RSYNC_PROTO, RSYNC_PROTO_LEN) == 0) {
+ const char *p = *sia + RSYNC_PROTO_LEN;
size_t fnlen, plen;
rsync_found = 1;
crl))
goto out;
- if (strncasecmp(*crl, "rsync://", 8) == 0) {
+ if (strncasecmp(*crl, RSYNC_PROTO, RSYNC_PROTO_LEN) == 0) {
rsync_found = 1;
goto out;
}