diff options
author | 2017-01-24 12:53:52 +0000 | |
---|---|---|
committer | 2017-01-24 12:53:52 +0000 | |
commit | 4de82fa3a83bf6e7c7d532d2e857f37371311ccc (patch) | |
tree | a79aed0657a3b167a6665aa2f75d661ec8ce7e8c | |
parent | correct usage format; ok beck claudio benno (diff) | |
download | wireguard-openbsd-4de82fa3a83bf6e7c7d532d2e857f37371311ccc.tar.xz wireguard-openbsd-4de82fa3a83bf6e7c7d532d2e857f37371311ccc.zip |
Complete jsing's coccinelle cleanup... by hand
ok jsing
-rw-r--r-- | usr.sbin/acme-client/chngproc.c | 8 | ||||
-rw-r--r-- | usr.sbin/acme-client/dnsproc.c | 8 | ||||
-rw-r--r-- | usr.sbin/acme-client/fileproc.c | 4 | ||||
-rw-r--r-- | usr.sbin/acme-client/http.c | 6 | ||||
-rw-r--r-- | usr.sbin/acme-client/json.c | 4 | ||||
-rw-r--r-- | usr.sbin/acme-client/keyproc.c | 36 | ||||
-rw-r--r-- | usr.sbin/acme-client/main.c | 4 | ||||
-rw-r--r-- | usr.sbin/acme-client/parse.y | 8 | ||||
-rw-r--r-- | usr.sbin/acme-client/revokeproc.c | 12 | ||||
-rw-r--r-- | usr.sbin/acme-client/util.c | 4 |
10 files changed, 47 insertions, 47 deletions
diff --git a/usr.sbin/acme-client/chngproc.c b/usr.sbin/acme-client/chngproc.c index 5562c2e79b4..4af466b6ae8 100644 --- a/usr.sbin/acme-client/chngproc.c +++ b/usr.sbin/acme-client/chngproc.c @@ -1,4 +1,4 @@ -/* $Id: chngproc.c,v 1.10 2017/01/24 12:05:14 jsing Exp $ */ +/* $Id: chngproc.c,v 1.11 2017/01/24 12:53:52 deraadt Exp $ */ /* * Copyright (c) 2016 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -61,13 +61,13 @@ chngproc(int netsock, const char *root) else if (lval == CHNG_SYN) op = lval; - if (CHNG__MAX == op) { + if (op == CHNG__MAX) { warnx("unknown operation from netproc"); goto out; - } else if (CHNG_STOP == op) + } else if (op == CHNG_STOP) break; - assert(CHNG_SYN == op); + assert(op == CHNG_SYN); /* * Read the thumbprint and token. diff --git a/usr.sbin/acme-client/dnsproc.c b/usr.sbin/acme-client/dnsproc.c index 897363d83bf..cdfe32f6c4d 100644 --- a/usr.sbin/acme-client/dnsproc.c +++ b/usr.sbin/acme-client/dnsproc.c @@ -1,4 +1,4 @@ -/* $Id: dnsproc.c,v 1.7 2017/01/24 12:05:14 jsing Exp $ */ +/* $Id: dnsproc.c,v 1.8 2017/01/24 12:53:52 deraadt Exp $ */ /* * Copyright (c) 2016 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -75,7 +75,7 @@ host_dns(const char *s, struct addr *vec) if (error) { warnx("%s: parse error: %s", - s, gai_strerror(error)); + s, gai_strerror(error)); return(-1); } @@ -138,10 +138,10 @@ dnsproc(int nfd) else if (lval == DNS_LOOKUP) op = lval; - if (DNS__MAX == op) { + if (op == DNS__MAX) { warnx("unknown operation from netproc"); goto out; - } else if (DNS_STOP == op) + } else if (op == DNS_STOP) break; if ((look = readstr(nfd, COMM_DNSQ)) == NULL) diff --git a/usr.sbin/acme-client/fileproc.c b/usr.sbin/acme-client/fileproc.c index df881ddcbf4..d19c26de1f7 100644 --- a/usr.sbin/acme-client/fileproc.c +++ b/usr.sbin/acme-client/fileproc.c @@ -1,4 +1,4 @@ -/* $Id: fileproc.c,v 1.12 2017/01/24 12:05:14 jsing Exp $ */ +/* $Id: fileproc.c,v 1.13 2017/01/24 12:53:52 deraadt Exp $ */ /* * Copyright (c) 2016 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -45,7 +45,7 @@ serialise(const char *tmp, const char *real, warnx("%s", tmp); close(fd); return (0); - } else if (v2 != NULL && (ssize_t)v2sz != write(fd, v2, v2sz)) { + } else if (v2 != NULL && write(fd, v2, v2sz) != (ssize_t)v2sz) { warnx("%s", tmp); close(fd); return (0); diff --git a/usr.sbin/acme-client/http.c b/usr.sbin/acme-client/http.c index 1ab0b98a66b..09ceb95b7cc 100644 --- a/usr.sbin/acme-client/http.c +++ b/usr.sbin/acme-client/http.c @@ -1,4 +1,4 @@ -/* $Id: http.c,v 1.16 2017/01/24 12:05:14 jsing Exp $ */ +/* $Id: http.c,v 1.17 2017/01/24 12:53:52 deraadt Exp $ */ /* * Copyright (c) 2016 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -359,7 +359,7 @@ http_open(const struct http *http, const void *p, size_t psz) } else if (!http_write(req, c, http)) { free(req); return (NULL); - } else if (p != NULL && ! http_write(p, psz, http)) { + } else if (p != NULL && !http_write(p, psz, http)) { free(req); return (NULL); } @@ -765,7 +765,7 @@ main(void) NULL, 0); #endif - if (NULL == g) + if (g == NULL) errx(EXIT_FAILURE, "http_get"); httph = http_head_parse(g->http, g->xfer, &httphsz); diff --git a/usr.sbin/acme-client/json.c b/usr.sbin/acme-client/json.c index 70c67862428..f30797fdcb1 100644 --- a/usr.sbin/acme-client/json.c +++ b/usr.sbin/acme-client/json.c @@ -1,4 +1,4 @@ -/* $Id: json.c,v 1.7 2017/01/24 12:05:14 jsing Exp $ */ +/* $Id: json.c,v 1.8 2017/01/24 12:53:52 deraadt Exp $ */ /* * Copyright (c) 2016 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -383,7 +383,7 @@ json_parse_capaths(struct jsmnn *n, struct capaths *p) p->revokecert = json_getstr(n, "revoke-cert"); return (p->newauthz != NULL && p->newcert != NULL && - p->newreg != NULL && p->revokecert != NULL); + p->newreg != NULL && p->revokecert != NULL); } /* diff --git a/usr.sbin/acme-client/keyproc.c b/usr.sbin/acme-client/keyproc.c index 232670e933b..2ae14e114b5 100644 --- a/usr.sbin/acme-client/keyproc.c +++ b/usr.sbin/acme-client/keyproc.c @@ -1,4 +1,4 @@ -/* $Id: keyproc.c,v 1.7 2016/09/13 17:13:37 deraadt Exp $ */ +/* $Id: keyproc.c,v 1.8 2017/01/24 12:53:52 deraadt Exp $ */ /* * Copyright (c) 2016 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -53,12 +53,12 @@ add_ext(STACK_OF(X509_EXTENSION) *sk, int nid, const char *value) * This leaks memory, but bounded to the number of SANs. */ - if (NULL == (cp = strdup(value))) { + if ((cp = strdup(value)) == NULL) { warn("strdup"); return (0); } ex = X509V3_EXT_conf_nid(NULL, NULL, nid, cp); - if (NULL == ex) { + if (ex == NULL) { warnx("X509V3_EXT_conf_nid"); free(cp); return (0); @@ -99,7 +99,7 @@ keyproc(int netsock, const char *keyfile, f = fopen(keyfile, newkey ? "wx" : "r"); umask(prev); - if (NULL == f) { + if (f == NULL) { warn("%s", keyfile); goto out; } @@ -114,11 +114,11 @@ keyproc(int netsock, const char *keyfile, } if (newkey) { - if (NULL == (pkey = rsa_key_create(f, keyfile))) + if ((pkey = rsa_key_create(f, keyfile)) == NULL) goto out; dodbg("%s: generated RSA domain key", keyfile); } else { - if (NULL == (pkey = rsa_key_load(f, keyfile))) + if ((pkey = rsa_key_load(f, keyfile)) == NULL) goto out; doddbg("%s: loaded RSA domain key", keyfile); } @@ -131,7 +131,7 @@ keyproc(int netsock, const char *keyfile, * Then set it as the X509 requester's key. */ - if (NULL == (x = X509_REQ_new())) { + if ((x = X509_REQ_new()) == NULL) { warnx("X509_new"); goto out; } else if (!X509_REQ_set_pubkey(x, pkey)) { @@ -141,7 +141,7 @@ keyproc(int netsock, const char *keyfile, /* Now specify the common name that we'll request. */ - if (NULL == (name = X509_NAME_new())) { + if ((name = X509_NAME_new()) == NULL) { warnx("X509_NAME_new"); goto out; } else if (!X509_NAME_add_entry_by_txt(name, "CN", @@ -163,12 +163,12 @@ keyproc(int netsock, const char *keyfile, if (altsz > 1) { nid = NID_subject_alt_name; - if (NULL == (exts = sk_X509_EXTENSION_new_null())) { + if ((exts = sk_X509_EXTENSION_new_null()) == NULL) { warnx("sk_X509_EXTENSION_new_null"); goto out; } /* Initialise to empty string. */ - if (NULL == (sans = strdup(""))) { + if ((sans = strdup("")) == NULL) { warn("strdup"); goto out; } @@ -183,12 +183,12 @@ keyproc(int netsock, const char *keyfile, for (i = 1; i < altsz; i++) { cc = asprintf(&san, "%sDNS:%s", i > 1 ? "," : "", alts[i]); - if (-1 == cc) { + if (cc == -1) { warn("asprintf"); goto out; } pp = realloc(sans, sansz + strlen(san)); - if (NULL == pp) { + if (pp == NULL) { warn("realloc"); goto out; } @@ -221,13 +221,13 @@ keyproc(int netsock, const char *keyfile, if ((len = i2d_X509_REQ(x, NULL)) < 0) { warnx("i2d_X509"); goto out; - } else if (NULL == (der = dercp = malloc(len))) { + } else if ((der = dercp = malloc(len)) == NULL) { warn("malloc"); goto out; } else if (len != i2d_X509_REQ(x, (u_char **)&dercp)) { warnx("i2d_X509"); goto out; - } else if (NULL == (der64 = base64buf_url(der, len))) { + } else if ((der64 = base64buf_url(der, len)) == NULL) { warnx("base64buf_url"); goto out; } @@ -246,17 +246,17 @@ keyproc(int netsock, const char *keyfile, rc = 1; out: close(netsock); - if (NULL != f) + if (f != NULL) fclose(f); free(der); free(der64); free(sans); free(san); - if (NULL != x) + if (x != NULL) X509_REQ_free(x); - if (NULL != name) + if (name != NULL) X509_NAME_free(name); - if (NULL != pkey) + if (pkey != NULL) EVP_PKEY_free(pkey); ERR_print_errors_fp(stderr); ERR_free_strings(); diff --git a/usr.sbin/acme-client/main.c b/usr.sbin/acme-client/main.c index 97548446635..ad887256028 100644 --- a/usr.sbin/acme-client/main.c +++ b/usr.sbin/acme-client/main.c @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.31 2017/01/24 12:38:41 deraadt Exp $ */ +/* $Id: main.c,v 1.32 2017/01/24 12:53:52 deraadt Exp $ */ /* * Copyright (c) 2016 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -431,7 +431,7 @@ main(int argc, char *argv[]) free(alts); return (rc != COMP__MAX ? EXIT_FAILURE : - (c == 2 ? EXIT_SUCCESS : 2)); + (c == 2 ? EXIT_SUCCESS : 2)); usage: fprintf(stderr, "usage: acme-client [-ADFnrv] [-f configfile] domain\n"); diff --git a/usr.sbin/acme-client/parse.y b/usr.sbin/acme-client/parse.y index 0f43129ef04..1595b52a752 100644 --- a/usr.sbin/acme-client/parse.y +++ b/usr.sbin/acme-client/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.15 2017/01/23 03:31:33 deraadt Exp $ */ +/* $OpenBSD: parse.y,v 1.16 2017/01/24 12:53:52 deraadt Exp $ */ /* * Copyright (c) 2016 Kristaps Dzonsons <kristaps@bsd.lv> @@ -1012,9 +1012,9 @@ int domain_valid(const char *cp) { - for ( ; '\0' != *cp; cp++) - if (!('.' == *cp || '-' == *cp || - '_' == *cp || isalnum((int)*cp))) + for ( ; *cp != '\0'; cp++) + if (!(*cp == '.' || *cp == '-' || + *cp == '_' || isalnum((int)*cp))) return (0); return (1); } diff --git a/usr.sbin/acme-client/revokeproc.c b/usr.sbin/acme-client/revokeproc.c index ae5d89a61ce..101e321843c 100644 --- a/usr.sbin/acme-client/revokeproc.c +++ b/usr.sbin/acme-client/revokeproc.c @@ -1,4 +1,4 @@ -/* $Id: revokeproc.c,v 1.10 2017/01/24 12:05:14 jsing Exp $ */ +/* $Id: revokeproc.c,v 1.11 2017/01/24 12:53:52 deraadt Exp $ */ /* * Copyright (c) 2016 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -143,7 +143,7 @@ revokeproc(int fd, const char *certdir, const char *certfile, int force, warnx("%s/%s: no certificate found", certdir, certfile); (void)writeop(fd, COMM_REVOKE_RESP, REVOKE_OK); goto out; - } else if (f == NULL && ! revocate) { + } else if (f == NULL && !revocate) { if (writeop(fd, COMM_REVOKE_RESP, REVOKE_EXP) >= 0) rc = 1; goto out; @@ -292,7 +292,7 @@ revokeproc(int fd, const char *certdir, const char *certfile, int force, rop = time(NULL) >= (t - RENEW_ALLOW) ? REVOKE_EXP : REVOKE_OK; - if (REVOKE_EXP == rop) + if (rop == REVOKE_EXP) dodbg("%s/%s: certificate renewable: %lld days left", certdir, certfile, (long long)(t - time(NULL)) / 24 / 60 / 60); @@ -301,7 +301,7 @@ revokeproc(int fd, const char *certdir, const char *certfile, int force, certdir, certfile, (long long)(t - time(NULL)) / 24 / 60 / 60); - if (REVOKE_OK == rop && force) { + if (rop == REVOKE_OK && force) { warnx("%s/%s: forcing renewal", certdir, certfile); rop = REVOKE_EXP; } @@ -322,10 +322,10 @@ revokeproc(int fd, const char *certdir, const char *certfile, int force, else if (lval == REVOKE_CHECK) op = lval; - if (REVOKE__MAX == op) { + if (op == REVOKE__MAX) { warnx("unknown operation from netproc"); goto out; - } else if (REVOKE_STOP == op) { + } else if (op == REVOKE_STOP) { rc = 1; goto out; } diff --git a/usr.sbin/acme-client/util.c b/usr.sbin/acme-client/util.c index f44080903a4..6e7653ce83d 100644 --- a/usr.sbin/acme-client/util.c +++ b/usr.sbin/acme-client/util.c @@ -1,4 +1,4 @@ -/* $Id: util.c,v 1.7 2017/01/24 12:05:14 jsing Exp $ */ +/* $Id: util.c,v 1.8 2017/01/24 12:53:52 deraadt Exp $ */ /* * Copyright (c) 2016 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -225,7 +225,7 @@ writebuf(int fd, enum comm comm, const void *v, size_t sz) warnx("short write: %s length", comms[comm]); else if ((ssz = write(fd, v, sz)) < 0) warn("write: %s", comms[comm]); - else if ((size_t)ssz != sz) + else if (sz != (size_t)ssz) warnx("short write: %s", comms[comm]); else rc = 1; |