-/* $OpenBSD: sftp-client.c,v 1.177 2025/03/11 07:48:51 dtucker Exp $ */
+/* $OpenBSD: sftp-client.c,v 1.178 2025/09/02 09:26:21 djm Exp $ */
/*
* Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
*
attr.flags |= SSH2_FILEXFER_ATTR_PERMISSIONS;
if ((msg = sshbuf_new()) == NULL)
- fatal("%s: sshbuf_new failed", __func__);
+ fatal_f("sshbuf_new failed");
attrib_clear(&junk); /* Send empty attributes */
(r = sshbuf_put_cstring(msg, oldpath)) != 0 ||
(r = sshbuf_put_u32(msg, SSH2_FXF_READ)) != 0 ||
(r = encode_attrib(msg, &junk)) != 0)
- fatal("%s: buffer error: %s", __func__, ssh_err(r));
+ fatal_fr(r, "buffer error");
send_msg(conn, msg);
debug3("Sent message SSH2_FXP_OPEN I:%u P:%s", id, oldpath);
(r = sshbuf_put_u32(msg, SSH2_FXF_WRITE|SSH2_FXF_CREAT|
SSH2_FXF_TRUNC)) != 0 ||
(r = encode_attrib(msg, &attr)) != 0)
- fatal("%s: buffer error: %s", __func__, ssh_err(r));
+ fatal_fr(r, "buffer error");
send_msg(conn, msg);
debug3("Sent message SSH2_FXP_OPEN I:%u P:%s", id, newpath);
(r = sshbuf_put_u64(msg, 0)) != 0 ||
(r = sshbuf_put_string(msg, new_handle, new_handle_len)) != 0 ||
(r = sshbuf_put_u64(msg, 0)) != 0)
- fatal("%s: buffer error: %s", __func__, ssh_err(r));
+ fatal_fr(r, "buffer error");
send_msg(conn, msg);
debug3("Sent message copy-data \"%s\" 0 0 -> \"%s\" 0",
oldpath, newpath);
-/* $OpenBSD: sftp-server.c,v 1.148 2024/04/30 06:23:51 djm Exp $ */
+/* $OpenBSD: sftp-server.c,v 1.149 2025/09/02 09:26:21 djm Exp $ */
/*
* Copyright (c) 2000-2004 Markus Friedl. All rights reserved.
*
(r = sshbuf_get_u64(iqueue, &read_len)) != 0 ||
(r = get_handle(iqueue, &write_handle)) != 0 ||
(r = sshbuf_get_u64(iqueue, &write_off)) != 0)
- fatal("%s: buffer error: %s", __func__, ssh_err(r));
+ fatal_fr(r, "buffer error");
debug("request %u: copy-data from \"%s\" (handle %d) off %llu len %llu "
"to \"%s\" (handle %d) off %llu",
if (lseek(read_fd, read_off, SEEK_SET) < 0) {
status = errno_to_portable(errno);
- error("%s: read_seek failed", __func__);
+ error_f("read_seek failed");
goto out;
}
if ((handle_to_flags(write_handle) & O_APPEND) == 0 &&
lseek(write_fd, write_off, SEEK_SET) < 0) {
status = errno_to_portable(errno);
- error("%s: write_seek failed", __func__);
+ error_f("write_seek failed");
goto out;
}
break;
} else if (ret == 0) {
status = errno_to_portable(errno);
- error("%s: read failed: %s", __func__, strerror(errno));
+ error_f("read failed: %s", strerror(errno));
break;
}
len = ret;
debug("%s: max connections %d, per source %d, masks %d,%d", __func__,
max, persource, ipv4len, ipv6len);
if (max <= 0)
- fatal("%s: invalid number of sockets: %d", __func__, max);
+ fatal_f("invalid number of sockets: %d", max);
children = xcalloc(max_children, sizeof(*children));
for (i = 0; i < max_children; i++)
children[i].id = -1;
if (max_persource == INT_MAX) /* no limit */
return 1;
- debug("%s: sock %d id %d limit %d", __func__, sock, id, max_persource);
+ debug_f("sock %d id %d limit %d", sock, id, max_persource);
if (srclimit_peer_addr(sock, &xa) != 0)
return 1;
bits = xa.af == AF_INET ? ipv4_masklen : ipv6_masklen;
}
}
if (addr_ntop(&xa, xas, sizeof(xas)) != 0) {
- debug3("%s: addr ntop failed", __func__);
+ debug3_f("addr ntop failed");
return 1;
}
debug3("%s: new unauthenticated connection from %s/%d, at %d of %d",
__func__, xas, bits, count, max_persource);
if (first_unused == max_children) { /* no free slot found */
- debug3("%s: no free slot", __func__);
+ debug3_f("no free slot");
return 0;
}
if (first_unused < 0 || first_unused >= max_children)
if (max_persource == INT_MAX) /* no limit */
return;
- debug("%s: id %d", __func__, id);
+ debug_f("id %d", id);
/* Clear corresponding state entry. */
for (i = 0; i < max_children; i++) {
if (children[i].id == id) {