diff options
author | Theo Buehler <tb@cvs.openbsd.org> | 2024-11-14 10:29:00 +0000 |
---|---|---|
committer | Theo Buehler <tb@cvs.openbsd.org> | 2024-11-14 10:29:00 +0000 |
commit | 3850aff5396d12401f386a395f4eea0dd9608654 (patch) | |
tree | 15c4ed5368e6f2cbb5134e7ab74c36f4fa6fdc88 | |
parent | 391ad8b84bc915c3a9d41dc5fef57e87efbfc592 (diff) |
rpki-client: use macros for skipping rather than hardcoded numbers
ok claudio
-rw-r--r-- | usr.sbin/rpki-client/http.c | 6 | ||||
-rw-r--r-- | usr.sbin/rpki-client/main.c | 4 | ||||
-rw-r--r-- | usr.sbin/rpki-client/rsync.c | 4 |
3 files changed, 7 insertions, 7 deletions
diff --git a/usr.sbin/rpki-client/http.c b/usr.sbin/rpki-client/http.c index bc4af4ba263..020c48ed759 100644 --- a/usr.sbin/rpki-client/http.c +++ b/usr.sbin/rpki-client/http.c @@ -1,4 +1,4 @@ -/* $OpenBSD: http.c,v 1.87 2024/09/08 07:23:36 tb Exp $ */ +/* $OpenBSD: http.c,v 1.88 2024/11/14 10:28:59 tb Exp $ */ /* * Copyright (c) 2020 Nils Fisher <nils_fisher@hotmail.com> * Copyright (c) 2020 Claudio Jeker <claudio@openbsd.org> @@ -415,7 +415,7 @@ proxy_parse_uri(char *uri) if (strncasecmp(uri, HTTP_PROTO, HTTP_PROTO_LEN) != 0) errx(1, "%s: http_proxy not using http schema", http_info(uri)); - host = uri + 7; + host = uri + HTTP_PROTO_LEN; if ((fullhost = strndup(host, strcspn(host, "/"))) == NULL) err(1, NULL); @@ -483,7 +483,7 @@ http_parse_uri(char *uri, char **ohost, char **oport, char **opath) warnx("%s: not using https schema", http_info(uri)); return -1; } - host = uri + 8; + host = uri + HTTPS_PROTO_LEN; if ((path = strchr(host, '/')) == NULL) { warnx("%s: missing https path", http_info(uri)); return -1; diff --git a/usr.sbin/rpki-client/main.c b/usr.sbin/rpki-client/main.c index c74bb69642e..13325062999 100644 --- a/usr.sbin/rpki-client/main.c +++ b/usr.sbin/rpki-client/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.270 2024/11/13 12:51:04 tb Exp $ */ +/* $OpenBSD: main.c,v 1.271 2024/11/14 10:28:59 tb Exp $ */ /* * Copyright (c) 2021 Claudio Jeker <claudio@openbsd.org> * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv> @@ -500,7 +500,7 @@ queue_add_from_cert(const struct cert *cert) if (strncmp(cert->repo, RSYNC_PROTO, RSYNC_PROTO_LEN) != 0) errx(1, "unexpected protocol"); - host = cert->repo + 8; + host = cert->repo + RSYNC_PROTO_LEN; LIST_FOREACH(le, &skiplist, entry) { if (strncasecmp(host, le->fqdn, strcspn(host, "/")) == 0) { diff --git a/usr.sbin/rpki-client/rsync.c b/usr.sbin/rpki-client/rsync.c index 2a83b78bfea..ad4ce6f87f3 100644 --- a/usr.sbin/rpki-client/rsync.c +++ b/usr.sbin/rpki-client/rsync.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rsync.c,v 1.51 2024/08/20 13:31:49 claudio Exp $ */ +/* $OpenBSD: rsync.c,v 1.52 2024/11/14 10:28:59 tb Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -71,7 +71,7 @@ rsync_base_uri(const char *uri) } /* Parse the non-zero-length hostname. */ - host = uri + 8; + host = uri + RSYNC_PROTO_LEN; if ((module = strchr(host, '/')) == NULL) { warnx("%s: missing rsync module", uri); |