-/* $OpenBSD: compress_gzip.c,v 1.10 2015/12/28 22:08:30 jung Exp $ */
+/* $OpenBSD: compress_gzip.c,v 1.11 2021/01/23 16:11:11 rob Exp $ */
/*
* Copyright (c) 2012 Gilles Chehade <gilles@poolp.org>
{
gzFile gzf;
char ibuf[GZIP_BUFFER_SIZE];
- int r, w;
+ int r;
int ret = 0;
if (in == NULL || out == NULL)
return (0);
while ((r = fread(ibuf, 1, GZIP_BUFFER_SIZE, in)) != 0) {
- if ((w = gzwrite(gzf, ibuf, r)) != r)
+ if (gzwrite(gzf, ibuf, r) != r)
goto end;
}
if (!feof(in))
{
gzFile gzf;
char obuf[GZIP_BUFFER_SIZE];
- int r, w;
+ int r;
int ret = 0;
if (in == NULL || out == NULL)
return (0);
while ((r = gzread(gzf, obuf, sizeof(obuf))) > 0) {
- if ((w = fwrite(obuf, r, 1, out)) != 1)
+ if (fwrite(obuf, r, 1, out) != 1)
goto end;
}
if (!gzeof(gzf))
-/* $OpenBSD: crypto.c,v 1.8 2019/06/28 13:32:50 deraadt Exp $ */
+/* $OpenBSD: crypto.c,v 1.9 2021/01/23 16:11:11 rob Exp $ */
/*
* Copyright (c) 2013 Gilles Chehade <gilles@openbsd.org>
uint8_t iv[IV_SIZE];
uint8_t tag[GCM_TAG_SIZE];
uint8_t version = API_VERSION;
- size_t r, w;
+ size_t r;
int len;
int ret = 0;
struct stat sb;
return 0;
/* prepend version byte*/
- if ((w = fwrite(&version, 1, sizeof version, out)) != sizeof version)
+ if (fwrite(&version, 1, sizeof version, out) != sizeof version)
return 0;
/* generate and prepend IV */
memset(iv, 0, sizeof iv);
arc4random_buf(iv, sizeof iv);
- if ((w = fwrite(iv, 1, sizeof iv, out)) != sizeof iv)
+ if (fwrite(iv, 1, sizeof iv, out) != sizeof iv)
return 0;
ctx = EVP_CIPHER_CTX_new();
while ((r = fread(ibuf, 1, CRYPTO_BUFFER_SIZE, in)) != 0) {
if (!EVP_EncryptUpdate(ctx, obuf, &len, ibuf, r))
goto end;
- if (len && (w = fwrite(obuf, len, 1, out)) != 1)
+ if (len && fwrite(obuf, len, 1, out) != 1)
goto end;
}
if (!feof(in))
/* finalize and write last chunk if any */
if (!EVP_EncryptFinal_ex(ctx, obuf, &len))
goto end;
- if (len && (w = fwrite(obuf, len, 1, out)) != 1)
+ if (len && fwrite(obuf, len, 1, out) != 1)
goto end;
/* get and append tag */
EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_GET_TAG, sizeof tag, tag);
- if ((w = fwrite(tag, sizeof tag, 1, out)) != 1)
+ if (fwrite(tag, sizeof tag, 1, out) != 1)
goto end;
fflush(out);
uint8_t iv[IV_SIZE];
uint8_t tag[GCM_TAG_SIZE];
uint8_t version;
- size_t r, w;
+ size_t r;
off_t sz;
int len;
int ret = 0;
break;
if (!EVP_DecryptUpdate(ctx, obuf, &len, ibuf, r))
goto end;
- if (len && (w = fwrite(obuf, len, 1, out)) != 1)
+ if (len && fwrite(obuf, len, 1, out) != 1)
goto end;
sz -= r;
}
/* finalize, write last chunk if any and perform authentication check */
if (!EVP_DecryptFinal_ex(ctx, obuf, &len))
goto end;
- if (len && (w = fwrite(obuf, len, 1, out)) != 1)
+ if (len && fwrite(obuf, len, 1, out) != 1)
goto end;
fflush(out);
-/* $OpenBSD: iobuf.c,v 1.13 2020/04/24 11:34:07 eric Exp $ */
+/* $OpenBSD: iobuf.c,v 1.14 2021/01/23 16:11:11 rob Exp $ */
/*
* Copyright (c) 2012 Eric Faurot <eric@openbsd.org>
*
iobuf_write_tls(struct iobuf *io, void *tls)
{
struct ioqbuf *q;
- int r;
ssize_t n;
q = io->outq;
n = SSL_write(tls, q->buf + q->rpos, q->wpos - q->rpos);
if (n <= 0) {
- switch ((r = SSL_get_error(tls, n))) {
+ switch (SSL_get_error(tls, n)) {
case SSL_ERROR_WANT_READ:
return (IOBUF_WANT_READ);
case SSL_ERROR_WANT_WRITE:
iobuf_read_tls(struct iobuf *io, void *tls)
{
ssize_t n;
- int r;
n = SSL_read(tls, io->buf + io->wpos, iobuf_left(io));
if (n < 0) {
- switch ((r = SSL_get_error(tls, n))) {
+ switch (SSL_get_error(tls, n)) {
case SSL_ERROR_WANT_READ:
return (IOBUF_WANT_READ);
case SSL_ERROR_WANT_WRITE:
-/* $OpenBSD: ioev.c,v 1.42 2019/06/12 17:42:53 eric Exp $ */
+/* $OpenBSD: ioev.c,v 1.43 2021/01/23 16:11:11 rob Exp $ */
/*
* Copyright (c) 2012 Eric Faurot <eric@openbsd.org>
*
io_dispatch_accept_tls(int fd, short event, void *humppa)
{
struct io *io = humppa;
- int e, ret;
+ int ret;
io_frame_enter("io_dispatch_accept_tls", io, event);
goto leave;
}
- switch ((e = SSL_get_error(io->tls, ret))) {
+ switch (SSL_get_error(io->tls, ret)) {
case SSL_ERROR_WANT_READ:
io_reset(io, EV_READ, io_dispatch_accept_tls);
break;
io_dispatch_connect_tls(int fd, short event, void *humppa)
{
struct io *io = humppa;
- int e, ret;
+ int ret;
io_frame_enter("io_dispatch_connect_tls", io, event);
goto leave;
}
- switch ((e = SSL_get_error(io->tls, ret))) {
+ switch (SSL_get_error(io->tls, ret)) {
case SSL_ERROR_WANT_READ:
io_reset(io, EV_READ, io_dispatch_connect_tls);
break;
-/* $OpenBSD: lka_filter.c,v 1.66 2020/12/31 08:27:15 martijn Exp $ */
+/* $OpenBSD: lka_filter.c,v 1.67 2021/01/23 16:11:11 rob Exp $ */
/*
* Copyright (c) 2018 Gilles Chehade <gilles@poolp.org>
TAILQ_HEAD(, filter_entry) chain[nitems(filter_execs)];
};
-static struct dict filter_smtp_in;
-
static struct tree sessions;
static int filters_inited;
void
lka_filter_register_hook(const char *name, const char *hook)
{
- struct dict *subsystem;
struct filter *filter;
const char *filter_name;
void *iter;
size_t i;
if (strncasecmp(hook, "smtp-in|", 8) == 0) {
- subsystem = &filter_smtp_in;
hook += 8;
}
else
{
char *line = NULL;
size_t linesize = 0;
- ssize_t linelen;
- while ((linelen = getline(&line, &linesize, stdin)) != -1) {
+ while (getline(&line, &linesize, stdin) != -1) {
line[strcspn(line, "\n")] = '\0';
if (line[0] == '.')
fprintf(conn, ".");
FILE *fp;
char *line = NULL;
size_t linesize = 0;
- ssize_t linelen;
struct stat sb;
char *home;
char *extension;
if ((fp = fdopen(fd, "w")) == NULL)
err(EX_TEMPFAIL, NULL);
- while ((linelen = getline(&line, &linesize, stdin)) != -1) {
+ while (getline(&line, &linesize, stdin) != -1) {
line[strcspn(line, "\n")] = '\0';
if (line[0] == '\0')
in_hdr = 0;
FILE *fp;
char *line = NULL;
size_t linesize = 0;
- ssize_t linelen;
time_t now;
time(&now);
err(EX_TEMPFAIL, NULL);
fprintf(fp, "From %s %s", sender, ctime(&now));
- while ((linelen = getline(&line, &linesize, stdin)) != -1) {
+ while (getline(&line, &linesize, stdin) != -1) {
line[strcspn(line, "\n")] = '\0';
if (strncmp(line, "From ", 5) == 0)
fprintf(fp, ">%s\n", line);
-/* $OpenBSD: parse.y,v 1.283 2021/01/19 09:16:20 claudio Exp $ */
+/* $OpenBSD: parse.y,v 1.284 2021/01/23 16:11:11 rob Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
filterel:
STRING {
struct filter_config *fr;
- struct filter_proc *fp;
size_t i;
if ((fr = dict_get(conf->sc_filters_dict, $1)) == NULL) {
}
if (fr->proc) {
- if ((fp = dict_get(&filter_config->chain_procs, fr->proc))) {
+ if (dict_get(&filter_config->chain_procs, fr->proc)) {
yyerror("no proc allowed twice within a filter chain: %s", fr->proc);
free($1);
YYERROR;
filter:
FILTER STRING PROC STRING {
- struct filter_proc *fp;
if (dict_get(conf->sc_filters_dict, $2)) {
yyerror("filter already exists with that name: %s", $2);
free($4);
YYERROR;
}
- if ((fp = dict_get(conf->sc_filter_processes_dict, $4)) == NULL) {
+ if (dict_get(conf->sc_filter_processes_dict, $4) == NULL) {
yyerror("no processor exist with that name: %s", $4);
free($4);
YYERROR;
-/* $OpenBSD: table_db.c,v 1.21 2019/06/28 13:32:51 deraadt Exp $ */
+/* $OpenBSD: table_db.c,v 1.22 2021/01/23 16:11:11 rob Exp $ */
/*
* Copyright (c) 2011 Gilles Chehade <gilles@poolp.org>
table_db_get_entry(void *hdl, const char *key, size_t *len)
{
struct dbhandle *handle = hdl;
- int ret;
DBT dbk;
DBT dbv;
char pkey[LINE_MAX];
dbk.data = pkey;
dbk.size = strlen(pkey) + 1;
- if ((ret = handle->db->get(handle->db, &dbk, &dbv, 0)) != 0)
+ if (handle->db->get(handle->db, &dbk, &dbv, 0) != 0)
return NULL;
*len = dbv.size;