Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused parameters from functions from which it is safe to do so #411

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 9 additions & 12 deletions channels.c
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ channel_set_xtype(struct ssh *ssh, int id, const char *xctype)
* when the channel consumer/producer is ready, e.g. shell exec'd
*/
static void
channel_register_fds(struct ssh *ssh, Channel *c, int rfd, int wfd, int efd,
channel_register_fds(Channel *c, int rfd, int wfd, int efd,
int extusage, int nonblock, int is_tty)
{
int val;
Expand Down Expand Up @@ -488,7 +488,7 @@ channel_new(struct ssh *ssh, char *ctype, int type, int rfd, int wfd, int efd,
fatal_fr(r, "sshbuf_set_max_size");
c->ostate = CHAN_OUTPUT_OPEN;
c->istate = CHAN_INPUT_OPEN;
channel_register_fds(ssh, c, rfd, wfd, efd, extusage, nonblock, 0);
channel_register_fds(c, rfd, wfd, efd, extusage, nonblock, 0);
c->self = found;
c->type = type;
c->ctype = ctype;
Expand Down Expand Up @@ -1195,7 +1195,7 @@ channel_set_fds(struct ssh *ssh, int id, int rfd, int wfd, int efd,
if (!c->have_remote_id)
fatal_f("channel %d: no remote id", c->self);

channel_register_fds(ssh, c, rfd, wfd, efd, extusage, nonblock, is_tty);
channel_register_fds(c, rfd, wfd, efd, extusage, nonblock, is_tty);
c->type = SSH_CHANNEL_OPEN;
c->lastused = monotime();
c->local_window = c->local_window_max = window_max;
Expand Down Expand Up @@ -1667,7 +1667,7 @@ channel_connect_stdio_fwd(struct ssh *ssh,
c->listening_port = 0;
c->force_drain = 1;

channel_register_fds(ssh, c, in, out, -1, 0, 1, 0);
channel_register_fds(c, in, out, -1, 0, 1, 0);
port_open_helper(ssh, c, port_to_connect == PORT_STREAMLOCAL ?
"direct-streamlocal@openssh.com" : "direct-tcpip");

Expand Down Expand Up @@ -4632,7 +4632,7 @@ channel_connect_ctx_free(struct channel_connect *cctx)
*/
static int
connect_to_helper(struct ssh *ssh, const char *name, int port, int socktype,
char *ctype, char *rname, struct channel_connect *cctx,
struct channel_connect *cctx,
int *reason, const char **errmsg)
{
struct addrinfo hints;
Expand Down Expand Up @@ -4705,8 +4705,7 @@ connect_to(struct ssh *ssh, const char *host, int port,
int sock;

memset(&cctx, 0, sizeof(cctx));
sock = connect_to_helper(ssh, host, port, SOCK_STREAM, ctype, rname,
&cctx, NULL, NULL);
sock = connect_to_helper(ssh, host, port, SOCK_STREAM, &cctx, NULL, NULL);
if (sock == -1) {
channel_connect_ctx_free(&cctx);
return NULL;
Expand Down Expand Up @@ -4819,8 +4818,7 @@ channel_connect_to_port(struct ssh *ssh, const char *host, u_short port,
}

memset(&cctx, 0, sizeof(cctx));
sock = connect_to_helper(ssh, host, port, SOCK_STREAM, ctype, rname,
&cctx, reason, errmsg);
sock = connect_to_helper(ssh, host, port, SOCK_STREAM, &cctx, reason, errmsg);
if (sock == -1) {
channel_connect_ctx_free(&cctx);
return NULL;
Expand Down Expand Up @@ -4951,15 +4949,14 @@ rdynamic_connect_finish(struct ssh *ssh, Channel *c)
}

memset(&cctx, 0, sizeof(cctx));
sock = connect_to_helper(ssh, c->path, c->host_port, SOCK_STREAM, NULL,
NULL, &cctx, NULL, NULL);
sock = connect_to_helper(ssh, c->path, c->host_port, SOCK_STREAM, &cctx, NULL, NULL);
if (sock == -1)
channel_connect_ctx_free(&cctx);
else {
/* similar to SSH_CHANNEL_CONNECTING but we've already sent the open */
c->type = SSH_CHANNEL_RDYNAMIC_FINISH;
c->connect_ctx = cctx;
channel_register_fds(ssh, c, sock, sock, -1, 0, 1, 0);
channel_register_fds(c, sock, sock, -1, 0, 1, 0);
}
return sock;
}
Expand Down
4 changes: 2 additions & 2 deletions kex.c
Original file line number Diff line number Diff line change
Expand Up @@ -1040,7 +1040,7 @@ choose_enc(struct sshenc *enc, char *client, char *server)
}

static int
choose_mac(struct ssh *ssh, struct sshmac *mac, char *client, char *server)
choose_mac(struct sshmac *mac, char *client, char *server)
{
char *name = match_list(client, server, NULL);

Expand Down Expand Up @@ -1240,7 +1240,7 @@ kex_choose_conf(struct ssh *ssh, uint32_t seq)
authlen = cipher_authlen(newkeys->enc.cipher);
/* ignore mac for authenticated encryption */
if (authlen == 0 &&
(r = choose_mac(ssh, &newkeys->mac, cprop[nmac],
(r = choose_mac(&newkeys->mac, cprop[nmac],
sprop[nmac])) != 0) {
kex->failed_choice = peer[nmac];
peer[nmac] = NULL;
Expand Down
8 changes: 4 additions & 4 deletions kexecdh.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
#include "ssherr.h"

static int
kex_ecdh_dec_key_group(struct kex *, const struct sshbuf *, EC_KEY *key,
kex_ecdh_dec_key_group(const struct sshbuf *, EC_KEY *key,
const EC_GROUP *, struct sshbuf **);

int
Expand Down Expand Up @@ -123,7 +123,7 @@ kex_ecdh_enc(struct kex *kex, const struct sshbuf *client_blob,
if ((r = sshbuf_put_ec(server_blob, pub_key, group)) != 0 ||
(r = sshbuf_get_u32(server_blob, NULL)) != 0)
goto out;
if ((r = kex_ecdh_dec_key_group(kex, client_blob, server_key, group,
if ((r = kex_ecdh_dec_key_group(client_blob, server_key, group,
shared_secretp)) != 0)
goto out;
*server_blobp = server_blob;
Expand All @@ -135,7 +135,7 @@ kex_ecdh_enc(struct kex *kex, const struct sshbuf *client_blob,
}

static int
kex_ecdh_dec_key_group(struct kex *kex, const struct sshbuf *ec_blob,
kex_ecdh_dec_key_group(const struct sshbuf *ec_blob,
EC_KEY *key, const EC_GROUP *group, struct sshbuf **shared_secretp)
{
struct sshbuf *buf = NULL;
Expand Down Expand Up @@ -202,7 +202,7 @@ kex_ecdh_dec(struct kex *kex, const struct sshbuf *server_blob,
{
int r;

r = kex_ecdh_dec_key_group(kex, server_blob, kex->ec_client_key,
r = kex_ecdh_dec_key_group(server_blob, kex->ec_client_key,
kex->ec_group, shared_secretp);
EC_KEY_free(kex->ec_client_key);
kex->ec_client_key = NULL;
Expand Down
30 changes: 15 additions & 15 deletions loginrec.c
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ construct_utmpx(struct logininfo *li, struct utmpx *utx)
/* write a utmp entry with the system's help (pututline() and pals) */
# ifdef UTMP_USE_LIBRARY
static int
utmp_write_library(struct logininfo *li, struct utmp *ut)
utmp_write_library(struct utmp *ut)
{
setutent();
pututline(ut);
Expand All @@ -840,7 +840,7 @@ utmp_write_library(struct logininfo *li, struct utmp *ut)
* This is a slightly modification of code in OpenBSD's login.c
*/
static int
utmp_write_direct(struct logininfo *li, struct utmp *ut)
utmp_write_direct(struct utmp *ut)
{
struct utmp old_ut;
register int fd;
Expand Down Expand Up @@ -929,12 +929,12 @@ utmp_perform_login(struct logininfo *li)

construct_utmp(li, &ut);
# ifdef UTMP_USE_LIBRARY
if (!utmp_write_library(li, &ut)) {
if (!utmp_write_library(&ut)) {
logit("%s: utmp_write_library() failed", __func__);
return (0);
}
# else
if (!utmp_write_direct(li, &ut)) {
if (!utmp_write_direct(&ut)) {
logit("%s: utmp_write_direct() failed", __func__);
return (0);
}
Expand All @@ -950,12 +950,12 @@ utmp_perform_logout(struct logininfo *li)

construct_utmp(li, &ut);
# ifdef UTMP_USE_LIBRARY
if (!utmp_write_library(li, &ut)) {
if (!utmp_write_library(&ut)) {
logit("%s: utmp_write_library() failed", __func__);
return (0);
}
# else
if (!utmp_write_direct(li, &ut)) {
if (!utmp_write_direct(&ut)) {
logit("%s: utmp_write_direct() failed", __func__);
return (0);
}
Expand Down Expand Up @@ -999,7 +999,7 @@ utmp_write_entry(struct logininfo *li)
/* write a utmpx entry with the system's help (pututxline() and pals) */
# ifdef UTMPX_USE_LIBRARY
static int
utmpx_write_library(struct logininfo *li, struct utmpx *utx)
utmpx_write_library(struct utmpx *utx)
{
setutxent();
pututxline(utx);
Expand All @@ -1014,7 +1014,7 @@ utmpx_write_library(struct logininfo *li, struct utmpx *utx)

/* write a utmp entry direct to the file */
static int
utmpx_write_direct(struct logininfo *li, struct utmpx *utx)
utmpx_write_direct(struct utmpx *utx)
{
logit("%s: not implemented!", __func__);
return (0);
Expand All @@ -1028,12 +1028,12 @@ utmpx_perform_login(struct logininfo *li)

construct_utmpx(li, &utx);
# ifdef UTMPX_USE_LIBRARY
if (!utmpx_write_library(li, &utx)) {
if (!utmpx_write_library(&utx)) {
logit("%s: utmp_write_library() failed", __func__);
return (0);
}
# else
if (!utmpx_write_direct(li, &ut)) {
if (!utmpx_write_direct(&utx)) {
logit("%s: utmp_write_direct() failed", __func__);
return (0);
}
Expand All @@ -1056,9 +1056,9 @@ utmpx_perform_logout(struct logininfo *li)
# endif

# ifdef UTMPX_USE_LIBRARY
utmpx_write_library(li, &utx);
utmpx_write_library(&utx);
# else
utmpx_write_direct(li, &utx);
utmpx_write_direct(&utx);
# endif
return (1);
}
Expand Down Expand Up @@ -1261,7 +1261,7 @@ wtmp_get_entry(struct logininfo *li)
* This is a slight modification of code in OpenBSD's logwtmp.c
*/
static int
wtmpx_write(struct logininfo *li, struct utmpx *utx)
wtmpx_write(struct utmpx *utx)
{
#ifndef HAVE_UPDWTMPX
struct stat buf;
Expand Down Expand Up @@ -1296,7 +1296,7 @@ wtmpx_perform_login(struct logininfo *li)
struct utmpx utx;

construct_utmpx(li, &utx);
return (wtmpx_write(li, &utx));
return (wtmpx_write(&utx));
}


Expand All @@ -1306,7 +1306,7 @@ wtmpx_perform_logout(struct logininfo *li)
struct utmpx utx;

construct_utmpx(li, &utx);
return (wtmpx_write(li, &utx));
return (wtmpx_write(&utx));
}


Expand Down
4 changes: 2 additions & 2 deletions packet.c
Original file line number Diff line number Diff line change
Expand Up @@ -1426,7 +1426,7 @@ ssh_packet_read(struct ssh *ssh)
}

static int
ssh_packet_read_poll2_mux(struct ssh *ssh, u_char *typep, u_int32_t *seqnr_p)
ssh_packet_read_poll2_mux(struct ssh *ssh, u_char *typep)
{
struct session_state *state = ssh->state;
const u_char *cp;
Expand Down Expand Up @@ -1476,7 +1476,7 @@ ssh_packet_read_poll2(struct ssh *ssh, u_char *typep, u_int32_t *seqnr_p)
int r;

if (state->mux)
return ssh_packet_read_poll2_mux(ssh, typep, seqnr_p);
return ssh_packet_read_poll2_mux(ssh, typep);

*typep = SSH_MSG_NONE;

Expand Down
4 changes: 2 additions & 2 deletions serverloop.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ process_input(struct ssh *ssh, int connection_in)
* Sends data from internal buffers to client program stdin.
*/
static void
process_output(struct ssh *ssh, int connection_out)
process_output(struct ssh *ssh)
{
int r;

Expand Down Expand Up @@ -397,7 +397,7 @@ server_loop2(struct ssh *ssh, Authctxt *authctxt)
if ((r = ssh_packet_check_rekey(ssh)) != 0)
fatal_fr(r, "cannot start rekeying");
if (conn_out_ready)
process_output(ssh, connection_out);
process_output(ssh);
}
collect_children(ssh);
free(pfd);
Expand Down
12 changes: 6 additions & 6 deletions session.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ prepare_auth_info_file(struct passwd *pw, struct sshbuf *info)
}

static void
set_fwdpermit_from_authopts(struct ssh *ssh, const struct sshauthopt *opts)
set_fwdpermit_from_authopts(struct ssh *ssh)
{
char *tmp, *cp, *host;
int port;
Expand Down Expand Up @@ -338,7 +338,7 @@ do_authenticated(struct ssh *ssh, Authctxt *authctxt)

/* setup the channel layer */
/* XXX - streamlocal? */
set_fwdpermit_from_authopts(ssh, auth_opts);
set_fwdpermit_from_authopts(ssh);

if (!auth_opts->permit_port_forwarding_flag ||
options.disable_forwarding) {
Expand Down Expand Up @@ -1198,7 +1198,7 @@ do_setup_env(struct ssh *ssh, Session *s, const char *shell)
* first in this order).
*/
static void
do_rc_files(struct ssh *ssh, Session *s, const char *shell)
do_rc_files(Session *s, const char *shell)
{
FILE *f = NULL;
char *cmd = NULL, *user_rc = NULL;
Expand Down Expand Up @@ -1304,7 +1304,7 @@ do_nologin(struct passwd *pw)
* must be root-owned directories with strict permissions.
*/
static void
safely_chroot(const char *path, uid_t uid)
safely_chroot(const char *path)
{
const char *cp;
char component[PATH_MAX];
Expand Down Expand Up @@ -1393,7 +1393,7 @@ do_setusercontext(struct passwd *pw)
(unsigned long long)pw->pw_uid);
chroot_path = percent_expand(tmp, "h", pw->pw_dir,
"u", pw->pw_name, "U", uidstr, (char *)NULL);
safely_chroot(chroot_path, pw->pw_uid);
safely_chroot(chroot_path);
free(tmp);
free(chroot_path);
/* Make sure we don't attempt to chroot again */
Expand Down Expand Up @@ -1637,7 +1637,7 @@ do_child(struct ssh *ssh, Session *s, const char *command)

closefrom(STDERR_FILENO + 1);

do_rc_files(ssh, s, shell);
do_rc_files(s, shell);

/* restore SIGPIPE for child */
ssh_signal(SIGPIPE, SIG_DFL);
Expand Down
6 changes: 3 additions & 3 deletions sftp-client.c
Original file line number Diff line number Diff line change
Expand Up @@ -2383,7 +2383,7 @@ sftp_upload_dir(struct sftp_conn *conn, const char *src, const char *dst,
}

static void
handle_dest_replies(struct sftp_conn *to, const char *to_path, int synchronous,
handle_dest_replies(struct sftp_conn *to, int synchronous,
u_int *nreqsp, u_int *write_errorp)
{
struct sshbuf *msg;
Expand Down Expand Up @@ -2550,7 +2550,7 @@ sftp_crossload(struct sftp_conn *from, struct sftp_conn *to,
}

/* Try to eat replies from the upload side (nonblocking) */
handle_dest_replies(to, to_path, 0,
handle_dest_replies(to, 0,
&num_upload_req, &write_error);

sshbuf_reset(msg);
Expand Down Expand Up @@ -2647,7 +2647,7 @@ sftp_crossload(struct sftp_conn *from, struct sftp_conn *to,

/* Drain replies from the server (blocking) */
debug3_f("waiting for %u replies from destination", num_upload_req);
handle_dest_replies(to, to_path, 1, &num_upload_req, &write_error);
handle_dest_replies(to, 1, &num_upload_req, &write_error);

/* Sanity check */
if (TAILQ_FIRST(&requests) != NULL)
Expand Down
4 changes: 2 additions & 2 deletions sntrup761.c
Original file line number Diff line number Diff line change
Expand Up @@ -1148,7 +1148,7 @@ static void ZDecrypt(Inputs r,const unsigned char *c,const unsigned char *sk)
#define Confirm_bytes 32

/* h = HashConfirm(r,pk,cache); cache is Hash4(pk) */
static void HashConfirm(unsigned char *h,const unsigned char *r,const unsigned char *pk,const unsigned char *cache)
static void HashConfirm(unsigned char *h,const unsigned char *r,const unsigned char *cache)
{
#ifndef LPR
unsigned char x[Hash_bytes*2];
Expand Down Expand Up @@ -1205,7 +1205,7 @@ static void Hide(unsigned char *c,unsigned char *r_enc,const Inputs r,const unsi
{
Inputs_encode(r_enc,r);
ZEncrypt(c,r,pk); c += Ciphertexts_bytes;
HashConfirm(c,r_enc,pk,cache);
HashConfirm(c,r_enc,cache);
}

/* c,k = Encap(pk) */
Expand Down
Loading
Loading