polish whitespace for portable files

This commit is contained in:
Damien Miller 2021-04-03 17:47:37 +11:00
parent 31d8d231eb
commit 57ed647ee0
25 changed files with 98 additions and 97 deletions

View File

@ -129,7 +129,7 @@ static AuditInfoTermID ssh_bsm_tid;
* getaudit_addr() is only present on IPv6 capable machines. * getaudit_addr() is only present on IPv6 capable machines.
*/ */
#if defined(HAVE_AUG_GET_MACHINE) || !defined(HAVE_GETAUDIT_ADDR) #if defined(HAVE_AUG_GET_MACHINE) || !defined(HAVE_GETAUDIT_ADDR)
extern int aug_get_machine(char *, u_int32_t *, u_int32_t *); extern int aug_get_machine(char *, u_int32_t *, u_int32_t *);
#else #else
static int static int
aug_get_machine(char *host, u_int32_t *addr, u_int32_t *type) aug_get_machine(char *host, u_int32_t *addr, u_int32_t *type)
@ -183,41 +183,41 @@ getacna(char *auditstring, int len)
scf_value_t *value = NULL; scf_value_t *value = NULL;
int ret = 0; int ret = 0;
/*
* The man page for getacna on Solaris 10 states we should return -2
* in case of error and set errno to indicate the error. We don't
* bother with errno here, though, since the only use of this function
* below doesn't check for errors anyway.
*/
handle = scf_handle_create(SCF_VERSION); handle = scf_handle_create(SCF_VERSION);
if (handle == NULL) if (handle == NULL)
return -2; /* The man page for getacna on Solaris 10 states return -2;
we should return -2 in case of error and set
errno to indicate the error. We don't bother
with errno here, though, since the only use
of this function below doesn't check for errors
anyway.
*/
ret = scf_handle_bind(handle); ret = scf_handle_bind(handle);
if (ret == -1) if (ret == -1)
return -2; return -2;
property = scf_property_create(handle); property = scf_property_create(handle);
if (property == NULL) if (property == NULL)
return -2; return -2;
ret = scf_handle_decode_fmri(handle, ret = scf_handle_decode_fmri(handle,
"svc:/system/auditd:default/:properties/preselection/naflags", "svc:/system/auditd:default/:properties/preselection/naflags",
NULL, NULL, NULL, NULL, property, 0); NULL, NULL, NULL, NULL, property, 0);
if (ret == -1) if (ret == -1)
return -2; return -2;
value = scf_value_create(handle); value = scf_value_create(handle);
if (value == NULL) if (value == NULL)
return -2; return -2;
ret = scf_property_get_value(property, value); ret = scf_property_get_value(property, value);
if (ret == -1) if (ret == -1)
return -2; return -2;
ret = scf_value_get_astring(value, auditstring, len); ret = scf_value_get_astring(value, auditstring, len);
if (ret == -1) if (ret == -1)
return -2; return -2;
scf_value_destroy(value); scf_value_destroy(value);
scf_property_destroy(property); scf_property_destroy(property);
@ -280,9 +280,10 @@ bsm_audit_record(int typ, char *string, au_event_t event_no)
(void) au_write(ad, AUToReturnFunc(typ, rc)); (void) au_write(ad, AUToReturnFunc(typ, rc));
#ifdef BROKEN_BSM_API #ifdef BROKEN_BSM_API
/* The last argument is the event modifier flags. For /*
some seemingly undocumented reason it was added in * The last argument is the event modifier flags. For some seemingly
Solaris 11. */ * undocumented reason it was added in Solaris 11.
*/
rc = au_close(ad, AU_TO_WRITE, event_no, 0); rc = au_close(ad, AU_TO_WRITE, event_no, 0);
#else #else
rc = au_close(ad, AU_TO_WRITE, event_no); rc = au_close(ad, AU_TO_WRITE, event_no);

View File

@ -163,17 +163,18 @@ auth_krb5_password(Authctxt *authctxt, const char *password)
goto out; goto out;
} }
problem = ssh_krb5_cc_gen(authctxt->krb5_ctx, &authctxt->krb5_fwd_ccache); problem = ssh_krb5_cc_gen(authctxt->krb5_ctx,
&authctxt->krb5_fwd_ccache);
if (problem) if (problem)
goto out; goto out;
problem = krb5_cc_initialize(authctxt->krb5_ctx, authctxt->krb5_fwd_ccache, problem = krb5_cc_initialize(authctxt->krb5_ctx,
authctxt->krb5_user); authctxt->krb5_fwd_ccache, authctxt->krb5_user);
if (problem) if (problem)
goto out; goto out;
problem= krb5_cc_store_cred(authctxt->krb5_ctx, authctxt->krb5_fwd_ccache, problem = krb5_cc_store_cred(authctxt->krb5_ctx,
&creds); authctxt->krb5_fwd_ccache, &creds);
if (problem) if (problem)
goto out; goto out;
#endif #endif
@ -202,7 +203,7 @@ auth_krb5_password(Authctxt *authctxt, const char *password)
if (authctxt->krb5_ctx != NULL && problem!=-1) { if (authctxt->krb5_ctx != NULL && problem!=-1) {
errmsg = krb5_get_error_message(authctxt->krb5_ctx, errmsg = krb5_get_error_message(authctxt->krb5_ctx,
problem); problem);
debug("Kerberos password authentication failed: %s", debug("Kerberos password authentication failed: %s",
errmsg); errmsg);
krb5_free_error_message(authctxt->krb5_ctx, errmsg); krb5_free_error_message(authctxt->krb5_ctx, errmsg);
} else } else

View File

@ -727,9 +727,9 @@ sshpam_init(struct ssh *ssh, Authctxt *authctxt)
*/ */
sshpam_rhost = xstrdup(auth_get_canonical_hostname(ssh, sshpam_rhost = xstrdup(auth_get_canonical_hostname(ssh,
options.use_dns)); options.use_dns));
sshpam_laddr = get_local_ipaddr( sshpam_laddr = get_local_ipaddr(
ssh_packet_get_connection_in(ssh)); ssh_packet_get_connection_in(ssh));
xasprintf(&sshpam_conninfo, "SSH_CONNECTION=%.50s %d %.50s %d", xasprintf(&sshpam_conninfo, "SSH_CONNECTION=%.50s %d %.50s %d",
ssh_remote_ipaddr(ssh), ssh_remote_port(ssh), ssh_remote_ipaddr(ssh), ssh_remote_port(ssh),
sshpam_laddr, ssh_local_port(ssh)); sshpam_laddr, ssh_local_port(ssh));
} }

View File

@ -1921,7 +1921,7 @@ channel_handle_rfd(struct ssh *ssh, Channel *c,
((errno == EAGAIN || errno == EWOULDBLOCK) && !force))) ((errno == EAGAIN || errno == EWOULDBLOCK) && !force)))
return 1; return 1;
#ifndef PTY_ZEROREAD #ifndef PTY_ZEROREAD
if (len <= 0) { if (len <= 0) {
#else #else
if ((!c->isatty && len <= 0) || if ((!c->isatty && len <= 0) ||
(c->isatty && (len < 0 || (len == 0 && errno != 0)))) { (c->isatty && (len < 0 || (len == 0 && errno != 0)))) {

View File

@ -494,7 +494,7 @@ cipher_get_keyiv(struct sshcipher_ctx *cc, u_char *iv, size_t len)
#endif #endif
if (cipher_authlen(c)) { if (cipher_authlen(c)) {
if (!EVP_CIPHER_CTX_ctrl(cc->evp, EVP_CTRL_GCM_IV_GEN, if (!EVP_CIPHER_CTX_ctrl(cc->evp, EVP_CTRL_GCM_IV_GEN,
len, iv)) len, iv))
return SSH_ERR_LIBCRYPTO_ERROR; return SSH_ERR_LIBCRYPTO_ERROR;
} else if (!EVP_CIPHER_CTX_get_iv(cc->evp, iv, len)) } else if (!EVP_CIPHER_CTX_get_iv(cc->evp, iv, len))
return SSH_ERR_LIBCRYPTO_ERROR; return SSH_ERR_LIBCRYPTO_ERROR;

View File

@ -571,7 +571,7 @@ client_wait_until_can_do_something(struct ssh *ssh,
fatal_fr(r, "sshbuf_putf"); fatal_fr(r, "sshbuf_putf");
quit_pending = 1; quit_pending = 1;
} else if (options.server_alive_interval > 0 && !FD_ISSET(connection_in, } else if (options.server_alive_interval > 0 && !FD_ISSET(connection_in,
*readsetp) && monotime() >= server_alive_time) *readsetp) && monotime() >= server_alive_time)
/* /*
* ServerAlive check is needed. We can't rely on the select * ServerAlive check is needed. We can't rely on the select
* timing out since traffic on the client side such as port * timing out since traffic on the client side such as port

View File

@ -137,9 +137,10 @@ passphrase_dialog(char *message)
gnome_dialog_close(GNOME_DIALOG(dialog)); gnome_dialog_close(GNOME_DIALOG(dialog));
return (result == 0 ? 0 : -1); return (result == 0 ? 0 : -1);
/* At least one grab failed - ungrab what we got, and report /*
the failure to the user. Note that XGrabServer() cannot * At least one grab failed - ungrab what we got, and report the
fail. */ * failure to the user. Note that XGrabServer() cannot fail.
*/
nograbkb: nograbkb:
gdk_pointer_ungrab(GDK_CURRENT_TIME); gdk_pointer_ungrab(GDK_CURRENT_TIME);
nograb: nograb:

View File

@ -68,11 +68,9 @@ report_failed_grab (GtkWidget *parent_window, const char *what)
GtkWidget *err; GtkWidget *err;
err = gtk_message_dialog_new(GTK_WINDOW(parent_window), 0, err = gtk_message_dialog_new(GTK_WINDOW(parent_window), 0,
GTK_MESSAGE_ERROR, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
GTK_BUTTONS_CLOSE, "Could not grab %s. A malicious client may be eavesdropping "
"Could not grab %s. " "on your session.", what);
"A malicious client may be eavesdropping "
"on your session.", what);
gtk_window_set_position(GTK_WINDOW(err), GTK_WIN_POS_CENTER); gtk_window_set_position(GTK_WINDOW(err), GTK_WIN_POS_CENTER);
gtk_dialog_run(GTK_DIALOG(err)); gtk_dialog_run(GTK_DIALOG(err));
@ -225,7 +223,7 @@ passphrase_dialog(char *message, int prompt_type)
*/ */
gtk_widget_realize(entry); gtk_widget_realize(entry);
g_signal_connect(G_OBJECT(entry), "key_press_event", g_signal_connect(G_OBJECT(entry), "key_press_event",
G_CALLBACK(check_none), dialog); G_CALLBACK(check_none), dialog);
} }
} }

View File

@ -94,7 +94,7 @@ struct logininfo *login_alloc_entry(pid_t pid, const char *username,
void login_free_entry(struct logininfo *li); void login_free_entry(struct logininfo *li);
/* fill out a pre-allocated structure with useful information */ /* fill out a pre-allocated structure with useful information */
int login_init_entry(struct logininfo *li, pid_t pid, const char *username, int login_init_entry(struct logininfo *li, pid_t pid, const char *username,
const char *hostname, const char *line); const char *hostname, const char *line);
/* place the current time in a logininfo struct */ /* place the current time in a logininfo struct */
void login_set_current_time(struct logininfo *li); void login_set_current_time(struct logininfo *li);

View File

@ -62,21 +62,21 @@ dump_logininfo(struct logininfo *li, char *descname)
{ {
/* yes I know how nasty this is */ /* yes I know how nasty this is */
printf("struct logininfo %s = {\n\t" printf("struct logininfo %s = {\n\t"
"progname\t'%s'\n\ttype\t\t%d\n\t" "progname\t'%s'\n\ttype\t\t%d\n\t"
"pid\t\t%d\n\tuid\t\t%d\n\t" "pid\t\t%d\n\tuid\t\t%d\n\t"
"line\t\t'%s'\n\tusername\t'%s'\n\t" "line\t\t'%s'\n\tusername\t'%s'\n\t"
"hostname\t'%s'\n\texit\t\t%d\n\ttermination\t%d\n\t" "hostname\t'%s'\n\texit\t\t%d\n\ttermination\t%d\n\t"
"tv_sec\t%d\n\ttv_usec\t%d\n\t" "tv_sec\t%d\n\ttv_usec\t%d\n\t"
"struct login_netinfo hostaddr {\n\t\t" "struct login_netinfo hostaddr {\n\t\t"
"struct sockaddr sa {\n" "struct sockaddr sa {\n"
"\t\t\tfamily\t%d\n\t\t}\n" "\t\t\tfamily\t%d\n\t\t}\n"
"\t}\n" "\t}\n"
"}\n", "}\n",
descname, li->progname, li->type, descname, li->progname, li->type,
li->pid, li->uid, li->line, li->pid, li->uid, li->line,
li->username, li->hostname, li->exit, li->username, li->hostname, li->exit,
li->termination, li->tv_sec, li->tv_usec, li->termination, li->tv_sec, li->tv_usec,
li->hostaddr.sa.sa_family); li->hostaddr.sa.sa_family);
} }
@ -118,7 +118,7 @@ testAPI()
/* NOTE: this is messy, but typically a program wouldn't have to set /* NOTE: this is messy, but typically a program wouldn't have to set
* any of this, a sockaddr_in* would be already prepared */ * any of this, a sockaddr_in* would be already prepared */
memcpy((void *)&(sa_in4.sin_addr), (void *)&(he->h_addr_list[0][0]), memcpy((void *)&(sa_in4.sin_addr), (void *)&(he->h_addr_list[0][0]),
sizeof(struct in_addr)); sizeof(struct in_addr));
login_set_addr(li1, (struct sockaddr *) &sa_in4, sizeof(sa_in4)); login_set_addr(li1, (struct sockaddr *) &sa_in4, sizeof(sa_in4));
strlcpy(li1->hostname, "localhost", sizeof(li1->hostname)); strlcpy(li1->hostname, "localhost", sizeof(li1->hostname));
} }
@ -145,8 +145,8 @@ testAPI()
t1 = login_get_lastlog_time(getuid()); t1 = login_get_lastlog_time(getuid());
strlcpy(s_t1, ctime(&t1), sizeof(s_t1)); strlcpy(s_t1, ctime(&t1), sizeof(s_t1));
printf("Before logging in:\n\tcurrent time is %d - %s\t" printf("Before logging in:\n\tcurrent time is %d - %s\t"
"lastlog time is %d - %s\n", "lastlog time is %d - %s\n",
(int)t0, s_t0, (int)t1, s_t1); (int)t0, s_t0, (int)t1, s_t1);
#endif #endif
printf("Performing a login on line %s ", stripline); printf("Performing a login on line %s ", stripline);
@ -172,10 +172,10 @@ testAPI()
printf("at %d - %s", (int)logouttime, s_logouttime); printf("at %d - %s", (int)logouttime, s_logouttime);
#endif #endif
printf("\nThe root login shown above should be gone.\n" printf("\nThe root login shown above should be gone.\n"
"If the root login hasn't gone, but another user on the same\n" "If the root login hasn't gone, but another user on the same\n"
"pty has, this is OK - we're hacking it here, and there\n" "pty has, this is OK - we're hacking it here, and there\n"
"shouldn't be two users on one pty in reality...\n" "shouldn't be two users on one pty in reality...\n"
"-- ('who' output follows)\n"); "-- ('who' output follows)\n");
login_logout(li1); login_logout(li1);
system(cmdstring); system(cmdstring);
@ -187,24 +187,24 @@ testAPI()
printf("After logging in, lastlog time is %d - %s\n", (int)t2, s_t2); printf("After logging in, lastlog time is %d - %s\n", (int)t2, s_t2);
if (t1 == t2) if (t1 == t2)
printf("The lastlog times before and after logging in are the " printf("The lastlog times before and after logging in are the "
"same.\nThis indicates that lastlog is ** NOT WORKING " "same.\nThis indicates that lastlog is ** NOT WORKING "
"CORRECTLY **\n"); "CORRECTLY **\n");
else if (t0 != t2) else if (t0 != t2)
/* We can be off by a second or so, even when recording works fine. /* We can be off by a second or so, even when recording works fine.
* I'm not 100% sure why, but it's true. */ * I'm not 100% sure why, but it's true. */
printf("** The login time and the lastlog time differ.\n" printf("** The login time and the lastlog time differ.\n"
"** This indicates that lastlog is either recording the " "** This indicates that lastlog is either recording the "
"wrong time,\n** or retrieving the wrong entry.\n" "wrong time,\n** or retrieving the wrong entry.\n"
"If it's off by less than %d second(s) " "If it's off by less than %d second(s) "
"run the test again.\n", PAUSE_BEFORE_LOGOUT); "run the test again.\n", PAUSE_BEFORE_LOGOUT);
else else
printf("lastlog agrees with the login time. This is a good thing.\n"); printf("lastlog agrees with the login time. This is a good thing.\n");
#endif #endif
printf("--\nThe output of 'last' shown next should have " printf("--\nThe output of 'last' shown next should have "
"an entry for root \n on %s for the time shown above:\n--\n", "an entry for root \n on %s for the time shown above:\n--\n",
stripline); stripline);
snprintf(cmdstring, sizeof(cmdstring), "last | grep '%s ' | head -3", snprintf(cmdstring, sizeof(cmdstring), "last | grep '%s ' | head -3",
stripline); stripline);
system(cmdstring); system(cmdstring);

View File

@ -211,7 +211,7 @@ b64_pton(char const *src, u_char *target, size_t targsize)
break; break;
pos = strchr(Base64, ch); pos = strchr(Base64, ch);
if (pos == 0) /* A non-base64 character. */ if (pos == 0) /* A non-base64 character. */
return (-1); return (-1);
switch (state) { switch (state) {

View File

@ -32,7 +32,7 @@
#define _COMPAT_POLL_H_ #define _COMPAT_POLL_H_
typedef struct pollfd { typedef struct pollfd {
int fd; int fd;
short events; short events;
short revents; short revents;
} pollfd_t; } pollfd_t;

View File

@ -135,13 +135,13 @@
#define DP_S_DONE 7 #define DP_S_DONE 7
/* format flags - Bits */ /* format flags - Bits */
#define DP_F_MINUS (1 << 0) #define DP_F_MINUS (1 << 0)
#define DP_F_PLUS (1 << 1) #define DP_F_PLUS (1 << 1)
#define DP_F_SPACE (1 << 2) #define DP_F_SPACE (1 << 2)
#define DP_F_NUM (1 << 3) #define DP_F_NUM (1 << 3)
#define DP_F_ZERO (1 << 4) #define DP_F_ZERO (1 << 4)
#define DP_F_UP (1 << 5) #define DP_F_UP (1 << 5)
#define DP_F_UNSIGNED (1 << 6) #define DP_F_UNSIGNED (1 << 6)
/* Conversion Flags */ /* Conversion Flags */
#define DP_C_SHORT 1 #define DP_C_SHORT 1
@ -592,7 +592,7 @@ fmtint(char *buffer, size_t *currlen, size_t maxlen,
#ifdef DEBUG_SNPRINTF #ifdef DEBUG_SNPRINTF
printf("zpad: %d, spad: %d, min: %d, max: %d, place: %d\n", printf("zpad: %d, spad: %d, min: %d, max: %d, place: %d\n",
zpadlen, spadlen, min, max, place); zpadlen, spadlen, min, max, place);
#endif #endif
/* Spaces */ /* Spaces */

View File

@ -40,7 +40,7 @@
#define WEXITSTATUS(w) (int)(WIFEXITED(w) ? ((_W_INT(w) >> 8) & 0377) : -1) #define WEXITSTATUS(w) (int)(WIFEXITED(w) ? ((_W_INT(w) >> 8) & 0377) : -1)
#define WTERMSIG(w) (int)(WIFSIGNALED(w) ? (_W_INT(w) & 0177) : -1) #define WTERMSIG(w) (int)(WIFSIGNALED(w) ? (_W_INT(w) & 0177) : -1)
#define WCOREFLAG 0x80 #define WCOREFLAG 0x80
#define WCOREDUMP(w) ((_W_INT(w)) & WCOREFLAG) #define WCOREDUMP(w) ((_W_INT(w)) & WCOREFLAG)
/* Prototype */ /* Prototype */
pid_t waitpid(int, int *, int); pid_t waitpid(int, int *, int);

View File

@ -87,7 +87,7 @@ char *optarg; /* argument associated with option */
/* return values */ /* return values */
#define BADCH (int)'?' #define BADCH (int)'?'
#define BADARG ((*options == ':') ? (int)':' : (int)'?') #define BADARG ((*options == ':') ? (int)':' : (int)'?')
#define INORDER (int)1 #define INORDER (int)1
#define EMSG "" #define EMSG ""

View File

@ -284,7 +284,7 @@ RSA_set0_crt_params(RSA *r, BIGNUM *dmp1, BIGNUM *dmq1, BIGNUM *iqmp)
if ((r->dmp1 == NULL && dmp1 == NULL) || if ((r->dmp1 == NULL && dmp1 == NULL) ||
(r->dmq1 == NULL && dmq1 == NULL) || (r->dmq1 == NULL && dmq1 == NULL) ||
(r->iqmp == NULL && iqmp == NULL)) (r->iqmp == NULL && iqmp == NULL))
return 0; return 0;
if (dmp1 != NULL) { if (dmp1 != NULL) {
BN_free(r->dmp1); BN_free(r->dmp1);

View File

@ -68,7 +68,7 @@ sys_set_rdomain(int fd, const char *name)
if (setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, if (setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE,
name, strlen(name)) == -1) { name, strlen(name)) == -1) {
error("%s: setsockopt(%d, SO_BINDTODEVICE, %s): %s", error("%s: setsockopt(%d, SO_BINDTODEVICE, %s): %s",
__func__, fd, name, strerror(errno)); __func__, fd, name, strerror(errno));
return -1; return -1;
} }
return 0; return 0;

View File

@ -143,7 +143,7 @@ get_iaf_password(struct passwd *pw)
if (pw_password == NULL) if (pw_password == NULL)
fatal("ia_get_logpwd: Unable to get the shadow passwd"); fatal("ia_get_logpwd: Unable to get the shadow passwd");
ia_closeinfo(uinfo); ia_closeinfo(uinfo);
return pw_password; return pw_password;
} }
else else
fatal("ia_openinfo: Unable to open the shadow passwd file"); fatal("ia_openinfo: Unable to open the shadow passwd file");

View File

@ -159,7 +159,7 @@
* same "backwards" definition. * same "backwards" definition.
*/ */
/* Shift-right (used in SHA-224, SHA-256, SHA-384, and SHA-512): */ /* Shift-right (used in SHA-224, SHA-256, SHA-384, and SHA-512): */
#define R(b,x) ((x) >> (b)) #define R(b,x) ((x) >> (b))
/* 32-bit Rotate-right (used in SHA-224 and SHA-256): */ /* 32-bit Rotate-right (used in SHA-224 and SHA-256): */
#define S32(b,x) (((x) >> (b)) | ((x) << (32 - (b)))) #define S32(b,x) (((x) >> (b)) | ((x) << (32 - (b))))
/* 64-bit Rotate-right (used in SHA-384 and SHA-512): */ /* 64-bit Rotate-right (used in SHA-384 and SHA-512): */

View File

@ -26,9 +26,9 @@
#include <limits.h> #include <limits.h>
#include <errno.h> #include <errno.h>
#define INVALID 1 #define INVALID 1
#define TOOSMALL 2 #define TOOSMALL 2
#define TOOLARGE 3 #define TOOLARGE 3
long long long long
strtonum(const char *numstr, long long minval, long long maxval, strtonum(const char *numstr, long long minval, long long maxval,

View File

@ -384,7 +384,7 @@ ssh_sandbox_child_debugging(void)
fatal("%s: sigaction(SIGSYS): %s", __func__, strerror(errno)); fatal("%s: sigaction(SIGSYS): %s", __func__, strerror(errno));
if (sigprocmask(SIG_UNBLOCK, &mask, NULL) == -1) if (sigprocmask(SIG_UNBLOCK, &mask, NULL) == -1)
fatal("%s: sigprocmask(SIGSYS): %s", fatal("%s: sigprocmask(SIGSYS): %s",
__func__, strerror(errno)); __func__, strerror(errno));
} }
#endif /* SANDBOX_SECCOMP_FILTER_DEBUG */ #endif /* SANDBOX_SECCOMP_FILTER_DEBUG */
@ -413,13 +413,13 @@ ssh_sandbox_child(struct ssh_sandbox *box)
debug3("%s: setting PR_SET_NO_NEW_PRIVS", __func__); debug3("%s: setting PR_SET_NO_NEW_PRIVS", __func__);
if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0) == -1) { if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0) == -1) {
debug("%s: prctl(PR_SET_NO_NEW_PRIVS): %s", debug("%s: prctl(PR_SET_NO_NEW_PRIVS): %s",
__func__, strerror(errno)); __func__, strerror(errno));
nnp_failed = 1; nnp_failed = 1;
} }
debug3("%s: attaching seccomp filter program", __func__); debug3("%s: attaching seccomp filter program", __func__);
if (prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, &preauth_program) == -1) if (prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, &preauth_program) == -1)
debug("%s: prctl(PR_SET_SECCOMP): %s", debug("%s: prctl(PR_SET_SECCOMP): %s",
__func__, strerror(errno)); __func__, strerror(errno));
else if (nnp_failed) else if (nnp_failed)
fatal("%s: SECCOMP_MODE_FILTER activated but " fatal("%s: SECCOMP_MODE_FILTER activated but "
"PR_SET_NO_NEW_PRIVS failed", __func__); "PR_SET_NO_NEW_PRIVS failed", __func__);

2
sftp.c
View File

@ -2213,7 +2213,7 @@ interactive_loop(struct sftp_conn *conn, char *file1, char *file2)
if ((line = el_gets(el, &count)) == NULL || if ((line = el_gets(el, &count)) == NULL ||
count <= 0) { count <= 0) {
printf("\n"); printf("\n");
break; break;
} }
history(hl, &hev, H_ENTER, line); history(hl, &hev, H_ENTER, line);
if (strlcpy(cmd, line, sizeof(cmd)) >= sizeof(cmd)) { if (strlcpy(cmd, line, sizeof(cmd)) >= sizeof(cmd)) {

2
ssh.c
View File

@ -1553,7 +1553,7 @@ main(int ac, char **av)
if (ssh_connect(ssh, host, host_arg, addrs, &hostaddr, options.port, if (ssh_connect(ssh, host, host_arg, addrs, &hostaddr, options.port,
options.connection_attempts, options.connection_attempts,
&timeout_ms, options.tcp_keep_alive) != 0) &timeout_ms, options.tcp_keep_alive) != 0)
exit(255); exit(255);
if (addrs != NULL) if (addrs != NULL)
freeaddrinfo(addrs); freeaddrinfo(addrs);

View File

@ -4385,14 +4385,14 @@ sshkey_private_to_blob_pem_pkcs8(struct sshkey *key, struct sshbuf *buf,
return SSH_ERR_PASSPHRASE_TOO_SHORT; return SSH_ERR_PASSPHRASE_TOO_SHORT;
if ((blob = sshbuf_new()) == NULL) if ((blob = sshbuf_new()) == NULL)
return SSH_ERR_ALLOC_FAIL; return SSH_ERR_ALLOC_FAIL;
if ((bio = BIO_new(BIO_s_mem())) == NULL) { if ((bio = BIO_new(BIO_s_mem())) == NULL) {
r = SSH_ERR_ALLOC_FAIL; r = SSH_ERR_ALLOC_FAIL;
goto out; goto out;
} }
if (format == SSHKEY_PRIVATE_PKCS8 && (pkey = EVP_PKEY_new()) == NULL) { if (format == SSHKEY_PRIVATE_PKCS8 && (pkey = EVP_PKEY_new()) == NULL) {
r = SSH_ERR_ALLOC_FAIL; r = SSH_ERR_ALLOC_FAIL;
goto out; goto out;
} }
if ((r = sshkey_unshield_private(key)) != 0) if ((r = sshkey_unshield_private(key)) != 0)
goto out; goto out;

View File

@ -42,7 +42,7 @@
is not part of the posix specification. */ is not part of the posix specification. */
#define SAVED_IDS_WORK_WITH_SETEUID #define SAVED_IDS_WORK_WITH_SETEUID
/* Saved effective uid. */ /* Saved effective uid. */
static uid_t saved_euid = 0; static uid_t saved_euid = 0;
static gid_t saved_egid = 0; static gid_t saved_egid = 0;
#endif #endif