From 690526fec2fb7958b621f3f6ac77c9612f1e73dc Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Sun, 5 Sep 2021 16:47:48 -0400 Subject: Use EX_USAGE for all local configuration errors --- bounce.c | 4 ++-- ring.c | 2 +- state.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bounce.c b/bounce.c index 3976836..515f7d7 100644 --- a/bounce.c +++ b/bounce.c @@ -296,7 +296,7 @@ int main(int argc, char *argv[]) { break; default: return EX_USAGE; } } - if (blindReq & CapUnsupported) errx(EX_CONFIG, "unsupported capability"); + if (blindReq & CapUnsupported) errx(EX_USAGE, "unsupported capability"); if (genPath) genCert(genPath, caPath); if (bindPath[0]) { @@ -330,7 +330,7 @@ int main(int argc, char *argv[]) { if (!real) real = nick; if (!clientAway) clientAway = "pounced :3"; if (clientPass && clientPass[0] != '$') { - errx(EX_CONFIG, "password must be hashed with -x"); + errx(EX_USAGE, "password must be hashed with -x"); } if (printCert) { diff --git a/ring.c b/ring.c index ed2c078..735d780 100644 --- a/ring.c +++ b/ring.c @@ -44,7 +44,7 @@ static struct { void ringAlloc(size_t len) { if (len & (len - 1)) { - errx(EX_CONFIG, "ring length must be power of two: %zu", len); + errx(EX_USAGE, "ring length must be power of two: %zu", len); } ring.lines = calloc(len, sizeof(*ring.lines)); if (!ring.lines) err(EX_OSERR, "calloc"); diff --git a/state.c b/state.c index 7a12afa..cb9419d 100644 --- a/state.c +++ b/state.c @@ -63,10 +63,10 @@ void stateLogin( if (plain) { byte buf[AuthLen] = {0}; size_t len = 1 + strlen(plain); - if (len > sizeof(buf)) errx(EX_CONFIG, "SASL PLAIN too long"); + if (len > sizeof(buf)) errx(EX_USAGE, "SASL PLAIN too long"); memcpy(&buf[1], plain, len - 1); byte *sep = memchr(buf, ':', len); - if (!sep) errx(EX_CONFIG, "SASL PLAIN missing colon"); + if (!sep) errx(EX_USAGE, "SASL PLAIN missing colon"); *sep = 0; base64(plainBase64, buf, len); explicit_bzero(buf, len); -- cgit 1.4.1