1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 09:27:59 +00:00

Adopt C99 <stdbool.h>'s true/false.

This commit includes <stdbool.h> from defs.h and deletes my
traditional definitions of TRUE and FALSE, but other than that, it's a
100% mechanical search-and-replace transforming all uses of TRUE and
FALSE into the C99-standardised lowercase spellings.

No actual types are changed in this commit; that will come next. This
is just getting the noise out of the way, so that subsequent commits
can have a higher proportion of signal.
This commit is contained in:
Simon Tatham 2018-10-29 19:50:29 +00:00
parent a647f2ba11
commit a6f1709c2f
127 changed files with 1994 additions and 2012 deletions

View File

@ -178,10 +178,10 @@ Channel *agentf_new(SshChannel *c)
af->c = c;
af->chan.vt = &agentf_channelvt;
af->chan.initial_fixed_window_size = 0;
af->rcvd_eof = FALSE;
af->rcvd_eof = false;
bufchain_init(&af->inbuffer);
af->pending = NULL;
af->input_wanted = TRUE;
af->input_wanted = true;
return &af->chan;
}
@ -220,7 +220,7 @@ static void agentf_send_eof(Channel *chan)
assert(chan->vt == &agentf_channelvt);
agentf *af = container_of(chan, agentf, chan);
af->rcvd_eof = TRUE;
af->rcvd_eof = true;
/* Call try_forward, which will respond to the EOF now if
* appropriate, or wait until the queue of outstanding requests is

View File

@ -29,7 +29,7 @@ void request_callback_notifications(toplevel_callback_notify_fn_t fn,
static void run_idempotent_callback(void *ctx)
{
struct IdempotentCallback *ic = (struct IdempotentCallback *)ctx;
ic->queued = FALSE;
ic->queued = false;
ic->fn(ic->ctx);
}
@ -37,7 +37,7 @@ void queue_idempotent_callback(struct IdempotentCallback *ic)
{
if (ic->queued)
return;
ic->queued = TRUE;
ic->queued = true;
queue_toplevel_callback(run_idempotent_callback, ic);
}
@ -101,7 +101,7 @@ void queue_toplevel_callback(toplevel_callback_fn_t fn, void *ctx)
int run_toplevel_callbacks(void)
{
int done_something = FALSE;
int done_something = false;
if (cbhead) {
/*
@ -122,7 +122,7 @@ int run_toplevel_callbacks(void)
sfree(cbcurr);
cbcurr = NULL;
done_something = TRUE;
done_something = true;
}
return done_something;
}

View File

@ -134,7 +134,7 @@ void help(void)
*/
printf("PuTTYgen: key generator and converter for the PuTTY tools\n"
"%s\n", ver);
usage(FALSE);
usage(false);
printf(" -t specify key type when generating (ed25519, ecdsa, rsa, "
"dsa, rsa1)\n"
" -b specify number of bits when generating key\n"
@ -177,9 +177,9 @@ static int move(char *from, char *to)
}
if (ret) {
perror("puttygen: cannot move new file on to old one");
return FALSE;
return false;
}
return TRUE;
return true;
}
static char *readpassphrase(const char *filename)
@ -208,7 +208,7 @@ static char *readpassphrase(const char *filename)
#define DEFAULT_RSADSA_BITS 2048
/* For Unix in particular, but harmless if this main() is reused elsewhere */
const int buildinfo_gtk_relevant = FALSE;
const int buildinfo_gtk_relevant = false;
int main(int argc, char **argv)
{
@ -220,8 +220,8 @@ int main(int argc, char **argv)
OPENSSH_NEW, SSHCOM } outtype = PRIVATE;
int bits = -1;
char *comment = NULL, *origcomment = NULL;
int change_passphrase = FALSE;
int errs = FALSE, nogo = FALSE;
int change_passphrase = false;
int errs = false, nogo = false;
int intype = SSH_KEYTYPE_UNOPENABLE;
int sshver = 0;
struct ssh2_userkey *ssh2key = NULL;
@ -242,7 +242,7 @@ int main(int argc, char **argv)
* return success.
*/
if (argc <= 1) {
usage(TRUE);
usage(true);
return 0;
}
@ -275,68 +275,68 @@ int main(int argc, char **argv)
if (!strcmp(opt, "-help")) {
if (val) {
errs = TRUE;
errs = true;
fprintf(stderr, "puttygen: option `-%s'"
" expects no argument\n", opt);
} else {
help();
nogo = TRUE;
nogo = true;
}
} else if (!strcmp(opt, "-version")) {
if (val) {
errs = TRUE;
errs = true;
fprintf(stderr, "puttygen: option `-%s'"
" expects no argument\n", opt);
} else {
showversion();
nogo = TRUE;
nogo = true;
}
} else if (!strcmp(opt, "-pgpfp")) {
if (val) {
errs = TRUE;
errs = true;
fprintf(stderr, "puttygen: option `-%s'"
" expects no argument\n", opt);
} else {
/* support --pgpfp for consistency */
pgp_fingerprints();
nogo = TRUE;
nogo = true;
}
} else if (!strcmp(opt, "-old-passphrase")) {
if (!val && argc > 1)
--argc, val = *++argv;
if (!val) {
errs = TRUE;
errs = true;
fprintf(stderr, "puttygen: option `-%s'"
" expects an argument\n", opt);
} else {
old_passphrase = readpassphrase(val);
if (!old_passphrase)
errs = TRUE;
errs = true;
}
} else if (!strcmp(opt, "-new-passphrase")) {
if (!val && argc > 1)
--argc, val = *++argv;
if (!val) {
errs = TRUE;
errs = true;
fprintf(stderr, "puttygen: option `-%s'"
" expects an argument\n", opt);
} else {
new_passphrase = readpassphrase(val);
if (!new_passphrase)
errs = TRUE;
errs = true;
}
} else if (!strcmp(opt, "-random-device")) {
if (!val && argc > 1)
--argc, val = *++argv;
if (!val) {
errs = TRUE;
errs = true;
fprintf(stderr, "puttygen: option `-%s'"
" expects an argument\n", opt);
} else {
random_device = val;
}
} else {
errs = TRUE;
errs = true;
fprintf(stderr,
"puttygen: no such option `-%s'\n", opt);
}
@ -356,14 +356,14 @@ int main(int argc, char **argv)
switch (c) {
case 'h':
help();
nogo = TRUE;
nogo = true;
break;
case 'V':
showversion();
nogo = TRUE;
nogo = true;
break;
case 'P':
change_passphrase = TRUE;
change_passphrase = true;
break;
case 'l':
outtype = FP;
@ -393,7 +393,7 @@ int main(int argc, char **argv)
else if (!*p) {
fprintf(stderr, "puttygen: option `-%c' expects a"
" parameter\n", c);
errs = TRUE;
errs = true;
}
/*
* Now c is the option and p is the parameter.
@ -413,7 +413,7 @@ int main(int argc, char **argv)
else {
fprintf(stderr,
"puttygen: unknown key type `%s'\n", p);
errs = TRUE;
errs = true;
}
break;
case 'b':
@ -440,7 +440,7 @@ int main(int argc, char **argv)
else {
fprintf(stderr,
"puttygen: unknown output type `%s'\n", p);
errs = TRUE;
errs = true;
}
break;
case 'o':
@ -453,7 +453,7 @@ int main(int argc, char **argv)
/*
* Unrecognised option.
*/
errs = TRUE;
errs = true;
fprintf(stderr, "puttygen: no such option `-%c'\n", c);
break;
}
@ -465,7 +465,7 @@ int main(int argc, char **argv)
if (!infile)
infile = p;
else {
errs = TRUE;
errs = true;
fprintf(stderr, "puttygen: cannot handle more than one"
" input file\n");
}
@ -492,19 +492,19 @@ int main(int argc, char **argv)
if (keytype == ECDSA && (bits != 256 && bits != 384 && bits != 521)) {
fprintf(stderr, "puttygen: invalid bits for ECDSA, choose 256, 384 or 521\n");
errs = TRUE;
errs = true;
}
if (keytype == ED25519 && (bits != 256)) {
fprintf(stderr, "puttygen: invalid bits for ED25519, choose 256\n");
errs = TRUE;
errs = true;
}
if (keytype == RSA2 || keytype == RSA1 || keytype == DSA) {
if (bits < 256) {
fprintf(stderr, "puttygen: cannot generate %s keys shorter than"
" 256 bits\n", (keytype == DSA ? "DSA" : "RSA"));
errs = TRUE;
errs = true;
} else if (bits < DEFAULT_RSADSA_BITS) {
fprintf(stderr, "puttygen: warning: %s keys shorter than"
" %d bits are probably not secure\n",
@ -524,7 +524,7 @@ int main(int argc, char **argv)
* ones, print the usage message and return failure.
*/
if (!infile && keytype == NOKEYGEN) {
usage(TRUE);
usage(true);
return 1;
}
@ -648,9 +648,9 @@ int main(int argc, char **argv)
intype == SSH_KEYTYPE_OPENSSH_PEM ||
intype == SSH_KEYTYPE_OPENSSH_NEW ||
intype == SSH_KEYTYPE_SSHCOM)
load_encrypted = TRUE;
load_encrypted = true;
else
load_encrypted = FALSE;
load_encrypted = false;
if (load_encrypted && (intype == SSH_KEYTYPE_SSH1_PUBLIC ||
intype == SSH_KEYTYPE_SSH2_PUBLIC_RFC4716 ||
@ -756,9 +756,9 @@ int main(int argc, char **argv)
if (!old_passphrase) {
prompts_t *p = new_prompts();
int ret;
p->to_server = FALSE;
p->to_server = false;
p->name = dupstr("SSH key passphrase");
add_prompt(p, dupstr("Enter passphrase to load key: "), FALSE);
add_prompt(p, dupstr("Enter passphrase to load key: "), false);
ret = console_get_userpass_input(p);
assert(ret >= 0);
if (!ret) {
@ -891,10 +891,10 @@ int main(int argc, char **argv)
prompts_t *p = new_prompts(NULL);
int ret;
p->to_server = FALSE;
p->to_server = false;
p->name = dupstr("New SSH key passphrase");
add_prompt(p, dupstr("Enter passphrase to save key: "), FALSE);
add_prompt(p, dupstr("Re-enter passphrase to verify: "), FALSE);
add_prompt(p, dupstr("Enter passphrase to save key: "), false);
add_prompt(p, dupstr("Re-enter passphrase to verify: "), false);
ret = console_get_userpass_input(p);
assert(ret >= 0);
if (!ret) {
@ -960,7 +960,7 @@ int main(int argc, char **argv)
FILE *fp;
if (outfile) {
fp = f_open(outfilename, "w", FALSE);
fp = f_open(outfilename, "w", false);
if (!fp) {
fprintf(stderr, "unable to open output file\n");
exit(1);
@ -1009,7 +1009,7 @@ int main(int argc, char **argv)
}
if (outfile) {
fp = f_open(outfilename, "w", FALSE);
fp = f_open(outfilename, "w", false);
if (!fp) {
fprintf(stderr, "unable to open output file\n");
exit(1);

View File

@ -159,8 +159,8 @@ static int cmdline_check_unavailable(int flag, const char *p)
if (need_save < 0) return x; \
} while (0)
static int seen_hostname_argument = FALSE;
static int seen_port_argument = FALSE;
static int seen_hostname_argument = false;
static int seen_port_argument = false;
int cmdline_process_param(const char *p, char *value,
int need_save, Conf *conf)
@ -227,7 +227,7 @@ int cmdline_process_param(const char *p, char *value,
buf = dupprintf("%.*s", (int)(p - host), host);
conf_set_str(conf, CONF_host, buf);
sfree(buf);
seen_hostname_argument = TRUE;
seen_hostname_argument = true;
}
/*
@ -243,7 +243,7 @@ int cmdline_process_param(const char *p, char *value,
* the next argument as a separate port; this one
* counts as explicitly provided.
*/
seen_port_argument = TRUE;
seen_port_argument = true;
} else {
conf_set_int(conf, CONF_port, -1);
}
@ -322,7 +322,7 @@ int cmdline_process_param(const char *p, char *value,
while (len > 0 && (hostname[len-1] == ' ' ||
hostname[len-1] == '\t'))
hostname[--len] = '\0';
seen_hostname_argument = TRUE;
seen_hostname_argument = true;
conf_set_str(conf, CONF_host, hostname);
if ((cmdline_tooltype & TOOLTYPE_HOST_ARG_CAN_BE_SESSION) &&
@ -353,7 +353,7 @@ int cmdline_process_param(const char *p, char *value,
do_defaults(hostname_after_user, conf2);
if (conf_launchable(conf2)) {
conf_copy_into(conf, conf2);
loaded_session = TRUE;
loaded_session = true;
/* And override the username if one was given. */
if (user)
conf_set_str(conf, CONF_username, user);
@ -385,7 +385,7 @@ int cmdline_process_param(const char *p, char *value,
int retd = cmdline_process_param("-P", dup, 1, conf);
sfree(dup);
assert(retd == 2);
seen_port_argument = TRUE;
seen_port_argument = true;
return 1;
} else {
/*
@ -401,7 +401,7 @@ int cmdline_process_param(const char *p, char *value,
/* This parameter must be processed immediately rather than being
* saved. */
do_defaults(value, conf);
loaded_session = TRUE;
loaded_session = true;
cmdline_session_name = dupstr(value);
return 2;
}
@ -594,7 +594,7 @@ int cmdline_process_param(const char *p, char *value,
fclose(fp);
conf_set_str(conf, CONF_remote_cmd, command);
conf_set_str(conf, CONF_remote_cmd2, "");
conf_set_int(conf, CONF_nopty, TRUE); /* command => no terminal */
conf_set_int(conf, CONF_nopty, true); /* command => no terminal */
sfree(command);
}
if (!strcmp(p, "-P")) {
@ -626,26 +626,26 @@ int cmdline_process_param(const char *p, char *value,
RETURN(1);
UNAVAILABLE_IN(TOOLTYPE_NONNETWORK);
SAVEABLE(0);
conf_set_int(conf, CONF_tryagent, TRUE);
conf_set_int(conf, CONF_tryagent, true);
}
if (!strcmp(p, "-noagent") || !strcmp(p, "-nopagent") ||
!strcmp(p, "-nopageant")) {
RETURN(1);
UNAVAILABLE_IN(TOOLTYPE_NONNETWORK);
SAVEABLE(0);
conf_set_int(conf, CONF_tryagent, FALSE);
conf_set_int(conf, CONF_tryagent, false);
}
if (!strcmp(p, "-share")) {
RETURN(1);
UNAVAILABLE_IN(TOOLTYPE_NONNETWORK);
SAVEABLE(0);
conf_set_int(conf, CONF_ssh_connection_sharing, TRUE);
conf_set_int(conf, CONF_ssh_connection_sharing, true);
}
if (!strcmp(p, "-noshare")) {
RETURN(1);
UNAVAILABLE_IN(TOOLTYPE_NONNETWORK);
SAVEABLE(0);
conf_set_int(conf, CONF_ssh_connection_sharing, FALSE);
conf_set_int(conf, CONF_ssh_connection_sharing, false);
}
if (!strcmp(p, "-A")) {
RETURN(1);
@ -860,7 +860,7 @@ int cmdline_process_param(const char *p, char *value,
!strcmp(p, "-restrictacl")) {
RETURN(1);
restrict_process_acl();
restricted_acl = TRUE;
restricted_acl = true;
}
#endif
@ -884,7 +884,7 @@ void cmdline_run_saved(Conf *conf)
int cmdline_host_ok(Conf *conf)
{
/*
* Return TRUE if the command-line arguments we've processed in
* Return true if the command-line arguments we've processed in
* TOOLTYPE_HOST_ARG mode are sufficient to justify launching a
* session.
*/
@ -895,7 +895,7 @@ int cmdline_host_ok(Conf *conf)
* clearly no.
*/
if (!conf_launchable(conf))
return FALSE;
return false;
/*
* But also, if we haven't seen either a -load option or a
@ -908,7 +908,7 @@ int cmdline_host_ok(Conf *conf)
* option to connect to something else or change the setting.
*/
if (!seen_hostname_argument && !loaded_session)
return FALSE;
return false;
return TRUE;
return true;
}

8
conf.c
View File

@ -513,11 +513,11 @@ int conf_deserialise(Conf *conf, BinarySource *src)
primary = get_uint32(src);
if (get_err(src))
return FALSE;
return false;
if (primary == 0xFFFFFFFFU)
return TRUE;
return true;
if (primary >= N_CONFIG_OPTIONS)
return FALSE;
return false;
entry = snew(struct conf_entry);
entry->key.primary = primary;
@ -548,7 +548,7 @@ int conf_deserialise(Conf *conf, BinarySource *src)
if (get_err(src)) {
free_entry(entry);
return FALSE;
return false;
}
conf_insert(conf, entry);

View File

@ -340,11 +340,11 @@ static void numeric_keypad_handler(union control *ctrl, dlgparam *dlg,
button = dlg_radiobutton_get(ctrl, dlg);
assert(button >= 0 && button < ctrl->radio.nbuttons);
if (button == 2) {
conf_set_int(conf, CONF_app_keypad, FALSE);
conf_set_int(conf, CONF_nethack_keypad, TRUE);
conf_set_int(conf, CONF_app_keypad, false);
conf_set_int(conf, CONF_nethack_keypad, true);
} else {
conf_set_int(conf, CONF_app_keypad, (button != 0));
conf_set_int(conf, CONF_nethack_keypad, FALSE);
conf_set_int(conf, CONF_nethack_keypad, false);
}
}
}
@ -613,7 +613,7 @@ struct sessionsaver_data {
static void sessionsaver_data_free(void *ssdv)
{
struct sessionsaver_data *ssd = (struct sessionsaver_data *)ssdv;
get_sesslist(&ssd->sesslist, FALSE);
get_sesslist(&ssd->sesslist, false);
sfree(ssd->savedsession);
sfree(ssd);
}
@ -685,7 +685,7 @@ static void sessionsaver_handler(union control *ctrl, dlgparam *dlg,
dlg_listbox_select(ssd->listbox, dlg, top);
}
} else if (event == EVENT_ACTION) {
int mbl = FALSE;
int mbl = false;
if (!ssd->midsession &&
(ctrl == ssd->listbox ||
(ssd->loadbutton && ctrl == ssd->loadbutton))) {
@ -720,8 +720,8 @@ static void sessionsaver_handler(union control *ctrl, dlgparam *dlg,
sfree(errmsg);
}
}
get_sesslist(&ssd->sesslist, FALSE);
get_sesslist(&ssd->sesslist, TRUE);
get_sesslist(&ssd->sesslist, false);
get_sesslist(&ssd->sesslist, true);
dlg_refresh(ssd->editbox, dlg);
dlg_refresh(ssd->listbox, dlg);
} else if (!ssd->midsession &&
@ -731,8 +731,8 @@ static void sessionsaver_handler(union control *ctrl, dlgparam *dlg,
dlg_beep(dlg);
} else {
del_settings(ssd->sesslist.sessions[i]);
get_sesslist(&ssd->sesslist, FALSE);
get_sesslist(&ssd->sesslist, TRUE);
get_sesslist(&ssd->sesslist, false);
get_sesslist(&ssd->sesslist, true);
dlg_refresh(ssd->listbox, dlg);
}
} else if (ctrl == ssd->okbutton) {
@ -751,7 +751,7 @@ static void sessionsaver_handler(union control *ctrl, dlgparam *dlg,
if (dlg_last_focused(ctrl, dlg) == ssd->listbox &&
!conf_launchable(conf)) {
Conf *conf2 = conf_new();
int mbl = FALSE;
int mbl = false;
if (!load_selected_session(ssd, dlg, conf2, &mbl)) {
dlg_beep(dlg);
conf_free(conf2);
@ -847,7 +847,7 @@ static void colour_handler(union control *ctrl, dlgparam *dlg,
Conf *conf = (Conf *)data;
struct colour_data *cd =
(struct colour_data *)ctrl->generic.context.p;
int update = FALSE, clear = FALSE, r, g, b;
int update = false, clear = false, r, g, b;
if (event == EVENT_REFRESH) {
if (ctrl == cd->listbox) {
@ -857,22 +857,22 @@ static void colour_handler(union control *ctrl, dlgparam *dlg,
for (i = 0; i < lenof(colours); i++)
dlg_listbox_add(ctrl, dlg, colours[i]);
dlg_update_done(ctrl, dlg);
clear = TRUE;
update = TRUE;
clear = true;
update = true;
}
} else if (event == EVENT_SELCHANGE) {
if (ctrl == cd->listbox) {
/* The user has selected a colour. Update the RGB text. */
int i = dlg_listbox_index(ctrl, dlg);
if (i < 0) {
clear = TRUE;
clear = true;
} else {
clear = FALSE;
clear = false;
r = conf_get_int_int(conf, CONF_colours, i*3+0);
g = conf_get_int_int(conf, CONF_colours, i*3+1);
b = conf_get_int_int(conf, CONF_colours, i*3+2);
}
update = TRUE;
update = true;
}
} else if (event == EVENT_VALCHANGE) {
if (ctrl == cd->redit || ctrl == cd->gedit || ctrl == cd->bedit) {
@ -925,8 +925,8 @@ static void colour_handler(union control *ctrl, dlgparam *dlg,
conf_set_int_int(conf, CONF_colours, i*3+0, r);
conf_set_int_int(conf, CONF_colours, i*3+1, g);
conf_set_int_int(conf, CONF_colours, i*3+2, b);
clear = FALSE;
update = TRUE;
clear = false;
update = true;
}
}
}
@ -1468,11 +1468,11 @@ void setup_config_box(struct controlbox *b, int midsession,
(char)(midsession ? 'a' : 'o'),
HELPCTX(no_help),
sessionsaver_handler, P(ssd));
ssd->okbutton->button.isdefault = TRUE;
ssd->okbutton->button.isdefault = true;
ssd->okbutton->generic.column = 3;
ssd->cancelbutton = ctrl_pushbutton(s, "Cancel", 'c', HELPCTX(no_help),
sessionsaver_handler, P(ssd));
ssd->cancelbutton->button.iscancel = TRUE;
ssd->cancelbutton->button.iscancel = true;
ssd->cancelbutton->generic.column = 4;
/* We carefully don't close the 5-column part, so that platform-
* specific add-ons can put extra buttons alongside Open and Cancel. */
@ -1530,7 +1530,7 @@ void setup_config_box(struct controlbox *b, int midsession,
midsession ? "Save the current session settings" :
"Load, save or delete a stored session");
ctrl_columns(s, 2, 75, 25);
get_sesslist(&ssd->sesslist, TRUE);
get_sesslist(&ssd->sesslist, true);
ssd->editbox = ctrl_editbox(s, "Saved Sessions", 'e', 100,
HELPCTX(session_saved),
sessionsaver_handler, P(ssd), P(NULL));
@ -1613,7 +1613,7 @@ void setup_config_box(struct controlbox *b, int midsession,
NULL);
}
ctrl_filesel(s, "Log file name:", 'f',
NULL, TRUE, "Select session log file name",
NULL, true, "Select session log file name",
HELPCTX(logging_filename),
conf_filesel_handler, I(CONF_logfilename));
ctrl_text(s, "(Log file name can contain &Y, &M, &D for date,"
@ -2144,8 +2144,8 @@ void setup_config_box(struct controlbox *b, int midsession,
HELPCTX(connection_username_from_env),
conf_radiobutton_handler,
I(CONF_username_from_env),
"Prompt", I(FALSE),
userlabel, I(TRUE),
"Prompt", I(false),
userlabel, I(true),
NULL);
sfree(userlabel);
}
@ -2482,7 +2482,7 @@ void setup_config_box(struct controlbox *b, int midsession,
* it become really unhelpful if a horizontal scrollbar
* appears, so we suppress that. */
mh->listbox->listbox.height = 2;
mh->listbox->listbox.hscroll = FALSE;
mh->listbox->listbox.hscroll = false;
ctrl_tabdelay(s, mh->rembutton);
mh->keybox = ctrl_editbox(s, "Key", 'k', 80,
HELPCTX(ssh_kex_manual_hostkeys),
@ -2558,7 +2558,7 @@ void setup_config_box(struct controlbox *b, int midsession,
conf_checkbox_handler,
I(CONF_change_username));
ctrl_filesel(s, "Private key file for authentication:", 'k',
FILTER_KEY_FILES, FALSE, "Select private key file",
FILTER_KEY_FILES, false, "Select private key file",
HELPCTX(ssh_auth_privkey),
conf_filesel_handler, I(CONF_keyfile));
@ -2615,7 +2615,7 @@ void setup_config_box(struct controlbox *b, int midsession,
*/
ctrl_filesel(s, "User-supplied GSSAPI library path:", 's',
FILTER_DYNLIB_FILES, FALSE, "Select library file",
FILTER_DYNLIB_FILES, false, "Select library file",
HELPCTX(ssh_gssapi_libraries),
conf_filesel_handler,
I(CONF_ssh_gss_custom));

View File

@ -5,6 +5,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include "sel.h"
@ -12,13 +13,6 @@
#include "malloc.h"
#include "pty.h"
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
#define IAC 255 /* interpret as command: */
#define DONT 254 /* you are not to use option */
#define DO 253 /* please, you use option */

8
defs.h
View File

@ -13,6 +13,7 @@
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
#if defined _MSC_VER && _MSC_VER < 1800
/* Work around lack of inttypes.h in older MSVC */
@ -22,13 +23,6 @@
#include <inttypes.h>
#endif
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
typedef struct conf_tag Conf;
typedef struct terminal_tag Terminal;

View File

@ -364,7 +364,7 @@ union control *ctrl_listbox(struct controlset *s, const char *label,
c->listbox.percentwidth = 100;
c->listbox.ncols = 0;
c->listbox.percentages = NULL;
c->listbox.hscroll = TRUE;
c->listbox.hscroll = true;
return c;
}
@ -381,7 +381,7 @@ union control *ctrl_droplist(struct controlset *s, const char *label,
c->listbox.percentwidth = percentage;
c->listbox.ncols = 0;
c->listbox.percentages = NULL;
c->listbox.hscroll = FALSE;
c->listbox.hscroll = false;
return c;
}
@ -398,7 +398,7 @@ union control *ctrl_draglist(struct controlset *s, const char *label,
c->listbox.percentwidth = 100;
c->listbox.ncols = 0;
c->listbox.percentages = NULL;
c->listbox.hscroll = FALSE;
c->listbox.hscroll = false;
return c;
}

View File

@ -340,7 +340,7 @@ union control {
int ncols; /* number of columns */
int *percentages; /* % width of each column */
/*
* Flag which can be set to FALSE to suppress the horizontal
* Flag which can be set to false to suppress the horizontal
* scroll bar if a list box entry goes off the right-hand
* side.
*/

View File

@ -7,7 +7,7 @@
#include "terminal.h"
/* For Unix in particular, but harmless if this main() is reused elsewhere */
const int buildinfo_gtk_relevant = FALSE;
const int buildinfo_gtk_relevant = false;
static const TermWinVtable fuzz_termwin_vt;
@ -44,7 +44,7 @@ int main(int argc, char **argv)
}
/* functions required by terminal.c */
static int fuzz_setup_draw_ctx(TermWin *tw) { return TRUE; }
static int fuzz_setup_draw_ctx(TermWin *tw) { return true; }
static void fuzz_draw_text(
TermWin *tw, int x, int y, wchar_t *text, int len,
unsigned long attr, int lattr, truecolour tc)
@ -84,18 +84,18 @@ static void fuzz_request_resize(TermWin *tw, int w, int h) {}
static void fuzz_set_title(TermWin *tw, const char *title) {}
static void fuzz_set_icon_title(TermWin *tw, const char *icontitle) {}
static void fuzz_set_minimised(TermWin *tw, int minimised) {}
static int fuzz_is_minimised(TermWin *tw) { return FALSE; }
static int fuzz_is_minimised(TermWin *tw) { return false; }
static void fuzz_set_maximised(TermWin *tw, int maximised) {}
static void fuzz_move(TermWin *tw, int x, int y) {}
static void fuzz_set_zorder(TermWin *tw, int top) {}
static int fuzz_palette_get(TermWin *tw, int n, int *r, int *g, int *b)
{ return FALSE; }
{ return false; }
static void fuzz_palette_set(TermWin *tw, int n, int r, int g, int b) {}
static void fuzz_palette_reset(TermWin *tw) {}
static void fuzz_get_pos(TermWin *tw, int *x, int *y) { *x = *y = 0; }
static void fuzz_get_pixels(TermWin *tw, int *x, int *y) { *x = *y = 0; }
static const char *fuzz_get_title(TermWin *tw, int icon) { return "moo"; }
static int fuzz_is_utf8(TermWin *tw) { return TRUE; }
static int fuzz_is_utf8(TermWin *tw) { return true; }
static const TermWinVtable fuzz_termwin_vt = {
fuzz_setup_draw_ctx,

View File

@ -316,7 +316,7 @@ static struct openssh_pem_key *load_openssh_pem_key(const Filename *filename,
ret = snew(struct openssh_pem_key);
ret->keyblob = strbuf_new();
fp = f_open(filename, "r", FALSE);
fp = f_open(filename, "r", false);
if (!fp) {
errmsg = "unable to open key file";
goto error;
@ -355,7 +355,7 @@ static struct openssh_pem_key *load_openssh_pem_key(const Filename *filename,
sfree(line);
line = NULL;
ret->encrypted = FALSE;
ret->encrypted = false;
memset(ret->iv, 0, sizeof(ret->iv));
headers_done = 0;
@ -385,7 +385,7 @@ static struct openssh_pem_key *load_openssh_pem_key(const Filename *filename,
}
p += 2;
if (!strcmp(p, "ENCRYPTED"))
ret->encrypted = TRUE;
ret->encrypted = true;
} else if (!strcmp(line, "DEK-Info")) {
int i, ivlen;
@ -1048,7 +1048,7 @@ int openssh_pem_write(const Filename *filename, struct ssh2_userkey *key,
* And save it. We'll use Unix line endings just in case it's
* subsequently transferred in binary mode.
*/
fp = f_open(filename, "wb", TRUE); /* ensure Unix line endings */
fp = f_open(filename, "wb", true); /* ensure Unix line endings */
if (!fp)
goto error;
fputs(header, fp);
@ -1125,7 +1125,7 @@ static struct openssh_new_key *load_openssh_new_key(const Filename *filename,
ret->keyblob = NULL;
ret->keyblob_len = ret->keyblob_size = 0;
fp = f_open(filename, "r", FALSE);
fp = f_open(filename, "r", false);
if (!fp) {
errmsg = "unable to open key file";
goto error;
@ -1621,7 +1621,7 @@ int openssh_new_write(const Filename *filename, struct ssh2_userkey *key,
* And save it. We'll use Unix line endings just in case it's
* subsequently transferred in binary mode.
*/
fp = f_open(filename, "wb", TRUE); /* ensure Unix line endings */
fp = f_open(filename, "wb", true); /* ensure Unix line endings */
if (!fp)
goto error;
fputs("-----BEGIN OPENSSH PRIVATE KEY-----\n", fp);
@ -1762,7 +1762,7 @@ static struct sshcom_key *load_sshcom_key(const Filename *filename,
ret->keyblob = NULL;
ret->keyblob_len = ret->keyblob_size = 0;
fp = f_open(filename, "r", FALSE);
fp = f_open(filename, "r", false);
if (!fp) {
errmsg = "unable to open key file";
goto error;
@ -1910,7 +1910,7 @@ int sshcom_encrypted(const Filename *filename, char **comment)
struct sshcom_key *key = load_sshcom_key(filename, NULL);
BinarySource src[1];
ptrlen str;
int answer = FALSE;
int answer = false;
*comment = NULL;
if (!key)
@ -1926,7 +1926,7 @@ int sshcom_encrypted(const Filename *filename, char **comment)
if (get_err(src))
goto done; /* key is invalid */
if (!ptrlen_eq_string(str, "none"))
answer = TRUE;
answer = true;
done:
if (key) {
@ -2338,7 +2338,7 @@ int sshcom_write(const Filename *filename, struct ssh2_userkey *key,
* And save it. We'll use Unix line endings just in case it's
* subsequently transferred in binary mode.
*/
fp = f_open(filename, "wb", TRUE); /* ensure Unix line endings */
fp = f_open(filename, "wb", true); /* ensure Unix line endings */
if (!fp)
goto error;
fputs("---- BEGIN SSH2 ENCRYPTED PRIVATE KEY ----\n", fp);

View File

@ -233,7 +233,7 @@ void ldisc_send(Ldisc *ldisc, const void *vbuf, int len, int interactive)
}
break;
case CTRL('V'): /* quote next char */
ldisc->quotenext = TRUE;
ldisc->quotenext = true;
break;
case CTRL('D'): /* logout or send */
if (ldisc->buflen == 0) {
@ -298,7 +298,7 @@ void ldisc_send(Ldisc *ldisc, const void *vbuf, int len, int interactive)
ldisc->buf[ldisc->buflen++] = c;
if (ECHOING)
pwrite(ldisc, (unsigned char) c);
ldisc->quotenext = FALSE;
ldisc->quotenext = false;
break;
}
}

View File

@ -87,18 +87,18 @@ static void logfopen_callback(void *vctx, int mode)
char buf[256], *event;
struct tm tm;
const char *fmode;
int shout = FALSE;
int shout = false;
if (mode == 0) {
ctx->state = L_ERROR; /* disable logging */
} else {
fmode = (mode == 1 ? "ab" : "wb");
ctx->lgfp = f_open(ctx->currlogfilename, fmode, FALSE);
ctx->lgfp = f_open(ctx->currlogfilename, fmode, false);
if (ctx->lgfp) {
ctx->state = L_OPEN;
} else {
ctx->state = L_ERROR;
shout = TRUE;
shout = true;
}
}
@ -425,9 +425,9 @@ void log_reconfig(LogContext *ctx, Conf *conf)
conf_get_filename(conf, CONF_logfilename)) ||
conf_get_int(ctx->conf, CONF_logtype) !=
conf_get_int(conf, CONF_logtype))
reset_logging = TRUE;
reset_logging = true;
else
reset_logging = FALSE;
reset_logging = false;
if (reset_logging)
logfclose(ctx);
@ -463,7 +463,7 @@ static Filename *xlatlognam(Filename *src, char *hostname, int port,
s = filename_to_str(src);
while (*s) {
int sanitise = FALSE;
int sanitise = false;
/* Let (bufp, len) be the string to append. */
bufp = buf; /* don't usually override this */
if (*s == '&') {
@ -501,7 +501,7 @@ static Filename *xlatlognam(Filename *src, char *hostname, int port,
* auto-format directives. E.g. 'hostname' can contain
* colons, if it's an IPv6 address, and colons aren't
* legal in filenames on Windows. */
sanitise = TRUE;
sanitise = true;
} else {
buf[0] = *s++;
size = 1;

View File

@ -139,7 +139,7 @@ static void mainchan_open_confirmation(Channel *chan)
char *key, *val, *cmd;
struct X11Display *x11disp;
struct X11FakeAuth *x11auth;
int retry_cmd_now = FALSE;
int retry_cmd_now = false;
if (conf_get_int(mc->conf, CONF_x11_forward)) {;
char *x11_setup_err;
@ -154,27 +154,27 @@ static void mainchan_open_confirmation(Channel *chan)
mc->cl, conf_get_int(mc->conf, CONF_x11_auth), x11disp);
sshfwd_request_x11_forwarding(
mc->sc, TRUE, x11auth->protoname, x11auth->datastring,
x11disp->screennum, FALSE);
mc->req_x11 = TRUE;
mc->sc, true, x11auth->protoname, x11auth->datastring,
x11disp->screennum, false);
mc->req_x11 = true;
}
}
if (ssh_agent_forwarding_permitted(mc->cl)) {
sshfwd_request_agent_forwarding(mc->sc, TRUE);
mc->req_agent = TRUE;
sshfwd_request_agent_forwarding(mc->sc, true);
mc->req_agent = true;
}
if (!conf_get_int(mc->conf, CONF_nopty)) {
sshfwd_request_pty(
mc->sc, TRUE, mc->conf, mc->term_width, mc->term_height);
mc->req_pty = TRUE;
mc->sc, true, mc->conf, mc->term_width, mc->term_height);
mc->req_pty = true;
}
for (val = conf_get_str_strs(mc->conf, CONF_environmt, NULL, &key);
val != NULL;
val = conf_get_str_strs(mc->conf, CONF_environmt, key, &key)) {
sshfwd_send_env_var(mc->sc, TRUE, key, val);
sshfwd_send_env_var(mc->sc, true, key, val);
mc->n_req_env++;
}
if (mc->n_req_env)
@ -182,21 +182,21 @@ static void mainchan_open_confirmation(Channel *chan)
cmd = conf_get_str(mc->conf, CONF_remote_cmd);
if (conf_get_int(mc->conf, CONF_ssh_subsys)) {
retry_cmd_now = !sshfwd_start_subsystem(mc->sc, TRUE, cmd);
retry_cmd_now = !sshfwd_start_subsystem(mc->sc, true, cmd);
} else if (*cmd) {
sshfwd_start_command(mc->sc, TRUE, cmd);
sshfwd_start_command(mc->sc, true, cmd);
} else {
sshfwd_start_shell(mc->sc, TRUE);
sshfwd_start_shell(mc->sc, true);
}
if (retry_cmd_now)
mainchan_try_fallback_command(mc);
else
mc->req_cmd_primary = TRUE;
mc->req_cmd_primary = true;
} else {
ssh_set_ldisc_option(mc->cl, LD_ECHO, TRUE);
ssh_set_ldisc_option(mc->cl, LD_EDIT, TRUE);
ssh_set_ldisc_option(mc->cl, LD_ECHO, true);
ssh_set_ldisc_option(mc->cl, LD_EDIT, true);
mainchan_ready(mc);
}
}
@ -205,11 +205,11 @@ static void mainchan_try_fallback_command(mainchan *mc)
{
const char *cmd = conf_get_str(mc->conf, CONF_remote_cmd2);
if (conf_get_int(mc->conf, CONF_ssh_subsys2)) {
sshfwd_start_subsystem(mc->sc, TRUE, cmd);
sshfwd_start_subsystem(mc->sc, true, cmd);
} else {
sshfwd_start_command(mc->sc, TRUE, cmd);
sshfwd_start_command(mc->sc, true, cmd);
}
mc->req_cmd_fallback = TRUE;
mc->req_cmd_fallback = true;
}
static void mainchan_request_response(Channel *chan, int success)
@ -219,7 +219,7 @@ static void mainchan_request_response(Channel *chan, int success)
PacketProtocolLayer *ppl = mc->ppl; /* for ppl_logevent */
if (mc->req_x11) {
mc->req_x11 = FALSE;
mc->req_x11 = false;
if (success) {
ppl_logevent(("X11 forwarding enabled"));
@ -231,7 +231,7 @@ static void mainchan_request_response(Channel *chan, int success)
}
if (mc->req_agent) {
mc->req_agent = FALSE;
mc->req_agent = false;
if (success) {
ppl_logevent(("Agent forwarding enabled"));
@ -243,16 +243,16 @@ static void mainchan_request_response(Channel *chan, int success)
}
if (mc->req_pty) {
mc->req_pty = FALSE;
mc->req_pty = false;
if (success) {
ppl_logevent(("Allocated pty"));
mc->got_pty = TRUE;
mc->got_pty = true;
} else {
ppl_logevent(("Server refused to allocate pty"));
ppl_printf(("Server refused to allocate pty\r\n"));
ssh_set_ldisc_option(mc->cl, LD_ECHO, TRUE);
ssh_set_ldisc_option(mc->cl, LD_EDIT, TRUE);
ssh_set_ldisc_option(mc->cl, LD_ECHO, true);
ssh_set_ldisc_option(mc->cl, LD_EDIT, true);
}
return;
}
@ -282,7 +282,7 @@ static void mainchan_request_response(Channel *chan, int success)
}
if (mc->req_cmd_primary) {
mc->req_cmd_primary = FALSE;
mc->req_cmd_primary = false;
if (success) {
ppl_logevent(("Started a shell/command"));
@ -302,7 +302,7 @@ static void mainchan_request_response(Channel *chan, int success)
}
if (mc->req_cmd_fallback) {
mc->req_cmd_fallback = FALSE;
mc->req_cmd_fallback = false;
if (success) {
ppl_logevent(("Started a shell/command"));
@ -318,14 +318,14 @@ static void mainchan_request_response(Channel *chan, int success)
static void mainchan_ready(mainchan *mc)
{
mc->ready = TRUE;
mc->ready = true;
ssh_set_wants_user_input(mc->cl, TRUE);
ssh_set_wants_user_input(mc->cl, true);
ssh_ppl_got_user_input(mc->ppl); /* in case any is already queued */
/* If an EOF arrived before we were ready, handle it now. */
if (mc->eof_pending) {
mc->eof_pending = FALSE;
mc->eof_pending = false;
mainchan_special_cmd(mc, SS_EOF, 0);
}
@ -387,8 +387,8 @@ static void mainchan_send_eof(Channel *chan)
sshfwd_write_eof(mc->sc);
ppl_logevent(("Sent EOF message"));
}
mc->eof_sent = TRUE;
ssh_set_wants_user_input(mc->cl, FALSE); /* now stop reading from stdin */
mc->eof_sent = true;
ssh_set_wants_user_input(mc->cl, false); /* now stop reading from stdin */
}
static void mainchan_set_input_wanted(Channel *chan, int wanted)
@ -418,7 +418,7 @@ static int mainchan_rcvd_exit_status(Channel *chan, int status)
ssh_got_exitcode(mc->ppl->ssh, status);
ppl_logevent(("Session sent command exit status %d", status));
return TRUE;
return true;
}
static void mainchan_log_exit_signal_common(
@ -466,7 +466,7 @@ static int mainchan_rcvd_exit_signal(
signame_str = dupprintf("signal SIG%.*s", PTRLEN_PRINTF(signame));
mainchan_log_exit_signal_common(mc, signame_str, core_dumped, msg);
sfree(signame_str);
return TRUE;
return true;
}
static int mainchan_rcvd_exit_signal_numeric(
@ -480,7 +480,7 @@ static int mainchan_rcvd_exit_signal_numeric(
signum_str = dupprintf("signal %d", signum);
mainchan_log_exit_signal_common(mc, signum_str, core_dumped, msg);
sfree(signum_str);
return TRUE;
return true;
}
void mainchan_get_specials(
@ -533,17 +533,17 @@ void mainchan_special_cmd(mainchan *mc, SessionSpecialCode code, int arg)
* Buffer the EOF to send as soon as the main channel is
* fully set up.
*/
mc->eof_pending = TRUE;
mc->eof_pending = true;
} else if (!mc->eof_sent) {
sshfwd_write_eof(mc->sc);
mc->eof_sent = TRUE;
mc->eof_sent = true;
}
} else if (code == SS_BRK) {
sshfwd_send_serial_break(
mc->sc, FALSE, 0 /* default break length */);
mc->sc, false, 0 /* default break length */);
} else if ((signame = ssh_signal_lookup(code)) != NULL) {
/* It's a signal. */
sshfwd_send_signal(mc->sc, FALSE, signame);
sshfwd_send_signal(mc->sc, false, signame);
ppl_logevent(("Sent signal SIG%s", signame));
}
}

View File

@ -88,10 +88,10 @@ int BinarySink_put_pstring(BinarySink *bs, const char *str)
{
size_t len = strlen(str);
if (len > 255)
return FALSE; /* can't write a Pascal-style string this long */
return false; /* can't write a Pascal-style string this long */
BinarySink_put_byte(bs, len);
bs->write(bs, str, len);
return TRUE;
return true;
}
/* ---------------------------------------------------------------------- */
@ -99,13 +99,13 @@ int BinarySink_put_pstring(BinarySink *bs, const char *str)
static int BinarySource_data_avail(BinarySource *src, size_t wanted)
{
if (src->err)
return FALSE;
return false;
if (wanted <= src->len - src->pos)
return TRUE;
return true;
src->err = BSE_OUT_OF_DATA;
return FALSE;
return false;
}
#define avail(wanted) BinarySource_data_avail(src, wanted)

38
misc.c
View File

@ -123,7 +123,7 @@ static const char *host_strchr_internal(const char *s, const char *set,
}
size_t host_strcspn(const char *s, const char *set)
{
const char *answer = host_strchr_internal(s, set, TRUE);
const char *answer = host_strchr_internal(s, set, true);
if (answer)
return answer - s;
else
@ -134,14 +134,14 @@ char *host_strchr(const char *s, int c)
char set[2];
set[0] = c;
set[1] = '\0';
return (char *) host_strchr_internal(s, set, TRUE);
return (char *) host_strchr_internal(s, set, true);
}
char *host_strrchr(const char *s, int c)
{
char set[2];
set[0] = c;
set[1] = '\0';
return (char *) host_strchr_internal(s, set, FALSE);
return (char *) host_strchr_internal(s, set, false);
}
#ifdef TEST_HOST_STRFOO
@ -235,9 +235,9 @@ prompts_t *new_prompts(void)
p->prompts = NULL;
p->n_prompts = 0;
p->data = NULL;
p->to_server = TRUE; /* to be on the safe side */
p->to_server = true; /* to be on the safe side */
p->name = p->instruction = NULL;
p->name_reqd = p->instr_reqd = FALSE;
p->name_reqd = p->instr_reqd = false;
return p;
}
void add_prompt(prompts_t *p, char *promptstr, int echo)
@ -830,9 +830,9 @@ int bufchain_try_fetch_consume(bufchain *ch, void *data, int len)
{
if (ch->buffersize >= len) {
bufchain_fetch_consume(ch, data, len);
return TRUE;
return true;
} else {
return FALSE;
return false;
}
}
@ -1113,11 +1113,11 @@ void smemclr(void *b, size_t n) {
/*
* Validate a manual host key specification (either entered in the
* GUI, or via -hostkey). If valid, we return TRUE, and update 'key'
* GUI, or via -hostkey). If valid, we return true, and update 'key'
* to contain a canonicalised version of the key string in 'key'
* (which is guaranteed to take up at most as much space as the
* original version), suitable for putting into the Conf. If not
* valid, we return FALSE.
* valid, we return false.
*/
int validate_manual_hostkey(char *key)
{
@ -1154,7 +1154,7 @@ int validate_manual_hostkey(char *key)
for (i = 0; i < 16*3 - 1; i++)
key[i] = tolower(q[i]);
key[16*3 - 1] = '\0';
return TRUE;
return true;
}
not_fingerprint:;
@ -1200,12 +1200,12 @@ int validate_manual_hostkey(char *key)
goto not_ssh2_blob; /* sorry */
strcpy(key, q);
return TRUE;
return true;
}
not_ssh2_blob:;
}
return FALSE;
return false;
}
int smemeq(const void *av, const void *bv, size_t len)
@ -1272,9 +1272,9 @@ int ptrlen_startswith(ptrlen whole, ptrlen prefix, ptrlen *tail)
tail->ptr = (const char *)whole.ptr + prefix.len;
tail->len = whole.len - prefix.len;
}
return TRUE;
return true;
}
return FALSE;
return false;
}
char *mkstr(ptrlen pl)
@ -1391,7 +1391,7 @@ char *buildinfo(const char *newline)
int nullseat_output(
Seat *seat, int is_stderr, const void *data, int len) { return 0; }
int nullseat_eof(Seat *seat) { return TRUE; }
int nullseat_eof(Seat *seat) { return true; }
int nullseat_get_userpass_input(
Seat *seat, prompts_t *p, bufchain *input) { return 0; }
void nullseat_notify_remote_exit(Seat *seat) {}
@ -1409,13 +1409,13 @@ int nullseat_confirm_weak_crypto_primitive(
int nullseat_confirm_weak_cached_hostkey(
Seat *seat, const char *algname, const char *betteralgs,
void (*callback)(void *ctx, int result), void *ctx) { return 0; }
int nullseat_is_never_utf8(Seat *seat) { return FALSE; }
int nullseat_is_always_utf8(Seat *seat) { return TRUE; }
int nullseat_is_never_utf8(Seat *seat) { return false; }
int nullseat_is_always_utf8(Seat *seat) { return true; }
void nullseat_echoedit_update(Seat *seat, int echoing, int editing) {}
const char *nullseat_get_x_display(Seat *seat) { return NULL; }
int nullseat_get_windowid(Seat *seat, long *id_out) { return FALSE; }
int nullseat_get_windowid(Seat *seat, long *id_out) { return false; }
int nullseat_get_window_pixel_size(
Seat *seat, int *width, int *height) { return FALSE; }
Seat *seat, int *width, int *height) { return false; }
void sk_free_peer_info(SocketPeerInfo *pi)
{

View File

@ -33,7 +33,7 @@ int cmdline_get_passwd_input(prompts_t *p)
int cmdline_process_param(const char *p, char *value,
int need_save, Conf *conf)
{
assert(FALSE && "cmdline_process_param should never be called");
assert(false && "cmdline_process_param should never be called");
}
/*

View File

@ -27,7 +27,7 @@ int random_byte(void)
return 0; /* unreachable, but placate optimiser */
}
static int pageant_local = FALSE;
static int pageant_local = false;
/*
* rsakeys stores SSH-1 RSA keys. ssh2keys stores all SSH-2 keys.
@ -627,7 +627,7 @@ void pageant_failure_msg(BinarySink *bs,
void pageant_init(void)
{
pageant_local = TRUE;
pageant_local = true;
rsakeys = newtree234(cmpkeys_rsa);
ssh2keys = newtree234(cmpkeys_ssh2);
}
@ -666,18 +666,18 @@ int pageant_delete_ssh1_key(struct RSAKey *rkey)
{
struct RSAKey *deleted = del234(rsakeys, rkey);
if (!deleted)
return FALSE;
return false;
assert(deleted == rkey);
return TRUE;
return true;
}
int pageant_delete_ssh2_key(struct ssh2_userkey *skey)
{
struct ssh2_userkey *deleted = del234(ssh2keys, skey);
if (!deleted)
return FALSE;
return false;
assert(deleted == skey);
return TRUE;
return true;
}
/* ----------------------------------------------------------------------
@ -842,7 +842,7 @@ static int pageant_listen_accepting(Plug *plug,
if ((err = sk_socket_error(pc->connsock)) != NULL) {
sk_close(pc->connsock);
sfree(pc);
return TRUE;
return true;
}
sk_set_frozen(pc->connsock, 0);

View File

@ -20,7 +20,7 @@ static void pinger_timer(void *ctx, unsigned long now)
if (pinger->pending && now == pinger->next) {
backend_special(pinger->backend, SS_PING, 0);
pinger->pending = FALSE;
pinger->pending = false;
pinger_schedule(pinger);
}
}
@ -30,7 +30,7 @@ static void pinger_schedule(Pinger *pinger)
unsigned long next;
if (!pinger->interval) {
pinger->pending = FALSE; /* cancel any pending ping */
pinger->pending = false; /* cancel any pending ping */
return;
}
@ -40,7 +40,7 @@ static void pinger_schedule(Pinger *pinger)
(next - pinger->when_set) < (pinger->next - pinger->when_set)) {
pinger->next = next;
pinger->when_set = timing_last_clock();
pinger->pending = TRUE;
pinger->pending = true;
}
}
@ -49,7 +49,7 @@ Pinger *pinger_new(Conf *conf, Backend *backend)
Pinger *pinger = snew(Pinger);
pinger->interval = conf_get_int(conf, CONF_ping_interval);
pinger->pending = FALSE;
pinger->pending = false;
pinger->backend = backend;
pinger_schedule(pinger);

View File

@ -254,7 +254,7 @@ static void pfd_receive(Plug *plug, int urgent, char *data, int len)
return;
if (socks_version == 4 && message_type == 1) {
/* CONNECT message */
int name_based = FALSE;
int name_based = false;
port = get_uint16(src);
ipv4 = get_uint32(src);
@ -264,7 +264,7 @@ static void pfd_receive(Plug *plug, int urgent, char *data, int len)
* extension to specify a hostname, which comes
* after the username.
*/
name_based = TRUE;
name_based = true;
}
get_asciz(src); /* skip username */
socks4_hostname = name_based ? get_asciz(src) : NULL;
@ -475,12 +475,12 @@ Channel *portfwd_raw_new(ConnectionLayer *cl, Plug **plug)
pf->plug.vt = &PortForwarding_plugvt;
pf->chan.initial_fixed_window_size = 0;
pf->chan.vt = &PortForwarding_channelvt;
pf->input_wanted = TRUE;
pf->input_wanted = true;
pf->c = NULL;
pf->cl = cl;
pf->input_wanted = TRUE;
pf->input_wanted = true;
pf->ready = 0;
pf->socks_state = SOCKS_NONE;
@ -526,7 +526,7 @@ static int pfl_accepting(Plug *p, accept_fn_t constructor, accept_ctx_t ctx)
s = constructor(ctx, plug);
if ((err = sk_socket_error(s)) != NULL) {
portfwd_raw_free(chan);
return TRUE;
return true;
}
pf = container_of(chan, struct PortForwarding, chan);
@ -581,9 +581,9 @@ static char *pfl_listen(const char *desthost, int destport,
if (desthost) {
pl->hostname = dupstr(desthost);
pl->port = destport;
pl->is_dynamic = FALSE;
pl->is_dynamic = false;
} else
pl->is_dynamic = TRUE;
pl->is_dynamic = true;
pl->cl = cl;
pl->s = new_listener(srcaddr, port, &pl->plug,
@ -1072,7 +1072,7 @@ int portfwdmgr_listen(PortFwdManager *mgr, const char *host, int port,
* We had this record already. Return failure.
*/
pfr_free(pfr);
return FALSE;
return false;
}
char *err = pfl_listen(keyhost, keyport, host, port,
@ -1085,10 +1085,10 @@ int portfwdmgr_listen(PortFwdManager *mgr, const char *host, int port,
sfree(err);
del234(mgr->forwardings, pfr);
pfr_free(pfr);
return FALSE;
return false;
}
return TRUE;
return true;
}
int portfwdmgr_unlisten(PortFwdManager *mgr, const char *host, int port)
@ -1108,12 +1108,12 @@ int portfwdmgr_unlisten(PortFwdManager *mgr, const char *host, int port)
PortFwdRecord *pfr = del234(mgr->forwardings, &pfr_key);
if (!pfr)
return FALSE;
return false;
logeventf(mgr->cl->logctx, "Closing listening port %s:%d", host, port);
pfr_free(pfr);
return TRUE;
return true;
}
/*
@ -1152,7 +1152,7 @@ char *portfwdmgr_connect(PortFwdManager *mgr, Channel **chan_ret,
pf->plug.vt = &PortForwarding_plugvt;
pf->chan.initial_fixed_window_size = 0;
pf->chan.vt = &PortForwarding_channelvt;
pf->input_wanted = TRUE;
pf->input_wanted = true;
pf->ready = 1;
pf->c = c;
pf->cl = mgr->cl;

View File

@ -778,7 +778,7 @@ int proxy_socks4_negotiate (ProxySocket *p, int change)
strbuf *command = strbuf_new();
char hostname[512];
int write_hostname = FALSE;
int write_hostname = false;
put_byte(command, 4); /* SOCKS version 4 */
put_byte(command, 1); /* CONNECT command */
@ -795,7 +795,7 @@ int proxy_socks4_negotiate (ProxySocket *p, int change)
case ADDRTYPE_NAME:
sk_getaddr(p->remote_addr, hostname, lenof(hostname));
put_uint32(command, 1);
write_hostname = TRUE;
write_hostname = true;
break;
case ADDRTYPE_IPV6:
p->error = "Proxy error: SOCKS version 4 does not support IPv6";

26
pscp.c
View File

@ -44,7 +44,7 @@ static int uploading = 0;
static Backend *backend;
static Conf *conf;
int sent_eof = FALSE;
int sent_eof = false;
static void source(const char *src);
static void rsource(const char *src);
@ -199,7 +199,7 @@ static int pscp_eof(Seat *seat)
seat_connection_fatal(
pscp_seat, "Received unexpected end-of-file from server");
}
return FALSE;
return false;
}
static int ssh_scp_recv(void *buf, int len)
{
@ -286,7 +286,7 @@ static void bump(const char *fmt, ...)
if (backend && backend_connected(backend)) {
char ch;
backend_special(backend, SS_EOF, 0);
sent_eof = TRUE;
sent_eof = true;
ssh_scp_recv(&ch, 1);
}
@ -439,7 +439,7 @@ static void do_cmd(char *host, char *user, char *cmd)
*/
conf_set_int(conf, CONF_x11_forward, 0);
conf_set_int(conf, CONF_agentfwd, 0);
conf_set_int(conf, CONF_ssh_simple, TRUE);
conf_set_int(conf, CONF_ssh_simple, true);
{
char *key;
while ((key = conf_get_str_nthstrkey(conf, CONF_portfwd, 0)) != NULL)
@ -457,12 +457,12 @@ static void do_cmd(char *host, char *user, char *cmd)
/* First choice is SFTP subsystem. */
main_cmd_is_sftp = 1;
conf_set_str(conf, CONF_remote_cmd, "sftp");
conf_set_int(conf, CONF_ssh_subsys, TRUE);
conf_set_int(conf, CONF_ssh_subsys, true);
if (try_scp) {
/* Fallback is to use the provided scp command. */
fallback_cmd_is_sftp = 0;
conf_set_str(conf, CONF_remote_cmd2, cmd);
conf_set_int(conf, CONF_ssh_subsys2, FALSE);
conf_set_int(conf, CONF_ssh_subsys2, false);
} else {
/* Since we're not going to try SCP, we may as well try
* harder to find an SFTP server, since in the current
@ -475,15 +475,15 @@ static void do_cmd(char *host, char *user, char *cmd)
"test -x /usr/local/lib/sftp-server &&"
" exec /usr/local/lib/sftp-server\n"
"exec sftp-server");
conf_set_int(conf, CONF_ssh_subsys2, FALSE);
conf_set_int(conf, CONF_ssh_subsys2, false);
}
} else {
/* Don't try SFTP at all; just try the scp command. */
main_cmd_is_sftp = 0;
conf_set_str(conf, CONF_remote_cmd, cmd);
conf_set_int(conf, CONF_ssh_subsys, FALSE);
conf_set_int(conf, CONF_ssh_subsys, false);
}
conf_set_int(conf, CONF_nopty, TRUE);
conf_set_int(conf, CONF_nopty, true);
logctx = log_init(default_logpolicy, conf);
@ -2239,8 +2239,8 @@ void cmdline_error(const char *p, ...)
exit(1);
}
const int share_can_be_downstream = TRUE;
const int share_can_be_upstream = FALSE;
const int share_can_be_downstream = true;
const int share_can_be_upstream = false;
/*
* Main program. (Called `psftp_main' because it gets called from
@ -2263,7 +2263,7 @@ int psftp_main(int argc, char *argv[])
/* Load Default Settings before doing anything else. */
conf = conf_new();
do_defaults(NULL, conf);
loaded_session = FALSE;
loaded_session = false;
for (i = 1; i < argc; i++) {
int ret;
@ -2336,7 +2336,7 @@ int psftp_main(int argc, char *argv[])
if (backend && backend_connected(backend)) {
char ch;
backend_special(backend, SS_EOF, 0);
sent_eof = TRUE;
sent_eof = true;
ssh_scp_recv(&ch, 1);
}
random_save_seed();

106
psftp.c
View File

@ -35,7 +35,7 @@ void do_sftp_cleanup();
char *pwd, *homedir;
static Backend *backend;
static Conf *conf;
int sent_eof = FALSE;
int sent_eof = false;
/* ------------------------------------------------------------
* Seat vtable.
@ -235,7 +235,7 @@ int sftp_get_file(char *fname, char *outfname, int recurse, int restart)
struct fxp_xfer *xfer;
uint64_t offset;
WFile *file;
int ret, shown_err = FALSE;
int ret, shown_err = false;
struct fxp_attrs attrs;
/*
@ -378,7 +378,7 @@ int sftp_get_file(char *fname, char *outfname, int recurse, int restart)
nextfname = dupcat(fname, "/", ournames[i]->filename, NULL);
nextoutfname = dir_file_cat(outfname, ournames[i]->filename);
ret = sftp_get_file(nextfname, nextoutfname, recurse, restart);
restart = FALSE; /* after first partial file, do full */
restart = false; /* after first partial file, do full */
sfree(nextoutfname);
sfree(nextfname);
if (!ret) {
@ -469,7 +469,7 @@ int sftp_get_file(char *fname, char *outfname, int recurse, int restart)
if (ret <= 0) {
if (!shown_err) {
printf("error while reading: %s\n", fxp_error());
shown_err = TRUE;
shown_err = true;
}
if (ret == INT_MIN) /* pktin not even freed */
sfree(pktin);
@ -622,7 +622,7 @@ int sftp_put_file(char *fname, char *outfname, int recurse, int restart)
nextfname = dir_file_cat(fname, ournames[i]);
nextoutfname = dupcat(outfname, "/", ournames[i], NULL);
ret = sftp_put_file(nextfname, nextoutfname, recurse, restart);
restart = FALSE; /* after first partial file, do full */
restart = false; /* after first partial file, do full */
sfree(nextoutfname);
sfree(nextfname);
if (!ret) {
@ -914,7 +914,7 @@ int wildcard_iterate(char *filename, int (*func)(void *, char *), void *ctx)
if (is_wc) {
SftpWildcardMatcher *swcm = sftp_begin_wildcard_matching(filename);
int matched = FALSE;
int matched = false;
sfree(unwcfname);
if (!swcm)
@ -929,7 +929,7 @@ int wildcard_iterate(char *filename, int (*func)(void *, char *), void *ctx)
ret = 0;
}
sfree(newname);
matched = TRUE;
matched = true;
ret &= func(ctx, cname);
sfree(cname);
}
@ -1000,7 +1000,7 @@ int sftp_cmd_close(struct sftp_command *cmd)
if (backend_connected(backend)) {
char ch;
backend_special(backend, SS_EOF, 0);
sent_eof = TRUE;
sent_eof = true;
sftp_recvdata(&ch, 1);
}
do_sftp_cleanup();
@ -1211,7 +1211,7 @@ int sftp_general_get(struct sftp_command *cmd, int restart, int multiple)
{
char *fname, *unwcfname, *origfname, *origwfname, *outfname;
int i, ret;
int recurse = FALSE;
int recurse = false;
if (!backend) {
not_connected();
@ -1225,7 +1225,7 @@ int sftp_general_get(struct sftp_command *cmd, int restart, int multiple)
i++;
break;
} else if (!strcmp(cmd->words[i], "-r")) {
recurse = TRUE;
recurse = true;
} else {
printf("%s: unrecognised option '%s'\n", cmd->words[0], cmd->words[i]);
return 0;
@ -1327,7 +1327,7 @@ int sftp_general_put(struct sftp_command *cmd, int restart, int multiple)
{
char *fname, *wfname, *origoutfname, *outfname;
int i, ret;
int recurse = FALSE;
int recurse = false;
if (!backend) {
not_connected();
@ -1341,7 +1341,7 @@ int sftp_general_put(struct sftp_command *cmd, int restart, int multiple)
i++;
break;
} else if (!strcmp(cmd->words[i], "-r")) {
recurse = TRUE;
recurse = true;
} else {
printf("%s: unrecognised option '%s'\n", cmd->words[0], cmd->words[i]);
return 0;
@ -1359,7 +1359,7 @@ int sftp_general_put(struct sftp_command *cmd, int restart, int multiple)
WildcardMatcher *wcm;
fname = cmd->words[i++];
if (multiple && test_wildcard(fname, FALSE) == WCTYPE_WILDCARD) {
if (multiple && test_wildcard(fname, false) == WCTYPE_WILDCARD) {
wcm = begin_wildcard_matching(fname);
wfname = wildcard_get_filename(wcm);
if (!wfname) {
@ -1560,9 +1560,9 @@ static int check_is_dir(char *dstfname)
if (result &&
(attrs.flags & SSH_FILEXFER_ATTR_PERMISSIONS) &&
(attrs.permissions & 0040000))
return TRUE;
return true;
else
return FALSE;
return false;
}
struct sftp_context_mv {
@ -1935,20 +1935,20 @@ static struct sftp_cmd_lookup {
* in ASCII order.
*/
{
"!", TRUE, "run a local command",
"!", true, "run a local command",
"<command>\n"
/* FIXME: this example is crap for non-Windows. */
" Runs a local command. For example, \"!del myfile\".\n",
sftp_cmd_pling
},
{
"bye", TRUE, "finish your SFTP session",
"bye", true, "finish your SFTP session",
"\n"
" Terminates your SFTP session and quits the PSFTP program.\n",
sftp_cmd_quit
},
{
"cd", TRUE, "change your remote working directory",
"cd", true, "change your remote working directory",
" [ <new working directory> ]\n"
" Change the remote working directory for your SFTP session.\n"
" If a new working directory is not supplied, you will be\n"
@ -1956,7 +1956,7 @@ static struct sftp_cmd_lookup {
sftp_cmd_cd
},
{
"chmod", TRUE, "change file permissions and modes",
"chmod", true, "change file permissions and modes",
" <modes> <filename-or-wildcard> [ <filename-or-wildcard>... ]\n"
" Change the file permissions on one or more remote files or\n"
" directories.\n"
@ -1984,7 +1984,7 @@ static struct sftp_cmd_lookup {
sftp_cmd_chmod
},
{
"close", TRUE, "finish your SFTP session but do not quit PSFTP",
"close", true, "finish your SFTP session but do not quit PSFTP",
"\n"
" Terminates your SFTP session, but does not quit the PSFTP\n"
" program. You can then use \"open\" to start another SFTP\n"
@ -1992,16 +1992,16 @@ static struct sftp_cmd_lookup {
sftp_cmd_close
},
{
"del", TRUE, "delete files on the remote server",
"del", true, "delete files on the remote server",
" <filename-or-wildcard> [ <filename-or-wildcard>... ]\n"
" Delete a file or files from the server.\n",
sftp_cmd_rm
},
{
"delete", FALSE, "del", NULL, sftp_cmd_rm
"delete", false, "del", NULL, sftp_cmd_rm
},
{
"dir", TRUE, "list remote files",
"dir", true, "list remote files",
" [ <directory-name> ]/[ <wildcard> ]\n"
" List the contents of a specified directory on the server.\n"
" If <directory-name> is not given, the current working directory\n"
@ -2011,10 +2011,10 @@ static struct sftp_cmd_lookup {
sftp_cmd_ls
},
{
"exit", TRUE, "bye", NULL, sftp_cmd_quit
"exit", true, "bye", NULL, sftp_cmd_quit
},
{
"get", TRUE, "download a file from the server to your local machine",
"get", true, "download a file from the server to your local machine",
" [ -r ] [ -- ] <filename> [ <local-filename> ]\n"
" Downloads a file on the server and stores it locally under\n"
" the same name, or under a different one if you supply the\n"
@ -2023,7 +2023,7 @@ static struct sftp_cmd_lookup {
sftp_cmd_get
},
{
"help", TRUE, "give help",
"help", true, "give help",
" [ <command> [ <command> ... ] ]\n"
" Give general help if no commands are specified.\n"
" If one or more commands are specified, give specific help on\n"
@ -2031,25 +2031,25 @@ static struct sftp_cmd_lookup {
sftp_cmd_help
},
{
"lcd", TRUE, "change local working directory",
"lcd", true, "change local working directory",
" <local-directory-name>\n"
" Change the local working directory of the PSFTP program (the\n"
" default location where the \"get\" command will save files).\n",
sftp_cmd_lcd
},
{
"lpwd", TRUE, "print local working directory",
"lpwd", true, "print local working directory",
"\n"
" Print the local working directory of the PSFTP program (the\n"
" default location where the \"get\" command will save files).\n",
sftp_cmd_lpwd
},
{
"ls", TRUE, "dir", NULL,
"ls", true, "dir", NULL,
sftp_cmd_ls
},
{
"mget", TRUE, "download multiple files at once",
"mget", true, "download multiple files at once",
" [ -r ] [ -- ] <filename-or-wildcard> [ <filename-or-wildcard>... ]\n"
" Downloads many files from the server, storing each one under\n"
" the same name it has on the server side. You can use wildcards\n"
@ -2058,13 +2058,13 @@ static struct sftp_cmd_lookup {
sftp_cmd_mget
},
{
"mkdir", TRUE, "create directories on the remote server",
"mkdir", true, "create directories on the remote server",
" <directory-name> [ <directory-name>... ]\n"
" Creates directories with the given names on the server.\n",
sftp_cmd_mkdir
},
{
"mput", TRUE, "upload multiple files at once",
"mput", true, "upload multiple files at once",
" [ -r ] [ -- ] <filename-or-wildcard> [ <filename-or-wildcard>... ]\n"
" Uploads many files to the server, storing each one under the\n"
" same name it has on the client side. You can use wildcards\n"
@ -2073,7 +2073,7 @@ static struct sftp_cmd_lookup {
sftp_cmd_mput
},
{
"mv", TRUE, "move or rename file(s) on the remote server",
"mv", true, "move or rename file(s) on the remote server",
" <source> [ <source>... ] <destination>\n"
" Moves or renames <source>(s) on the server to <destination>,\n"
" also on the server.\n"
@ -2085,14 +2085,14 @@ static struct sftp_cmd_lookup {
sftp_cmd_mv
},
{
"open", TRUE, "connect to a host",
"open", true, "connect to a host",
" [<user>@]<hostname> [<port>]\n"
" Establishes an SFTP connection to a given host. Only usable\n"
" when you are not already connected to a server.\n",
sftp_cmd_open
},
{
"put", TRUE, "upload a file from your local machine to the server",
"put", true, "upload a file from your local machine to the server",
" [ -r ] [ -- ] <filename> [ <remote-filename> ]\n"
" Uploads a file to the server and stores it there under\n"
" the same name, or under a different one if you supply the\n"
@ -2101,17 +2101,17 @@ static struct sftp_cmd_lookup {
sftp_cmd_put
},
{
"pwd", TRUE, "print your remote working directory",
"pwd", true, "print your remote working directory",
"\n"
" Print the current remote working directory for your SFTP session.\n",
sftp_cmd_pwd
},
{
"quit", TRUE, "bye", NULL,
"quit", true, "bye", NULL,
sftp_cmd_quit
},
{
"reget", TRUE, "continue downloading files",
"reget", true, "continue downloading files",
" [ -r ] [ -- ] <filename> [ <local-filename> ]\n"
" Works exactly like the \"get\" command, but the local file\n"
" must already exist. The download will begin at the end of the\n"
@ -2120,15 +2120,15 @@ static struct sftp_cmd_lookup {
sftp_cmd_reget
},
{
"ren", TRUE, "mv", NULL,
"ren", true, "mv", NULL,
sftp_cmd_mv
},
{
"rename", FALSE, "mv", NULL,
"rename", false, "mv", NULL,
sftp_cmd_mv
},
{
"reput", TRUE, "continue uploading files",
"reput", true, "continue uploading files",
" [ -r ] [ -- ] <filename> [ <remote-filename> ]\n"
" Works exactly like the \"put\" command, but the remote file\n"
" must already exist. The upload will begin at the end of the\n"
@ -2137,11 +2137,11 @@ static struct sftp_cmd_lookup {
sftp_cmd_reput
},
{
"rm", TRUE, "del", NULL,
"rm", true, "del", NULL,
sftp_cmd_rm
},
{
"rmdir", TRUE, "remove directories on the remote server",
"rmdir", true, "remove directories on the remote server",
" <directory-name> [ <directory-name>... ]\n"
" Removes the directory with the given name on the server.\n"
" The directory will not be removed unless it is empty.\n"
@ -2382,7 +2382,7 @@ void do_sftp_cleanup()
char ch;
if (backend) {
backend_special(backend, SS_EOF, 0);
sent_eof = TRUE;
sent_eof = true;
sftp_recvdata(&ch, 1);
backend_free(backend);
sftp_cleanup_request();
@ -2545,7 +2545,7 @@ static int psftp_eof(Seat *seat)
seat_connection_fatal(
psftp_seat, "Received unexpected end-of-file from SFTP server");
}
return FALSE;
return false;
}
int sftp_recvdata(char *buf, int len)
@ -2763,7 +2763,7 @@ static int psftp_connect(char *userhost, char *user, int portnumber)
*/
conf_set_int(conf, CONF_x11_forward, 0);
conf_set_int(conf, CONF_agentfwd, 0);
conf_set_int(conf, CONF_ssh_simple, TRUE);
conf_set_int(conf, CONF_ssh_simple, true);
{
char *key;
while ((key = conf_get_str_nthstrkey(conf, CONF_portfwd, 0)) != NULL)
@ -2772,8 +2772,8 @@ static int psftp_connect(char *userhost, char *user, int portnumber)
/* Set up subsystem name. */
conf_set_str(conf, CONF_remote_cmd, "sftp");
conf_set_int(conf, CONF_ssh_subsys, TRUE);
conf_set_int(conf, CONF_nopty, TRUE);
conf_set_int(conf, CONF_ssh_subsys, true);
conf_set_int(conf, CONF_nopty, true);
/*
* Set up fallback option, for SSH-1 servers or servers with the
@ -2798,7 +2798,7 @@ static int psftp_connect(char *userhost, char *user, int portnumber)
"test -x /usr/local/lib/sftp-server &&"
" exec /usr/local/lib/sftp-server\n"
"exec sftp-server");
conf_set_int(conf, CONF_ssh_subsys2, FALSE);
conf_set_int(conf, CONF_ssh_subsys2, false);
logctx = log_init(default_logpolicy, conf);
@ -2839,8 +2839,8 @@ void cmdline_error(const char *p, ...)
exit(1);
}
const int share_can_be_downstream = TRUE;
const int share_can_be_upstream = FALSE;
const int share_can_be_downstream = true;
const int share_can_be_upstream = false;
/*
* Main program. Parse arguments etc.
@ -2867,7 +2867,7 @@ int psftp_main(int argc, char *argv[])
/* Load Default Settings before doing anything else. */
conf = conf_new();
do_defaults(NULL, conf);
loaded_session = FALSE;
loaded_session = false;
for (i = 1; i < argc; i++) {
int ret;
@ -2948,7 +2948,7 @@ int psftp_main(int argc, char *argv[])
if (backend && backend_connected(backend)) {
char ch;
backend_special(backend, SS_EOF, 0);
sent_eof = TRUE;
sent_eof = true;
sftp_recvdata(&ch, 1);
}
do_sftp_cleanup();

View File

@ -36,11 +36,11 @@ int ssh_sftp_loop_iteration(void);
* Read a command line for PSFTP from standard input. Caller must
* free.
*
* If `backend_required' is TRUE, should also listen for activity
* If `backend_required' is true, should also listen for activity
* at the backend (rekeys, clientalives, unexpected closures etc)
* and respond as necessary, and if the backend closes it should
* treat this as a failure condition. If `backend_required' is
* FALSE, a back end is not (intentionally) active at all (e.g.
* false, a back end is not (intentionally) active at all (e.g.
* psftp before an `open' command).
*/
char *ssh_sftp_get_cmdline(const char *prompt, int backend_required);
@ -166,7 +166,7 @@ void finish_wildcard_matching(WildcardMatcher *dir);
* to filenames returned from FXP_READDIR, which means we can panic
* if we see _anything_ resembling a directory separator.
*
* Returns TRUE if the filename is kosher, FALSE if dangerous.
* Returns true if the filename is kosher, false if dangerous.
*/
int vet_filename(const char *name);

26
putty.h
View File

@ -511,7 +511,7 @@ struct BackendVtable {
const SessionSpecial *(*get_specials) (Backend *be);
int (*connected) (Backend *be);
int (*exitcode) (Backend *be);
/* If back->sendok() returns FALSE, the backend doesn't currently
/* If back->sendok() returns false, the backend doesn't currently
* want input data, so the frontend should avoid acquiring any if
* possible (passing back-pressure on to its sender). */
int (*sendok) (Backend *be);
@ -593,7 +593,7 @@ GLOBAL int default_protocol;
GLOBAL int default_port;
/*
* This is set TRUE by cmdline.c iff a session is loaded with "-load".
* This is set true by cmdline.c iff a session is loaded with "-load".
*/
GLOBAL int loaded_session;
/*
@ -746,9 +746,9 @@ struct SeatVtable {
/*
* Called when the back end wants to indicate that EOF has arrived
* on the server-to-client stream. Returns FALSE to indicate that
* on the server-to-client stream. Returns false to indicate that
* we intend to keep the session open in the other direction, or
* TRUE to indicate that if they're closing so are we.
* true to indicate that if they're closing so are we.
*/
int (*eof)(Seat *seat);
@ -901,16 +901,16 @@ struct SeatVtable {
/*
* Return the X11 id of the X terminal window relevant to a seat,
* by returning TRUE and filling in the output pointer. Return
* FALSE if there isn't one or if the concept is meaningless.
* by returning true and filling in the output pointer. Return
* false if there isn't one or if the concept is meaningless.
*/
int (*get_windowid)(Seat *seat, long *id_out);
/*
* Return the size of the terminal window in pixels. If the
* concept is meaningless or the information is unavailable,
* return FALSE; otherwise fill in the output pointers and return
* TRUE.
* return false; otherwise fill in the output pointers and return
* true.
*/
int (*get_window_pixel_size)(Seat *seat, int *width, int *height);
};
@ -953,9 +953,9 @@ void seat_connection_fatal(Seat *seat, const char *fmt, ...);
/* Handy aliases for seat_output which set is_stderr to a fixed value. */
#define seat_stdout(seat, data, len) \
seat_output(seat, FALSE, data, len)
seat_output(seat, false, data, len)
#define seat_stderr(seat, data, len) \
seat_output(seat, TRUE, data, len)
seat_output(seat, true, data, len)
/*
* Stub methods for seat implementations that want to use the obvious
@ -1922,9 +1922,9 @@ int open_for_write_would_lose_data(const Filename *fn);
* run_timers() is called from the front end when it has reason to
* think some timers have reached their moment, or when it simply
* needs to know how long to wait next. We pass it the time we
* think it is. It returns TRUE and places the time when the next
* think it is. It returns true and places the time when the next
* timer needs to go off in `next', or alternatively it returns
* FALSE if there are no timers at all pending.
* false if there are no timers at all pending.
*
* timer_change_notify() must be supplied by the front end; it
* notifies the front end that a new timer has been added to the
@ -2020,7 +2020,7 @@ unsigned long timing_last_clock(void);
* call) then it can call toplevel_callback_pending(), which will
* return true if at least one callback is in the queue.
*
* run_toplevel_callbacks() returns TRUE if it ran any actual code.
* run_toplevel_callbacks() returns true if it ran any actual code.
* This can be used as a means of speculatively terminating a select
* loop, as in PSFTP, for example - if a callback has run then perhaps
* it might have done whatever the loop's caller was waiting for.

16
raw.c
View File

@ -66,7 +66,7 @@ static void raw_closing(Plug *plug, const char *error_msg, int error_code,
if (raw->s) {
sk_close(raw->s);
raw->s = NULL;
raw->closed_on_socket_error = TRUE;
raw->closed_on_socket_error = true;
seat_notify_remote_exit(raw->seat);
}
logevent(raw->logctx, error_msg);
@ -81,10 +81,10 @@ static void raw_closing(Plug *plug, const char *error_msg, int error_code,
if (!raw->sent_socket_eof) {
if (raw->s)
sk_write_eof(raw->s);
raw->sent_socket_eof= TRUE;
raw->sent_socket_eof= true;
}
}
raw->sent_console_eof = TRUE;
raw->sent_console_eof = true;
raw_check_close(raw);
}
}
@ -95,7 +95,7 @@ static void raw_receive(Plug *plug, int urgent, char *data, int len)
c_write(raw, data, len);
/* We count 'session start', for proxy logging purposes, as being
* when data is received from the network and printed. */
raw->session_started = TRUE;
raw->session_started = true;
}
static void raw_sent(Plug *plug, int bufsize)
@ -134,11 +134,11 @@ static const char *raw_init(Seat *seat, Backend **backend_handle,
raw->plug.vt = &Raw_plugvt;
raw->backend.vt = &raw_backend;
raw->s = NULL;
raw->closed_on_socket_error = FALSE;
raw->closed_on_socket_error = false;
*backend_handle = &raw->backend;
raw->sent_console_eof = raw->sent_socket_eof = FALSE;
raw->sent_console_eof = raw->sent_socket_eof = false;
raw->bufsize = 0;
raw->session_started = FALSE;
raw->session_started = false;
raw->conf = conf_copy(conf);
raw->seat = seat;
@ -239,7 +239,7 @@ static void raw_special(Backend *be, SessionSpecialCode code, int arg)
Raw *raw = container_of(be, Raw, backend);
if (code == SS_EOF && raw->s) {
sk_write_eof(raw->s);
raw->sent_socket_eof= TRUE;
raw->sent_socket_eof= true;
raw_check_close(raw);
}

View File

@ -61,7 +61,7 @@ static void rlogin_closing(Plug *plug, const char *error_msg, int error_code,
sk_close(rlogin->s);
rlogin->s = NULL;
if (error_msg)
rlogin->closed_on_socket_error = TRUE;
rlogin->closed_on_socket_error = true;
seat_notify_remote_exit(rlogin->seat);
}
if (error_msg) {
@ -166,7 +166,7 @@ static const char *rlogin_init(Seat *seat, Backend **backend_handle,
rlogin->plug.vt = &Rlogin_plugvt;
rlogin->backend.vt = &rlogin_backend;
rlogin->s = NULL;
rlogin->closed_on_socket_error = FALSE;
rlogin->closed_on_socket_error = false;
rlogin->seat = seat;
rlogin->logctx = logctx;
rlogin->term_width = conf_get_int(conf, CONF_width);
@ -224,9 +224,9 @@ static const char *rlogin_init(Seat *seat, Backend **backend_handle,
int ret;
rlogin->prompt = new_prompts();
rlogin->prompt->to_server = TRUE;
rlogin->prompt->to_server = true;
rlogin->prompt->name = dupstr("Rlogin login name");
add_prompt(rlogin->prompt, dupstr("rlogin username: "), TRUE);
add_prompt(rlogin->prompt, dupstr("rlogin username: "), true);
ret = seat_get_userpass_input(rlogin->seat, rlogin->prompt, NULL);
if (ret >= 0) {
rlogin_startup(rlogin, rlogin->prompt->prompts[0]->result);

View File

@ -268,14 +268,14 @@ struct ScpReplyReceiver {
static void scp_reply_ok(SftpReplyBuilder *srb)
{
ScpReplyReceiver *reply = container_of(srb, ScpReplyReceiver, srb);
reply->err = FALSE;
reply->err = false;
}
static void scp_reply_error(
SftpReplyBuilder *srb, unsigned code, const char *msg)
{
ScpReplyReceiver *reply = container_of(srb, ScpReplyReceiver, srb);
reply->err = TRUE;
reply->err = true;
reply->code = code;
sfree(reply->errmsg);
reply->errmsg = dupstr(msg);
@ -284,7 +284,7 @@ static void scp_reply_error(
static void scp_reply_name_count(SftpReplyBuilder *srb, unsigned count)
{
ScpReplyReceiver *reply = container_of(srb, ScpReplyReceiver, srb);
reply->err = FALSE;
reply->err = false;
}
static void scp_reply_full_name(
@ -293,7 +293,7 @@ static void scp_reply_full_name(
{
ScpReplyReceiver *reply = container_of(srb, ScpReplyReceiver, srb);
char *p;
reply->err = FALSE;
reply->err = false;
sfree((void *)reply->name.ptr);
reply->name.ptr = p = mkstr(name);
reply->name.len = name.len;
@ -303,14 +303,14 @@ static void scp_reply_full_name(
static void scp_reply_simple_name(SftpReplyBuilder *srb, ptrlen name)
{
ScpReplyReceiver *reply = container_of(srb, ScpReplyReceiver, srb);
reply->err = FALSE;
reply->err = false;
}
static void scp_reply_handle(SftpReplyBuilder *srb, ptrlen handle)
{
ScpReplyReceiver *reply = container_of(srb, ScpReplyReceiver, srb);
char *p;
reply->err = FALSE;
reply->err = false;
sfree((void *)reply->handle.ptr);
reply->handle.ptr = p = mkstr(handle);
reply->handle.len = handle.len;
@ -320,7 +320,7 @@ static void scp_reply_data(SftpReplyBuilder *srb, ptrlen data)
{
ScpReplyReceiver *reply = container_of(srb, ScpReplyReceiver, srb);
char *p;
reply->err = FALSE;
reply->err = false;
sfree((void *)reply->data.ptr);
reply->data.ptr = p = mkstr(data);
reply->data.len = data.len;
@ -330,7 +330,7 @@ static void scp_reply_attrs(
SftpReplyBuilder *srb, struct fxp_attrs attrs)
{
ScpReplyReceiver *reply = container_of(srb, ScpReplyReceiver, srb);
reply->err = FALSE;
reply->err = false;
reply->attrs = attrs;
}
@ -426,8 +426,8 @@ static void scp_source_push(ScpSource *scp, ScpSourceNodeType type,
static char *scp_source_err_base(ScpSource *scp, const char *fmt, va_list ap)
{
char *msg = dupvprintf(fmt, ap);
sshfwd_write_ext(scp->sc, TRUE, msg, strlen(msg));
sshfwd_write_ext(scp->sc, TRUE, "\012", 1);
sshfwd_write_ext(scp->sc, true, msg, strlen(msg));
sshfwd_write_ext(scp->sc, true, "\012", 1);
return msg;
}
static void scp_source_err(ScpSource *scp, const char *fmt, ...)
@ -451,7 +451,7 @@ static void scp_source_abort(ScpSource *scp, const char *fmt, ...)
sshfwd_write_eof(scp->sc);
sshfwd_initiate_close(scp->sc, msg);
scp->finished = TRUE;
scp->finished = true;
}
static void scp_source_push_name(
@ -687,7 +687,7 @@ static void scp_source_process_stack(ScpSource *scp)
* wildcard (if any) we're using to match the filenames we get
* back.
*/
sftpsrv_stat(scp->sf, &scp->reply.srb, pathname, TRUE);
sftpsrv_stat(scp->sf, &scp->reply.srb, pathname, true);
if (scp->reply.err) {
scp_source_abort(
scp, "%.*s: unable to access: %s",
@ -755,7 +755,7 @@ static void scp_source_process_stack(ScpSource *scp)
sshfwd_send_exit_status(scp->sc, 0);
sshfwd_write_eof(scp->sc);
sshfwd_initiate_close(scp->sc, NULL);
scp->finished = TRUE;
scp->finished = true;
return;
}
@ -766,7 +766,7 @@ static void scp_source_process_stack(ScpSource *scp)
scp->head = node->next;
if (node->type == SCP_READDIR) {
sftpsrv_readdir(scp->sf, &scp->reply.srb, node->handle, 1, TRUE);
sftpsrv_readdir(scp->sf, &scp->reply.srb, node->handle, 1, true);
if (scp->reply.err) {
if (scp->reply.code != SSH_FX_EOF)
scp_source_err(scp, "%.*s: unable to list directory: %s",
@ -871,7 +871,7 @@ static int scp_source_send(ScpServer *s, const void *vdata, size_t length)
if (scp->expect_newline) {
if (data[i] == '\012') {
/* End of an error message following a 1 byte */
scp->expect_newline = FALSE;
scp->expect_newline = false;
scp->acks++;
}
} else {
@ -880,7 +880,7 @@ static int scp_source_send(ScpServer *s, const void *vdata, size_t length)
scp->acks++;
break;
case 1: /* non-fatal error; consume it */
scp->expect_newline = TRUE;
scp->expect_newline = true;
break;
case 2:
scp_source_abort(
@ -918,7 +918,7 @@ static void scp_source_eof(ScpServer *s)
if (scp->finished)
return;
scp->eof = TRUE;
scp->eof = true;
scp_source_process_stack(scp);
}
@ -962,8 +962,8 @@ struct ScpSinkStackEntry {
ptrlen destpath;
/*
* If isdir is TRUE, then destpath identifies a directory that the
* files we receive should be created inside. If it's FALSE, then
* If isdir is true, then destpath identifies a directory that the
* files we receive should be created inside. If it's false, then
* it identifies the exact pathname the next file we receive
* should be created _as_ - regardless of the filename in the 'C'
* command.
@ -1031,11 +1031,11 @@ static ScpSink *scp_sink_new(
* directory because of the -d option in the command line,
* test it ourself to see whether it is or not.
*/
sftpsrv_stat(scp->sf, &scp->reply.srb, pathname, TRUE);
sftpsrv_stat(scp->sf, &scp->reply.srb, pathname, true);
if (!scp->reply.err &&
(scp->reply.attrs.flags & SSH_FILEXFER_ATTR_PERMISSIONS) &&
(scp->reply.attrs.permissions & PERMS_DIRECTORY))
pathname_is_definitely_dir = TRUE;
pathname_is_definitely_dir = true;
}
scp_sink_push(scp, pathname, pathname_is_definitely_dir);
@ -1102,7 +1102,7 @@ static void scp_sink_coroutine(ScpSink *scp)
if (sscanf(scp->command->s, "T%lu %lu %lu %lu",
&scp->mtime, &dummy1, &scp->atime, &dummy2) != 4)
goto parse_error;
scp->got_file_times = TRUE;
scp->got_file_times = true;
} else if (scp->command_chr == 'C' || scp->command_chr == 'D') {
/*
* Common handling of the start of this case, because the
@ -1148,7 +1148,7 @@ static void scp_sink_coroutine(ScpSink *scp)
scp->attrs.atime = scp->atime;
scp->attrs.flags |= SSH_FILEXFER_ATTR_ACMODTIME;
}
scp->got_file_times = FALSE;
scp->got_file_times = false;
if (scp->command_chr == 'D') {
sftpsrv_mkdir(scp->sf, &scp->reply.srb,
@ -1161,7 +1161,7 @@ static void scp_sink_coroutine(ScpSink *scp)
goto done;
}
scp_sink_push(scp, scp->filename, TRUE);
scp_sink_push(scp, scp->filename, true);
} else {
sftpsrv_open(scp->sf, &scp->reply.srb, scp->filename,
SSH_FXF_WRITE | SSH_FXF_CREAT | SSH_FXF_TRUNC,
@ -1227,7 +1227,7 @@ static void scp_sink_coroutine(ScpSink *scp)
goto done;
}
scp_sink_pop(scp);
scp->got_file_times = FALSE;
scp->got_file_times = false;
} else {
ptrlen cmd_pl;
@ -1245,8 +1245,8 @@ static void scp_sink_coroutine(ScpSink *scp)
done:
if (scp->errmsg) {
sshfwd_write_ext(scp->sc, TRUE, scp->errmsg, strlen(scp->errmsg));
sshfwd_write_ext(scp->sc, TRUE, "\012", 1);
sshfwd_write_ext(scp->sc, true, scp->errmsg, strlen(scp->errmsg));
sshfwd_write_ext(scp->sc, true, "\012", 1);
sshfwd_send_exit_status(scp->sc, 1);
} else {
sshfwd_send_exit_status(scp->sc, 0);
@ -1273,7 +1273,7 @@ static void scp_sink_eof(ScpServer *s)
{
ScpSink *scp = container_of(s, ScpSink, scpserver);
scp->input_eof = TRUE;
scp->input_eof = true;
scp_sink_coroutine(scp);
}
@ -1307,8 +1307,8 @@ static struct ScpServerVtable ScpError_ScpServer_vt = {
static void scp_error_send_message_cb(void *vscp)
{
ScpError *scp = (ScpError *)vscp;
sshfwd_write_ext(scp->sc, TRUE, scp->message, strlen(scp->message));
sshfwd_write_ext(scp->sc, TRUE, "\n", 1);
sshfwd_write_ext(scp->sc, true, scp->message, strlen(scp->message));
sshfwd_write_ext(scp->sc, true, "\n", 1);
sshfwd_send_exit_status(scp->sc, 1);
sshfwd_write_eof(scp->sc);
sshfwd_initiate_close(scp->sc, scp->message);
@ -1353,8 +1353,8 @@ static void scp_error_free(ScpServer *s)
ScpServer *scp_recognise_exec(
SshChannel *sc, const SftpServerVtable *sftpserver_vt, ptrlen command)
{
int recursive = FALSE, preserve = FALSE;
int targetshouldbedirectory = FALSE;
int recursive = false, preserve = false;
int targetshouldbedirectory = false;
ptrlen command_orig = command;
if (!ptrlen_startswith(command, PTRLEN_LITERAL("scp "), &command))
@ -1366,15 +1366,15 @@ ScpServer *scp_recognise_exec(
continue;
}
if (ptrlen_startswith(command, PTRLEN_LITERAL("-r "), &command)) {
recursive = TRUE;
recursive = true;
continue;
}
if (ptrlen_startswith(command, PTRLEN_LITERAL("-p "), &command)) {
preserve = TRUE;
preserve = true;
continue;
}
if (ptrlen_startswith(command, PTRLEN_LITERAL("-d "), &command)) {
targetshouldbedirectory = TRUE;
targetshouldbedirectory = true;
continue;
}
break;

View File

@ -206,7 +206,7 @@ Channel *sesschan_new(SshChannel *c, LogContext *logctx,
sess->conf = conf_new();
load_open_settings(NULL, sess->conf);
/* Set close-on-exit = TRUE to suppress uxpty.c's "[pterm: process
/* Set close-on-exit = true to suppress uxpty.c's "[pterm: process
* terminated with status x]" message */
conf_set_int(sess->conf, CONF_close_on_exit, FORCE_ON);
@ -282,10 +282,10 @@ int sesschan_run_shell(Channel *chan)
sesschan *sess = container_of(chan, sesschan, chan);
if (sess->backend)
return FALSE;
return false;
sesschan_start_backend(sess, NULL);
return TRUE;
return true;
}
int sesschan_run_command(Channel *chan, ptrlen command)
@ -293,21 +293,21 @@ int sesschan_run_command(Channel *chan, ptrlen command)
sesschan *sess = container_of(chan, sesschan, chan);
if (sess->backend)
return FALSE;
return false;
/* FIXME: make this possible to configure off */
if ((sess->scpsrv = scp_recognise_exec(sess->c, sess->sftpserver_vt,
command)) != NULL) {
sess->chan.vt = &scp_channelvt;
logevent(sess->parent_logctx, "Starting built-in SCP server");
return TRUE;
return true;
}
char *command_str = mkstr(command);
sesschan_start_backend(sess, command_str);
sfree(command_str);
return TRUE;
return true;
}
int sesschan_run_subsystem(Channel *chan, ptrlen subsys)
@ -318,10 +318,10 @@ int sesschan_run_subsystem(Channel *chan, ptrlen subsys)
sess->sftpsrv = sftpsrv_new(sess->sftpserver_vt);
sess->chan.vt = &sftp_channelvt;
logevent(sess->parent_logctx, "Starting built-in SFTP subsystem");
return TRUE;
return true;
}
return FALSE;
return false;
}
static void fwd_log(Plug *plug, int type, SockAddr *addr, int port,
@ -344,13 +344,13 @@ static int xfwd_accepting(Plug *p, accept_fn_t constructor, accept_ctx_t ctx)
s = constructor(ctx, plug);
if ((err = sk_socket_error(s)) != NULL) {
portfwd_raw_free(chan);
return TRUE;
return true;
}
pi = sk_peer_info(s);
portfwd_raw_setup(chan, s, ssh_serverside_x11_open(sess->c->cl, chan, pi));
sk_free_peer_info(pi);
return FALSE;
return false;
}
static const PlugVtable xfwd_plugvt = {
@ -371,7 +371,7 @@ int sesschan_enable_x11_forwarding(
char screensuffix[32];
if (oneshot)
return FALSE; /* not supported */
return false; /* not supported */
snprintf(screensuffix, sizeof(screensuffix), ".%u", screen_number);
@ -379,7 +379,7 @@ int sesschan_enable_x11_forwarding(
* Decode the authorisation data from ASCII hex into binary.
*/
if (authdata_hex.len % 2)
return FALSE; /* expected an even number of digits */
return false; /* expected an even number of digits */
authdata_bin = strbuf_new();
for (i = 0; i < authdata_hex.len; i += 2) {
const unsigned char *hex = authdata_hex.ptr;
@ -387,7 +387,7 @@ int sesschan_enable_x11_forwarding(
if (!isxdigit(hex[i]) || !isxdigit(hex[i+1])) {
strbuf_free(authdata_bin);
return FALSE; /* not hex */
return false; /* not hex */
}
hexbuf[0] = hex[i];
@ -420,11 +420,11 @@ static int agentfwd_accepting(
s = constructor(ctx, plug);
if ((err = sk_socket_error(s)) != NULL) {
portfwd_raw_free(chan);
return TRUE;
return true;
}
portfwd_raw_setup(chan, s, ssh_serverside_agent_open(sess->c->cl, chan));
return FALSE;
return false;
}
static const PlugVtable agentfwd_plugvt = {
@ -467,20 +467,20 @@ int sesschan_allocate_pty(
char *s;
if (sess->want_pty)
return FALSE;
return false;
s = mkstr(termtype);
conf_set_str(sess->conf, CONF_termtype, s);
sfree(s);
sess->want_pty = TRUE;
sess->want_pty = true;
sess->ttymodes = modes;
sess->wc = width;
sess->hc = height;
sess->wp = pixwidth;
sess->hp = pixheight;
return TRUE;
return true;
}
int sesschan_set_env(Channel *chan, ptrlen var, ptrlen value)
@ -492,7 +492,7 @@ int sesschan_set_env(Channel *chan, ptrlen var, ptrlen value)
sfree(svar);
sfree(svalue);
return TRUE;
return true;
}
int sesschan_send_break(Channel *chan, unsigned length)
@ -506,9 +506,9 @@ int sesschan_send_break(Channel *chan, unsigned length)
* implementation-defined semantics to _its_ duration
* parameter, this all just sounds too difficult. */
backend_special(sess->backend, SS_BRK, 0);
return TRUE;
return true;
}
return FALSE;
return false;
}
int sesschan_send_signal(Channel *chan, ptrlen signame)
@ -527,10 +527,10 @@ int sesschan_send_signal(Channel *chan, ptrlen signame)
#undef SIGNAL_SUB
if (code == SS_EXITMENU)
return FALSE;
return false;
backend_special(sess->backend, code, 0);
return TRUE;
return true;
}
int sesschan_change_window_size(
@ -540,7 +540,7 @@ int sesschan_change_window_size(
sesschan *sess = container_of(chan, sesschan, chan);
if (!sess->want_pty)
return FALSE;
return false;
sess->wc = width;
sess->hc = height;
@ -550,7 +550,7 @@ int sesschan_change_window_size(
if (sess->backend)
backend_size(sess->backend, sess->wc, sess->hc);
return TRUE;
return true;
}
static int sesschan_seat_output(
@ -590,10 +590,10 @@ static int sesschan_seat_eof(Seat *seat)
sesschan *sess = container_of(seat, sesschan, seat);
sshfwd_write_eof(sess->c);
sess->seen_eof = TRUE;
sess->seen_eof = true;
queue_toplevel_callback(sesschan_check_close_callback, sess);
return TRUE;
return true;
}
static void sesschan_notify_remote_exit(Seat *seat)
@ -611,14 +611,14 @@ static void sesschan_notify_remote_exit(Seat *seat)
sigmsg = dupstr("");
sshfwd_send_exit_signal(
sess->c, signame, FALSE, ptrlen_from_asciz(sigmsg));
sess->c, signame, false, ptrlen_from_asciz(sigmsg));
sfree(sigmsg);
} else {
sshfwd_send_exit_status(sess->c, backend_exitcode(sess->backend));
}
sess->seen_exit = TRUE;
sess->seen_exit = true;
queue_toplevel_callback(sesschan_check_close_callback, sess);
}
@ -628,9 +628,9 @@ static void sesschan_connection_fatal(Seat *seat, const char *message)
/* Closest translation I can think of */
sshfwd_send_exit_signal(
sess->c, PTRLEN_LITERAL("HUP"), FALSE, ptrlen_from_asciz(message));
sess->c, PTRLEN_LITERAL("HUP"), false, ptrlen_from_asciz(message));
sess->ignoring_input = TRUE;
sess->ignoring_input = true;
}
static int sesschan_get_window_pixel_size(Seat *seat, int *width, int *height)
@ -640,7 +640,7 @@ static int sesschan_get_window_pixel_size(Seat *seat, int *width, int *height)
*width = sess->wp;
*height = sess->hp;
return TRUE;
return true;
}
/* ----------------------------------------------------------------------

View File

@ -183,7 +183,7 @@ static int gppmap(settings_r *sesskey, const char *name,
*/
buf = gpps_raw(sesskey, name, NULL);
if (!buf)
return FALSE;
return false;
p = buf;
while (*p) {
@ -227,12 +227,12 @@ static int gppmap(settings_r *sesskey, const char *name,
}
sfree(buf);
return TRUE;
return true;
}
/*
* Write a set of name/value pairs in the above format, or just the
* names if include_values is FALSE.
* names if include_values is false.
*/
static void wmap(settings_w *sesskey, char const *outkey, Conf *conf,
int primary, int include_values)
@ -549,7 +549,7 @@ void save_open_settings(settings_w *sesskey, Conf *conf)
write_setting_i(sesskey, "TCPKeepalives", conf_get_int(conf, CONF_tcp_keepalives));
write_setting_s(sesskey, "TerminalType", conf_get_str(conf, CONF_termtype));
write_setting_s(sesskey, "TerminalSpeed", conf_get_str(conf, CONF_termspeed));
wmap(sesskey, "TerminalModes", conf, CONF_ttymodes, TRUE);
wmap(sesskey, "TerminalModes", conf, CONF_ttymodes, true);
/* Address family selection */
write_setting_i(sesskey, "AddressFamily", conf_get_int(conf, CONF_addressfamily));
@ -565,7 +565,7 @@ void save_open_settings(settings_w *sesskey, Conf *conf)
write_setting_s(sesskey, "ProxyPassword", conf_get_str(conf, CONF_proxy_password));
write_setting_s(sesskey, "ProxyTelnetCommand", conf_get_str(conf, CONF_proxy_telnet_command));
write_setting_i(sesskey, "ProxyLogToTerm", conf_get_int(conf, CONF_proxy_log_to_term));
wmap(sesskey, "Environment", conf, CONF_environmt, TRUE);
wmap(sesskey, "Environment", conf, CONF_environmt, true);
write_setting_s(sesskey, "UserName", conf_get_str(conf, CONF_username));
write_setting_i(sesskey, "UserNameFromEnvironment", conf_get_int(conf, CONF_username_from_env));
write_setting_s(sesskey, "LocalUserName", conf_get_str(conf, CONF_localusername));
@ -727,7 +727,7 @@ void save_open_settings(settings_w *sesskey, Conf *conf)
write_setting_filename(sesskey, "X11AuthFile", conf_get_filename(conf, CONF_xauthfile));
write_setting_i(sesskey, "LocalPortAcceptAll", conf_get_int(conf, CONF_lport_acceptall));
write_setting_i(sesskey, "RemotePortAcceptAll", conf_get_int(conf, CONF_rport_acceptall));
wmap(sesskey, "PortForwardings", conf, CONF_portfwd, TRUE);
wmap(sesskey, "PortForwardings", conf, CONF_portfwd, true);
write_setting_i(sesskey, "BugIgnore1", 2-conf_get_int(conf, CONF_sshbug_ignore1));
write_setting_i(sesskey, "BugPlainPW1", 2-conf_get_int(conf, CONF_sshbug_plainpw1));
write_setting_i(sesskey, "BugRSA1", 2-conf_get_int(conf, CONF_sshbug_rsa1));
@ -759,7 +759,7 @@ void save_open_settings(settings_w *sesskey, Conf *conf)
write_setting_i(sesskey, "ConnectionSharing", conf_get_int(conf, CONF_ssh_connection_sharing));
write_setting_i(sesskey, "ConnectionSharingUpstream", conf_get_int(conf, CONF_ssh_connection_sharing_upstream));
write_setting_i(sesskey, "ConnectionSharingDownstream", conf_get_int(conf, CONF_ssh_connection_sharing_downstream));
wmap(sesskey, "SSHManualHostKeys", conf, CONF_ssh_manual_hostkeys, FALSE);
wmap(sesskey, "SSHManualHostKeys", conf, CONF_ssh_manual_hostkeys, false);
}
void load_settings(const char *section, Conf *conf)
@ -1195,7 +1195,7 @@ void load_open_settings(settings_r *sesskey, Conf *conf)
i = gppi_raw(sesskey, "BugOldGex2", 0); conf_set_int(conf, CONF_sshbug_oldgex2, 2-i);
i = gppi_raw(sesskey, "BugWinadj", 0); conf_set_int(conf, CONF_sshbug_winadj, 2-i);
i = gppi_raw(sesskey, "BugChanReq", 0); conf_set_int(conf, CONF_sshbug_chanreq, 2-i);
conf_set_int(conf, CONF_ssh_simple, FALSE);
conf_set_int(conf, CONF_ssh_simple, false);
gppi(sesskey, "StampUtmp", 1, conf, CONF_stamp_utmp);
gppi(sesskey, "LoginShell", 1, conf, CONF_login_shell);
gppi(sesskey, "ScrollbarOnLeft", 0, conf, CONF_scrollbar_on_left);

4
sftp.c
View File

@ -970,7 +970,7 @@ struct fxp_xfer *xfer_download_init(struct fxp_handle *fh, uint64_t offset)
{
struct fxp_xfer *xfer = xfer_init(fh, offset);
xfer->eof = FALSE;
xfer->eof = false;
xfer_download_queue(xfer);
return xfer;
@ -999,7 +999,7 @@ int xfer_download_gotpkt(struct fxp_xfer *xfer, struct sftp_packet *pktin)
#endif
if ((rr->retlen < 0 && fxp_error_type()==SSH_FX_EOF) || rr->retlen == 0) {
xfer->eof = TRUE;
xfer->eof = true;
rr->retlen = 0;
rr->complete = -1;
#ifdef DEBUG_DOWNLOAD

View File

@ -125,14 +125,14 @@ struct sftp_packet *sftp_handle_request(
path = get_string(req);
if (get_err(req))
goto decode_error;
sftpsrv_stat(srv, rb, path, TRUE);
sftpsrv_stat(srv, rb, path, true);
break;
case SSH_FXP_LSTAT:
path = get_string(req);
if (get_err(req))
goto decode_error;
sftpsrv_stat(srv, rb, path, FALSE);
sftpsrv_stat(srv, rb, path, false);
break;
case SSH_FXP_FSTAT:
@ -171,7 +171,7 @@ struct sftp_packet *sftp_handle_request(
handle = get_string(req);
if (get_err(req))
goto decode_error;
sftpsrv_readdir(srv, rb, handle, INT_MAX, FALSE);
sftpsrv_readdir(srv, rb, handle, INT_MAX, false);
break;
case SSH_FXP_WRITE:

36
ssh.c
View File

@ -98,7 +98,7 @@ struct Ssh {
ConnectionLayer cl_dummy;
/*
* session_started is FALSE until we initialise the main protocol
* session_started is false until we initialise the main protocol
* layers. So it distinguishes between base_layer==NULL meaning
* that the SSH protocol hasn't been set up _yet_, and
* base_layer==NULL meaning the SSH protocol has run and finished.
@ -153,7 +153,7 @@ static void ssh_got_ssh_version(struct ssh_version_receiver *rcv,
BinaryPacketProtocol *old_bpp;
PacketProtocolLayer *connection_layer;
ssh->session_started = TRUE;
ssh->session_started = true;
/*
* We don't support choosing a major protocol version dynamically,
@ -180,7 +180,7 @@ static void ssh_got_ssh_version(struct ssh_version_receiver *rcv,
int is_simple =
(conf_get_int(ssh->conf, CONF_ssh_simple) && !ssh->connshare);
ssh->bpp = ssh2_bpp_new(ssh->logctx, &ssh->stats, FALSE);
ssh->bpp = ssh2_bpp_new(ssh->logctx, &ssh->stats, false);
ssh_connect_bpp(ssh);
#ifndef NO_GSSAPI
@ -246,7 +246,7 @@ static void ssh_got_ssh_version(struct ssh_version_receiver *rcv,
ssh_verstring_get_local(old_bpp),
ssh_verstring_get_remote(old_bpp),
&ssh->gss_state,
&ssh->stats, transport_child_layer, FALSE);
&ssh->stats, transport_child_layer, false);
ssh_connect_ppl(ssh, ssh->base_layer);
if (userauth_layer)
@ -272,7 +272,7 @@ static void ssh_got_ssh_version(struct ssh_version_receiver *rcv,
ssh_connect_bpp(ssh);
connection_layer = ssh2_connection_new(
ssh, NULL, FALSE, ssh->conf, ssh_verstring_get_remote(old_bpp),
ssh, NULL, false, ssh->conf, ssh_verstring_get_remote(old_bpp),
&ssh->cl);
ssh_connect_ppl(ssh, connection_layer);
ssh->base_layer = connection_layer;
@ -380,13 +380,13 @@ static void ssh_initiate_connection_close(Ssh *ssh)
/* Force any remaining queued SSH packets through the BPP, and
* schedule closing the network socket after they go out. */
ssh_bpp_handle_output(ssh->bpp);
ssh->pending_close = TRUE;
ssh->pending_close = true;
queue_idempotent_callback(&ssh->ic_out_raw);
/* Now we expect the other end to close the connection too in
* response, so arrange that we'll receive notification of that
* via ssh_remote_eof. */
ssh->bpp->expect_close = TRUE;
ssh->bpp->expect_close = true;
}
#define GET_FORMATTED_MSG \
@ -521,7 +521,7 @@ static void ssh_closing(Plug *plug, const char *error_msg, int error_code,
if (error_msg) {
ssh_remote_error(ssh, "Network error: %s", error_msg);
} else if (ssh->bpp) {
ssh->bpp->input_eof = TRUE;
ssh->bpp->input_eof = true;
queue_idempotent_callback(&ssh->bpp->ic_in_raw);
}
}
@ -644,18 +644,18 @@ static const char *connect_to_host(Ssh *ssh, const char *host, int port,
* downstream and need to do our connection setup differently.
*/
ssh->connshare = NULL;
ssh->attempting_connshare = TRUE; /* affects socket logging behaviour */
ssh->attempting_connshare = true; /* affects socket logging behaviour */
ssh->s = ssh_connection_sharing_init(
ssh->savedhost, ssh->savedport, ssh->conf, ssh->logctx,
&ssh->plug, &ssh->connshare);
if (ssh->connshare)
ssh_connshare_provide_connlayer(ssh->connshare, &ssh->cl_dummy);
ssh->attempting_connshare = FALSE;
ssh->attempting_connshare = false;
if (ssh->s != NULL) {
/*
* We are a downstream.
*/
ssh->bare_connection = TRUE;
ssh->bare_connection = true;
ssh->fullhostname = NULL;
*realhost = dupstr(host); /* best we can do */
@ -718,7 +718,7 @@ static const char *connect_to_host(Ssh *ssh, const char *host, int port,
ssh->bpp = ssh_verstring_new(
ssh->conf, ssh->logctx, ssh->bare_connection,
ssh->version == 1 ? "1.5" : "2.0", &ssh->version_receiver,
FALSE, "PuTTY");
false, "PuTTY");
ssh_connect_bpp(ssh);
queue_idempotent_callback(&ssh->bpp->ic_in_raw);
@ -745,9 +745,9 @@ void ssh_throttle_conn(Ssh *ssh, int adjust)
assert(ssh->conn_throttle_count >= 0);
if (ssh->conn_throttle_count && !old_count) {
frozen = TRUE;
frozen = true;
} else if (!ssh->conn_throttle_count && old_count) {
frozen = FALSE;
frozen = false;
} else {
return; /* don't change current frozen state */
}
@ -819,7 +819,7 @@ static const char *ssh_init(Seat *seat, Backend **backend_handle,
ssh->cl_dummy.logctx = ssh->logctx = logctx;
random_ref(); /* do this now - may be needed by sharing setup code */
ssh->need_random_unref = TRUE;
ssh->need_random_unref = true;
p = connect_to_host(ssh, host, port, realhost, nodelay, keepalive);
if (p != NULL) {
@ -827,7 +827,7 @@ static const char *ssh_init(Seat *seat, Backend **backend_handle,
* frees this useless Ssh object, in case the caller is
* impatient and just exits without bothering, in which case
* the random seed won't be re-saved. */
ssh->need_random_unref = FALSE;
ssh->need_random_unref = false;
random_unref();
return p;
}
@ -1038,7 +1038,7 @@ void ssh_ldisc_update(Ssh *ssh)
static int ssh_ldisc(Backend *be, int option)
{
Ssh *ssh = container_of(be, Ssh, backend);
return ssh->cl ? ssh_ldisc_option(ssh->cl, option) : FALSE;
return ssh->cl ? ssh_ldisc_option(ssh->cl, option) : false;
}
static void ssh_provide_ldisc(Backend *be, Ldisc *ldisc)
@ -1090,7 +1090,7 @@ extern int ssh_fallback_cmd(Backend *be)
void ssh_got_fallback_cmd(Ssh *ssh)
{
ssh->fallback_cmd = TRUE;
ssh->fallback_cmd = true;
}
const struct BackendVtable ssh_backend = {

18
ssh.h
View File

@ -108,22 +108,22 @@ void pq_in_clear(PktInQueue *pq);
void pq_out_clear(PktOutQueue *pq);
#define pq_push(pq, pkt) \
TYPECHECK((pq)->after(&(pq)->pqb, NULL, FALSE) == pkt, \
TYPECHECK((pq)->after(&(pq)->pqb, NULL, false) == pkt, \
pq_base_push(&(pq)->pqb, &(pkt)->qnode))
#define pq_push_front(pq, pkt) \
TYPECHECK((pq)->after(&(pq)->pqb, NULL, FALSE) == pkt, \
TYPECHECK((pq)->after(&(pq)->pqb, NULL, false) == pkt, \
pq_base_push_front(&(pq)->pqb, &(pkt)->qnode))
#define pq_peek(pq) ((pq)->after(&(pq)->pqb, &(pq)->pqb.end, FALSE))
#define pq_pop(pq) ((pq)->after(&(pq)->pqb, &(pq)->pqb.end, TRUE))
#define pq_peek(pq) ((pq)->after(&(pq)->pqb, &(pq)->pqb.end, false))
#define pq_pop(pq) ((pq)->after(&(pq)->pqb, &(pq)->pqb.end, true))
#define pq_concatenate(dst, q1, q2) \
TYPECHECK((q1)->after(&(q1)->pqb, NULL, FALSE) == \
(dst)->after(&(dst)->pqb, NULL, FALSE) && \
(q2)->after(&(q2)->pqb, NULL, FALSE) == \
(dst)->after(&(dst)->pqb, NULL, FALSE), \
TYPECHECK((q1)->after(&(q1)->pqb, NULL, false) == \
(dst)->after(&(dst)->pqb, NULL, false) && \
(q2)->after(&(q2)->pqb, NULL, false) == \
(dst)->after(&(dst)->pqb, NULL, false), \
pq_base_concatenate(&(dst)->pqb, &(q1)->pqb, &(q2)->pqb))
#define pq_first(pq) pq_peek(pq)
#define pq_next(pq, pkt) ((pq)->after(&(pq)->pqb, &(pkt)->qnode, FALSE))
#define pq_next(pq, pkt) ((pq)->after(&(pq)->pqb, &(pkt)->qnode, false))
/*
* Packet type contexts, so that ssh2_pkt_type can correctly decode

View File

@ -145,7 +145,7 @@ static void ssh1_bpp_handle_input(BinaryPacketProtocol *bpp)
*/
s->pktin = snew_plus(PktIn, s->biglen);
s->pktin->qnode.prev = s->pktin->qnode.next = NULL;
s->pktin->qnode.on_free_queue = FALSE;
s->pktin->qnode.on_free_queue = false;
s->pktin->type = 0;
s->maxlen = s->biglen;
@ -209,7 +209,7 @@ static void ssh1_bpp_handle_input(BinaryPacketProtocol *bpp)
if (s->bpp.logctx) {
logblank_t blanks[MAX_BLANKS];
int nblanks = ssh1_censor_packet(
s->bpp.pls, s->pktin->type, FALSE,
s->bpp.pls, s->pktin->type, false,
make_ptrlen(s->data, s->length), blanks);
log_packet(s->bpp.logctx, PKT_INCOMING, s->pktin->type,
ssh1_pkt_type(s->pktin->type),
@ -244,7 +244,7 @@ static void ssh1_bpp_handle_input(BinaryPacketProtocol *bpp)
* schedule a run of our output side in case we
* had any packets queued up in the meantime.
*/
s->pending_compression_request = FALSE;
s->pending_compression_request = false;
queue_idempotent_callback(&s->bpp.ic_out_pq);
}
break;
@ -287,7 +287,7 @@ static void ssh1_bpp_format_packet(struct ssh1_bpp_state *s, PktOut *pkt)
pkt->length - pkt->prefix);
logblank_t blanks[MAX_BLANKS];
int nblanks = ssh1_censor_packet(
s->bpp.pls, pkt->type, TRUE, pktdata, blanks);
s->bpp.pls, pkt->type, true, pktdata, blanks);
log_packet(s->bpp.logctx, PKT_OUTGOING, pkt->type,
ssh1_pkt_type(pkt->type),
pktdata.ptr, pktdata.len, nblanks, blanks,
@ -353,7 +353,7 @@ static void ssh1_bpp_handle_output(BinaryPacketProtocol *bpp)
* the pending flag, and stop processing packets this
* time.
*/
s->pending_compression_request = TRUE;
s->pending_compression_request = true;
break;
}
}

View File

@ -24,7 +24,7 @@ void ssh1_connection_direction_specific_setup(
*/
s->mainchan = mainchan_new(
&s->ppl, &s->cl, s->conf, s->term_width, s->term_height,
FALSE /* is_simple */, NULL);
false /* is_simple */, NULL);
}
}
@ -85,7 +85,7 @@ static void ssh1_connection_process_trivial_succfails(void *vs)
{
struct ssh1_connection_state *s = (struct ssh1_connection_state *)vs;
while (s->succfail_head && s->succfail_head->trivial)
ssh1_connection_process_succfail(s, TRUE);
ssh1_connection_process_succfail(s, true);
}
int ssh1_handle_direction_specific_packet(
@ -107,7 +107,7 @@ int ssh1_handle_direction_specific_packet(
ssh_remote_error(s->ppl.ssh,
"Received %s with no outstanding request",
ssh1_pkt_type(pktin->type));
return TRUE;
return true;
}
ssh1_connection_process_succfail(
@ -115,7 +115,7 @@ int ssh1_handle_direction_specific_packet(
queue_toplevel_callback(
ssh1_connection_process_trivial_succfails, s);
return TRUE;
return true;
case SSH1_SMSG_X11_OPEN:
remid = get_uint32(pktin);
@ -133,9 +133,9 @@ int ssh1_handle_direction_specific_packet(
ssh1_channel_init(c);
c->remoteid = remid;
c->chan = x11_new_channel(s->x11authtree, &c->sc,
NULL, -1, FALSE);
NULL, -1, false);
c->remoteid = remid;
c->halfopen = FALSE;
c->halfopen = false;
pktout = ssh_bpp_new_pktout(
s->ppl.bpp, SSH1_MSG_CHANNEL_OPEN_CONFIRMATION);
@ -145,7 +145,7 @@ int ssh1_handle_direction_specific_packet(
ppl_logevent(("Opened X11 forward channel"));
}
return TRUE;
return true;
case SSH1_SMSG_AGENT_OPEN:
remid = get_uint32(pktin);
@ -162,7 +162,7 @@ int ssh1_handle_direction_specific_packet(
ssh1_channel_init(c);
c->remoteid = remid;
c->chan = agentf_new(&c->sc);
c->halfopen = FALSE;
c->halfopen = false;
pktout = ssh_bpp_new_pktout(
s->ppl.bpp, SSH1_MSG_CHANNEL_OPEN_CONFIRMATION);
@ -171,7 +171,7 @@ int ssh1_handle_direction_specific_packet(
pq_push(s->ppl.out_pq, pktout);
}
return TRUE;
return true;
case SSH1_MSG_PORT_OPEN:
remid = get_uint32(pktin);
@ -211,7 +211,7 @@ int ssh1_handle_direction_specific_packet(
} else {
ssh1_channel_init(c);
c->remoteid = remid;
c->halfopen = FALSE;
c->halfopen = false;
pktout = ssh_bpp_new_pktout(
s->ppl.bpp, SSH1_MSG_CHANNEL_OPEN_CONFIRMATION);
put_uint32(pktout, c->remoteid);
@ -223,7 +223,7 @@ int ssh1_handle_direction_specific_packet(
sfree(pf.dhost);
return TRUE;
return true;
case SSH1_SMSG_STDOUT_DATA:
case SSH1_SMSG_STDERR_DATA:
@ -238,7 +238,7 @@ int ssh1_handle_direction_specific_packet(
}
}
return TRUE;
return true;
case SSH1_SMSG_EXIT_STATUS:
{
@ -246,12 +246,12 @@ int ssh1_handle_direction_specific_packet(
ppl_logevent(("Server sent command exit status %d", exitcode));
ssh_got_exitcode(s->ppl.ssh, exitcode);
s->session_terminated = TRUE;
s->session_terminated = true;
}
return TRUE;
return true;
default:
return FALSE;
return false;
}
}
@ -289,7 +289,7 @@ static void ssh1mainchan_request_x11_forwarding(
put_uint32(pktout, screen_number);
pq_push(s->ppl.out_pq, pktout);
ssh1mainchan_queue_response(s, want_reply, FALSE);
ssh1mainchan_queue_response(s, want_reply, false);
}
static void ssh1mainchan_request_agent_forwarding(
@ -303,7 +303,7 @@ static void ssh1mainchan_request_agent_forwarding(
s->ppl.bpp, SSH1_CMSG_AGENT_REQUEST_FORWARDING);
pq_push(s->ppl.out_pq, pktout);
ssh1mainchan_queue_response(s, want_reply, FALSE);
ssh1mainchan_queue_response(s, want_reply, false);
}
static void ssh1mainchan_request_pty(
@ -324,13 +324,13 @@ static void ssh1mainchan_request_pty(
get_ttymodes_from_conf(s->ppl.seat, conf));
pq_push(s->ppl.out_pq, pktout);
ssh1mainchan_queue_response(s, want_reply, FALSE);
ssh1mainchan_queue_response(s, want_reply, false);
}
static int ssh1mainchan_send_env_var(
SshChannel *sc, int want_reply, const char *var, const char *value)
{
return FALSE; /* SSH-1 doesn't support this at all */
return false; /* SSH-1 doesn't support this at all */
}
static void ssh1mainchan_start_shell(
@ -343,7 +343,7 @@ static void ssh1mainchan_start_shell(
pktout = ssh_bpp_new_pktout(s->ppl.bpp, SSH1_CMSG_EXEC_SHELL);
pq_push(s->ppl.out_pq, pktout);
ssh1mainchan_queue_response(s, want_reply, TRUE);
ssh1mainchan_queue_response(s, want_reply, true);
}
static void ssh1mainchan_start_command(
@ -357,25 +357,25 @@ static void ssh1mainchan_start_command(
put_stringz(pktout, command);
pq_push(s->ppl.out_pq, pktout);
ssh1mainchan_queue_response(s, want_reply, TRUE);
ssh1mainchan_queue_response(s, want_reply, true);
}
static int ssh1mainchan_start_subsystem(
SshChannel *sc, int want_reply, const char *subsystem)
{
return FALSE; /* SSH-1 doesn't support this at all */
return false; /* SSH-1 doesn't support this at all */
}
static int ssh1mainchan_send_serial_break(
SshChannel *sc, int want_reply, int length)
{
return FALSE; /* SSH-1 doesn't support this at all */
return false; /* SSH-1 doesn't support this at all */
}
static int ssh1mainchan_send_signal(
SshChannel *sc, int want_reply, const char *signame)
{
return FALSE; /* SSH-1 doesn't support this at all */
return false; /* SSH-1 doesn't support this at all */
}
static void ssh1mainchan_send_terminal_size_change(
@ -512,7 +512,7 @@ struct ssh_rportfwd *ssh1_rportfwd_alloc(
put_uint32(pktout, rpf->dport);
pq_push(s->ppl.out_pq, pktout);
ssh1_queue_succfail_handler(s, ssh1_rportfwd_response, rpf, FALSE);
ssh1_queue_succfail_handler(s, ssh1_rportfwd_response, rpf, false);
return rpf;
}
@ -520,12 +520,12 @@ struct ssh_rportfwd *ssh1_rportfwd_alloc(
SshChannel *ssh1_serverside_x11_open(
ConnectionLayer *cl, Channel *chan, const SocketPeerInfo *pi)
{
assert(FALSE && "Should never be called in the client");
assert(false && "Should never be called in the client");
return NULL;
}
SshChannel *ssh1_serverside_agent_open(ConnectionLayer *cl, Channel *chan)
{
assert(FALSE && "Should never be called in the client");
assert(false && "Should never be called in the client");
return NULL;
}

View File

@ -72,8 +72,8 @@ int ssh1_handle_direction_specific_packet(
ppl_logevent(("Client requested a shell"));
chan_run_shell(s->mainchan_chan);
s->finished_setup = TRUE;
return TRUE;
s->finished_setup = true;
return true;
case SSH1_CMSG_EXEC_CMD:
if (s->finished_setup)
@ -82,8 +82,8 @@ int ssh1_handle_direction_specific_packet(
cmd = get_string(pktin);
ppl_logevent(("Client sent command '%.*s'", PTRLEN_PRINTF(cmd)));
chan_run_command(s->mainchan_chan, cmd);
s->finished_setup = TRUE;
return TRUE;
s->finished_setup = true;
return true;
case SSH1_CMSG_REQUEST_COMPRESSION:
if (s->compressing) {
@ -99,10 +99,10 @@ int ssh1_handle_direction_specific_packet(
/* And now ensure that the _next_ packet will be the first
* compressed one. */
ssh1_bpp_start_compression(s->ppl.bpp);
s->compressing = TRUE;
s->compressing = true;
}
return TRUE;
return true;
case SSH1_CMSG_REQUEST_PTY:
if (s->finished_setup)
@ -118,21 +118,21 @@ int ssh1_handle_direction_specific_packet(
if (get_err(pktin)) {
ppl_logevent(("Unable to decode pty request packet"));
success = FALSE;
success = false;
} else if (!chan_allocate_pty(
s->mainchan_chan, termtype, width, height,
pixwidth, pixheight, modes)) {
ppl_logevent(("Unable to allocate a pty"));
success = FALSE;
success = false;
} else {
success = TRUE;
success = true;
}
}
pktout = ssh_bpp_new_pktout(
s->ppl.bpp, (success ? SSH1_SMSG_SUCCESS : SSH1_SMSG_FAILURE));
pq_push(s->ppl.out_pq, pktout);
return TRUE;
return true;
case SSH1_CMSG_PORT_FORWARD_REQUEST:
if (s->finished_setup)
@ -153,7 +153,7 @@ int ssh1_handle_direction_specific_packet(
pktout = ssh_bpp_new_pktout(
s->ppl.bpp, (success ? SSH1_SMSG_SUCCESS : SSH1_SMSG_FAILURE));
pq_push(s->ppl.out_pq, pktout);
return TRUE;
return true;
case SSH1_CMSG_X11_REQUEST_FORWARDING:
if (s->finished_setup)
@ -167,13 +167,13 @@ int ssh1_handle_direction_specific_packet(
screen_number = get_uint32(pktin);
success = chan_enable_x11_forwarding(
s->mainchan_chan, FALSE, authproto, authdata, screen_number);
s->mainchan_chan, false, authproto, authdata, screen_number);
}
pktout = ssh_bpp_new_pktout(
s->ppl.bpp, (success ? SSH1_SMSG_SUCCESS : SSH1_SMSG_FAILURE));
pq_push(s->ppl.out_pq, pktout);
return TRUE;
return true;
case SSH1_CMSG_AGENT_REQUEST_FORWARDING:
if (s->finished_setup)
@ -184,19 +184,19 @@ int ssh1_handle_direction_specific_packet(
pktout = ssh_bpp_new_pktout(
s->ppl.bpp, (success ? SSH1_SMSG_SUCCESS : SSH1_SMSG_FAILURE));
pq_push(s->ppl.out_pq, pktout);
return TRUE;
return true;
case SSH1_CMSG_STDIN_DATA:
data = get_string(pktin);
chan_send(s->mainchan_chan, FALSE, data.ptr, data.len);
return TRUE;
chan_send(s->mainchan_chan, false, data.ptr, data.len);
return true;
case SSH1_CMSG_EOF:
chan_send_eof(s->mainchan_chan);
return TRUE;
return true;
case SSH1_CMSG_WINDOW_SIZE:
return TRUE;
return true;
case SSH1_MSG_PORT_OPEN:
remid = get_uint32(pktin);
@ -226,7 +226,7 @@ int ssh1_handle_direction_specific_packet(
} else {
ssh1_channel_init(c);
c->remoteid = remid;
c->halfopen = FALSE;
c->halfopen = false;
pktout = ssh_bpp_new_pktout(
s->ppl.bpp, SSH1_MSG_CHANNEL_OPEN_CONFIRMATION);
put_uint32(pktout, c->remoteid);
@ -235,10 +235,10 @@ int ssh1_handle_direction_specific_packet(
ppl_logevent(("Forwarded port opened successfully"));
}
return TRUE;
return true;
default:
return FALSE;
return false;
}
unexpected_setup_packet:
@ -246,12 +246,12 @@ int ssh1_handle_direction_specific_packet(
"setup phase, type %d (%s)", pktin->type,
ssh1_pkt_type(pktin->type));
/* FIXME: ensure caller copes with us just having freed the whole layer */
return TRUE;
return true;
}
SshChannel *ssh1_session_open(ConnectionLayer *cl, Channel *chan)
{
assert(FALSE && "Should never be called in the server");
assert(false && "Should never be called in the server");
}
struct ssh_rportfwd *ssh1_rportfwd_alloc(
@ -260,7 +260,7 @@ struct ssh_rportfwd *ssh1_rportfwd_alloc(
int addressfamily, const char *log_description, PortFwdRecord *pfr,
ssh_sharing_connstate *share_ctx)
{
assert(FALSE && "Should never be called in the server");
assert(false && "Should never be called in the server");
return NULL;
}
@ -320,7 +320,7 @@ SshChannel *ssh1_serverside_x11_open(
c->connlayer = s;
ssh1_channel_init(c);
c->halfopen = TRUE;
c->halfopen = true;
c->chan = chan;
ppl_logevent(("Forwarding X11 connection to client"));
@ -342,7 +342,7 @@ SshChannel *ssh1_serverside_agent_open(ConnectionLayer *cl, Channel *chan)
c->connlayer = s;
ssh1_channel_init(c);
c->halfopen = TRUE;
c->halfopen = true;
c->chan = chan;
ppl_logevent(("Forwarding agent connection to client"));

View File

@ -234,9 +234,9 @@ static int ssh1_connection_filter_queue(struct ssh1_connection_state *s)
while (1) {
if (ssh1_common_filter_queue(&s->ppl))
return TRUE;
return true;
if ((pktin = pq_peek(s->ppl.in_pq)) == NULL)
return FALSE;
return false;
switch (pktin->type) {
case SSH1_MSG_CHANNEL_DATA:
@ -263,15 +263,15 @@ static int ssh1_connection_filter_queue(struct ssh1_connection_state *s)
ssh1_pkt_type(pktin->type),
!c ? "nonexistent" : c->halfopen ? "half-open" : "open",
localid);
return TRUE;
return true;
}
switch (pktin->type) {
case SSH1_MSG_CHANNEL_OPEN_CONFIRMATION:
assert(c->halfopen);
c->remoteid = get_uint32(pktin);
c->halfopen = FALSE;
c->throttling_conn = FALSE;
c->halfopen = false;
c->throttling_conn = false;
chan_open_confirmation(c->chan);
@ -288,7 +288,7 @@ static int ssh1_connection_filter_queue(struct ssh1_connection_state *s)
* message. We'll have handled that in this code by
* having already turned c->chan into a zombie, so its
* want_close method (which ssh1_channel_check_close
* will consult) will already be returning TRUE.
* will consult) will already be returning true.
*/
ssh1_channel_check_close(c);
@ -310,10 +310,10 @@ static int ssh1_connection_filter_queue(struct ssh1_connection_state *s)
data = get_string(pktin);
if (!get_err(pktin)) {
int bufsize = chan_send(
c->chan, FALSE, data.ptr, data.len);
c->chan, false, data.ptr, data.len);
if (!c->throttling_conn && bufsize > SSH1_BUFFER_LIMIT) {
c->throttling_conn = TRUE;
c->throttling_conn = true;
ssh_throttle_conn(s->ppl.ssh, +1);
}
}
@ -335,7 +335,7 @@ static int ssh1_connection_filter_queue(struct ssh1_connection_state *s)
"Received CHANNEL_CLOSE_CONFIRMATION for channel"
" %u for which we never sent CHANNEL_CLOSE\n",
c->localid);
return TRUE;
return true;
}
c->closes |= CLOSES_RCVD_CLOSECONF;
@ -351,9 +351,9 @@ static int ssh1_connection_filter_queue(struct ssh1_connection_state *s)
if (ssh1_handle_direction_specific_packet(s, pktin)) {
pq_pop(s->ppl.in_pq);
if (ssh1_check_termination(s))
return TRUE;
return true;
} else {
return FALSE;
return false;
}
}
}
@ -377,7 +377,7 @@ static void ssh1_connection_process_queue(PacketProtocolLayer *ppl)
crBegin(s->crState);
portfwdmgr_config(s->portfwdmgr, s->conf);
s->portfwdmgr_configured = TRUE;
s->portfwdmgr_configured = true;
while (!s->finished_setup) {
ssh1_connection_direction_specific_setup(s);
@ -460,7 +460,7 @@ static void ssh1_channel_try_eof(struct ssh1_channel *c)
if (c->halfopen)
return; /* can't close: not even opened yet */
c->pending_eof = FALSE; /* we're about to send it */
c->pending_eof = false; /* we're about to send it */
pktout = ssh_bpp_new_pktout(s->ppl.bpp, SSH1_MSG_CHANNEL_CLOSE);
put_uint32(pktout, c->remoteid);
@ -525,10 +525,10 @@ int ssh1_check_termination(struct ssh1_connection_state *s)
pq_push(s->ppl.out_pq, pktout);
ssh_user_close(s->ppl.ssh, "Session finished");
return TRUE;
return true;
}
return FALSE;
return false;
}
/*
@ -539,8 +539,8 @@ void ssh1_channel_init(struct ssh1_channel *c)
{
struct ssh1_connection_state *s = c->connlayer;
c->closes = 0;
c->pending_eof = FALSE;
c->throttling_conn = FALSE;
c->pending_eof = false;
c->throttling_conn = false;
c->sc.vt = &ssh1channel_vtable;
c->sc.cl = &s->cl;
c->localid = alloc_channel_id(s->channels, struct ssh1_channel);
@ -561,7 +561,7 @@ static void ssh1channel_write_eof(SshChannel *sc)
if (c->closes & CLOSES_SENT_CLOSE)
return;
c->pending_eof = TRUE;
c->pending_eof = true;
ssh1_channel_try_eof(c);
}
@ -573,7 +573,7 @@ static void ssh1channel_initiate_close(SshChannel *sc, const char *err)
reason = err ? dupprintf("due to local error: %s", err) : NULL;
ssh1_channel_close_local(c, reason);
sfree(reason);
c->pending_eof = FALSE; /* this will confuse a zombie channel */
c->pending_eof = false; /* this will confuse a zombie channel */
ssh1_channel_check_close(c);
}
@ -634,7 +634,7 @@ static SshChannel *ssh1_lportfwd_open(
c->connlayer = s;
ssh1_channel_init(c);
c->halfopen = TRUE;
c->halfopen = true;
c->chan = chan;
ppl_logevent(("Opening connection to %s:%d for %s",
@ -743,7 +743,7 @@ static void ssh1_enable_x_fwd(ConnectionLayer *cl)
struct ssh1_connection_state *s =
container_of(cl, struct ssh1_connection_state, cl);
s->X11_fwd_enabled = TRUE;
s->X11_fwd_enabled = true;
}
static void ssh1_enable_agent_fwd(ConnectionLayer *cl)
@ -751,7 +751,7 @@ static void ssh1_enable_agent_fwd(ConnectionLayer *cl)
struct ssh1_connection_state *s =
container_of(cl, struct ssh1_connection_state, cl);
s->agent_fwd_enabled = TRUE;
s->agent_fwd_enabled = true;
}
static void ssh1_set_wants_user_input(ConnectionLayer *cl, int wanted)
@ -760,7 +760,7 @@ static void ssh1_set_wants_user_input(ConnectionLayer *cl, int wanted)
container_of(cl, struct ssh1_connection_state, cl);
s->want_user_input = wanted;
s->finished_setup = TRUE;
s->finished_setup = true;
}
static int ssh1_connection_want_user_input(PacketProtocolLayer *ppl)

View File

@ -45,11 +45,11 @@ static void ssh1_login_server_process_queue(PacketProtocolLayer *);
static int ssh1_login_server_get_specials(
PacketProtocolLayer *ppl, add_special_fn_t add_special,
void *ctx) { return FALSE; }
void *ctx) { return false; }
static void ssh1_login_server_special_cmd(PacketProtocolLayer *ppl,
SessionSpecialCode code, int arg) {}
static int ssh1_login_server_want_user_input(
PacketProtocolLayer *ppl) { return FALSE; }
PacketProtocolLayer *ppl) { return false; }
static void ssh1_login_server_got_user_input(PacketProtocolLayer *ppl) {}
static void ssh1_login_server_reconfigure(
PacketProtocolLayer *ppl, Conf *conf) {}
@ -138,7 +138,7 @@ static void ssh1_login_server_process_queue(PacketProtocolLayer *ppl)
s->servkey = snew(struct RSAKey);
rsa_generate(s->servkey, server_key_bits, no_progress, NULL);
s->servkey->comment = NULL;
s->servkey_generated_here = TRUE;
s->servkey_generated_here = true;
}
s->local_protoflags = SSH1_PROTOFLAGS_SUPPORTED;

View File

@ -394,9 +394,9 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl)
if ((s->username = get_remote_username(s->conf)) == NULL) {
s->cur_prompt = new_prompts();
s->cur_prompt->to_server = TRUE;
s->cur_prompt->to_server = true;
s->cur_prompt->name = dupstr("SSH login name");
add_prompt(s->cur_prompt, dupstr("login as: "), TRUE);
add_prompt(s->cur_prompt, dupstr("login as: "), true);
s->userpass_ret = seat_get_userpass_input(
s->ppl.seat, s->cur_prompt, NULL);
while (1) {
@ -408,9 +408,9 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl)
if (s->userpass_ret >= 0)
break;
s->want_user_input = TRUE;
s->want_user_input = true;
crReturnV;
s->want_user_input = FALSE;
s->want_user_input = false;
}
if (!s->userpass_ret) {
/*
@ -436,11 +436,11 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl)
if (!(s->supported_auths_mask & (1 << SSH1_AUTH_RSA))) {
/* We must not attempt PK auth. Pretend we've already tried it. */
s->tried_publickey = s->tried_agent = TRUE;
s->tried_publickey = s->tried_agent = true;
} else {
s->tried_publickey = s->tried_agent = FALSE;
s->tried_publickey = s->tried_agent = false;
}
s->tis_auth_refused = s->ccard_auth_refused = FALSE;
s->tis_auth_refused = s->ccard_auth_refused = false;
/*
* Load the public half of any configured keyfile for later use.
@ -491,7 +491,7 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl)
/*
* Attempt RSA authentication using Pageant.
*/
s->authed = FALSE;
s->authed = false;
s->tried_agent = 1;
ppl_logevent(("Pageant is running. Requesting keys."));
@ -597,7 +597,7 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl)
"agent\r\n", PTRLEN_PRINTF(
s->comment)));
}
s->authed = TRUE;
s->authed = true;
} else
ppl_logevent(("Pageant's response not "
"accepted"));
@ -638,7 +638,7 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl)
ppl_logevent(("Trying public key \"%s\"",
filename_to_str(s->keyfile)));
s->tried_publickey = 1;
got_passphrase = FALSE;
got_passphrase = false;
while (!got_passphrase) {
/*
* Get a passphrase, if necessary.
@ -652,11 +652,11 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl)
passphrase = NULL;
} else {
s->cur_prompt = new_prompts(s->ppl.seat);
s->cur_prompt->to_server = FALSE;
s->cur_prompt->to_server = false;
s->cur_prompt->name = dupstr("SSH key passphrase");
add_prompt(s->cur_prompt,
dupprintf("Passphrase for key \"%.100s\": ",
s->publickey_comment), FALSE);
s->publickey_comment), false);
s->userpass_ret = seat_get_userpass_input(
s->ppl.seat, s->cur_prompt, NULL);
while (1) {
@ -668,9 +668,9 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl)
if (s->userpass_ret >= 0)
break;
s->want_user_input = TRUE;
s->want_user_input = true;
crReturnV;
s->want_user_input = FALSE;
s->want_user_input = false;
}
if (!s->userpass_ret) {
/* Failed to get a passphrase. Terminate. */
@ -693,19 +693,19 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl)
}
if (retd == 1) {
/* Correct passphrase. */
got_passphrase = TRUE;
got_passphrase = true;
} else if (retd == 0) {
ppl_printf(("Couldn't load private key from %s (%s).\r\n",
filename_to_str(s->keyfile), error));
got_passphrase = FALSE;
got_passphrase = false;
break; /* go and try something else */
} else if (retd == -1) {
ppl_printf(("Wrong passphrase.\r\n"));
got_passphrase = FALSE;
got_passphrase = false;
/* and try again */
} else {
assert(0 && "unexpected return from rsa_ssh1_loadkey()");
got_passphrase = FALSE; /* placate optimisers */
got_passphrase = false; /* placate optimisers */
}
}
@ -818,7 +818,7 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl)
return;
}
ppl_logevent(("Received TIS challenge"));
s->cur_prompt->to_server = TRUE;
s->cur_prompt->to_server = true;
s->cur_prompt->name = dupstr("SSH TIS authentication");
/* Prompt heuristic comes from OpenSSH */
if (!memchr(challenge.ptr, '\n', challenge.len)) {
@ -832,8 +832,8 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl)
dupprintf("Using TIS authentication.%s%s",
(*instr_suf) ? "\n" : "",
instr_suf);
s->cur_prompt->instr_reqd = TRUE;
add_prompt(s->cur_prompt, prompt, FALSE);
s->cur_prompt->instr_reqd = true;
add_prompt(s->cur_prompt, prompt, false);
sfree(instr_suf);
} else {
ssh_proto_error(s->ppl.ssh, "Received unexpected packet"
@ -866,9 +866,9 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl)
return;
}
ppl_logevent(("Received CryptoCard challenge"));
s->cur_prompt->to_server = TRUE;
s->cur_prompt->to_server = true;
s->cur_prompt->name = dupstr("SSH CryptoCard authentication");
s->cur_prompt->name_reqd = FALSE;
s->cur_prompt->name_reqd = false;
/* Prompt heuristic comes from OpenSSH */
if (!memchr(challenge.ptr, '\n', challenge.len)) {
instr_suf = dupstr("");
@ -881,8 +881,8 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl)
dupprintf("Using CryptoCard authentication.%s%s",
(*instr_suf) ? "\n" : "",
instr_suf);
s->cur_prompt->instr_reqd = TRUE;
add_prompt(s->cur_prompt, prompt, FALSE);
s->cur_prompt->instr_reqd = true;
add_prompt(s->cur_prompt, prompt, false);
sfree(instr_suf);
} else {
ssh_proto_error(s->ppl.ssh, "Received unexpected packet"
@ -898,11 +898,11 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl)
"available");
return;
}
s->cur_prompt->to_server = TRUE;
s->cur_prompt->to_server = true;
s->cur_prompt->name = dupstr("SSH password");
add_prompt(s->cur_prompt, dupprintf("%s@%s's password: ",
s->username, s->savedhost),
FALSE);
false);
}
/*
@ -921,9 +921,9 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl)
if (s->userpass_ret >= 0)
break;
s->want_user_input = TRUE;
s->want_user_input = true;
crReturnV;
s->want_user_input = FALSE;
s->want_user_input = false;
}
if (!s->userpass_ret) {
/*

View File

@ -85,7 +85,7 @@ static void ssh2_bare_bpp_handle_input(BinaryPacketProtocol *bpp)
*/
s->pktin = snew_plus(PktIn, s->packetlen);
s->pktin->qnode.prev = s->pktin->qnode.next = NULL;
s->pktin->qnode.on_free_queue = FALSE;
s->pktin->qnode.on_free_queue = false;
s->maxlen = 0;
s->data = snew_plus_get_aux(s->pktin);
@ -111,7 +111,7 @@ static void ssh2_bare_bpp_handle_input(BinaryPacketProtocol *bpp)
if (s->bpp.logctx) {
logblank_t blanks[MAX_BLANKS];
int nblanks = ssh2_censor_packet(
s->bpp.pls, s->pktin->type, FALSE,
s->bpp.pls, s->pktin->type, false,
make_ptrlen(s->data, s->packetlen), blanks);
log_packet(s->bpp.logctx, PKT_INCOMING, s->pktin->type,
ssh2_pkt_type(s->bpp.pls->kctx, s->bpp.pls->actx,
@ -158,7 +158,7 @@ static void ssh2_bare_bpp_format_packet(struct ssh2_bare_bpp_state *s,
ptrlen pktdata = make_ptrlen(pkt->data + 5, pkt->length - 5);
logblank_t blanks[MAX_BLANKS];
int nblanks = ssh2_censor_packet(
s->bpp.pls, pkt->type, TRUE, pktdata, blanks);
s->bpp.pls, pkt->type, true, pktdata, blanks);
log_packet(s->bpp.logctx, PKT_OUTGOING, pkt->type,
ssh2_pkt_type(s->bpp.pls->kctx, s->bpp.pls->actx,
pkt->type),

View File

@ -117,7 +117,7 @@ void ssh2_bpp_new_outgoing_crypto(
ssh2_cipher_alg(s->out.cipher)->text_name));
} else {
s->out.cipher = NULL;
s->cbc_ignore_workaround = FALSE;
s->cbc_ignore_workaround = false;
}
s->out.etm_mode = etm_mode;
if (mac) {
@ -217,7 +217,7 @@ void ssh2_bpp_new_incoming_crypto(
/* Clear the pending_newkeys flag, so that handle_input below will
* start consuming the input data again. */
s->pending_newkeys = FALSE;
s->pending_newkeys = false;
/* And schedule a run of handle_input, in case there's already
* input data in the queue. */
@ -349,7 +349,7 @@ static void ssh2_bpp_handle_input(BinaryPacketProtocol *bpp)
s->pktin = snew_plus(PktIn, s->maxlen);
s->pktin->qnode.prev = s->pktin->qnode.next = NULL;
s->pktin->type = 0;
s->pktin->qnode.on_free_queue = FALSE;
s->pktin->qnode.on_free_queue = false;
s->data = snew_plus_get_aux(s->pktin);
memcpy(s->data, s->buf, s->maxlen);
} else if (s->in.mac && s->in.etm_mode) {
@ -399,7 +399,7 @@ static void ssh2_bpp_handle_input(BinaryPacketProtocol *bpp)
s->pktin = snew_plus(PktIn, OUR_V2_PACKETLIMIT + s->maclen);
s->pktin->qnode.prev = s->pktin->qnode.next = NULL;
s->pktin->type = 0;
s->pktin->qnode.on_free_queue = FALSE;
s->pktin->qnode.on_free_queue = false;
s->data = snew_plus_get_aux(s->pktin);
memcpy(s->data, s->buf, 4);
@ -465,7 +465,7 @@ static void ssh2_bpp_handle_input(BinaryPacketProtocol *bpp)
s->pktin = snew_plus(PktIn, s->maxlen);
s->pktin->qnode.prev = s->pktin->qnode.next = NULL;
s->pktin->type = 0;
s->pktin->qnode.on_free_queue = FALSE;
s->pktin->qnode.on_free_queue = false;
s->data = snew_plus_get_aux(s->pktin);
memcpy(s->data, s->buf, s->cipherblk);
@ -562,7 +562,7 @@ static void ssh2_bpp_handle_input(BinaryPacketProtocol *bpp)
if (s->bpp.logctx) {
logblank_t blanks[MAX_BLANKS];
int nblanks = ssh2_censor_packet(
s->bpp.pls, s->pktin->type, FALSE,
s->bpp.pls, s->pktin->type, false,
make_ptrlen(s->data, s->length), blanks);
log_packet(s->bpp.logctx, PKT_INCOMING, s->pktin->type,
ssh2_pkt_type(s->bpp.pls->kctx, s->bpp.pls->actx,
@ -590,7 +590,7 @@ static void ssh2_bpp_handle_input(BinaryPacketProtocol *bpp)
* the transport layer has initialised the new keys by
* calling ssh2_bpp_new_incoming_crypto above.
*/
s->pending_newkeys = TRUE;
s->pending_newkeys = true;
crWaitUntilV(!s->pending_newkeys);
continue;
}
@ -611,7 +611,7 @@ static void ssh2_bpp_handle_input(BinaryPacketProtocol *bpp)
* that a delayed compression method enabled in any
* future rekey will be treated as un-delayed.
*/
s->seen_userauth_success = TRUE;
s->seen_userauth_success = true;
}
if (s->pending_compression && userauth_range(type)) {
@ -627,7 +627,7 @@ static void ssh2_bpp_handle_input(BinaryPacketProtocol *bpp)
* to authenticate. The next userauth packet we send
* will re-block the output direction.
*/
s->pending_compression = FALSE;
s->pending_compression = false;
queue_idempotent_callback(&s->bpp.ic_out_pq);
}
}
@ -665,7 +665,7 @@ static void ssh2_bpp_format_packet_inner(struct ssh2_bpp_state *s, PktOut *pkt)
pkt->length - pkt->prefix);
logblank_t blanks[MAX_BLANKS];
int nblanks = ssh2_censor_packet(
s->bpp.pls, pkt->type, TRUE, pktdata, blanks);
s->bpp.pls, pkt->type, true, pktdata, blanks);
log_packet(s->bpp.logctx, PKT_OUTGOING, pkt->type,
ssh2_pkt_type(s->bpp.pls->kctx, s->bpp.pls->actx,
pkt->type),
@ -894,7 +894,7 @@ static void ssh2_bpp_handle_output(BinaryPacketProtocol *bpp)
* USERAUTH_SUCCESS. Block (non-userauth) outgoing packets
* until we see the reply.
*/
s->pending_compression = TRUE;
s->pending_compression = true;
return;
} else if (type == SSH2_MSG_USERAUTH_SUCCESS && s->is_server) {
ssh2_bpp_enable_pending_compression(s);

View File

@ -131,7 +131,7 @@ int ssh2_connection_parse_global_request(
* We don't know of any global requests that an SSH client needs
* to honour.
*/
return FALSE;
return false;
}
PktOut *ssh2_portfwd_chanopen(
@ -290,7 +290,7 @@ SshChannel *ssh2_session_open(ConnectionLayer *cl, Channel *chan)
c->connlayer = s;
ssh2_channel_init(c);
c->halfopen = TRUE;
c->halfopen = true;
c->chan = chan;
ppl_logevent(("Opening main session channel"));
@ -304,13 +304,13 @@ SshChannel *ssh2_session_open(ConnectionLayer *cl, Channel *chan)
SshChannel *ssh2_serverside_x11_open(
ConnectionLayer *cl, Channel *chan, const SocketPeerInfo *pi)
{
assert(FALSE && "Should never be called in the client");
assert(false && "Should never be called in the client");
return 0; /* placate optimiser */
}
SshChannel *ssh2_serverside_agent_open(ConnectionLayer *cl, Channel *chan)
{
assert(FALSE && "Should never be called in the client");
assert(false && "Should never be called in the client");
return 0; /* placate optimiser */
}
@ -353,24 +353,24 @@ int ssh2channel_start_subsystem(
put_stringz(pktout, subsystem);
pq_push(s->ppl.out_pq, pktout);
return TRUE;
return true;
}
void ssh2channel_send_exit_status(SshChannel *sc, int status)
{
assert(FALSE && "Should never be called in the client");
assert(false && "Should never be called in the client");
}
void ssh2channel_send_exit_signal(
SshChannel *sc, ptrlen signame, int core_dumped, ptrlen msg)
{
assert(FALSE && "Should never be called in the client");
assert(false && "Should never be called in the client");
}
void ssh2channel_send_exit_signal_numeric(
SshChannel *sc, int signum, int core_dumped, ptrlen msg)
{
assert(FALSE && "Should never be called in the client");
assert(false && "Should never be called in the client");
}
void ssh2channel_request_x11_forwarding(
@ -434,7 +434,7 @@ int ssh2channel_send_env_var(
put_stringz(pktout, value);
pq_push(s->ppl.out_pq, pktout);
return TRUE;
return true;
}
int ssh2channel_send_serial_break(SshChannel *sc, int want_reply, int length)
@ -447,7 +447,7 @@ int ssh2channel_send_serial_break(SshChannel *sc, int want_reply, int length)
put_uint32(pktout, length);
pq_push(s->ppl.out_pq, pktout);
return TRUE;
return true;
}
int ssh2channel_send_signal(
@ -461,7 +461,7 @@ int ssh2channel_send_signal(
put_stringz(pktout, signame);
pq_push(s->ppl.out_pq, pktout);
return TRUE;
return true;
}
void ssh2channel_send_terminal_size_change(SshChannel *sc, int w, int h)

View File

@ -100,7 +100,7 @@ int ssh2_connection_parse_global_request(
return toret;
} else {
/* Unrecognised request. */
return FALSE;
return false;
}
}
@ -142,17 +142,17 @@ struct ssh_rportfwd *ssh2_rportfwd_alloc(
int addressfamily, const char *log_description, PortFwdRecord *pfr,
ssh_sharing_connstate *share_ctx)
{
assert(FALSE && "Should never be called in the server");
assert(false && "Should never be called in the server");
}
void ssh2_rportfwd_remove(ConnectionLayer *cl, struct ssh_rportfwd *rpf)
{
assert(FALSE && "Should never be called in the server");
assert(false && "Should never be called in the server");
}
SshChannel *ssh2_session_open(ConnectionLayer *cl, Channel *chan)
{
assert(FALSE && "Should never be called in the server");
assert(false && "Should never be called in the server");
}
SshChannel *ssh2_serverside_x11_open(
@ -166,7 +166,7 @@ SshChannel *ssh2_serverside_x11_open(
c->connlayer = s;
ssh2_channel_init(c);
c->halfopen = TRUE;
c->halfopen = true;
c->chan = chan;
ppl_logevent(("Forwarding X11 channel to client"));
@ -189,7 +189,7 @@ SshChannel *ssh2_serverside_agent_open(ConnectionLayer *cl, Channel *chan)
c->connlayer = s;
ssh2_channel_init(c);
c->halfopen = TRUE;
c->halfopen = true;
c->chan = chan;
ppl_logevent(("Forwarding SSH agent to client"));
@ -202,19 +202,19 @@ SshChannel *ssh2_serverside_agent_open(ConnectionLayer *cl, Channel *chan)
void ssh2channel_start_shell(SshChannel *sc, int want_reply)
{
assert(FALSE && "Should never be called in the server");
assert(false && "Should never be called in the server");
}
void ssh2channel_start_command(
SshChannel *sc, int want_reply, const char *command)
{
assert(FALSE && "Should never be called in the server");
assert(false && "Should never be called in the server");
}
int ssh2channel_start_subsystem(
SshChannel *sc, int want_reply, const char *subsystem)
{
assert(FALSE && "Should never be called in the server");
assert(false && "Should never be called in the server");
}
void ssh2channel_send_exit_status(SshChannel *sc, int status)
@ -262,38 +262,38 @@ void ssh2channel_request_x11_forwarding(
SshChannel *sc, int want_reply, const char *authproto,
const char *authdata, int screen_number, int oneshot)
{
assert(FALSE && "Should never be called in the server");
assert(false && "Should never be called in the server");
}
void ssh2channel_request_agent_forwarding(SshChannel *sc, int want_reply)
{
assert(FALSE && "Should never be called in the server");
assert(false && "Should never be called in the server");
}
void ssh2channel_request_pty(
SshChannel *sc, int want_reply, Conf *conf, int w, int h)
{
assert(FALSE && "Should never be called in the server");
assert(false && "Should never be called in the server");
}
int ssh2channel_send_env_var(
SshChannel *sc, int want_reply, const char *var, const char *value)
{
assert(FALSE && "Should never be called in the server");
assert(false && "Should never be called in the server");
}
int ssh2channel_send_serial_break(SshChannel *sc, int want_reply, int length)
{
assert(FALSE && "Should never be called in the server");
assert(false && "Should never be called in the server");
}
int ssh2channel_send_signal(
SshChannel *sc, int want_reply, const char *signame)
{
assert(FALSE && "Should never be called in the server");
assert(false && "Should never be called in the server");
}
void ssh2channel_send_terminal_size_change(SshChannel *sc, int w, int h)
{
assert(FALSE && "Should never be called in the server");
assert(false && "Should never be called in the server");
}

View File

@ -334,9 +334,9 @@ static int ssh2_connection_filter_queue(struct ssh2_connection_state *s)
while (1) {
if (ssh2_common_filter_queue(&s->ppl))
return TRUE;
return true;
if ((pktin = pq_peek(s->ppl.in_pq)) == NULL)
return FALSE;
return false;
switch (pktin->type) {
case SSH2_MSG_GLOBAL_REQUEST:
@ -363,7 +363,7 @@ static int ssh2_connection_filter_queue(struct ssh2_connection_state *s)
"Received %s with no outstanding global request",
ssh2_pkt_type(s->ppl.bpp->pls->kctx, s->ppl.bpp->pls->actx,
pktin->type));
return TRUE;
return true;
}
s->globreq_head->handler(s, pktin, s->globreq_head->ctx);
@ -405,7 +405,7 @@ static int ssh2_connection_filter_queue(struct ssh2_connection_state *s)
}
c->remoteid = remid;
c->halfopen = FALSE;
c->halfopen = false;
if (chanopen_result.outcome == CHANOPEN_RESULT_FAILURE) {
pktout = ssh_bpp_new_pktout(
s->ppl.bpp, SSH2_MSG_CHANNEL_OPEN_FAILURE);
@ -479,14 +479,14 @@ static int ssh2_connection_filter_queue(struct ssh2_connection_state *s)
(!c ? "nonexistent" :
c->halfopen ? "half-open" : "open"),
localid);
return TRUE;
return true;
}
switch (pktin->type) {
case SSH2_MSG_CHANNEL_OPEN_CONFIRMATION:
assert(c->halfopen);
c->remoteid = get_uint32(pktin);
c->halfopen = FALSE;
c->halfopen = false;
c->remwindow = get_uint32(pktin);
c->remmaxpkt = get_uint32(pktin);
@ -505,7 +505,7 @@ static int ssh2_connection_filter_queue(struct ssh2_connection_state *s)
* message. We'll have handled that in this code by
* having already turned c->chan into a zombie, so its
* want_close method (which ssh2_channel_check_close
* will consult) will already be returning TRUE.
* will consult) will already be returning true.
*/
ssh2_channel_check_close(c);
@ -569,7 +569,7 @@ static int ssh2_connection_filter_queue(struct ssh2_connection_state *s)
if ((bufsize > c->locmaxwin ||
(s->ssh_is_simple && bufsize>0)) &&
!c->throttling_conn) {
c->throttling_conn = TRUE;
c->throttling_conn = true;
ssh_throttle_conn(s->ppl.ssh, +1);
}
}
@ -586,7 +586,7 @@ static int ssh2_connection_filter_queue(struct ssh2_connection_state *s)
type = get_string(pktin);
want_reply = get_bool(pktin);
reply_success = FALSE;
reply_success = false;
if (c->closes & CLOSES_SENT_CLOSE) {
/*
@ -596,7 +596,7 @@ static int ssh2_connection_filter_queue(struct ssh2_connection_state *s)
* side's CHANNEL_CLOSE and arrive after they have
* wound the channel up completely.
*/
want_reply = FALSE;
want_reply = false;
}
/*
@ -610,7 +610,7 @@ static int ssh2_connection_filter_queue(struct ssh2_connection_state *s)
} else if (ptrlen_eq_string(type, "exit-signal")) {
ptrlen signame;
int signum;
int core = FALSE;
int core = false;
ptrlen errmsg;
int format;
@ -657,7 +657,7 @@ static int ssh2_connection_filter_queue(struct ssh2_connection_state *s)
break;
default:
/* Couldn't parse this message in either format */
reply_success = FALSE;
reply_success = false;
break;
}
} else if (ptrlen_eq_string(type, "shell")) {
@ -694,7 +694,7 @@ static int ssh2_connection_filter_queue(struct ssh2_connection_state *s)
if (get_err(bs_modes) || get_avail(bs_modes) > 0) {
ppl_logevent(("Unable to decode terminal mode "
"string"));
reply_success = FALSE;
reply_success = false;
} else {
reply_success = chan_allocate_pty(
c->chan, termtype, width, height,
@ -740,7 +740,7 @@ static int ssh2_connection_filter_queue(struct ssh2_connection_state *s)
"channel request",
ssh2_pkt_type(s->ppl.bpp->pls->kctx,
s->ppl.bpp->pls->actx, pktin->type));
return TRUE;
return true;
}
ocr->handler(c, pktin, ocr->ctx);
c->chanreq_head = ocr->next;
@ -839,7 +839,7 @@ static int ssh2_connection_filter_queue(struct ssh2_connection_state *s)
break;
default:
return FALSE;
return false;
}
}
}
@ -966,7 +966,7 @@ static void ssh2_connection_process_queue(PacketProtocolLayer *ppl)
* Enable port forwardings.
*/
portfwdmgr_config(s->portfwdmgr, s->conf);
s->portfwdmgr_configured = TRUE;
s->portfwdmgr_configured = true;
/*
* Create the main session channel, if any.
@ -1051,7 +1051,7 @@ static void ssh2_channel_try_eof(struct ssh2_channel *c)
if (bufchain_size(&c->outbuffer) > 0 || bufchain_size(&c->errbuffer) > 0)
return; /* can't send EOF: pending outgoing data */
c->pending_eof = FALSE; /* we're about to send it */
c->pending_eof = false; /* we're about to send it */
pktout = ssh_bpp_new_pktout(s->ppl.bpp, SSH2_MSG_CHANNEL_EOF);
put_uint32(pktout, c->remoteid);
@ -1120,7 +1120,7 @@ static void ssh2_try_send_and_unthrottle(struct ssh2_channel *c)
return; /* don't send on channels we've EOFed */
bufsize = ssh2_try_send(c);
if (bufsize == 0) {
c->throttled_by_backlog = FALSE;
c->throttled_by_backlog = false;
ssh2_channel_check_throttle(c);
}
}
@ -1227,9 +1227,9 @@ void ssh2_channel_init(struct ssh2_channel *c)
{
struct ssh2_connection_state *s = c->connlayer;
c->closes = 0;
c->pending_eof = FALSE;
c->throttling_conn = FALSE;
c->throttled_by_backlog = FALSE;
c->pending_eof = false;
c->throttling_conn = false;
c->throttled_by_backlog = false;
c->sharectx = NULL;
c->locwindow = c->locmaxwin = c->remlocwin =
s->ssh_is_simple ? OUR_V2_BIGWIN : OUR_V2_WINSIZE;
@ -1313,7 +1313,7 @@ static void ssh2channel_write_eof(SshChannel *sc)
if (c->closes & CLOSES_SENT_EOF)
return;
c->pending_eof = TRUE;
c->pending_eof = true;
ssh2_channel_try_eof(c);
}
@ -1325,7 +1325,7 @@ static void ssh2channel_initiate_close(SshChannel *sc, const char *err)
reason = err ? dupprintf("due to local error: %s", err) : NULL;
ssh2_channel_close_local(c, reason);
sfree(reason);
c->pending_eof = FALSE; /* this will confuse a zombie channel */
c->pending_eof = false; /* this will confuse a zombie channel */
ssh2_channel_check_close(c);
}
@ -1414,7 +1414,7 @@ static SshChannel *ssh2_lportfwd_open(
c->connlayer = s;
ssh2_channel_init(c);
c->halfopen = TRUE;
c->halfopen = true;
c->chan = chan;
pktout = ssh2_portfwd_chanopen(s, c, hostname, port, description, pi);
@ -1534,11 +1534,11 @@ static int ssh2_connection_get_specials(
{
struct ssh2_connection_state *s =
container_of(ppl, struct ssh2_connection_state, ppl);
int toret = FALSE;
int toret = false;
if (s->mainchan) {
mainchan_get_specials(s->mainchan, add_special, ctx);
toret = TRUE;
toret = true;
}
/*
@ -1551,7 +1551,7 @@ static int ssh2_connection_get_specials(
add_special(ctx, NULL, SS_SEP, 0);
add_special(ctx, "IGNORE message", SS_NOP, 0);
toret = TRUE;
toret = true;
}
return toret;
@ -1642,7 +1642,7 @@ static void ssh2_enable_x_fwd(ConnectionLayer *cl)
struct ssh2_connection_state *s =
container_of(cl, struct ssh2_connection_state, cl);
s->X11_fwd_enabled = TRUE;
s->X11_fwd_enabled = true;
}
static void ssh2_enable_agent_fwd(ConnectionLayer *cl)
@ -1650,7 +1650,7 @@ static void ssh2_enable_agent_fwd(ConnectionLayer *cl)
struct ssh2_connection_state *s =
container_of(cl, struct ssh2_connection_state, cl);
s->agent_fwd_enabled = TRUE;
s->agent_fwd_enabled = true;
}
static void ssh2_set_wants_user_input(ConnectionLayer *cl, int wanted)

View File

@ -618,7 +618,7 @@ void ssh2kex_coroutine(struct ssh2_transport_state *s)
return;
}
s->gss_kex_used = TRUE;
s->gss_kex_used = true;
/*-
* If this the first KEX, save the GSS context for "gssapi-keyex"
@ -695,7 +695,7 @@ void ssh2kex_coroutine(struct ssh2_transport_state *s)
* cache.
*/
if (s->hostkey_alg) {
s->need_gss_transient_hostkey = TRUE;
s->need_gss_transient_hostkey = true;
} else {
/*
* If we negotiated the "null" host key algorithm
@ -718,7 +718,7 @@ void ssh2kex_coroutine(struct ssh2_transport_state *s)
*/
if (!s->warned_about_no_gss_transient_hostkey) {
ppl_logevent(("No fallback host key available"));
s->warned_about_no_gss_transient_hostkey = TRUE;
s->warned_about_no_gss_transient_hostkey = true;
}
}
}
@ -738,7 +738,7 @@ void ssh2kex_coroutine(struct ssh2_transport_state *s)
ppl_logevent(("Post-GSS rekey provided fallback host key:"));
ppl_logevent(("%s", s->fingerprint));
ssh_transient_hostkey_cache_add(s->thc, s->hkey);
s->need_gss_transient_hostkey = FALSE;
s->need_gss_transient_hostkey = false;
} else if (!ssh_transient_hostkey_cache_verify(s->thc, s->hkey)) {
ppl_logevent(("Non-GSS rekey after initial GSS kex "
"used host key:"));
@ -836,7 +836,7 @@ void ssh2kex_coroutine(struct ssh2_transport_state *s)
s->fingerprint = NULL;
store_host_key(s->savedhost, s->savedport,
ssh_key_cache_id(s->hkey), s->keystr);
s->cross_certifying = FALSE;
s->cross_certifying = false;
/*
* Don't forget to store the new key as the one we'll be
* re-checking in future normal rekeys.

View File

@ -82,12 +82,12 @@ void ssh2kex_coroutine(struct ssh2_transport_state *s)
}
if (pktin->type != SSH2_MSG_KEX_DH_GEX_REQUEST_OLD) {
s->dh_got_size_bounds = TRUE;
s->dh_got_size_bounds = true;
s->dh_min_size = get_uint32(pktin);
s->pbits = get_uint32(pktin);
s->dh_max_size = get_uint32(pktin);
} else {
s->dh_got_size_bounds = FALSE;
s->dh_got_size_bounds = false;
s->pbits = get_uint32(pktin);
}

View File

@ -91,7 +91,7 @@ int ssh_transient_hostkey_cache_verify(
ssh_transient_hostkey_cache *thc, ssh_key *key)
{
struct ssh_transient_hostkey_cache_entry *ent;
int toret = FALSE;
int toret = false;
if ((ent = find234(thc->cache, (void *)ssh_key_alg(key),
ssh_transient_hostkey_cache_find)) != NULL) {
@ -101,7 +101,7 @@ int ssh_transient_hostkey_cache_verify(
if (this_blob->len == ent->pub_blob->len &&
!memcmp(this_blob->s, ent->pub_blob->s,
this_blob->len))
toret = TRUE;
toret = true;
strbuf_free(this_blob);
}

View File

@ -141,7 +141,7 @@ PacketProtocolLayer *ssh2_transport_new(
s->shgss->ctx = NULL;
#endif
s->thc = ssh_transient_hostkey_cache_new();
s->gss_kex_used = FALSE;
s->gss_kex_used = false;
s->outgoing_kexinit = strbuf_new();
s->incoming_kexinit = strbuf_new();
@ -336,7 +336,7 @@ int ssh2_common_filter_queue(PacketProtocolLayer *ppl)
ssh2_disconnect_reasons[reason] : "unknown"),
PTRLEN_PRINTF(msg));
pq_pop(ppl->in_pq);
return TRUE; /* indicate that we've been freed */
return true; /* indicate that we've been freed */
case SSH2_MSG_DEBUG:
/* XXX maybe we should actually take notice of the return value */
@ -352,11 +352,11 @@ int ssh2_common_filter_queue(PacketProtocolLayer *ppl)
break;
default:
return FALSE;
return false;
}
}
return FALSE;
return false;
}
static int ssh2_transport_filter_queue(struct ssh2_transport_state *s)
@ -365,9 +365,9 @@ static int ssh2_transport_filter_queue(struct ssh2_transport_state *s)
while (1) {
if (ssh2_common_filter_queue(&s->ppl))
return TRUE;
return true;
if ((pktin = pq_peek(s->ppl.in_pq)) == NULL)
return FALSE;
return false;
/* Pass on packets to the next layer if they're outside
* the range reserved for the transport protocol. */
@ -381,7 +381,7 @@ static int ssh2_transport_filter_queue(struct ssh2_transport_state *s)
ssh2_pkt_type(s->ppl.bpp->pls->kctx,
s->ppl.bpp->pls->actx,
pktin->type));
return TRUE;
return true;
}
pq_pop(s->ppl.in_pq);
@ -389,7 +389,7 @@ static int ssh2_transport_filter_queue(struct ssh2_transport_state *s)
} else {
/* Anything else is a transport-layer packet that the main
* process_queue coroutine should handle. */
return FALSE;
return false;
}
}
}
@ -522,10 +522,10 @@ static void ssh2_write_kexinit_lists(
for (j = 0; j < MAXKEXLIST; j++)
kexlists[i][j].name = NULL;
/* List key exchange algorithms. */
warn = FALSE;
warn = false;
for (i = 0; i < n_preferred_kex; i++) {
const struct ssh_kexes *k = preferred_kex[i];
if (!k) warn = TRUE;
if (!k) warn = true;
else for (j = 0; j < k->nkexes; j++) {
alg = ssh2_kexinit_addalg(kexlists[KEXLIST_KEX],
k->list[j]->name);
@ -543,7 +543,7 @@ static void ssh2_write_kexinit_lists(
alg = ssh2_kexinit_addalg(kexlists[KEXLIST_HOSTKEY],
ssh_key_alg(our_hostkeys[i])->ssh_id);
alg->u.hk.hostkey = ssh_key_alg(our_hostkeys[i]);
alg->u.hk.warn = FALSE;
alg->u.hk.warn = false;
}
} else if (first_time) {
/*
@ -558,10 +558,10 @@ static void ssh2_write_kexinit_lists(
* they surely _do_ want to be alerted that a server
* they're actually connecting to is using it.
*/
warn = FALSE;
warn = false;
for (i = 0; i < n_preferred_hk; i++) {
if (preferred_hk[i] == HK_WARN)
warn = TRUE;
warn = true;
for (j = 0; j < lenof(ssh2_hostkey_algs); j++) {
if (ssh2_hostkey_algs[j].id != preferred_hk[i])
continue;
@ -574,10 +574,10 @@ static void ssh2_write_kexinit_lists(
}
}
}
warn = FALSE;
warn = false;
for (i = 0; i < n_preferred_hk; i++) {
if (preferred_hk[i] == HK_WARN)
warn = TRUE;
warn = true;
for (j = 0; j < lenof(ssh2_hostkey_algs); j++) {
if (ssh2_hostkey_algs[j].id != preferred_hk[i])
continue;
@ -601,10 +601,10 @@ static void ssh2_write_kexinit_lists(
* in which case the cache will currently be empty, which
* isn't helpful!
*/
warn = FALSE;
warn = false;
for (i = 0; i < n_preferred_hk; i++) {
if (preferred_hk[i] == HK_WARN)
warn = TRUE;
warn = true;
for (j = 0; j < lenof(ssh2_hostkey_algs); j++) {
if (ssh2_hostkey_algs[j].id != preferred_hk[i])
continue;
@ -629,7 +629,7 @@ static void ssh2_write_kexinit_lists(
assert(hk_prev);
alg = ssh2_kexinit_addalg(kexlists[KEXLIST_HOSTKEY], hk_prev->ssh_id);
alg->u.hk.hostkey = hk_prev;
alg->u.hk.warn = FALSE;
alg->u.hk.warn = false;
}
if (can_gssapi_keyex) {
alg = ssh2_kexinit_addalg(kexlists[KEXLIST_HOSTKEY], "null");
@ -637,7 +637,7 @@ static void ssh2_write_kexinit_lists(
}
/* List encryption algorithms (client->server then server->client). */
for (k = KEXLIST_CSCIPHER; k <= KEXLIST_SCCIPHER; k++) {
warn = FALSE;
warn = false;
#ifdef FUZZING
alg = ssh2_kexinit_addalg(kexlists[k], "none");
alg->u.cipher.cipher = NULL;
@ -645,7 +645,7 @@ static void ssh2_write_kexinit_lists(
#endif /* FUZZING */
for (i = 0; i < n_preferred_ciphers; i++) {
const struct ssh2_ciphers *c = preferred_ciphers[i];
if (!c) warn = TRUE;
if (!c) warn = true;
else for (j = 0; j < c->nciphers; j++) {
alg = ssh2_kexinit_addalg(kexlists[k],
c->list[j]->name);
@ -671,12 +671,12 @@ static void ssh2_write_kexinit_lists(
#ifdef FUZZING
alg = ssh2_kexinit_addalg(kexlists[j], "none");
alg->u.mac.mac = NULL;
alg->u.mac.etm = FALSE;
alg->u.mac.etm = false;
#endif /* FUZZING */
for (i = 0; i < nmacs; i++) {
alg = ssh2_kexinit_addalg(kexlists[j], maclist[i]->name);
alg->u.mac.mac = maclist[i];
alg->u.mac.etm = FALSE;
alg->u.mac.etm = false;
}
for (i = 0; i < nmacs; i++) {
/* For each MAC, there may also be an ETM version,
@ -684,7 +684,7 @@ static void ssh2_write_kexinit_lists(
if (maclist[i]->etm_name) {
alg = ssh2_kexinit_addalg(kexlists[j], maclist[i]->etm_name);
alg->u.mac.mac = maclist[i];
alg->u.mac.etm = TRUE;
alg->u.mac.etm = true;
}
}
}
@ -697,22 +697,22 @@ static void ssh2_write_kexinit_lists(
/* Prefer non-delayed versions */
alg = ssh2_kexinit_addalg(kexlists[j], preferred_comp->name);
alg->u.comp.comp = preferred_comp;
alg->u.comp.delayed = FALSE;
alg->u.comp.delayed = false;
if (preferred_comp->delayed_name) {
alg = ssh2_kexinit_addalg(kexlists[j],
preferred_comp->delayed_name);
alg->u.comp.comp = preferred_comp;
alg->u.comp.delayed = TRUE;
alg->u.comp.delayed = true;
}
for (i = 0; i < lenof(compressions); i++) {
const struct ssh_compression_alg *c = compressions[i];
alg = ssh2_kexinit_addalg(kexlists[j], c->name);
alg->u.comp.comp = c;
alg->u.comp.delayed = FALSE;
alg->u.comp.delayed = false;
if (c->delayed_name) {
alg = ssh2_kexinit_addalg(kexlists[j], c->delayed_name);
alg->u.comp.comp = c;
alg->u.comp.delayed = TRUE;
alg->u.comp.delayed = true;
}
}
}
@ -757,7 +757,7 @@ static int ssh2_scan_kexinits(
get_data(client, 1 + 16);
get_data(server, 1 + 16);
guess_correct = TRUE;
guess_correct = true;
/* Find the matching string in each list, and map it to its
* kexinit_algorithm structure. */
@ -772,13 +772,13 @@ static int ssh2_scan_kexinits(
* agree" that we'd generate if we pressed on regardless
* and treated the empty get_string() result as genuine */
ssh_proto_error(ssh, "KEXINIT packet was incomplete");
return FALSE;
return false;
}
for (cfirst = TRUE, clist = clists[i];
get_commasep_word(&clist, &cword); cfirst = FALSE)
for (sfirst = TRUE, slist = slists[i];
get_commasep_word(&slist, &sword); sfirst = FALSE)
for (cfirst = true, clist = clists[i];
get_commasep_word(&clist, &cword); cfirst = false)
for (sfirst = true, slist = slists[i];
get_commasep_word(&slist, &sword); sfirst = false)
if (ptrlen_eq_ptrlen(cword, sword)) {
found = cword;
goto found_match;
@ -798,7 +798,7 @@ static int ssh2_scan_kexinits(
* PROTOCOL.chacha20poly1305 or as far as I can see by their
* code.)
*/
guess_correct = FALSE;
guess_correct = false;
continue;
@ -819,7 +819,7 @@ static int ssh2_scan_kexinits(
* packet (if any) is officially wrong.
*/
if ((i == KEXLIST_KEX || i == KEXLIST_HOSTKEY) && !(cfirst || sfirst))
guess_correct = FALSE;
guess_correct = false;
}
/*
@ -867,7 +867,7 @@ static int ssh2_scan_kexinits(
*/
ssh_sw_abort(ssh, "Couldn't agree a %s (available: %.*s)",
kexlist_descr[i], PTRLEN_PRINTF(slists[i]));
return FALSE;
return false;
}
switch (i) {
@ -922,7 +922,7 @@ static int ssh2_scan_kexinits(
break;
default:
assert(FALSE && "Bad list index in scan_kexinits");
assert(false && "Bad list index in scan_kexinits");
}
}
@ -943,7 +943,7 @@ static int ssh2_scan_kexinits(
server_hostkeys[(*n_server_hostkeys)++] = i;
}
return TRUE;
return true;
}
void ssh2transport_finalise_exhash(struct ssh2_transport_state *s)
@ -979,9 +979,9 @@ static void ssh2_transport_process_queue(PacketProtocolLayer *ppl)
s->in.mac = s->out.mac = NULL;
s->in.comp = s->out.comp = NULL;
s->got_session_id = FALSE;
s->need_gss_transient_hostkey = FALSE;
s->warned_about_no_gss_transient_hostkey = FALSE;
s->got_session_id = false;
s->need_gss_transient_hostkey = false;
s->warned_about_no_gss_transient_hostkey = false;
begin_key_exchange:
@ -992,7 +992,7 @@ static void ssh2_transport_process_queue(PacketProtocolLayer *ppl)
* GSS key exchange even if we could. (See comments below,
* where the flag was set on the previous key exchange.)
*/
s->can_gssapi_keyex = FALSE;
s->can_gssapi_keyex = false;
} else if (conf_get_int(s->conf, CONF_try_gssapi_kex)) {
/*
* We always check if we have GSS creds before we come up with
@ -1007,7 +1007,7 @@ static void ssh2_transport_process_queue(PacketProtocolLayer *ppl)
* state is "fresh".
*/
if (s->rekey_class != RK_GSS_UPDATE)
ssh2_transport_gss_update(s, TRUE);
ssh2_transport_gss_update(s, true);
/* Do GSSAPI KEX when capable */
s->can_gssapi_keyex = s->gss_status & GSS_KEX_CAPABLE;
@ -1028,7 +1028,7 @@ static void ssh2_transport_process_queue(PacketProtocolLayer *ppl)
s->can_gssapi_keyex = 0;
s->gss_delegate = conf_get_int(s->conf, CONF_gssapifwd);
} else {
s->can_gssapi_keyex = FALSE;
s->can_gssapi_keyex = false;
}
#endif
@ -1053,7 +1053,7 @@ static void ssh2_transport_process_queue(PacketProtocolLayer *ppl)
!s->got_session_id, s->can_gssapi_keyex,
s->gss_kex_used && !s->need_gss_transient_hostkey);
/* First KEX packet does _not_ follow, because we're not that brave. */
put_bool(s->outgoing_kexinit, FALSE);
put_bool(s->outgoing_kexinit, false);
put_uint32(s->outgoing_kexinit, 0); /* reserved */
/*
@ -1067,7 +1067,7 @@ static void ssh2_transport_process_queue(PacketProtocolLayer *ppl)
/*
* Flag that KEX is in progress.
*/
s->kex_in_progress = TRUE;
s->kex_in_progress = true;
/*
* Wait for the other side's KEXINIT, and save it.
@ -1097,7 +1097,7 @@ static void ssh2_transport_process_queue(PacketProtocolLayer *ppl)
s->kexlists, &s->kex_alg, &s->hostkey_alg, &s->out, &s->in,
&s->warn_kex, &s->warn_hk, &s->warn_cscipher,
&s->warn_sccipher, s->ppl.ssh, NULL, &s->ignorepkt, &nhk, hks))
return; /* FALSE means a fatal error function was called */
return; /* false means a fatal error function was called */
/*
* In addition to deciding which host key we're actually going
@ -1147,13 +1147,13 @@ static void ssh2_transport_process_queue(PacketProtocolLayer *ppl)
for (j = 0; j < s->n_uncert_hostkeys; j++) {
const struct ssh_signkey_with_user_pref_id *hktype =
&ssh2_hostkey_algs[s->uncert_hostkeys[j]];
int better = FALSE;
int better = false;
for (k = 0; k < HK_MAX; k++) {
int id = conf_get_int_int(s->conf, CONF_ssh_hklist, k);
if (id == HK_WARN) {
break;
} else if (id == hktype->id) {
better = TRUE;
better = true;
break;
}
}
@ -1245,7 +1245,7 @@ static void ssh2_transport_process_queue(PacketProtocolLayer *ppl)
memcpy(s->session_id, s->exchange_hash, sizeof(s->exchange_hash));
s->session_id_len = s->kex_alg->hash->hlen;
assert(s->session_id_len <= sizeof(s->session_id));
s->got_session_id = TRUE;
s->got_session_id = true;
}
/*
@ -1254,7 +1254,7 @@ static void ssh2_transport_process_queue(PacketProtocolLayer *ppl)
pktout = ssh_bpp_new_pktout(s->ppl.bpp, SSH2_MSG_NEWKEYS);
pq_push(s->ppl.out_pq, pktout);
/* Start counting down the outgoing-data limit for these cipher keys. */
s->stats->out.running = TRUE;
s->stats->out.running = true;
s->stats->out.remaining = s->max_data_size;
/*
@ -1317,7 +1317,7 @@ static void ssh2_transport_process_queue(PacketProtocolLayer *ppl)
return;
}
/* Start counting down the incoming-data limit for these cipher keys. */
s->stats->in.running = TRUE;
s->stats->in.running = true;
s->stats->in.remaining = s->max_data_size;
/*
@ -1377,7 +1377,7 @@ static void ssh2_transport_process_queue(PacketProtocolLayer *ppl)
/*
* Otherwise, schedule a timer for our next rekey.
*/
s->kex_in_progress = FALSE;
s->kex_in_progress = false;
s->last_rekey = GETTICKCOUNT();
(void) ssh2_transport_timer_update(s, 0);
@ -1429,7 +1429,7 @@ static void ssh2_transport_process_queue(PacketProtocolLayer *ppl)
pq_push(s->ppl.out_pq, pktout);
}
s->higher_layer_ok = TRUE;
s->higher_layer_ok = true;
queue_idempotent_callback(&s->higher_layer->ic_process_queue);
}
@ -1504,7 +1504,7 @@ static void ssh2_transport_process_queue(PacketProtocolLayer *ppl)
s->rekey_reason));
/* Reset the counters, so that at least this message doesn't
* hit the event log _too_ often. */
s->stats->in.running = s->stats->out.running = TRUE;
s->stats->in.running = s->stats->out.running = true;
s->stats->in.remaining = s->stats->out.remaining =
s->max_data_size;
(void) ssh2_transport_timer_update(s, 0);
@ -1556,7 +1556,7 @@ static void ssh2_transport_timer(void *ctx, unsigned long now)
* but not if this is unsafe.
*/
if (conf_get_int(s->conf, CONF_gssapirekey)) {
ssh2_transport_gss_update(s, FALSE);
ssh2_transport_gss_update(s, false);
if ((s->gss_status & GSS_KEX_CAPABLE) != 0 &&
(s->gss_status & GSS_CTXT_MAYFAIL) == 0 &&
(s->gss_status & (GSS_CRED_UPDATED|GSS_CTXT_EXPIRES)) != 0) {
@ -1797,12 +1797,12 @@ static int ssh2_transport_get_specials(
{
struct ssh2_transport_state *s =
container_of(ppl, struct ssh2_transport_state, ppl);
int need_separator = FALSE;
int need_separator = false;
int toret;
if (ssh_ppl_get_specials(s->higher_layer, add_special, ctx)) {
need_separator = TRUE;
toret = TRUE;
need_separator = true;
toret = true;
}
/*
@ -1813,11 +1813,11 @@ static int ssh2_transport_get_specials(
if (!(s->ppl.remote_bugs & BUG_SSH2_REKEY)) {
if (need_separator) {
add_special(ctx, NULL, SS_SEP, 0);
need_separator = FALSE;
need_separator = false;
}
add_special(ctx, "Repeat key exchange", SS_REKEY, 0);
toret = TRUE;
toret = true;
if (s->n_uncert_hostkeys) {
int i;
@ -1852,7 +1852,7 @@ static void ssh2_transport_special_cmd(PacketProtocolLayer *ppl,
} else if (code == SS_XCERT) {
if (!s->kex_in_progress) {
s->hostkey_alg = ssh2_hostkey_algs[arg].alg;
s->cross_certifying = TRUE;
s->cross_certifying = true;
s->rekey_reason = "cross-certifying new host key";
s->rekey_class = RK_NORMAL;
queue_idempotent_callback(&s->ppl.ic_process_queue);
@ -1884,7 +1884,7 @@ static void ssh2_transport_reconfigure(PacketProtocolLayer *ppl, Conf *conf)
{
struct ssh2_transport_state *s;
const char *rekey_reason = NULL;
int rekey_mandatory = FALSE;
int rekey_mandatory = false;
unsigned long old_max_data_size, rekey_time;
int i;
@ -1921,19 +1921,19 @@ static void ssh2_transport_reconfigure(PacketProtocolLayer *ppl, Conf *conf)
if (conf_get_int(s->conf, CONF_compression) !=
conf_get_int(conf, CONF_compression)) {
rekey_reason = "compression setting changed";
rekey_mandatory = TRUE;
rekey_mandatory = true;
}
for (i = 0; i < CIPHER_MAX; i++)
if (conf_get_int_int(s->conf, CONF_ssh_cipherlist, i) !=
conf_get_int_int(conf, CONF_ssh_cipherlist, i)) {
rekey_reason = "cipher settings changed";
rekey_mandatory = TRUE;
rekey_mandatory = true;
}
if (conf_get_int(s->conf, CONF_ssh2_des_cbc) !=
conf_get_int(conf, CONF_ssh2_des_cbc)) {
rekey_reason = "cipher settings changed";
rekey_mandatory = TRUE;
rekey_mandatory = true;
}
conf_free(s->conf);

View File

@ -146,13 +146,13 @@ static void ssh2_userauth_server_process_queue(PacketProtocolLayer *ppl)
*/
pktout = ssh_bpp_new_pktout(s->ppl.bpp, SSH2_MSG_USERAUTH_FAILURE);
put_stringz(pktout, "");
put_bool(pktout, FALSE);
put_bool(pktout, false);
pq_push(s->ppl.out_pq, pktout);
continue;
}
s->methods = auth_methods(s->authpolicy);
s->partial_success = FALSE;
s->partial_success = false;
if (ptrlen_eq_string(s->method, "none")) {
s->this_method = AUTHMETHOD_NONE;
@ -327,7 +327,7 @@ static void ssh2_userauth_server_process_queue(PacketProtocolLayer *ppl)
*/
s->methods = auth_methods(s->authpolicy);
}
s->partial_success = TRUE;
s->partial_success = true;
failure:
pktout = ssh_bpp_new_pktout(s->ppl.bpp, SSH2_MSG_USERAUTH_FAILURE);

View File

@ -206,8 +206,8 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
crBegin(s->crState);
#ifndef NO_GSSAPI
s->tried_gssapi = FALSE;
s->tried_gssapi_keyex_auth = FALSE;
s->tried_gssapi = false;
s->tried_gssapi_keyex_auth = false;
#endif
/*
@ -351,7 +351,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
* the username they will want to be able to get back and
* retype it!
*/
s->got_username = FALSE;
s->got_username = false;
while (1) {
/*
* Get a username.
@ -364,9 +364,9 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
*/
} else if ((s->username = s->default_username) == NULL) {
s->cur_prompt = new_prompts();
s->cur_prompt->to_server = TRUE;
s->cur_prompt->to_server = true;
s->cur_prompt->name = dupstr("SSH login name");
add_prompt(s->cur_prompt, dupstr("login as: "), TRUE);
add_prompt(s->cur_prompt, dupstr("login as: "), true);
s->userpass_ret = seat_get_userpass_input(
s->ppl.seat, s->cur_prompt, NULL);
while (1) {
@ -378,9 +378,9 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
if (s->userpass_ret >= 0)
break;
s->want_user_input = TRUE;
s->want_user_input = true;
crReturnV;
s->want_user_input = FALSE;
s->want_user_input = false;
}
if (!s->userpass_ret) {
/*
@ -397,7 +397,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
if ((flags & FLAG_VERBOSE) || (flags & FLAG_INTERACTIVE))
ppl_printf(("Using username \"%s\".\r\n", s->username));
}
s->got_username = TRUE;
s->got_username = true;
/*
* Send an authentication request using method "none": (a)
@ -413,11 +413,11 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
pq_push(s->ppl.out_pq, s->pktout);
s->type = AUTH_TYPE_NONE;
s->tried_pubkey_config = FALSE;
s->kbd_inter_refused = FALSE;
s->tried_pubkey_config = false;
s->kbd_inter_refused = false;
/* Reset agent request state. */
s->done_agent = FALSE;
s->done_agent = false;
if (s->agent_response.ptr) {
if (s->pkblob_pos_in_agent) {
s->asrc->pos = s->pkblob_pos_in_agent;
@ -590,7 +590,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
/* gssapi-keyex authentication */
s->type = AUTH_TYPE_GSSAPI;
s->tried_gssapi_keyex_auth = TRUE;
s->tried_gssapi_keyex_auth = true;
s->ppl.bpp->pls->actx = SSH2_PKTCTX_GSSAPI;
if (s->shgss->lib->gsslogmsg)
@ -632,7 +632,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
put_stringz(s->pktout, s->successor_layer->vt->name);
put_stringz(s->pktout, "publickey");
/* method */
put_bool(s->pktout, FALSE); /* no signature included */
put_bool(s->pktout, false); /* no signature included */
put_stringpl(s->pktout, s->alg);
put_stringpl(s->pktout, s->pk);
pq_push(s->ppl.out_pq, s->pktout);
@ -663,7 +663,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
put_stringz(s->pktout, s->successor_layer->vt->name);
put_stringz(s->pktout, "publickey");
/* method */
put_bool(s->pktout, TRUE); /* signature included */
put_bool(s->pktout, true); /* signature included */
put_stringpl(s->pktout, s->alg);
put_stringpl(s->pktout, s->pk);
@ -707,12 +707,12 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
/* Do we have any keys left to try? */
if (s->pkblob_pos_in_agent) {
s->done_agent = TRUE;
s->tried_pubkey_config = TRUE;
s->done_agent = true;
s->tried_pubkey_config = true;
} else {
s->keyi++;
if (s->keyi >= s->nkeys)
s->done_agent = TRUE;
s->done_agent = true;
}
} else if (s->can_pubkey && s->publickey_blob &&
@ -723,7 +723,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
s->ppl.bpp->pls->actx = SSH2_PKTCTX_PUBLICKEY;
s->tried_pubkey_config = TRUE;
s->tried_pubkey_config = true;
/*
* Try the public key supplied in the configuration.
@ -736,7 +736,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
put_stringz(s->pktout, s->username);
put_stringz(s->pktout, s->successor_layer->vt->name);
put_stringz(s->pktout, "publickey"); /* method */
put_bool(s->pktout, FALSE);
put_bool(s->pktout, false);
/* no signature included */
put_stringz(s->pktout, s->publickey_algorithm);
put_string(s->pktout, s->publickey_blob->s,
@ -769,12 +769,12 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
* Get a passphrase from the user.
*/
s->cur_prompt = new_prompts();
s->cur_prompt->to_server = FALSE;
s->cur_prompt->to_server = false;
s->cur_prompt->name = dupstr("SSH key passphrase");
add_prompt(s->cur_prompt,
dupprintf("Passphrase for key \"%.100s\": ",
s->publickey_comment),
FALSE);
false);
s->userpass_ret = seat_get_userpass_input(
s->ppl.seat, s->cur_prompt, NULL);
while (1) {
@ -787,9 +787,9 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
if (s->userpass_ret >= 0)
break;
s->want_user_input = TRUE;
s->want_user_input = true;
crReturnV;
s->want_user_input = FALSE;
s->want_user_input = false;
}
if (!s->userpass_ret) {
/* Failed to get a passphrase. Terminate. */
@ -845,7 +845,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
put_stringz(s->pktout, s->username);
put_stringz(s->pktout, s->successor_layer->vt->name);
put_stringz(s->pktout, "publickey"); /* method */
put_bool(s->pktout, TRUE); /* signature follows */
put_bool(s->pktout, true); /* signature follows */
put_stringz(s->pktout, ssh_key_ssh_id(key->key));
pkblob = strbuf_new();
ssh_key_public_blob(key->key, BinarySink_UPCAST(pkblob));
@ -889,7 +889,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
ptrlen data;
s->type = AUTH_TYPE_GSSAPI;
s->tried_gssapi = TRUE;
s->tried_gssapi = true;
s->ppl.bpp->pls->actx = SSH2_PKTCTX_GSSAPI;
if (s->shgss->lib->gsslogmsg)
@ -1073,7 +1073,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
* Give up on it entirely. */
pq_push_front(s->ppl.in_pq, pktin);
s->type = AUTH_TYPE_KEYBOARD_INTERACTIVE_QUIET;
s->kbd_inter_refused = TRUE; /* don't try it again */
s->kbd_inter_refused = true; /* don't try it again */
continue;
}
@ -1093,7 +1093,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
inst = get_string(pktin);
get_string(pktin); /* skip language tag */
s->cur_prompt = new_prompts();
s->cur_prompt->to_server = TRUE;
s->cur_prompt->to_server = true;
/*
* Get any prompt(s) from the packet.
@ -1119,11 +1119,11 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
* local prompts? */
s->cur_prompt->name =
dupprintf("SSH server: %.*s", PTRLEN_PRINTF(name));
s->cur_prompt->name_reqd = TRUE;
s->cur_prompt->name_reqd = true;
} else {
s->cur_prompt->name =
dupstr("SSH server authentication");
s->cur_prompt->name_reqd = FALSE;
s->cur_prompt->name_reqd = false;
}
/* We add a prefix to try to make it clear that a prompt
* has come from the server.
@ -1138,9 +1138,9 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
"authentication.%s%.*s",
inst.len ? "\n" : "",
PTRLEN_PRINTF(inst));
s->cur_prompt->instr_reqd = TRUE;
s->cur_prompt->instr_reqd = true;
} else {
s->cur_prompt->instr_reqd = FALSE;
s->cur_prompt->instr_reqd = false;
}
/*
@ -1158,9 +1158,9 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
if (s->userpass_ret >= 0)
break;
s->want_user_input = TRUE;
s->want_user_input = true;
crReturnV;
s->want_user_input = FALSE;
s->want_user_input = false;
}
if (!s->userpass_ret) {
/*
@ -1218,11 +1218,11 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
s->ppl.bpp->pls->actx = SSH2_PKTCTX_PASSWORD;
s->cur_prompt = new_prompts();
s->cur_prompt->to_server = TRUE;
s->cur_prompt->to_server = true;
s->cur_prompt->name = dupstr("SSH password");
add_prompt(s->cur_prompt, dupprintf("%s@%s's password: ",
s->username, s->hostname),
FALSE);
false);
s->userpass_ret = seat_get_userpass_input(
s->ppl.seat, s->cur_prompt, NULL);
@ -1235,9 +1235,9 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
if (s->userpass_ret >= 0)
break;
s->want_user_input = TRUE;
s->want_user_input = true;
crReturnV;
s->want_user_input = FALSE;
s->want_user_input = false;
}
if (!s->userpass_ret) {
/*
@ -1274,7 +1274,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
put_stringz(s->pktout, s->username);
put_stringz(s->pktout, s->successor_layer->vt->name);
put_stringz(s->pktout, "password");
put_bool(s->pktout, FALSE);
put_bool(s->pktout, false);
put_stringz(s->pktout, s->password);
s->pktout->minlen = 256;
pq_push(s->ppl.out_pq, s->pktout);
@ -1286,7 +1286,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
* request.
*/
crMaybeWaitUntilV((pktin = ssh2_userauth_pop(s)) != NULL);
changereq_first_time = TRUE;
changereq_first_time = true;
while (pktin->type == SSH2_MSG_USERAUTH_PASSWD_CHANGEREQ) {
@ -1296,7 +1296,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
* Loop until the server accepts it.
*/
int got_new = FALSE; /* not live over crReturn */
int got_new = false; /* not live over crReturn */
ptrlen prompt; /* not live over crReturn */
{
@ -1312,10 +1312,10 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
prompt = get_string(pktin);
s->cur_prompt = new_prompts();
s->cur_prompt->to_server = TRUE;
s->cur_prompt->to_server = true;
s->cur_prompt->name = dupstr("New SSH password");
s->cur_prompt->instruction = mkstr(prompt);
s->cur_prompt->instr_reqd = TRUE;
s->cur_prompt->instr_reqd = true;
/*
* There's no explicit requirement in the protocol
* for the "old" passwords in the original and
@ -1330,11 +1330,11 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
*/
add_prompt(s->cur_prompt,
dupstr("Current password (blank for previously entered password): "),
FALSE);
false);
add_prompt(s->cur_prompt, dupstr("Enter new password: "),
FALSE);
false);
add_prompt(s->cur_prompt, dupstr("Confirm new password: "),
FALSE);
false);
/*
* Loop until the user manages to enter the same
@ -1353,9 +1353,9 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
if (s->userpass_ret >= 0)
break;
s->want_user_input = TRUE;
s->want_user_input = true;
crReturnV;
s->want_user_input = FALSE;
s->want_user_input = false;
}
if (!s->userpass_ret) {
/*
@ -1409,7 +1409,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
put_stringz(s->pktout, s->username);
put_stringz(s->pktout, s->successor_layer->vt->name);
put_stringz(s->pktout, "password");
put_bool(s->pktout, TRUE);
put_bool(s->pktout, true);
put_stringz(s->pktout, s->password);
put_stringz(s->pktout,
s->cur_prompt->prompts[1]->result);
@ -1424,7 +1424,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
* new password.)
*/
crMaybeWaitUntilV((pktin = ssh2_userauth_pop(s)) != NULL);
changereq_first_time = FALSE;
changereq_first_time = false;
}
@ -1638,7 +1638,7 @@ static int ssh2_userauth_get_specials(
PacketProtocolLayer *ppl, add_special_fn_t add_special, void *ctx)
{
/* No specials provided by this layer. */
return FALSE;
return false;
}
static void ssh2_userauth_special_cmd(PacketProtocolLayer *ppl,

View File

@ -99,8 +99,8 @@ struct DataTransferStats {
#define DTS_CONSUME(stats, direction, size) \
((stats)->direction.running && \
(stats)->direction.remaining <= (size) ? \
((stats)->direction.running = FALSE, TRUE) : \
((stats)->direction.remaining -= (size), FALSE))
((stats)->direction.running = false, true) : \
((stats)->direction.remaining -= (size), false))
BinaryPacketProtocol *ssh2_bpp_new(
LogContext *logctx, struct DataTransferStats *stats, int is_server);

View File

@ -28,7 +28,7 @@ struct ChannelVtable {
int (*want_close)(Channel *, int sent_local_eof, int rcvd_remote_eof);
/* A method for every channel request we know of. All of these
* return TRUE for success or FALSE for failure. */
* return true for success or false for failure. */
int (*rcvd_exit_status)(Channel *, int status);
int (*rcvd_exit_signal)(
Channel *chan, ptrlen signame, int core_dumped, ptrlen msg);
@ -217,7 +217,7 @@ struct SshChannel {
ConnectionLayer *cl;
};
#define sshfwd_write(c, buf, len) ((c)->vt->write(c, FALSE, buf, len))
#define sshfwd_write(c, buf, len) ((c)->vt->write(c, false, buf, len))
#define sshfwd_write_ext(c, stderr, buf, len) \
((c)->vt->write(c, stderr, buf, len))
#define sshfwd_write_eof(c) ((c)->vt->write_eof(c))

View File

@ -52,7 +52,7 @@ void pq_base_push_front(PacketQueueBase *pqb, PacketQueueNode *node)
}
static PacketQueueNode pktin_freeq_head = {
&pktin_freeq_head, &pktin_freeq_head, TRUE
&pktin_freeq_head, &pktin_freeq_head, true
};
static void pktin_free_queue_callback(void *vctx)
@ -68,7 +68,7 @@ static void pktin_free_queue_callback(void *vctx)
}
static IdempotentCallback ic_pktin_free = {
pktin_free_queue_callback, NULL, FALSE
pktin_free_queue_callback, NULL, false
};
static PktIn *pq_in_after(PacketQueueBase *pqb,
@ -86,7 +86,7 @@ static PktIn *pq_in_after(PacketQueueBase *pqb,
node->next = &pktin_freeq_head;
node->next->prev = node;
node->prev->next = node;
node->on_free_queue = TRUE;
node->on_free_queue = true;
queue_idempotent_callback(&ic_pktin_free);
}
@ -224,7 +224,7 @@ PktOut *ssh_new_packet(void)
pkt->downstream_id = 0;
pkt->additional_log_text = NULL;
pkt->qnode.next = pkt->qnode.prev = NULL;
pkt->qnode.on_free_queue = FALSE;
pkt->qnode.on_free_queue = false;
return pkt;
}
@ -331,7 +331,7 @@ static void zombiechan_set_input_wanted(Channel *chan, int enable)
static int zombiechan_want_close(Channel *chan, int sent_eof, int rcvd_eof)
{
return TRUE;
return true;
}
/* ----------------------------------------------------------------------
@ -361,75 +361,75 @@ int chan_default_want_close(
int chan_no_exit_status(Channel *chan, int status)
{
return FALSE;
return false;
}
int chan_no_exit_signal(
Channel *chan, ptrlen signame, int core_dumped, ptrlen msg)
{
return FALSE;
return false;
}
int chan_no_exit_signal_numeric(
Channel *chan, int signum, int core_dumped, ptrlen msg)
{
return FALSE;
return false;
}
int chan_no_run_shell(Channel *chan)
{
return FALSE;
return false;
}
int chan_no_run_command(Channel *chan, ptrlen command)
{
return FALSE;
return false;
}
int chan_no_run_subsystem(Channel *chan, ptrlen subsys)
{
return FALSE;
return false;
}
int chan_no_enable_x11_forwarding(
Channel *chan, int oneshot, ptrlen authproto, ptrlen authdata,
unsigned screen_number)
{
return FALSE;
return false;
}
int chan_no_enable_agent_forwarding(Channel *chan)
{
return FALSE;
return false;
}
int chan_no_allocate_pty(
Channel *chan, ptrlen termtype, unsigned width, unsigned height,
unsigned pixwidth, unsigned pixheight, struct ssh_ttymodes modes)
{
return FALSE;
return false;
}
int chan_no_set_env(Channel *chan, ptrlen var, ptrlen value)
{
return FALSE;
return false;
}
int chan_no_send_break(Channel *chan, unsigned length)
{
return FALSE;
return false;
}
int chan_no_send_signal(Channel *chan, ptrlen signame)
{
return FALSE;
return false;
}
int chan_no_change_window_size(
Channel *chan, unsigned width, unsigned height,
unsigned pixwidth, unsigned pixheight)
{
return FALSE;
return false;
}
void chan_no_request_response(Channel *chan, int success)
@ -558,7 +558,7 @@ struct ssh_ttymodes get_ttymodes_from_conf(Seat *seat, Conf *conf)
assert(0 && "Bad mode->type");
}
modes.have_mode[mode->opcode] = TRUE;
modes.have_mode[mode->opcode] = true;
modes.mode_val[mode->opcode] = ival;
}
@ -572,9 +572,9 @@ struct ssh_ttymodes get_ttymodes_from_conf(Seat *seat, Conf *conf)
ospeed = ispeed = 38400; /* last-resort defaults */
sscanf(conf_get_str(conf, CONF_termspeed), "%u,%u", &ospeed, &ispeed);
/* Currently we unconditionally set these */
modes.have_mode[TTYMODE_ISPEED] = TRUE;
modes.have_mode[TTYMODE_ISPEED] = true;
modes.mode_val[TTYMODE_ISPEED] = ispeed;
modes.have_mode[TTYMODE_OSPEED] = TRUE;
modes.have_mode[TTYMODE_OSPEED] = true;
modes.mode_val[TTYMODE_OSPEED] = ospeed;
}
@ -613,7 +613,7 @@ struct ssh_ttymodes read_ttymodes_from_packet(
our_opcode = our_ttymode_opcode(real_opcode, ssh_version);
assert(our_opcode < TTYMODE_LIMIT);
modes.have_mode[our_opcode] = TRUE;
modes.have_mode[our_opcode] = true;
if (ssh_version == 1 && real_opcode >= 1 && real_opcode <= 127)
modes.mode_val[our_opcode] = get_byte(bs);
@ -709,19 +709,19 @@ int in_commasep_string(char const *needle, char const *haystack, int haylen)
char *p;
if (!needle || !haystack) /* protect against null pointers */
return FALSE;
return false;
/*
* Is it at the start of the string?
*/
if (first_in_commasep_string(needle, haystack, haylen))
return TRUE;
return true;
/*
* If not, search for the next comma and resume after that.
* If no comma found, terminate.
*/
p = memchr(haystack, ',', haylen);
if (!p)
return FALSE;
return false;
/* + 1 to skip over comma */
return in_commasep_string(needle, p + 1, haylen - (p + 1 - haystack));
}
@ -749,7 +749,7 @@ int get_commasep_word(ptrlen *list, ptrlen *word)
}
if (!list->len)
return FALSE;
return false;
comma = memchr(list->ptr, ',', list->len);
if (!comma) {
@ -762,7 +762,7 @@ int get_commasep_word(ptrlen *list, ptrlen *word)
list->ptr = (const char *)list->ptr + wordlen + 1;
list->len -= wordlen + 1;
}
return TRUE;
return true;
}
/* ----------------------------------------------------------------------
@ -873,7 +873,7 @@ void ssh_bpp_common_setup(BinaryPacketProtocol *bpp)
{
pq_in_init(&bpp->in_pq);
pq_out_init(&bpp->out_pq);
bpp->input_eof = FALSE;
bpp->input_eof = false;
bpp->ic_in_raw.fn = ssh_bpp_input_raw_data_callback;
bpp->ic_in_raw.ctx = bpp;
bpp->ic_out_pq.fn = ssh_bpp_output_packet_callback;
@ -923,10 +923,10 @@ int ssh2_bpp_check_unimplemented(BinaryPacketProtocol *bpp, PktIn *pktin)
PktOut *pkt = ssh_bpp_new_pktout(bpp, SSH2_MSG_UNIMPLEMENTED);
put_uint32(pkt, pktin->sequence);
pq_push(&bpp->out_pq, pkt);
return TRUE;
return true;
}
return FALSE;
return false;
}
#undef BITMAP_UNIVERSAL
@ -1002,10 +1002,10 @@ int ssh1_common_get_specials(
*/
if (!(ppl->remote_bugs & BUG_CHOKES_ON_SSH1_IGNORE)) {
add_special(ctx, "IGNORE message", SS_NOP, 0);
return TRUE;
return true;
}
return FALSE;
return false;
}
int ssh1_common_filter_queue(PacketProtocolLayer *ppl)
@ -1021,7 +1021,7 @@ int ssh1_common_filter_queue(PacketProtocolLayer *ppl)
"Remote side sent disconnect message:\n\"%.*s\"",
PTRLEN_PRINTF(msg));
pq_pop(ppl->in_pq);
return TRUE; /* indicate that we've been freed */
return true; /* indicate that we've been freed */
case SSH1_MSG_DEBUG:
msg = get_string(pktin);
@ -1035,11 +1035,11 @@ int ssh1_common_filter_queue(PacketProtocolLayer *ppl)
break;
default:
return FALSE;
return false;
}
}
return FALSE;
return false;
}
void ssh1_compute_session_id(

View File

@ -2754,10 +2754,10 @@ int ec_nist_alg_and_curve_by_bits(int bits,
case 256: *alg = &ssh_ecdsa_nistp256; break;
case 384: *alg = &ssh_ecdsa_nistp384; break;
case 521: *alg = &ssh_ecdsa_nistp521; break;
default: return FALSE;
default: return false;
}
*curve = ((struct ecsign_extra *)(*alg)->extra)->curve();
return TRUE;
return true;
}
int ec_ed_alg_and_curve_by_bits(int bits,
@ -2766,8 +2766,8 @@ int ec_ed_alg_and_curve_by_bits(int bits,
{
switch (bits) {
case 256: *alg = &ssh_ecdsa_ed25519; break;
default: return FALSE;
default: return false;
}
*curve = ((struct ecsign_extra *)(*alg)->extra)->curve();
return TRUE;
return true;
}

View File

@ -148,7 +148,7 @@ int rsa_ssh1_loadkey(const Filename *filename, struct RSAKey *key,
int ret = 0;
const char *error = NULL;
fp = f_open(filename, "rb", FALSE);
fp = f_open(filename, "rb", false);
if (!fp) {
error = "can't open file";
goto end;
@ -162,7 +162,7 @@ int rsa_ssh1_loadkey(const Filename *filename, struct RSAKey *key,
/*
* This routine will take care of calling fclose() for us.
*/
ret = rsa_ssh1_load_main(fp, key, FALSE, NULL, passphrase, &error);
ret = rsa_ssh1_load_main(fp, key, false, NULL, passphrase, &error);
fp = NULL;
goto end;
}
@ -189,7 +189,7 @@ int rsa_ssh1_encrypted(const Filename *filename, char **comment)
FILE *fp;
char buf[64];
fp = f_open(filename, "rb", FALSE);
fp = f_open(filename, "rb", false);
if (!fp)
return 0; /* doesn't even exist */
@ -202,7 +202,7 @@ int rsa_ssh1_encrypted(const Filename *filename, char **comment)
/*
* This routine will take care of calling fclose() for us.
*/
return rsa_ssh1_load_main(fp, NULL, FALSE, comment, NULL, &dummy);
return rsa_ssh1_load_main(fp, NULL, false, comment, NULL, &dummy);
}
fclose(fp);
return 0; /* wasn't the right kind of file */
@ -222,9 +222,9 @@ int rsa_ssh1_loadpub(const Filename *filename, BinarySink *bs,
const char *error = NULL;
/* Default return if we fail. */
ret = FALSE;
ret = false;
fp = f_open(filename, "rb", FALSE);
fp = f_open(filename, "rb", false);
if (!fp) {
error = "can't open file";
goto end;
@ -236,10 +236,10 @@ int rsa_ssh1_loadpub(const Filename *filename, BinarySink *bs,
*/
if (fgets(buf, sizeof(buf), fp) && !strcmp(buf, rsa_signature)) {
memset(&key, 0, sizeof(key));
if (rsa_ssh1_load_main(fp, &key, TRUE, commentptr, NULL, &error)) {
if (rsa_ssh1_load_main(fp, &key, true, commentptr, NULL, &error)) {
rsa_ssh1_public_blob(bs, &key, RSA_SSH1_EXPONENT_FIRST);
freersakey(&key);
ret = TRUE;
ret = true;
}
fp = NULL; /* rsa_ssh1_load_main unconditionally closes fp */
} else {
@ -291,7 +291,7 @@ int rsa_ssh1_loadpub(const Filename *filename, BinarySink *bs,
freersakey(&key);
sfree(line);
fclose(fp);
return TRUE;
return true;
not_public_either:
sfree(line);
@ -375,7 +375,7 @@ int rsa_ssh1_savekey(const Filename *filename, struct RSAKey *key,
/*
* Done. Write the result to the file.
*/
fp = f_open(filename, "wb", TRUE);
fp = f_open(filename, "wb", true);
if (fp) {
int ret = (fwrite(buf->u, 1, buf->len, fp) == (size_t) (buf->len));
if (fclose(fp))
@ -536,13 +536,13 @@ static int read_blob(FILE *fp, int nlines, BinarySink *bs)
line = read_body(fp);
if (!line) {
sfree(blob);
return FALSE;
return false;
}
linelen = strlen(line);
if (linelen % 4 != 0 || linelen > 64) {
sfree(blob);
sfree(line);
return FALSE;
return false;
}
for (j = 0; j < linelen; j += 4) {
unsigned char decoded[3];
@ -550,13 +550,13 @@ static int read_blob(FILE *fp, int nlines, BinarySink *bs)
if (!k) {
sfree(line);
sfree(blob);
return FALSE;
return false;
}
put_data(bs, decoded, k);
}
sfree(line);
}
return TRUE;
return true;
}
/*
@ -605,7 +605,7 @@ struct ssh2_userkey *ssh2_load_userkey(const Filename *filename,
encryption = comment = mac = NULL;
public_blob = private_blob = NULL;
fp = f_open(filename, "rb", FALSE);
fp = f_open(filename, "rb", false);
if (!fp) {
error = "can't open file";
goto error;
@ -737,7 +737,7 @@ struct ssh2_userkey *ssh2_load_userkey(const Filename *filename,
if (old_fmt) {
/* MAC (or hash) only covers the private blob. */
macdata = private_blob;
free_macdata = FALSE;
free_macdata = false;
} else {
macdata = strbuf_new();
put_stringz(macdata, alg->ssh_id);
@ -747,7 +747,7 @@ struct ssh2_userkey *ssh2_load_userkey(const Filename *filename,
public_blob->len);
put_string(macdata, private_blob->s,
private_blob->len);
free_macdata = TRUE;
free_macdata = true;
}
if (is_mac) {
@ -957,7 +957,7 @@ int rfc4716_loadpub(FILE *fp, char **algorithm,
sfree(comment);
put_data(bs, pubblob, pubbloblen);
sfree(pubblob);
return TRUE;
return true;
error:
sfree(line);
@ -965,7 +965,7 @@ int rfc4716_loadpub(FILE *fp, char **algorithm,
sfree(pubblob);
if (errorstr)
*errorstr = error;
return FALSE;
return false;
}
int openssh_loadpub(FILE *fp, char **algorithm,
@ -1033,7 +1033,7 @@ int openssh_loadpub(FILE *fp, char **algorithm,
sfree(line);
put_data(bs, pubblob, pubbloblen);
sfree(pubblob);
return TRUE;
return true;
error:
sfree(line);
@ -1041,7 +1041,7 @@ int openssh_loadpub(FILE *fp, char **algorithm,
sfree(pubblob);
if (errorstr)
*errorstr = error;
return FALSE;
return false;
}
int ssh2_userkey_loadpub(const Filename *filename, char **algorithm,
@ -1055,7 +1055,7 @@ int ssh2_userkey_loadpub(const Filename *filename, char **algorithm,
const char *error = NULL;
char *comment = NULL;
fp = f_open(filename, "rb", FALSE);
fp = f_open(filename, "rb", false);
if (!fp) {
error = "can't open file";
goto error;
@ -1128,7 +1128,7 @@ int ssh2_userkey_loadpub(const Filename *filename, char **algorithm,
fclose(fp);
if (algorithm)
*algorithm = dupstr(alg->ssh_id);
return TRUE;
return true;
/*
* Error processing.
@ -1142,7 +1142,7 @@ int ssh2_userkey_loadpub(const Filename *filename, char **algorithm,
sfree(comment);
*commentptr = NULL;
}
return FALSE;
return false;
}
int ssh2_userkey_encrypted(const Filename *filename, char **commentptr)
@ -1154,7 +1154,7 @@ int ssh2_userkey_encrypted(const Filename *filename, char **commentptr)
if (commentptr)
*commentptr = NULL;
fp = f_open(filename, "rb", FALSE);
fp = f_open(filename, "rb", false);
if (!fp)
return 0;
if (!read_header(fp, header)
@ -1323,7 +1323,7 @@ int ssh2_save_userkey(const Filename *filename, struct ssh2_userkey *key,
smemclr(&s, sizeof(s));
}
fp = f_open(filename, "w", TRUE);
fp = f_open(filename, "w", true);
if (!fp) {
strbuf_free(pub_blob);
strbuf_free(priv_blob);
@ -1586,7 +1586,7 @@ int key_type(const Filename *filename)
FILE *fp;
int ret;
fp = f_open(filename, "r", FALSE);
fp = f_open(filename, "r", false);
if (!fp)
return SSH_KEYTYPE_UNOPENABLE;
ret = key_type_fp(fp);

View File

@ -80,7 +80,7 @@ static void random_stir(void)
*/
if (pool.stir_pending)
return;
pool.stir_pending = TRUE;
pool.stir_pending = true;
noise_get_light(random_add_noise);
@ -193,7 +193,7 @@ static void random_stir(void)
pool.poolpos = sizeof(pool.incoming);
pool.stir_pending = FALSE;
pool.stir_pending = false;
#ifdef RANDOM_DIAGNOSTICS
{

View File

@ -288,7 +288,7 @@ Bignum rsa_ssh1_decrypt(Bignum input, struct RSAKey *key)
int rsa_ssh1_decrypt_pkcs1(Bignum input, struct RSAKey *key, strbuf *outbuf)
{
strbuf *data = strbuf_new();
int success = FALSE;
int success = false;
BinarySource src[1];
{
@ -313,7 +313,7 @@ int rsa_ssh1_decrypt_pkcs1(Bignum input, struct RSAKey *key, strbuf *outbuf)
}
/* Everything else is the payload */
success = TRUE;
success = true;
put_data(outbuf, get_ptr(src), get_avail(src));
out:

View File

@ -74,7 +74,7 @@ void share_setup_x11_channel(ssh_sharing_connstate *cs, share_channel *chan,
int protomajor, int protominor,
const void *initial_data, int initial_len) {}
Channel *agentf_new(SshChannel *c) { return NULL; }
int agent_exists(void) { return FALSE; }
int agent_exists(void) { return false; }
void ssh_got_exitcode(Ssh *ssh, int exitcode) {}
mainchan *mainchan_new(
@ -128,7 +128,7 @@ static void server_closing(Plug *plug, const char *error_msg, int error_code,
if (error_msg) {
ssh_remote_error(&srv->ssh, "Network error: %s", error_msg);
} else if (srv->bpp) {
srv->bpp->input_eof = TRUE;
srv->bpp->input_eof = true;
queue_idempotent_callback(&srv->bpp->ic_in_raw);
}
}
@ -181,9 +181,9 @@ void ssh_throttle_conn(Ssh *ssh, int adjust)
assert(srv->conn_throttle_count >= 0);
if (srv->conn_throttle_count && !old_count) {
frozen = TRUE;
frozen = true;
} else if (!srv->conn_throttle_count && old_count) {
frozen = FALSE;
frozen = false;
} else {
return; /* don't change current frozen state */
}
@ -221,7 +221,7 @@ Plug *ssh_server_plug(
srv->plug.vt = &ssh_server_plugvt;
srv->conf = conf_copy(conf);
srv->logctx = log_init(logpolicy, conf);
conf_set_int(srv->conf, CONF_ssh_no_shell, TRUE);
conf_set_int(srv->conf, CONF_ssh_no_shell, true);
srv->nhostkeys = nhostkeys;
srv->hostkeys = hostkeys;
srv->hostkey1 = hostkey1;
@ -261,9 +261,9 @@ void ssh_server_start(Plug *plug, Socket *socket)
srv->ic_out_raw.ctx = srv;
srv->version_receiver.got_ssh_version = server_got_ssh_version;
srv->bpp = ssh_verstring_new(
srv->conf, srv->logctx, FALSE /* bare_connection */,
srv->conf, srv->logctx, false /* bare_connection */,
our_protoversion, &srv->version_receiver,
TRUE, "Uppity");
true, "Uppity");
server_connect_bpp(srv);
queue_idempotent_callback(&srv->bpp->ic_in_raw);
}
@ -304,7 +304,7 @@ static void server_connect_bpp(server *srv)
srv->bpp->remote_bugs = srv->remote_bugs;
/* Servers don't really have a notion of 'unexpected' connection
* closure. The client is free to close if it likes. */
srv->bpp->expect_close = TRUE;
srv->bpp->expect_close = true;
}
static void server_connect_ppl(server *srv, PacketProtocolLayer *ppl)
@ -409,11 +409,11 @@ static void server_got_ssh_version(struct ssh_version_receiver *rcv,
if (major_version == 2) {
PacketProtocolLayer *userauth_layer, *transport_child_layer;
srv->bpp = ssh2_bpp_new(srv->logctx, &srv->stats, TRUE);
srv->bpp = ssh2_bpp_new(srv->logctx, &srv->stats, true);
server_connect_bpp(srv);
connection_layer = ssh2_connection_new(
&srv->ssh, NULL, FALSE, srv->conf,
&srv->ssh, NULL, false, srv->conf,
ssh_verstring_get_local(old_bpp), &srv->cl);
ssh2connection_server_configure(connection_layer, srv->sftpserver_vt);
server_connect_ppl(srv, connection_layer);
@ -432,7 +432,7 @@ static void server_got_ssh_version(struct ssh_version_receiver *rcv,
srv->conf, NULL, 0, NULL,
ssh_verstring_get_remote(old_bpp),
ssh_verstring_get_local(old_bpp),
&srv->gss_state, &srv->stats, transport_child_layer, TRUE);
&srv->gss_state, &srv->stats, transport_child_layer, true);
ssh2_transport_provide_hostkeys(
srv->base_layer, srv->hostkeys, srv->nhostkeys);
if (userauth_layer)

View File

@ -63,7 +63,7 @@ int auth_ssh1int_response(AuthPolicy *, ptrlen response);
struct RSAKey *auth_publickey_ssh1(
AuthPolicy *ap, ptrlen username, Bignum rsa_modulus);
/* auth_successful returns FALSE if further authentication is needed */
/* auth_successful returns false if further authentication is needed */
int auth_successful(AuthPolicy *, ptrlen username, unsigned method);
PacketProtocolLayer *ssh2_userauth_server_new(

View File

@ -631,7 +631,7 @@ static struct share_xchannel *share_add_xchannel
struct share_xchannel *xc = snew(struct share_xchannel);
xc->upstream_id = upstream_id;
xc->server_id = server_id;
xc->live = TRUE;
xc->live = true;
xc->msghead = xc->msgtail = NULL;
if (add234(cs->xchannels_by_us, xc) != xc) {
sfree(xc);
@ -676,7 +676,7 @@ static struct share_forwarding *share_add_forwarding
struct share_forwarding *fwd = snew(struct share_forwarding);
fwd->host = dupstr(host);
fwd->port = port;
fwd->active = FALSE;
fwd->active = false;
if (add234(cs->forwardings, fwd) != fwd) {
/* Duplicate?! */
sfree(fwd);
@ -875,7 +875,7 @@ static void share_try_cleanup(struct ssh_sharing_connstate *cs)
if (fwd->active) {
strbuf *packet = strbuf_new();
put_stringz(packet, "cancel-tcpip-forward");
put_bool(packet, FALSE); /* !want_reply */
put_bool(packet, false); /* !want_reply */
put_stringz(packet, fwd->host);
put_uint32(packet, fwd->port);
ssh_send_packet_from_downstream(
@ -997,7 +997,7 @@ void share_dead_xchannel_respond(struct ssh_sharing_connstate *cs,
* Handle queued incoming messages from the server destined for an
* xchannel which is dead (i.e. downstream sent OPEN_FAILURE).
*/
int delete = FALSE;
int delete = false;
while (xc->msghead) {
struct share_xchannel_message *msg = xc->msghead;
xc->msghead = msg->next;
@ -1024,7 +1024,7 @@ void share_dead_xchannel_respond(struct ssh_sharing_connstate *cs,
/*
* On CHANNEL_CLOSE we can discard the channel completely.
*/
delete = TRUE;
delete = true;
}
sfree(msg);
@ -1092,7 +1092,7 @@ void share_xchannel_failure(struct ssh_sharing_connstate *cs,
* Now mark the xchannel as dead, and respond to anything sent on
* it until we see CLOSE for it in turn.
*/
xc->live = FALSE;
xc->live = false;
share_dead_xchannel_respond(cs, xc);
}
@ -1183,7 +1183,7 @@ void share_got_pkt_from_server(ssh_sharing_connstate *cs, int type,
if (type == SSH2_MSG_REQUEST_FAILURE) {
share_remove_forwarding(cs, globreq->fwd);
} else {
globreq->fwd->active = TRUE;
globreq->fwd->active = true;
}
} else if (globreq->type == GLOBREQ_CANCEL_TCPIP_FORWARD) {
if (type == SSH2_MSG_REQUEST_SUCCESS) {
@ -1795,7 +1795,7 @@ static void share_receive(Plug *plug, int urgent, char *data, int len)
cs->recvlen--; /* trim off \r before \n */
log_downstream(cs, "Downstream version string: %.*s",
cs->recvlen, cs->recvbuf);
cs->got_verstring = TRUE;
cs->got_verstring = true;
/*
* Loop round reading packets.
@ -1861,7 +1861,7 @@ static void share_send_verstring(ssh_sharing_connstate *cs)
sk_write(cs->sock, fullstring, strlen(fullstring));
sfree(fullstring);
cs->sent_verstring = TRUE;
cs->sent_verstring = true;
}
int share_ndownstreams(ssh_sharing_state *sharestate)
@ -1942,11 +1942,11 @@ static int share_listen_accepting(Plug *plug,
add234(cs->parent->connections, cs);
cs->sent_verstring = FALSE;
cs->sent_verstring = false;
if (sharestate->server_verstring)
share_send_verstring(cs);
cs->got_verstring = FALSE;
cs->got_verstring = false;
cs->recvlen = 0;
cs->crLine = 0;
cs->halfchannels = newtree234(share_halfchannel_cmp);
@ -2026,7 +2026,7 @@ int ssh_share_test_for_upstream(const char *host, int port, Conf *conf)
sock = NULL;
logtext = ds_err = us_err = NULL;
result = platform_ssh_share(sockname, conf, nullplug, (Plug *)NULL, &sock,
&logtext, &ds_err, &us_err, FALSE, TRUE);
&logtext, &ds_err, &us_err, false, true);
sfree(logtext);
sfree(ds_err);
@ -2035,11 +2035,11 @@ int ssh_share_test_for_upstream(const char *host, int port, Conf *conf)
if (result == SHARE_NONE) {
assert(sock == NULL);
return FALSE;
return false;
} else {
assert(result == SHARE_DOWNSTREAM);
sk_close(sock);
return TRUE;
return true;
}
}

View File

@ -265,7 +265,7 @@ void ssh_verstring_handle_input(BinaryPacketProtocol *bpp)
}
}
s->found_prefix = TRUE;
s->found_prefix = true;
/*
* Start a buffer to store the full greeting line.

View File

@ -59,13 +59,6 @@
#define sresize(x, n, type) ( (type *) realloc((x), (n) * sizeof(type)) )
#define sfree(x) ( free((x)) )
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
typedef struct { const struct dummy *vt; } ssh_compressor;
typedef struct { const struct dummy *vt; } ssh_decompressor;
static const struct dummy { int i; } ssh_zlib;
@ -97,7 +90,7 @@ static int lz77_init(struct LZ77Context *ctx);
/*
* Supply data to be compressed. Will update the private fields of
* the LZ77Context, and will call literal() and match() to output.
* If `compress' is FALSE, it will never emit a match, but will
* If `compress' is false, it will never emit a match, but will
* instead call literal() for everything.
*/
static void lz77_compress(struct LZ77Context *ctx,
@ -657,9 +650,9 @@ void zlib_compress_block(ssh_compressor *sc, unsigned char *block, int len,
outbits(out, 0x9C78, 16);
out->firstblock = 0;
in_block = FALSE;
in_block = false;
} else
in_block = TRUE;
in_block = true;
if (!in_block) {
/*
@ -674,7 +667,7 @@ void zlib_compress_block(ssh_compressor *sc, unsigned char *block, int len,
/*
* Do the compression.
*/
lz77_compress(&comp->ectx, block, len, TRUE);
lz77_compress(&comp->ectx, block, len, true);
/*
* End the block (by transmitting code 256, which is
@ -1235,7 +1228,7 @@ int main(int argc, char **argv)
unsigned char buf[16], *outbuf;
int ret, outlen;
ssh_decompressor *handle;
int noheader = FALSE, opts = TRUE;
int noheader = false, opts = true;
char *filename = NULL;
FILE *fp;
@ -1244,9 +1237,9 @@ int main(int argc, char **argv)
if (p[0] == '-' && opts) {
if (!strcmp(p, "-d"))
noheader = TRUE;
noheader = true;
else if (!strcmp(p, "--"))
opts = FALSE; /* next thing is filename */
opts = false; /* next thing is filename */
else {
fprintf(stderr, "unknown command line option '%s'\n", p);
return 1;

View File

@ -271,7 +271,7 @@ static void option_side_effects(Telnet *telnet, const struct Opt *o, int enabled
telnet->opt_states[o_they_sga.index] = REQUESTED;
send_opt(telnet, o_they_sga.send, o_they_sga.option);
}
telnet->activated = TRUE;
telnet->activated = true;
}
}
@ -647,7 +647,7 @@ static void telnet_closing(Plug *plug, const char *error_msg, int error_code,
sk_close(telnet->s);
telnet->s = NULL;
if (error_msg)
telnet->closed_on_socket_error = TRUE;
telnet->closed_on_socket_error = true;
seat_notify_remote_exit(telnet->seat);
}
if (error_msg) {
@ -661,8 +661,8 @@ static void telnet_receive(Plug *plug, int urgent, char *data, int len)
{
Telnet *telnet = container_of(plug, Telnet, plug);
if (urgent)
telnet->in_synch = TRUE;
telnet->session_started = TRUE;
telnet->in_synch = true;
telnet->session_started = true;
do_telnet_read(telnet, data, len);
}
@ -703,10 +703,10 @@ static const char *telnet_init(Seat *seat, Backend **backend_handle,
telnet->backend.vt = &telnet_backend;
telnet->conf = conf_copy(conf);
telnet->s = NULL;
telnet->closed_on_socket_error = FALSE;
telnet->echoing = TRUE;
telnet->editing = TRUE;
telnet->activated = FALSE;
telnet->closed_on_socket_error = false;
telnet->echoing = true;
telnet->editing = true;
telnet->activated = false;
telnet->sb_buf = NULL;
telnet->sb_size = 0;
telnet->seat = seat;
@ -716,7 +716,7 @@ static const char *telnet_init(Seat *seat, Backend **backend_handle,
telnet->state = TOP_LEVEL;
telnet->ldisc = NULL;
telnet->pinger = NULL;
telnet->session_started = TRUE;
telnet->session_started = true;
*backend_handle = &telnet->backend;
/*
@ -759,13 +759,13 @@ static const char *telnet_init(Seat *seat, Backend **backend_handle,
if (telnet->opt_states[(*o)->index] == REQUESTED)
send_opt(telnet, (*o)->send, (*o)->option);
}
telnet->activated = TRUE;
telnet->activated = true;
}
/*
* Set up SYNCH state.
*/
telnet->in_synch = FALSE;
telnet->in_synch = false;
/*
* We can send special commands from the start.
@ -1025,7 +1025,7 @@ static int telnet_ldisc(Backend *be, int option)
return telnet->echoing;
if (option == LD_EDIT)
return telnet->editing;
return FALSE;
return false;
}
static void telnet_provide_ldisc(Backend *be, Ldisc *ldisc)

File diff suppressed because it is too large Load Diff

View File

@ -52,7 +52,7 @@ struct termline {
int cols; /* number of real columns on the line */
int size; /* number of allocated termchars
* (cc-lists may make this > cols) */
int temporary; /* TRUE if decompressed from scrollback */
int temporary; /* true if decompressed from scrollback */
int cc_free; /* offset to first cc in free list */
struct termchar *chars;
};
@ -166,7 +166,7 @@ struct terminal_tag {
int esc_nargs;
int esc_query;
#define ANSI(x,y) ((x)+((y)<<8))
#define ANSI_QUE(x) ANSI(x,TRUE)
#define ANSI_QUE(x) ANSI(x,true)
#define OSC_STR_MAX 2048
int osc_strlen;

View File

@ -37,7 +37,7 @@ void queue_idempotent_callback(IdempotentCallback *ic) { assert(0); }
#define fromxdigit(c) ( (c)>'9' ? ((c)&0xDF) - 'A' + 10 : (c) - '0' )
/* For Unix in particular, but harmless if this main() is reused elsewhere */
const int buildinfo_gtk_relevant = FALSE;
const int buildinfo_gtk_relevant = false;
int main(int argc, char **argv)
{
@ -215,7 +215,7 @@ int main(int argc, char **argv)
answer_q = bigdiv(n, d);
answer_r = bigmod(n, d);
fail = FALSE;
fail = false;
if (bignum_cmp(expect_q, answer_q) != 0) {
char *as = bignum_decimal(n);
char *bs = bignum_decimal(d);
@ -224,7 +224,7 @@ int main(int argc, char **argv)
printf("%d: fail: %s / %s gave %s expected %s\n",
line, as, bs, cs, ds);
fail = TRUE;
fail = true;
sfree(as);
sfree(bs);
@ -239,7 +239,7 @@ int main(int argc, char **argv)
printf("%d: fail: %s mod %s gave %s expected %s\n",
line, as, bs, cs, ds);
fail = TRUE;
fail = true;
sfree(as);
sfree(bs);

View File

@ -176,7 +176,7 @@ int run_timers(unsigned long anow, unsigned long *next)
first = (struct timer *)index234(timers, 0);
if (!first)
return FALSE; /* no timers remaining */
return false; /* no timers remaining */
if (find234(timer_contexts, first->ctx, NULL) == NULL) {
/*
@ -200,7 +200,7 @@ int run_timers(unsigned long anow, unsigned long *next)
* future. Return how long it has yet to go.
*/
*next = first->now;
return TRUE;
return true;
}
}
}

View File

@ -88,7 +88,7 @@ https://wiki.gnome.org/Projects/GTK%2B/OSX/Bundling has some links.
char *x_get_default(const char *key) { return NULL; }
const int buildinfo_gtk_relevant = TRUE;
const int buildinfo_gtk_relevant = true;
#if !GTK_CHECK_VERSION(3,0,0)
/* This front end only works in GTK 3. If that's not what we've got,
@ -275,7 +275,7 @@ void window_setup_error(const char *errmsg)
create_message_box(NULL, "Error creating session window", errmsg,
string_width("Some sort of fiddly error message that "
"might be technical"),
TRUE, &buttons_ok, window_setup_error_callback, NULL);
true, &buttons_ok, window_setup_error_callback, NULL);
}
static void activate(GApplication *app,
@ -319,7 +319,7 @@ int main(int argc, char **argv)
/* Call the function in ux{putty,pterm}.c to do app-type
* specific setup */
extern void setup(int);
setup(FALSE); /* FALSE means we are not a one-session process */
setup(false); /* false means we are not a one-session process */
}
if (argc > 1) {

View File

@ -122,7 +122,7 @@ static gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
} else {
#if GTK_CHECK_VERSION(2,0,0)
if (gtk_im_context_filter_keypress(ctx->imc, event))
return TRUE;
return true;
#endif
if (event->type == GDK_KEY_PRESS) {
@ -158,7 +158,7 @@ static gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
}
}
}
return TRUE;
return true;
}
#if GTK_CHECK_VERSION(2,0,0)
@ -177,7 +177,7 @@ static gint configure_area(GtkWidget *widget, GdkEventConfigure *event,
ctx->width = event->width;
ctx->height = event->height;
gtk_widget_queue_draw(widget);
return TRUE;
return true;
}
#ifdef DRAW_DEFAULT_CAIRO
@ -193,7 +193,7 @@ static void askpass_redraw_gdk(GdkWindow *win, struct drawing_area_ctx *ctx)
{
GdkGC *gc = gdk_gc_new(win);
gdk_gc_set_foreground(gc, &ctx->cols[ctx->state]);
gdk_draw_rectangle(win, gc, TRUE, 0, 0, ctx->width, ctx->height);
gdk_draw_rectangle(win, gc, true, 0, 0, ctx->width, ctx->height);
gdk_gc_unref(gc);
}
#endif
@ -203,7 +203,7 @@ static gint draw_area(GtkWidget *widget, cairo_t *cr, gpointer data)
{
struct drawing_area_ctx *ctx = (struct drawing_area_ctx *)data;
askpass_redraw_cairo(cr, ctx);
return TRUE;
return true;
}
#else
static gint expose_area(GtkWidget *widget, GdkEventExpose *event,
@ -219,7 +219,7 @@ static gint expose_area(GtkWidget *widget, GdkEventExpose *event,
askpass_redraw_gdk(gtk_widget_get_window(ctx->area), ctx);
#endif
return TRUE;
return true;
}
#endif
@ -245,7 +245,7 @@ static gboolean try_grab_keyboard(gpointer vctx)
ctx->seat = seat;
ret = gdk_seat_grab(seat, gdkw, GDK_SEAT_CAPABILITY_KEYBOARD,
TRUE, NULL, NULL, NULL, NULL);
true, NULL, NULL, NULL, NULL);
/*
* For some reason GDK 3.22 hides the GDK window as a side effect
@ -281,7 +281,7 @@ static gboolean try_grab_keyboard(gpointer vctx)
ret = gdk_device_grab(ctx->keyboard,
gtk_widget_get_window(ctx->dialog),
GDK_OWNERSHIP_NONE,
TRUE,
true,
GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK,
NULL,
GDK_CURRENT_TIME);
@ -290,7 +290,7 @@ static gboolean try_grab_keyboard(gpointer vctx)
* It's much simpler in GTK 1 and 2!
*/
ret = gdk_keyboard_grab(gtk_widget_get_window(ctx->dialog),
FALSE, GDK_CURRENT_TIME);
false, GDK_CURRENT_TIME);
#endif
if (ret != GDK_GRAB_SUCCESS)
goto fail;
@ -323,7 +323,7 @@ static gboolean try_grab_keyboard(gpointer vctx)
gtk_widget_queue_draw(ctx->drawingareas[i].area);
}
return FALSE;
return false;
fail:
/*
@ -347,7 +347,7 @@ static gboolean try_grab_keyboard(gpointer vctx)
} else {
g_timeout_add(1000/8, try_grab_keyboard, ctx);
}
return FALSE;
return false;
}
void realize(GtkWidget *widget, gpointer vctx)
@ -389,12 +389,12 @@ static const char *gtk_askpass_setup(struct askpass_ctx *ctx,
ctx->promptlabel = gtk_label_new(prompt_text);
align_label_left(GTK_LABEL(ctx->promptlabel));
gtk_widget_show(ctx->promptlabel);
gtk_label_set_line_wrap(GTK_LABEL(ctx->promptlabel), TRUE);
gtk_label_set_line_wrap(GTK_LABEL(ctx->promptlabel), true);
#if GTK_CHECK_VERSION(3,0,0)
gtk_label_set_width_chars(GTK_LABEL(ctx->promptlabel), 48);
#endif
our_dialog_add_to_content_area(GTK_WINDOW(ctx->dialog),
ctx->promptlabel, TRUE, TRUE, 0);
ctx->promptlabel, true, true, 0);
#if GTK_CHECK_VERSION(2,0,0)
ctx->imc = gtk_im_multicontext_new();
#endif
@ -406,7 +406,7 @@ static const char *gtk_askpass_setup(struct askpass_ctx *ctx,
ctx->cols[1].red = ctx->cols[1].green = ctx->cols[1].blue = 0;
ctx->cols[2].red = ctx->cols[2].green = ctx->cols[2].blue = 0x8000;
gdk_colormap_alloc_colors(ctx->colmap, ctx->cols, 2,
FALSE, TRUE, success);
false, true, success);
if (!success[0] || !success[1])
return "unable to allocate colours";
}
@ -426,7 +426,7 @@ static const char *gtk_askpass_setup(struct askpass_ctx *ctx,
* piece of template text. */
gtk_widget_set_size_request(ctx->drawingareas[i].area, 32, 32);
gtk_box_pack_end(action_area, ctx->drawingareas[i].area,
TRUE, TRUE, 5);
true, true, 5);
g_signal_connect(G_OBJECT(ctx->drawingareas[i].area),
"configure_event",
G_CALLBACK(configure_area),
@ -459,10 +459,10 @@ static const char *gtk_askpass_setup(struct askpass_ctx *ctx,
* the prompt label at random, and we'll use gtk_grab_add to
* ensure key events go to it.
*/
gtk_widget_set_sensitive(ctx->dialog, TRUE);
gtk_widget_set_sensitive(ctx->dialog, true);
#if GTK_CHECK_VERSION(2,0,0)
gtk_window_set_keep_above(GTK_WINDOW(ctx->dialog), TRUE);
gtk_window_set_keep_above(GTK_WINDOW(ctx->dialog), true);
#endif
/*
@ -503,14 +503,14 @@ static void gtk_askpass_cleanup(struct askpass_ctx *ctx)
static int setup_gtk(const char *display)
{
static int gtk_initialised = FALSE;
static int gtk_initialised = false;
int argc;
char *real_argv[3];
char **argv = real_argv;
int ret;
if (gtk_initialised)
return TRUE;
return true;
argc = 0;
argv[argc++] = dupstr("dummy");
@ -524,7 +524,7 @@ static int setup_gtk(const char *display)
return ret;
}
const int buildinfo_gtk_relevant = TRUE;
const int buildinfo_gtk_relevant = true;
char *gtk_askpass_main(const char *display, const char *wintitle,
const char *prompt, int *success)
@ -537,22 +537,22 @@ char *gtk_askpass_main(const char *display, const char *wintitle,
/* In case gtk_init hasn't been called yet by the program */
if (!setup_gtk(display)) {
*success = FALSE;
*success = false;
return dupstr("unable to initialise GTK");
}
if ((err = gtk_askpass_setup(ctx, wintitle, prompt)) != NULL) {
*success = FALSE;
*success = false;
return dupprintf("%s", err);
}
gtk_main();
gtk_askpass_cleanup(ctx);
if (ctx->passphrase) {
*success = TRUE;
*success = true;
return ctx->passphrase;
} else {
*success = FALSE;
*success = false;
return ctx->error_message;
}
}
@ -577,7 +577,7 @@ int main(int argc, char **argv)
gtk_init(&argc, &argv);
if (argc != 2) {
success = FALSE;
success = false;
ret = dupprintf("usage: %s <prompt text>", argv[0]);
} else {
srand(time(NULL));

View File

@ -3,6 +3,7 @@
*/
#include <gtk/gtk.h>
#include "defs.h"
#include "gtkcompat.h"
#include "gtkcols.h"
@ -157,7 +158,7 @@ static void columns_class_init(ColumnsClass *klass)
static void columns_init(Columns *cols)
{
gtk_widget_set_has_window(GTK_WIDGET(cols), FALSE);
gtk_widget_set_has_window(GTK_WIDGET(cols), false);
cols->children = NULL;
cols->spacing = 0;
@ -222,7 +223,7 @@ static void columns_map(GtkWidget *widget)
g_return_if_fail(IS_COLUMNS(widget));
cols = COLUMNS(widget);
gtk_widget_set_mapped(GTK_WIDGET(cols), TRUE);
gtk_widget_set_mapped(GTK_WIDGET(cols), true);
for (children = cols->children;
children && (child = children->data);
@ -243,7 +244,7 @@ static void columns_unmap(GtkWidget *widget)
g_return_if_fail(IS_COLUMNS(widget));
cols = COLUMNS(widget);
gtk_widget_set_mapped(GTK_WIDGET(cols), FALSE);
gtk_widget_set_mapped(GTK_WIDGET(cols), false);
for (children = cols->children;
children && (child = children->data);
@ -285,9 +286,9 @@ static gint columns_expose(GtkWidget *widget, GdkEventExpose *event)
GList *children;
GdkEventExpose child_event;
g_return_val_if_fail(widget != NULL, FALSE);
g_return_val_if_fail(IS_COLUMNS(widget), FALSE);
g_return_val_if_fail(event != NULL, FALSE);
g_return_val_if_fail(widget != NULL, false);
g_return_val_if_fail(IS_COLUMNS(widget), false);
g_return_val_if_fail(event != NULL, false);
if (GTK_WIDGET_DRAWABLE(widget)) {
cols = COLUMNS(widget);
@ -304,7 +305,7 @@ static gint columns_expose(GtkWidget *widget, GdkEventExpose *event)
gtk_widget_event(child->widget, (GdkEvent *)&child_event);
}
}
return FALSE;
return false;
}
#endif
@ -438,7 +439,7 @@ void columns_set_cols(Columns *cols, gint ncols, const gint *percentages)
childdata->widget = NULL;
childdata->ncols = ncols;
childdata->percentages = g_new(gint, ncols);
childdata->force_left = FALSE;
childdata->force_left = false;
for (i = 0; i < ncols; i++)
childdata->percentages[i] = percentages[i];
@ -459,7 +460,7 @@ void columns_add(Columns *cols, GtkWidget *child,
childdata->widget = child;
childdata->colstart = colstart;
childdata->colspan = colspan;
childdata->force_left = FALSE;
childdata->force_left = false;
childdata->same_height_as = NULL;
childdata->percentages = NULL;
@ -506,7 +507,7 @@ void columns_force_left_align(Columns *cols, GtkWidget *widget)
child = columns_find_child(cols, widget);
g_return_if_fail(child != NULL);
child->force_left = TRUE;
child->force_left = true;
if (gtk_widget_get_visible(widget))
gtk_widget_queue_resize(GTK_WIDGET(cols));
}
@ -563,14 +564,14 @@ static gint columns_focus(FOCUS_METHOD_SUPERCLASS *super, GtkDirectionType dir)
GList *pos;
GtkWidget *focuschild;
g_return_val_if_fail(super != NULL, FALSE);
g_return_val_if_fail(IS_COLUMNS(super), FALSE);
g_return_val_if_fail(super != NULL, false);
g_return_val_if_fail(IS_COLUMNS(super), false);
cols = COLUMNS(super);
if (!gtk_widget_is_drawable(GTK_WIDGET(cols)) ||
!gtk_widget_is_sensitive(GTK_WIDGET(cols)))
return FALSE;
return false;
if (!gtk_widget_get_can_focus(GTK_WIDGET(cols)) &&
(dir == GTK_DIR_TAB_FORWARD || dir == GTK_DIR_TAB_BACKWARD)) {
@ -593,16 +594,16 @@ static gint columns_focus(FOCUS_METHOD_SUPERCLASS *super, GtkDirectionType dir)
GTK_IS_CONTAINER(child) &&
!gtk_widget_has_focus(child)) {
if (CHILD_FOCUS(child, dir))
return TRUE;
return true;
}
}
} else if (gtk_widget_is_drawable(child)) {
if (GTK_IS_CONTAINER(child)) {
if (CHILD_FOCUS(child, dir))
return TRUE;
return true;
} else if (gtk_widget_get_can_focus(child)) {
gtk_widget_grab_focus(child);
return TRUE;
return true;
}
}
@ -612,7 +613,7 @@ static gint columns_focus(FOCUS_METHOD_SUPERCLASS *super, GtkDirectionType dir)
pos = pos->prev;
}
return FALSE;
return false;
} else
return columns_inherited_focus(super, dir);
}
@ -668,7 +669,7 @@ static gint columns_compute_width(Columns *cols, widget_dim_fn_t get_width)
printf("label %p '%s' wrap=%s: ", child->widget,
gtk_label_get_text(GTK_LABEL(child->widget)),
(gtk_label_get_line_wrap(GTK_LABEL(child->widget))
? "TRUE" : "FALSE"));
? "true" : "false"));
else
printf("widget %p: ", child->widget);
{

View File

@ -88,7 +88,7 @@ gboolean fd_input_func(GIOChannel *source, GIOCondition condition,
if (condition & G_IO_OUT)
select_result(sourcefd, 2);
return TRUE;
return true;
}
#else
void fd_input_func(gpointer data, gint sourcefd, GdkInputCondition condition)
@ -173,11 +173,11 @@ static gint timer_trigger(gpointer data)
}
/*
* Returning FALSE means 'don't call this timer again', which
* Returning false means 'don't call this timer again', which
* _should_ be redundant given that we removed it above, but just
* in case, return FALSE anyway.
* in case, return false anyway.
*/
return FALSE;
return false;
}
void timer_change_notify(unsigned long next)
@ -215,10 +215,10 @@ static gint idle_toplevel_callback_func(gpointer data)
*/
if (!toplevel_callback_pending() && idle_fn_scheduled) {
g_source_remove(toplevel_callback_idle_id);
idle_fn_scheduled = FALSE;
idle_fn_scheduled = false;
}
return TRUE;
return true;
}
static void notify_toplevel_callback(void *vctx)
@ -226,7 +226,7 @@ static void notify_toplevel_callback(void *vctx)
if (!idle_fn_scheduled) {
toplevel_callback_idle_id =
g_idle_add(idle_toplevel_callback_func, NULL);
idle_fn_scheduled = TRUE;
idle_fn_scheduled = true;
}
}

View File

@ -200,7 +200,7 @@
#if GTK_CHECK_VERSION(3,0,0)
#define gtk_hseparator_new() gtk_separator_new(GTK_ORIENTATION_HORIZONTAL)
/* Fortunately, my hboxes and vboxes never actually set homogeneous to
* TRUE, so I can just wrap these deprecated constructors with a macro
* true, so I can just wrap these deprecated constructors with a macro
* without also having to arrange a call to gtk_box_set_homogeneous. */
#define gtk_hbox_new(homogeneous, spacing) \
gtk_box_new(GTK_ORIENTATION_HORIZONTAL, spacing)

View File

@ -197,7 +197,7 @@ static void dlg_init(struct dlgparam *dp)
{
dp->byctrl = newtree234(uctrl_cmp_byctrl);
dp->bywidget = newtree234(uctrl_cmp_bywidget);
dp->coloursel_result.ok = FALSE;
dp->coloursel_result.ok = false;
dp->window = dp->cancelbutton = NULL;
#if !GTK_CHECK_VERSION(2,0,0)
dp->treeitems = NULL;
@ -265,7 +265,7 @@ void dlg_radiobutton_set(union control *ctrl, dlgparam *dp, int which)
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
assert(uc->ctrl->generic.type == CTRL_RADIO);
assert(uc->buttons != NULL);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(uc->buttons[which]), TRUE);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(uc->buttons[which]), true);
}
int dlg_radiobutton_get(union control *ctrl, dlgparam *dp)
@ -790,17 +790,17 @@ void dlg_listbox_select(union control *ctrl, dlgparam *dp, int index)
items = gtk_container_children(GTK_CONTAINER(uc->list));
nitems = g_list_length(items);
if (nitems > 0) {
int modified = FALSE;
int modified = false;
g_list_free(items);
newtop = uc->adj->lower +
(uc->adj->upper - uc->adj->lower) * index / nitems;
newbot = uc->adj->lower +
(uc->adj->upper - uc->adj->lower) * (index+1) / nitems;
if (uc->adj->value > newtop) {
modified = TRUE;
modified = true;
uc->adj->value = newtop;
} else if (uc->adj->value < newbot - uc->adj->page_size) {
modified = TRUE;
modified = true;
uc->adj->value = newbot - uc->adj->page_size;
}
if (modified)
@ -824,7 +824,7 @@ void dlg_listbox_select(union control *ctrl, dlgparam *dp, int index)
path = gtk_tree_path_new_from_indices(index, -1);
gtk_tree_selection_select_path(treesel, path);
gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(uc->treeview),
path, NULL, FALSE, 0.0, 0.0);
path, NULL, false, 0.0, 0.0);
gtk_tree_path_free(path);
return;
}
@ -1063,7 +1063,7 @@ void dlg_error_msg(dlgparam *dp, const char *msg)
create_message_box(
dp->window, "Error", msg,
string_width("Some sort of text about a config-box error message"),
FALSE, &buttons_ok, trivial_post_dialog_fn, NULL);
false, &buttons_ok, trivial_post_dialog_fn, NULL);
}
/*
@ -1104,7 +1104,7 @@ void dlg_coloursel_start(union control *ctrl, dlgparam *dp, int r, int g, int b)
GtkWidget *coloursel =
gtk_color_chooser_dialog_new("Select a colour",
GTK_WINDOW(dp->window));
gtk_color_chooser_set_use_alpha(GTK_COLOR_CHOOSER(coloursel), FALSE);
gtk_color_chooser_set_use_alpha(GTK_COLOR_CHOOSER(coloursel), false);
#else
GtkWidget *okbutton, *cancelbutton;
GtkWidget *coloursel =
@ -1112,12 +1112,12 @@ void dlg_coloursel_start(union control *ctrl, dlgparam *dp, int r, int g, int b)
GtkColorSelectionDialog *ccs = GTK_COLOR_SELECTION_DIALOG(coloursel);
GtkColorSelection *cs = GTK_COLOR_SELECTION
(gtk_color_selection_dialog_get_color_selection(ccs));
gtk_color_selection_set_has_opacity_control(cs, FALSE);
gtk_color_selection_set_has_opacity_control(cs, false);
#endif
dp->coloursel_result.ok = FALSE;
dp->coloursel_result.ok = false;
gtk_window_set_modal(GTK_WINDOW(coloursel), TRUE);
gtk_window_set_modal(GTK_WINDOW(coloursel), true);
#if GTK_CHECK_VERSION(3,0,0)
{
@ -1214,7 +1214,7 @@ static gboolean widget_focus(GtkWidget *widget, GdkEventFocus *event,
dp->currfocus = focus;
}
return FALSE;
return false;
}
static void button_clicked(GtkButton *button, gpointer data)
@ -1251,7 +1251,7 @@ static gboolean editbox_key(GtkWidget *widget, GdkEventKey *event,
event, &return_val);
return return_val;
}
return FALSE;
return false;
}
static void editbox_changed(GtkEditable *ed, gpointer data)
@ -1269,7 +1269,7 @@ static gboolean editbox_lostfocus(GtkWidget *ed, GdkEventFocus *event,
struct dlgparam *dp = (struct dlgparam *)data;
struct uctrl *uc = dlg_find_bywidget(dp, GTK_WIDGET(ed));
uc->ctrl->generic.handler(uc->ctrl, dp, dp->data, EVENT_REFRESH);
return FALSE;
return false;
}
#if !GTK_CHECK_VERSION(2,0,0)
@ -1366,22 +1366,22 @@ static gboolean listitem_key(GtkWidget *item, GdkEventKey *event,
g_list_free(chead);
}
return TRUE;
return true;
}
return FALSE;
return false;
}
static gboolean listitem_single_key(GtkWidget *item, GdkEventKey *event,
gpointer data)
{
return listitem_key(item, event, data, FALSE);
return listitem_key(item, event, data, false);
}
static gboolean listitem_multi_key(GtkWidget *item, GdkEventKey *event,
gpointer data)
{
return listitem_key(item, event, data, TRUE);
return listitem_key(item, event, data, true);
}
static gboolean listitem_button_press(GtkWidget *item, GdkEventButton *event,
@ -1395,7 +1395,7 @@ static gboolean listitem_button_press(GtkWidget *item, GdkEventButton *event,
case GDK_2BUTTON_PRESS: uc->nclicks = 2; break;
case GDK_3BUTTON_PRESS: uc->nclicks = 3; break;
}
return FALSE;
return false;
}
static gboolean listitem_button_release(GtkWidget *item, GdkEventButton *event,
@ -1405,9 +1405,9 @@ static gboolean listitem_button_release(GtkWidget *item, GdkEventButton *event,
struct uctrl *uc = dlg_find_bywidget(dp, GTK_WIDGET(item));
if (uc->nclicks>1) {
uc->ctrl->generic.handler(uc->ctrl, dp, dp->data, EVENT_ACTION);
return TRUE;
return true;
}
return FALSE;
return false;
}
static void list_selchange(GtkList *list, gpointer data)
@ -1497,7 +1497,7 @@ static gboolean draglist_valchange(gpointer data)
sfree(ctx);
return FALSE;
return false;
}
static void listbox_reorder(GtkTreeModel *treemodel, GtkTreePath *path,
@ -1626,9 +1626,9 @@ static void colourchoose_response(GtkDialog *dialog,
dp->coloursel_result.r = (int) (255 * rgba.red);
dp->coloursel_result.g = (int) (255 * rgba.green);
dp->coloursel_result.b = (int) (255 * rgba.blue);
dp->coloursel_result.ok = TRUE;
dp->coloursel_result.ok = true;
} else {
dp->coloursel_result.ok = FALSE;
dp->coloursel_result.ok = false;
}
uc->ctrl->generic.handler(uc->ctrl, dp, dp->data, EVENT_CALLBACK);
@ -1667,7 +1667,7 @@ static void coloursel_ok(GtkButton *button, gpointer data)
dp->coloursel_result.b = (int) (255 * cvals[2]);
}
#endif
dp->coloursel_result.ok = TRUE;
dp->coloursel_result.ok = true;
uc->ctrl->generic.handler(uc->ctrl, dp, dp->data, EVENT_CALLBACK);
}
@ -1676,7 +1676,7 @@ static void coloursel_cancel(GtkButton *button, gpointer data)
struct dlgparam *dp = (struct dlgparam *)data;
gpointer coloursel = g_object_get_data(G_OBJECT(button), "user-data");
struct uctrl *uc = g_object_get_data(G_OBJECT(coloursel), "user-data");
dp->coloursel_result.ok = FALSE;
dp->coloursel_result.ok = false;
uc->ctrl->generic.handler(uc->ctrl, dp, dp->data, EVENT_CALLBACK);
}
@ -1697,7 +1697,7 @@ static void filefont_clicked(GtkButton *button, gpointer data)
STANDARD_CANCEL_LABEL, GTK_RESPONSE_CANCEL,
STANDARD_OPEN_LABEL, GTK_RESPONSE_ACCEPT,
(const gchar *)NULL);
gtk_window_set_modal(GTK_WINDOW(filechoose), TRUE);
gtk_window_set_modal(GTK_WINDOW(filechoose), true);
g_object_set_data(G_OBJECT(filechoose), "user-data", (gpointer)uc);
g_signal_connect(G_OBJECT(filechoose), "response",
G_CALLBACK(filechoose_response), (gpointer)dp);
@ -1705,7 +1705,7 @@ static void filefont_clicked(GtkButton *button, gpointer data)
#else
GtkWidget *filesel =
gtk_file_selection_new(uc->ctrl->fileselect.title);
gtk_window_set_modal(GTK_WINDOW(filesel), TRUE);
gtk_window_set_modal(GTK_WINDOW(filesel), true);
g_object_set_data
(G_OBJECT(GTK_FILE_SELECTION(filesel)->ok_button), "user-data",
(gpointer)filesel);
@ -1735,7 +1735,7 @@ static void filefont_clicked(GtkButton *button, gpointer data)
gchar *spacings[] = { "c", "m", NULL };
GtkWidget *fontsel =
gtk_font_selection_dialog_new("Select a font");
gtk_window_set_modal(GTK_WINDOW(fontsel), TRUE);
gtk_window_set_modal(GTK_WINDOW(fontsel), true);
gtk_font_selection_dialog_set_filter
(GTK_FONT_SELECTION_DIALOG(fontsel),
GTK_FONT_FILTER_BASE, GTK_FONT_ALL,
@ -1792,7 +1792,7 @@ static void filefont_clicked(GtkButton *button, gpointer data)
unifontsel *fontsel = unifontsel_new("Select a font");
gtk_window_set_modal(fontsel->window, TRUE);
gtk_window_set_modal(fontsel->window, true);
unifontsel_set_name(fontsel, fontname);
g_object_set_data(G_OBJECT(fontsel->ok_button),
@ -1877,7 +1877,7 @@ GtkWidget *layout_ctrls(struct dlgparam *dp, struct Shortcuts *scs,
for (i = 0; i < s->ncontrols; i++) {
union control *ctrl = s->ctrls[i];
struct uctrl *uc;
int left = FALSE;
int left = false;
GtkWidget *w = NULL;
switch (ctrl->generic.type) {
@ -1919,7 +1919,7 @@ GtkWidget *layout_ctrls(struct dlgparam *dp, struct Shortcuts *scs,
case CTRL_BUTTON:
w = gtk_button_new_with_label(ctrl->generic.label);
if (win) {
gtk_widget_set_can_default(w, TRUE);
gtk_widget_set_can_default(w, true);
if (ctrl->button.isdefault)
gtk_window_set_default(win, w);
if (ctrl->button.iscancel)
@ -1940,7 +1940,7 @@ GtkWidget *layout_ctrls(struct dlgparam *dp, struct Shortcuts *scs,
G_CALLBACK(widget_focus), dp);
shortcut_add(scs, gtk_bin_get_child(GTK_BIN(w)),
ctrl->checkbox.shortcut, SHORTCUT_UCTRL, uc);
left = TRUE;
left = true;
break;
case CTRL_RADIO:
/*
@ -2011,7 +2011,7 @@ GtkWidget *layout_ctrls(struct dlgparam *dp, struct Shortcuts *scs,
* GTK 1 combo box.
*/
w = gtk_combo_new();
gtk_combo_set_value_in_list(GTK_COMBO(w), FALSE, TRUE);
gtk_combo_set_value_in_list(GTK_COMBO(w), false, true);
uc->entry = GTK_COMBO(w)->entry;
uc->list = GTK_COMBO(w)->list;
signalobject = uc->entry;
@ -2033,7 +2033,7 @@ GtkWidget *layout_ctrls(struct dlgparam *dp, struct Shortcuts *scs,
} else {
w = gtk_entry_new();
if (ctrl->editbox.password)
gtk_entry_set_visibility(GTK_ENTRY(w), FALSE);
gtk_entry_set_visibility(GTK_ENTRY(w), false);
uc->entry = w;
signalobject = w;
}
@ -2226,7 +2226,7 @@ GtkWidget *layout_ctrls(struct dlgparam *dp, struct Shortcuts *scs,
* column to look at in the list model).
*/
cr = gtk_cell_renderer_text_new();
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(w), cr, TRUE);
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(w), cr, true);
gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(w), cr,
"text", 1, NULL);
@ -2337,7 +2337,7 @@ GtkWidget *layout_ctrls(struct dlgparam *dp, struct Shortcuts *scs,
(GTK_TREE_MODEL(uc->listmodel));
g_object_set_data(G_OBJECT(uc->listmodel), "user-data",
(gpointer)w);
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(w), FALSE);
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(w), false);
sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(w));
gtk_tree_selection_set_mode
(sel, ctrl->listbox.multisel ? GTK_SELECTION_MULTIPLE :
@ -2351,7 +2351,7 @@ GtkWidget *layout_ctrls(struct dlgparam *dp, struct Shortcuts *scs,
G_CALLBACK(listbox_selchange), dp);
if (ctrl->listbox.draglist) {
gtk_tree_view_set_reorderable(GTK_TREE_VIEW(w), TRUE);
gtk_tree_view_set_reorderable(GTK_TREE_VIEW(w), true);
g_signal_connect(G_OBJECT(uc->listmodel), "row-inserted",
G_CALLBACK(listbox_reorder), dp);
}
@ -2375,7 +2375,7 @@ GtkWidget *layout_ctrls(struct dlgparam *dp, struct Shortcuts *scs,
if (!ctrl->listbox.hscroll) {
g_object_set(G_OBJECT(cellrend),
"ellipsize", PANGO_ELLIPSIZE_END,
"ellipsize-set", TRUE,
"ellipsize-set", true,
(const char *)NULL);
}
column = gtk_tree_view_column_new_with_attributes
@ -2482,7 +2482,7 @@ GtkWidget *layout_ctrls(struct dlgparam *dp, struct Shortcuts *scs,
uc->text = w = gtk_label_new(uc->ctrl->generic.label);
#endif
align_label_left(GTK_LABEL(w));
gtk_label_set_line_wrap(GTK_LABEL(w), TRUE);
gtk_label_set_line_wrap(GTK_LABEL(w), true);
break;
}
@ -2570,10 +2570,10 @@ static int tree_grab_focus(struct dlgparam *dp)
}
if (f >= 0)
return FALSE;
return false;
else {
gtk_widget_grab_focus(dp->currtreeitem);
return TRUE;
return true;
}
}
@ -2584,7 +2584,7 @@ gint tree_focus(GtkContainer *container, GtkDirectionType direction,
g_signal_stop_emission_by_name(G_OBJECT(container), "focus");
/*
* If there's a focused treeitem, we return FALSE to cause the
* If there's a focused treeitem, we return false to cause the
* focus to move on to some totally other control. If not, we
* focus the selected one.
*/
@ -2598,7 +2598,7 @@ int win_key_press(GtkWidget *widget, GdkEventKey *event, gpointer data)
if (event->keyval == GDK_KEY_Escape && dp->cancelbutton) {
g_signal_emit_by_name(G_OBJECT(dp->cancelbutton), "clicked");
return TRUE;
return true;
}
if ((event->state & GDK_MOD1_MASK) &&
@ -2713,7 +2713,7 @@ int win_key_press(GtkWidget *widget, GdkEventKey *event, gpointer data)
}
}
return FALSE;
return false;
}
#if !GTK_CHECK_VERSION(2,0,0)
@ -2742,10 +2742,10 @@ int tree_key_press(GtkWidget *widget, GdkEventKey *event, gpointer data)
*/
{
GtkWidget *w = dp->treeitems[i];
int vis = TRUE;
int vis = true;
while (w && (GTK_IS_TREE_ITEM(w) || GTK_IS_TREE(w))) {
if (!GTK_WIDGET_VISIBLE(w)) {
vis = FALSE;
vis = false;
break;
}
w = w->parent;
@ -2762,7 +2762,7 @@ int tree_key_press(GtkWidget *widget, GdkEventKey *event, gpointer data)
g_signal_emit_by_name(G_OBJECT(dp->treeitems[j]), "toggle");
gtk_widget_grab_focus(dp->treeitems[j]);
}
return TRUE;
return true;
}
/*
@ -2772,15 +2772,15 @@ int tree_key_press(GtkWidget *widget, GdkEventKey *event, gpointer data)
if (event->keyval == GDK_Left || event->keyval == GDK_KP_Left) {
g_signal_stop_emission_by_name(G_OBJECT(widget), "key_press_event");
gtk_tree_item_collapse(GTK_TREE_ITEM(widget));
return TRUE;
return true;
}
if (event->keyval == GDK_Right || event->keyval == GDK_KP_Right) {
g_signal_stop_emission_by_name(G_OBJECT(widget), "key_press_event");
gtk_tree_item_expand(GTK_TREE_ITEM(widget));
return TRUE;
return true;
}
return FALSE;
return false;
}
#endif
@ -2935,15 +2935,15 @@ GtkWidget *create_config_box(const char *title, Conf *conf,
gtk_setup_config_box(dp->ctrlbox, midsession, window);
gtk_window_set_title(GTK_WINDOW(window), title);
hbox = gtk_hbox_new(FALSE, 4);
our_dialog_add_to_content_area(GTK_WINDOW(window), hbox, TRUE, TRUE, 0);
hbox = gtk_hbox_new(false, 4);
our_dialog_add_to_content_area(GTK_WINDOW(window), hbox, true, true, 0);
gtk_container_set_border_width(GTK_CONTAINER(hbox), 10);
gtk_widget_show(hbox);
vbox = gtk_vbox_new(FALSE, 4);
gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0);
vbox = gtk_vbox_new(false, 4);
gtk_box_pack_start(GTK_BOX(hbox), vbox, false, false, 0);
gtk_widget_show(vbox);
cols = columns_new(4);
gtk_box_pack_start(GTK_BOX(vbox), cols, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(vbox), cols, false, false, 0);
gtk_widget_show(cols);
label = gtk_label_new("Category:");
columns_add(COLUMNS(cols), label, 0, 1);
@ -2954,7 +2954,7 @@ GtkWidget *create_config_box(const char *title, Conf *conf,
treestore = gtk_tree_store_new
(TREESTORE_NUM, G_TYPE_STRING, G_TYPE_INT);
tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(treestore));
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(tree), FALSE);
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(tree), false);
treerenderer = gtk_cell_renderer_text_new();
treecolumn = gtk_tree_view_column_new_with_attributes
("Label", treerenderer, "text", 0, NULL);
@ -2972,11 +2972,11 @@ GtkWidget *create_config_box(const char *title, Conf *conf,
G_CALLBACK(widget_focus), dp);
shortcut_add(&scs, label, 'g', SHORTCUT_TREE, tree);
gtk_widget_show(treescroll);
gtk_box_pack_start(GTK_BOX(vbox), treescroll, TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(vbox), treescroll, true, true, 0);
panels = gtk_notebook_new();
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(panels), FALSE);
gtk_notebook_set_show_border(GTK_NOTEBOOK(panels), FALSE);
gtk_box_pack_start(GTK_BOX(hbox), panels, TRUE, TRUE, 0);
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(panels), false);
gtk_notebook_set_show_border(GTK_NOTEBOOK(panels), false);
gtk_box_pack_start(GTK_BOX(hbox), panels, true, true, 0);
gtk_widget_show(panels);
panelvbox = NULL;
@ -3023,7 +3023,7 @@ GtkWidget *create_config_box(const char *title, Conf *conf,
first = (panelvbox == NULL);
panelvbox = gtk_vbox_new(FALSE, 4);
panelvbox = gtk_vbox_new(false, 4);
gtk_widget_show(panelvbox);
gtk_notebook_append_page(GTK_NOTEBOOK(panels), panelvbox,
NULL);
@ -3076,7 +3076,7 @@ GtkWidget *create_config_box(const char *title, Conf *conf,
*/
gtk_tree_view_expand_row(GTK_TREE_VIEW(tree),
selparams[nselparams].treepath,
FALSE);
false);
} else {
selparams[nselparams].treepath = NULL;
}
@ -3117,7 +3117,7 @@ GtkWidget *create_config_box(const char *title, Conf *conf,
}
w = layout_ctrls(dp, &selparams[nselparams-1].shortcuts, s, NULL);
gtk_box_pack_start(GTK_BOX(panelvbox), w, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(panelvbox), w, false, false, 0);
gtk_widget_show(w);
}
}
@ -3330,7 +3330,7 @@ GtkWidget *create_message_box(
I(button->value));
c->generic.column = index++;
if (button->type > 0)
c->button.isdefault = TRUE;
c->button.isdefault = true;
/* We always arrange that _some_ button is labelled as
* 'iscancel', so that pressing Escape will always cause
@ -3342,7 +3342,7 @@ GtkWidget *create_message_box(
* that really is just showing a _message_ and not even asking
* a question) then that will be picked. */
if (button->type == min_type)
c->button.iscancel = TRUE;
c->button.iscancel = true;
}
s1 = ctrl_getset(dp->ctrlbox, "x", "", "");
@ -3356,7 +3356,7 @@ GtkWidget *create_message_box(
w1 = layout_ctrls(dp, &scs, s1, GTK_WINDOW(window));
gtk_container_set_border_width(GTK_CONTAINER(w1), 10);
gtk_widget_set_size_request(w1, minwid+20, -1);
our_dialog_add_to_content_area(GTK_WINDOW(window), w1, TRUE, TRUE, 0);
our_dialog_add_to_content_area(GTK_WINDOW(window), w1, true, true, 0);
gtk_widget_show(w1);
dp->shortcuts = &scs;
@ -3367,7 +3367,7 @@ GtkWidget *create_message_box(
if (selectable) {
#if GTK_CHECK_VERSION(2,0,0)
struct uctrl *uc = dlg_find_byctrl(dp, textctrl);
gtk_label_set_selectable(GTK_LABEL(uc->text), TRUE);
gtk_label_set_selectable(GTK_LABEL(uc->text), true);
/*
* GTK selectable labels have a habit of selecting their
@ -3523,7 +3523,7 @@ int gtk_seat_verify_ssh_host_key(
mainwin = GTK_WIDGET(gtk_seat_get_window(seat));
msgbox = create_message_box(
mainwin, "PuTTY Security Alert", text, string_width(fingerprint), TRUE,
mainwin, "PuTTY Security Alert", text, string_width(fingerprint), true,
&buttons_hostkey, verify_ssh_host_key_result_callback, result_ctx);
register_dialog(seat, DIALOG_SLOT_NETWORK_PROMPT, msgbox);
@ -3584,7 +3584,7 @@ int gtk_seat_confirm_weak_crypto_primitive(
msgbox = create_message_box(
mainwin, "PuTTY Security Alert", text,
string_width("Reasonably long line of text as a width template"),
FALSE, &buttons_yn, simple_prompt_result_callback, result_ctx);
false, &buttons_yn, simple_prompt_result_callback, result_ctx);
register_dialog(seat, result_ctx->dialog_slot, msgbox);
sfree(text);
@ -3621,7 +3621,7 @@ int gtk_seat_confirm_weak_cached_hostkey(
mainwin, "PuTTY Security Alert", text,
string_width("is ecdsa-nistp521, which is below the configured"
" warning threshold."),
FALSE, &buttons_yn, simple_prompt_result_callback, result_ctx);
false, &buttons_yn, simple_prompt_result_callback, result_ctx);
register_dialog(seat, result_ctx->dialog_slot, msgbox);
sfree(text);
@ -3642,7 +3642,7 @@ void nonfatal_message_box(void *window, const char *msg)
create_message_box(
window, title, msg,
string_width("REASONABLY LONG LINE OF TEXT FOR BASIC SANITY"),
FALSE, &buttons_ok, trivial_post_dialog_fn, NULL);
false, &buttons_ok, trivial_post_dialog_fn, NULL);
sfree(title);
}
@ -3683,7 +3683,7 @@ static void licence_clicked(GtkButton *button, gpointer data)
create_message_box(aboutbox, title, LICENCE_TEXT("\n\n"),
string_width("LONGISH LINE OF TEXT SO THE LICENCE"
" BOX ISN'T EXCESSIVELY TALL AND THIN"),
TRUE, &buttons_ok, trivial_post_dialog_fn, NULL);
true, &buttons_ok, trivial_post_dialog_fn, NULL);
sfree(title);
}
@ -3705,17 +3705,17 @@ void about_box(void *window)
sfree(title);
w = gtk_button_new_with_label("Close");
gtk_widget_set_can_default(w, TRUE);
gtk_widget_set_can_default(w, true);
gtk_window_set_default(GTK_WINDOW(aboutbox), w);
action_area = our_dialog_make_action_hbox(GTK_WINDOW(aboutbox));
gtk_box_pack_end(action_area, w, FALSE, FALSE, 0);
gtk_box_pack_end(action_area, w, false, false, 0);
g_signal_connect(G_OBJECT(w), "clicked",
G_CALLBACK(about_close_clicked), NULL);
gtk_widget_show(w);
w = gtk_button_new_with_label("View Licence");
gtk_widget_set_can_default(w, TRUE);
gtk_box_pack_end(action_area, w, FALSE, FALSE, 0);
gtk_widget_set_can_default(w, true);
gtk_box_pack_end(action_area, w, false, false, 0);
g_signal_connect(G_OBJECT(w), "clicked",
G_CALLBACK(licence_clicked), NULL);
gtk_widget_show(w);
@ -3729,11 +3729,11 @@ void about_box(void *window)
w = gtk_label_new(label_text);
gtk_label_set_justify(GTK_LABEL(w), GTK_JUSTIFY_CENTER);
#if GTK_CHECK_VERSION(2,0,0)
gtk_label_set_selectable(GTK_LABEL(w), TRUE);
gtk_label_set_selectable(GTK_LABEL(w), true);
#endif
sfree(label_text);
}
our_dialog_add_to_content_area(GTK_WINDOW(aboutbox), w, FALSE, FALSE, 0);
our_dialog_add_to_content_area(GTK_WINDOW(aboutbox), w, false, false, 0);
#if GTK_CHECK_VERSION(2,0,0)
/*
* Same precautions against initial select-all as in
@ -3901,7 +3901,7 @@ gint eventlog_selection_clear(GtkWidget *widget, GdkEventSelection *seldata,
sfree(es->seldata);
es->sellen = 0;
es->seldata = NULL;
return TRUE;
return true;
}
void showeventlog(eventlog_stuff *es, void *parentwin)
@ -3931,7 +3931,7 @@ void showeventlog(eventlog_stuff *es, void *parentwin)
c = ctrl_pushbutton(s0, "Close", 'c', HELPCTX(no_help),
eventlog_ok_handler, P(NULL));
c->button.column = 1;
c->button.isdefault = TRUE;
c->button.isdefault = true;
s1 = ctrl_getset(es->eventbox, "x", "", "");
es->listctrl = c = ctrl_listbox(s1, NULL, NO_SHORTCUT, HELPCTX(no_help),
@ -3957,7 +3957,7 @@ void showeventlog(eventlog_stuff *es, void *parentwin)
("LINE OF TEXT GIVING WIDTH OF EVENT LOG IS "
"QUITE LONG 'COS SSH LOG ENTRIES ARE WIDE"),
-1);
our_dialog_add_to_content_area(GTK_WINDOW(window), w1, TRUE, TRUE, 0);
our_dialog_add_to_content_area(GTK_WINDOW(window), w1, true, true, 0);
gtk_widget_show(w1);
es->dp.data = es;
@ -4086,7 +4086,7 @@ int gtkdlg_askappend(Seat *seat, Filename *filename,
msgbox = create_message_box(
mainwin, mbtitle, message,
string_width("LINE OF TEXT SUITABLE FOR THE ASKAPPEND WIDTH"),
FALSE, &buttons_append, simple_prompt_result_callback, result_ctx);
false, &buttons_append, simple_prompt_result_callback, result_ctx);
register_dialog(seat, result_ctx->dialog_slot, msgbox);
sfree(message);

View File

@ -448,8 +448,8 @@ static unifont *x11font_create(GtkWidget *widget, const char *name,
charset_encoding = XInternAtom(disp, "CHARSET_ENCODING", False);
pubcs = realcs = CS_NONE;
sixteen_bit = FALSE;
variable = TRUE;
sixteen_bit = false;
variable = true;
if (XGetFontProperty(xfs, charset_registry, &registry_ret) &&
XGetFontProperty(xfs, charset_encoding, &encoding_ret)) {
@ -467,7 +467,7 @@ static unifont *x11font_create(GtkWidget *widget, const char *name,
* into 16-bit Unicode.
*/
if (!strcasecmp(encoding, "iso10646-1")) {
sixteen_bit = TRUE;
sixteen_bit = true;
pubcs = realcs = CS_UTF8;
}
@ -496,7 +496,7 @@ static unifont *x11font_create(GtkWidget *widget, const char *name,
spc = XGetAtomName(disp, (Atom)spacing_ret);
if (spc && strchr("CcMm", spc[0]))
variable = FALSE;
variable = false;
}
xfont = snew(struct x11font);
@ -506,7 +506,7 @@ static unifont *x11font_create(GtkWidget *widget, const char *name,
xfont->u.descent = xfs->descent;
xfont->u.height = xfont->u.ascent + xfont->u.descent;
xfont->u.public_charset = pubcs;
xfont->u.want_fallback = TRUE;
xfont->u.want_fallback = true;
#ifdef DRAW_TEXT_GDK
xfont->u.preferred_drawtype = DRAWTYPE_GDK;
#elif defined DRAW_TEXT_CAIRO
@ -525,7 +525,7 @@ static unifont *x11font_create(GtkWidget *widget, const char *name,
for (i = 0; i < lenof(xfont->fonts); i++) {
xfont->fonts[i].xfs = NULL;
xfont->fonts[i].allocated = FALSE;
xfont->fonts[i].allocated = false;
#ifdef DRAW_TEXT_CAIRO
xfont->fonts[i].glyphcache = NULL;
xfont->fonts[i].nglyphs = 0;
@ -534,7 +534,7 @@ static unifont *x11font_create(GtkWidget *widget, const char *name,
#endif
}
xfont->fonts[0].xfs = xfs;
xfont->fonts[0].allocated = TRUE;
xfont->fonts[0].allocated = true;
return &xfont->u;
}
@ -572,7 +572,7 @@ static void x11_alloc_subfont(struct x11font *xfont, int sfid)
char *derived_name = x11_guess_derived_font_name
(disp, xfont->fonts[0].xfs, sfid & 1, !!(sfid & 2));
xfont->fonts[sfid].xfs = XLoadQueryFont(disp, derived_name);
xfont->fonts[sfid].allocated = TRUE;
xfont->fonts[sfid].allocated = true;
sfree(derived_name);
/* Note that xfont->fonts[sfid].xfs may still be NULL, if XLQF failed. */
}
@ -597,7 +597,7 @@ static int x11font_has_glyph(unifont *font, wchar_t glyph)
int sblen = wc_to_mb(xfont->real_charset, 0, &glyph, 1,
sbstring, 2, "", NULL);
if (sblen == 0 || !sbstring[0])
return FALSE; /* not even in the charset */
return false; /* not even in the charset */
return x11_font_has_glyph(xfont->fonts[0].xfs, 0,
(unsigned char)sbstring[0]);
@ -862,14 +862,14 @@ static void x11font_really_draw_text(
*/
step = 1;
nsteps = nchars;
centre = TRUE;
centre = true;
} else {
/*
* In a fixed-pitch font, we can draw the whole lot in one go.
*/
step = nchars;
nsteps = 1;
centre = FALSE;
centre = false;
}
dfns->setup(ctx, xfi, disp);
@ -1391,17 +1391,17 @@ static int pangofont_check_desc_makes_sense(PangoContext *ctx,
#ifndef PANGO_PRE_1POINT6
map = pango_context_get_font_map(ctx);
if (!map)
return FALSE;
return false;
pango_font_map_list_families(map, &families, &nfamilies);
#else
pango_context_list_families(ctx, &families, &nfamilies);
#endif
matched = FALSE;
matched = false;
for (i = 0; i < nfamilies; i++) {
if (!g_ascii_strcasecmp(pango_font_family_get_name(families[i]),
pango_font_description_get_family(desc))) {
matched = TRUE;
matched = true;
break;
}
}
@ -1454,7 +1454,7 @@ static unifont *pangofont_create_internal(GtkWidget *widget,
pfont->u.ascent = PANGO_PIXELS(pango_font_metrics_get_ascent(metrics));
pfont->u.descent = PANGO_PIXELS(pango_font_metrics_get_descent(metrics));
pfont->u.height = pfont->u.ascent + pfont->u.descent;
pfont->u.want_fallback = FALSE;
pfont->u.want_fallback = false;
#ifdef DRAW_TEXT_CAIRO
pfont->u.preferred_drawtype = DRAWTYPE_CAIRO;
#elif defined DRAW_TEXT_GDK
@ -1562,7 +1562,7 @@ static int pangofont_char_width(PangoLayout *layout, struct pangofont *pfont,
static int pangofont_has_glyph(unifont *font, wchar_t glyph)
{
/* Pango implements font fallback, so assume it has everything */
return TRUE;
return true;
}
#ifdef DRAW_TEXT_GDK
@ -1592,7 +1592,7 @@ static void pangofont_draw_internal(unifont_drawctx *ctx, unifont *font,
PangoRectangle rect;
char *utfstring, *utfptr;
int utflen;
int shadowbold = FALSE;
int shadowbold = false;
void (*draw_layout)(unifont_drawctx *ctx,
gint x, gint y, PangoLayout *layout) = NULL;
@ -1616,7 +1616,7 @@ static void pangofont_draw_internal(unifont_drawctx *ctx, unifont *font,
pango_layout_set_font_description(layout, pfont->desc);
if (bold > pfont->bold) {
if (pfont->shadowalways)
shadowbold = TRUE;
shadowbold = true;
else {
PangoFontDescription *desc2 =
pango_font_description_copy_static(pfont->desc);
@ -1743,7 +1743,7 @@ static void pangofont_draw_text(unifont_drawctx *ctx, unifont *font,
int wide, int bold, int cellwidth)
{
pangofont_draw_internal(ctx, font, x, y, string, len, wide, bold,
cellwidth, FALSE);
cellwidth, false);
}
static void pangofont_draw_combining(unifont_drawctx *ctx, unifont *font,
@ -1765,7 +1765,7 @@ static void pangofont_draw_combining(unifont_drawctx *ctx, unifont *font,
len++;
}
pangofont_draw_internal(ctx, font, x, y, string, len, wide, bold,
cellwidth, TRUE);
cellwidth, true);
sfree(tmpstring);
}
@ -2234,7 +2234,7 @@ unifont *multifont_create(GtkWidget *widget, const char *name,
mfont->u.descent = font->descent;
mfont->u.height = font->height;
mfont->u.public_charset = font->public_charset;
mfont->u.want_fallback = FALSE; /* shouldn't be needed, but just in case */
mfont->u.want_fallback = false; /* shouldn't be needed, but just in case */
mfont->u.preferred_drawtype = font->preferred_drawtype;
mfont->main = font;
mfont->fallback = fallback;
@ -2456,8 +2456,8 @@ static void unifontsel_deselect(unifontsel_internal *fs)
fs->selected = NULL;
gtk_list_store_clear(fs->style_model);
gtk_list_store_clear(fs->size_model);
gtk_widget_set_sensitive(fs->u.ok_button, FALSE);
gtk_widget_set_sensitive(fs->size_entry, FALSE);
gtk_widget_set_sensitive(fs->u.ok_button, false);
gtk_widget_set_sensitive(fs->size_entry, false);
unifontsel_draw_preview_text(fs);
}
@ -2469,7 +2469,7 @@ static void unifontsel_setup_familylist(unifontsel_internal *fs)
int currflags = -1;
fontinfo *info;
fs->inhibit_response = TRUE;
fs->inhibit_response = true;
gtk_list_store_clear(fs->family_model);
listindex = 0;
@ -2522,20 +2522,20 @@ static void unifontsel_setup_familylist(unifontsel_internal *fs)
if (fs->selected && fs->selected->familyindex < 0)
unifontsel_deselect(fs);
fs->inhibit_response = FALSE;
fs->inhibit_response = false;
}
static void unifontsel_setup_stylelist(unifontsel_internal *fs,
int start, int end)
{
GtkTreeIter iter;
int i, listindex, minpos = -1, maxpos = -1, started = FALSE;
int i, listindex, minpos = -1, maxpos = -1, started = false;
char *currcs = NULL, *currstyle = NULL;
fontinfo *info;
gtk_list_store_clear(fs->style_model);
listindex = 0;
started = FALSE;
started = false;
/*
* Search through the font tree for anything matching our
@ -2563,12 +2563,12 @@ static void unifontsel_setup_stylelist(unifontsel_internal *fs,
* We've either finished a style/charset, or started a
* new one, or both.
*/
started = TRUE;
started = true;
if (currstyle) {
gtk_list_store_append(fs->style_model, &iter);
gtk_list_store_set(fs->style_model, &iter,
0, currstyle, 1, minpos, 2, maxpos+1,
3, TRUE, 4, PANGO_WEIGHT_NORMAL, -1);
3, true, 4, PANGO_WEIGHT_NORMAL, -1);
listindex++;
}
if (info) {
@ -2577,7 +2577,7 @@ static void unifontsel_setup_stylelist(unifontsel_internal *fs,
gtk_list_store_append(fs->style_model, &iter);
gtk_list_store_set(fs->style_model, &iter,
0, info->charset, 1, -1, 2, -1,
3, FALSE, 4, PANGO_WEIGHT_BOLD, -1);
3, false, 4, PANGO_WEIGHT_BOLD, -1);
listindex++;
}
currcs = info->charset;
@ -2664,7 +2664,7 @@ static void unifontsel_draw_preview_text_inner(unifont_drawctx *dctx,
(GTK_WIDGET(fs->u.window), info->realname, fs->selsize);
font = info->fontclass->create(GTK_WIDGET(fs->u.window),
sizename ? sizename : info->realname,
FALSE, FALSE, 0, 0);
false, false, 0, 0);
} else
font = NULL;
@ -2715,11 +2715,11 @@ static void unifontsel_draw_preview_text_inner(unifont_drawctx *dctx,
info->fontclass->draw_text(dctx, font,
0, font->ascent,
L"bankrupt jilted showmen quiz convex fogey",
41, FALSE, FALSE, font->width);
41, false, false, font->width);
info->fontclass->draw_text(dctx, font,
0, font->ascent + font->height,
L"BANKRUPT JILTED SHOWMEN QUIZ CONVEX FOGEY",
41, FALSE, FALSE, font->width);
41, false, false, font->width);
/*
* The ordering of punctuation here is also selected
* with some specific aims in mind. I put ` and '
@ -2735,7 +2735,7 @@ static void unifontsel_draw_preview_text_inner(unifont_drawctx *dctx,
info->fontclass->draw_text(dctx, font,
0, font->ascent + font->height * 2,
L"0123456789!?,.:;<>()[]{}\\/`'\"+*-=~#_@|%&^$",
42, FALSE, FALSE, font->width);
42, false, false, font->width);
info->fontclass->destroy(font);
}
@ -2803,7 +2803,7 @@ static void unifontsel_draw_preview_text(unifontsel_internal *fs)
#endif
gdk_window_invalidate_rect(gtk_widget_get_window(fs->preview_area),
NULL, FALSE);
NULL, false);
}
static void unifontsel_select_font(unifontsel_internal *fs,
@ -2816,14 +2816,14 @@ static void unifontsel_select_font(unifontsel_internal *fs,
GtkTreePath *treepath;
GtkTreeIter iter;
fs->inhibit_response = TRUE;
fs->inhibit_response = true;
fs->selected = info;
fs->selsize = size;
if (size_is_explicit)
fs->intendedsize = size;
gtk_widget_set_sensitive(fs->u.ok_button, TRUE);
gtk_widget_set_sensitive(fs->u.ok_button, true);
/*
* Find the index of this fontinfo in the selorder list.
@ -2852,7 +2852,7 @@ static void unifontsel_select_font(unifontsel_internal *fs,
(gtk_tree_view_get_selection(GTK_TREE_VIEW(fs->family_list)),
treepath);
gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(fs->family_list),
treepath, NULL, FALSE, 0.0, 0.0);
treepath, NULL, false, 0.0, 0.0);
success = gtk_tree_model_get_iter(GTK_TREE_MODEL(fs->family_model),
&iter, treepath);
assert(success);
@ -2876,7 +2876,7 @@ static void unifontsel_select_font(unifontsel_internal *fs,
(gtk_tree_view_get_selection(GTK_TREE_VIEW(fs->style_list)),
treepath);
gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(fs->style_list),
treepath, NULL, FALSE, 0.0, 0.0);
treepath, NULL, false, 0.0, 0.0);
gtk_tree_model_get_iter(GTK_TREE_MODEL(fs->style_model),
&iter, treepath);
gtk_tree_path_free(treepath);
@ -2899,7 +2899,7 @@ static void unifontsel_select_font(unifontsel_internal *fs,
(gtk_tree_view_get_selection(GTK_TREE_VIEW(fs->size_list)),
treepath);
gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(fs->size_list),
treepath, NULL, FALSE, 0.0, 0.0);
treepath, NULL, false, 0.0, 0.0);
gtk_tree_path_free(treepath);
size = info->size;
} else {
@ -2908,9 +2908,9 @@ static void unifontsel_select_font(unifontsel_internal *fs,
if (unifontsel_default_sizes[j] == size) {
treepath = gtk_tree_path_new_from_indices(j, -1);
gtk_tree_view_set_cursor(GTK_TREE_VIEW(fs->size_list),
treepath, NULL, FALSE);
treepath, NULL, false);
gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(fs->size_list),
treepath, NULL, FALSE, 0.0,
treepath, NULL, false, 0.0,
0.0);
gtk_tree_path_free(treepath);
}
@ -2940,7 +2940,7 @@ static void unifontsel_select_font(unifontsel_internal *fs,
unifontsel_draw_preview_text(fs);
fs->inhibit_response = FALSE;
fs->inhibit_response = false;
}
static void unifontsel_button_toggled(GtkToggleButton *tb, gpointer data)
@ -3125,7 +3125,7 @@ static void family_changed(GtkTreeSelection *treeselection, gpointer data)
if (!info->size)
fs->selsize = fs->intendedsize; /* font is scalable */
unifontsel_select_font(fs, info, info->size ? info->size : fs->selsize,
1, FALSE);
1, false);
}
static void style_changed(GtkTreeSelection *treeselection, gpointer data)
@ -3152,7 +3152,7 @@ static void style_changed(GtkTreeSelection *treeselection, gpointer data)
if (!info->size)
fs->selsize = fs->intendedsize; /* font is scalable */
unifontsel_select_font(fs, info, info->size ? info->size : fs->selsize,
2, FALSE);
2, false);
}
static void size_changed(GtkTreeSelection *treeselection, gpointer data)
@ -3171,7 +3171,7 @@ static void size_changed(GtkTreeSelection *treeselection, gpointer data)
gtk_tree_model_get(treemodel, &treeiter, 1, &minval, 2, &size, -1);
info = (fontinfo *)index234(fs->fonts_by_selorder, minval);
unifontsel_select_font(fs, info, info->size ? info->size : size, 3, TRUE);
unifontsel_select_font(fs, info, info->size ? info->size : size, 3, true);
}
static void size_entry_changed(GtkEditable *ed, gpointer data)
@ -3188,7 +3188,7 @@ static void size_entry_changed(GtkEditable *ed, gpointer data)
if (size > 0) {
assert(fs->selected->size == 0);
unifontsel_select_font(fs, fs->selected, size, 3, TRUE);
unifontsel_select_font(fs, fs->selected, size, 3, true);
}
}
@ -3212,7 +3212,7 @@ static void alias_resolve(GtkTreeView *treeview, GtkTreePath *path,
struct fontinfo_realname_find f;
newname = info->fontclass->canonify_fontname
(GTK_WIDGET(fs->u.window), info->realname, &newsize, &flags, TRUE);
(GTK_WIDGET(fs->u.window), info->realname, &newsize, &flags, true);
f.realname = newname;
f.flags = flags;
@ -3225,7 +3225,7 @@ static void alias_resolve(GtkTreeView *treeview, GtkTreePath *path,
return; /* didn't change under canonification => not an alias */
unifontsel_select_font(fs, newinfo,
newinfo->size ? newinfo->size : newsize,
1, TRUE);
1, true);
}
}
@ -3240,7 +3240,7 @@ static gint unifontsel_draw_area(GtkWidget *widget, cairo_t *cr, gpointer data)
dctx.u.cairo.cr = cr;
unifontsel_draw_preview_text_inner(&dctx, fs);
return TRUE;
return true;
}
#else
static gint unifontsel_expose_area(GtkWidget *widget, GdkEventExpose *event,
@ -3262,7 +3262,7 @@ static gint unifontsel_expose_area(GtkWidget *widget, GdkEventExpose *event,
unifontsel_draw_preview_text(fs);
#endif
return TRUE;
return true;
}
#endif
@ -3295,9 +3295,9 @@ static gint unifontsel_configure_area(GtkWidget *widget,
}
#endif
gdk_window_invalidate_rect(gtk_widget_get_window(widget), NULL, FALSE);
gdk_window_invalidate_rect(gtk_widget_get_window(widget), NULL, false);
return TRUE;
return true;
}
unifontsel *unifontsel_new(const char *wintitle)
@ -3309,7 +3309,7 @@ unifontsel *unifontsel_new(const char *wintitle)
int lists_height, preview_height, font_width, style_width, size_width;
int i;
fs->inhibit_response = FALSE;
fs->inhibit_response = false;
fs->selected = NULL;
{
@ -3352,7 +3352,7 @@ unifontsel *unifontsel_new(const char *wintitle)
table = gtk_grid_new();
gtk_grid_set_column_spacing(GTK_GRID(table), 8);
#else
table = gtk_table_new(8, 3, FALSE);
table = gtk_table_new(8, 3, false);
gtk_table_set_col_spacings(GTK_TABLE(table), 8);
#endif
gtk_widget_show(table);
@ -3375,14 +3375,14 @@ unifontsel *unifontsel_new(const char *wintitle)
gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area
(GTK_DIALOG(fs->u.window))),
w, TRUE, TRUE, 0);
w, true, true, 0);
label = gtk_label_new_with_mnemonic("_Font:");
gtk_widget_show(label);
align_label_left(GTK_LABEL(label));
#if GTK_CHECK_VERSION(3,0,0)
gtk_grid_attach(GTK_GRID(table), label, 0, 0, 1, 1);
g_object_set(G_OBJECT(label), "hexpand", TRUE, (const char *)NULL);
g_object_set(G_OBJECT(label), "hexpand", true, (const char *)NULL);
#else
gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0);
#endif
@ -3394,7 +3394,7 @@ unifontsel *unifontsel_new(const char *wintitle)
*/
model = gtk_list_store_new(3, G_TYPE_STRING, G_TYPE_INT, G_TYPE_INT);
w = gtk_tree_view_new_with_model(GTK_TREE_MODEL(model));
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(w), FALSE);
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(w), false);
gtk_label_set_mnemonic_widget(GTK_LABEL(label), w);
gtk_widget_show(w);
column = gtk_tree_view_column_new_with_attributes
@ -3417,7 +3417,7 @@ unifontsel *unifontsel_new(const char *wintitle)
gtk_widget_set_size_request(scroll, font_width, lists_height);
#if GTK_CHECK_VERSION(3,0,0)
gtk_grid_attach(GTK_GRID(table), scroll, 0, 1, 1, 2);
g_object_set(G_OBJECT(scroll), "expand", TRUE, (const char *)NULL);
g_object_set(G_OBJECT(scroll), "expand", true, (const char *)NULL);
#else
gtk_table_attach(GTK_TABLE(table), scroll, 0, 1, 1, 3, GTK_FILL,
GTK_EXPAND | GTK_FILL, 0, 0);
@ -3430,7 +3430,7 @@ unifontsel *unifontsel_new(const char *wintitle)
align_label_left(GTK_LABEL(label));
#if GTK_CHECK_VERSION(3,0,0)
gtk_grid_attach(GTK_GRID(table), label, 1, 0, 1, 1);
g_object_set(G_OBJECT(label), "hexpand", TRUE, (const char *)NULL);
g_object_set(G_OBJECT(label), "hexpand", true, (const char *)NULL);
#else
gtk_table_attach(GTK_TABLE(table), label, 1, 2, 0, 1, GTK_FILL, 0, 0, 0);
#endif
@ -3445,7 +3445,7 @@ unifontsel *unifontsel_new(const char *wintitle)
model = gtk_list_store_new(5, G_TYPE_STRING, G_TYPE_INT, G_TYPE_INT,
G_TYPE_BOOLEAN, G_TYPE_INT);
w = gtk_tree_view_new_with_model(GTK_TREE_MODEL(model));
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(w), FALSE);
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(w), false);
gtk_label_set_mnemonic_widget(GTK_LABEL(label), w);
gtk_widget_show(w);
column = gtk_tree_view_column_new_with_attributes
@ -3466,7 +3466,7 @@ unifontsel *unifontsel_new(const char *wintitle)
gtk_widget_set_size_request(scroll, style_width, lists_height);
#if GTK_CHECK_VERSION(3,0,0)
gtk_grid_attach(GTK_GRID(table), scroll, 1, 1, 1, 2);
g_object_set(G_OBJECT(scroll), "expand", TRUE, (const char *)NULL);
g_object_set(G_OBJECT(scroll), "expand", true, (const char *)NULL);
#else
gtk_table_attach(GTK_TABLE(table), scroll, 1, 2, 1, 3, GTK_FILL,
GTK_EXPAND | GTK_FILL, 0, 0);
@ -3479,7 +3479,7 @@ unifontsel *unifontsel_new(const char *wintitle)
align_label_left(GTK_LABEL(label));
#if GTK_CHECK_VERSION(3,0,0)
gtk_grid_attach(GTK_GRID(table), label, 2, 0, 1, 1);
g_object_set(G_OBJECT(label), "hexpand", TRUE, (const char *)NULL);
g_object_set(G_OBJECT(label), "hexpand", true, (const char *)NULL);
#else
gtk_table_attach(GTK_TABLE(table), label, 2, 3, 0, 1, GTK_FILL, 0, 0, 0);
#endif
@ -3495,7 +3495,7 @@ unifontsel *unifontsel_new(const char *wintitle)
gtk_widget_show(w);
#if GTK_CHECK_VERSION(3,0,0)
gtk_grid_attach(GTK_GRID(table), w, 2, 1, 1, 1);
g_object_set(G_OBJECT(w), "hexpand", TRUE, (const char *)NULL);
g_object_set(G_OBJECT(w), "hexpand", true, (const char *)NULL);
#else
gtk_table_attach(GTK_TABLE(table), w, 2, 3, 1, 2, GTK_FILL, 0, 0, 0);
#endif
@ -3504,7 +3504,7 @@ unifontsel *unifontsel_new(const char *wintitle)
model = gtk_list_store_new(3, G_TYPE_STRING, G_TYPE_INT, G_TYPE_INT);
w = gtk_tree_view_new_with_model(GTK_TREE_MODEL(model));
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(w), FALSE);
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(w), false);
gtk_widget_show(w);
column = gtk_tree_view_column_new_with_attributes
("Size", gtk_cell_renderer_text_new(),
@ -3523,7 +3523,7 @@ unifontsel *unifontsel_new(const char *wintitle)
GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
#if GTK_CHECK_VERSION(3,0,0)
gtk_grid_attach(GTK_GRID(table), scroll, 2, 2, 1, 1);
g_object_set(G_OBJECT(scroll), "expand", TRUE, (const char *)NULL);
g_object_set(G_OBJECT(scroll), "expand", true, (const char *)NULL);
#else
gtk_table_attach(GTK_TABLE(table), scroll, 2, 3, 2, 3, GTK_FILL,
GTK_EXPAND | GTK_FILL, 0, 0);
@ -3545,9 +3545,9 @@ unifontsel *unifontsel_new(const char *wintitle)
fs->preview_bg.red = fs->preview_bg.green = fs->preview_bg.blue = 0xFFFF;
#if !GTK_CHECK_VERSION(3,0,0)
gdk_colormap_alloc_color(gdk_colormap_get_system(), &fs->preview_fg,
FALSE, FALSE);
false, false);
gdk_colormap_alloc_color(gdk_colormap_get_system(), &fs->preview_bg,
FALSE, FALSE);
false, false);
#endif
#if GTK_CHECK_VERSION(3,0,0)
g_signal_connect(G_OBJECT(fs->preview_area), "draw",
@ -3584,7 +3584,7 @@ unifontsel *unifontsel_new(const char *wintitle)
gtk_widget_show(w);
#if GTK_CHECK_VERSION(3,0,0)
gtk_grid_attach(GTK_GRID(table), w, 0, 3, 3, 1);
g_object_set(G_OBJECT(w), "expand", TRUE, (const char *)NULL);
g_object_set(G_OBJECT(w), "expand", true, (const char *)NULL);
#else
gtk_table_attach(GTK_TABLE(table), w, 0, 3, 3, 4,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 8);
@ -3607,7 +3607,7 @@ unifontsel *unifontsel_new(const char *wintitle)
fs->filter_buttons[fs->n_filter_buttons++] = w;
#if GTK_CHECK_VERSION(3,0,0)
gtk_grid_attach(GTK_GRID(table), w, 0, 4, 3, 1);
g_object_set(G_OBJECT(w), "hexpand", TRUE, (const char *)NULL);
g_object_set(G_OBJECT(w), "hexpand", true, (const char *)NULL);
#else
gtk_table_attach(GTK_TABLE(table), w, 0, 3, 4, 5, GTK_FILL, 0, 0, 0);
#endif
@ -3620,7 +3620,7 @@ unifontsel *unifontsel_new(const char *wintitle)
fs->filter_buttons[fs->n_filter_buttons++] = w;
#if GTK_CHECK_VERSION(3,0,0)
gtk_grid_attach(GTK_GRID(table), w, 0, 5, 3, 1);
g_object_set(G_OBJECT(w), "hexpand", TRUE, (const char *)NULL);
g_object_set(G_OBJECT(w), "hexpand", true, (const char *)NULL);
#else
gtk_table_attach(GTK_TABLE(table), w, 0, 3, 5, 6, GTK_FILL, 0, 0, 0);
#endif
@ -3633,7 +3633,7 @@ unifontsel *unifontsel_new(const char *wintitle)
fs->filter_buttons[fs->n_filter_buttons++] = w;
#if GTK_CHECK_VERSION(3,0,0)
gtk_grid_attach(GTK_GRID(table), w, 0, 6, 3, 1);
g_object_set(G_OBJECT(w), "hexpand", TRUE, (const char *)NULL);
g_object_set(G_OBJECT(w), "hexpand", true, (const char *)NULL);
#else
gtk_table_attach(GTK_TABLE(table), w, 0, 3, 6, 7, GTK_FILL, 0, 0, 0);
#endif
@ -3647,7 +3647,7 @@ unifontsel *unifontsel_new(const char *wintitle)
fs->filter_buttons[fs->n_filter_buttons++] = w;
#if GTK_CHECK_VERSION(3,0,0)
gtk_grid_attach(GTK_GRID(table), w, 0, 7, 3, 1);
g_object_set(G_OBJECT(w), "hexpand", TRUE, (const char *)NULL);
g_object_set(G_OBJECT(w), "hexpand", true, (const char *)NULL);
#else
gtk_table_attach(GTK_TABLE(table), w, 0, 3, 7, 8, GTK_FILL, 0, 0, 0);
#endif
@ -3673,7 +3673,7 @@ unifontsel *unifontsel_new(const char *wintitle)
unifontsel_setup_familylist(fs);
fs->selsize = fs->intendedsize = 13; /* random default */
gtk_widget_set_sensitive(fs->u.ok_button, FALSE);
gtk_widget_set_sensitive(fs->u.ok_button, false);
return &fs->u;
}
@ -3716,7 +3716,7 @@ void unifontsel_set_name(unifontsel *fontsel, const char *fontname)
fontname = unifont_do_prefix(fontname, &start, &end);
for (i = start; i < end; i++) {
fontname2 = unifont_types[i]->canonify_fontname
(GTK_WIDGET(fs->u.window), fontname, &size, &flags, FALSE);
(GTK_WIDGET(fs->u.window), fontname, &size, &flags, false);
if (fontname2)
break;
}
@ -3754,7 +3754,7 @@ void unifontsel_set_name(unifontsel *fontsel, const char *fontname)
* know everything we need to fill in all the fields in the
* dialog.
*/
unifontsel_select_font(fs, info, size, 0, TRUE);
unifontsel_select_font(fs, info, size, 0, true);
}
char *unifontsel_get_name(unifontsel *fontsel)

View File

@ -554,7 +554,7 @@ GtkWidget *make_gtk_toplevel_window(GtkFrontend *frontend)
return gtk_window_new(GTK_WINDOW_TOPLEVEL);
}
const int buildinfo_gtk_relevant = TRUE;
const int buildinfo_gtk_relevant = true;
struct post_initial_config_box_ctx {
Conf *conf;
@ -594,7 +594,7 @@ int main(int argc, char **argv)
/* Call the function in ux{putty,pterm}.c to do app-type
* specific setup */
extern void setup(int);
setup(TRUE); /* TRUE means we are a one-session process */
setup(true); /* true means we are a one-session process */
}
progname = argv[0];
@ -633,7 +633,7 @@ int main(int argc, char **argv)
smemclr(argv[1], strlen(argv[1]));
assert(!dup_check_launchable || conf_launchable(conf));
need_config_box = FALSE;
need_config_box = false;
} else {
if (do_cmdline(argc, argv, 0, conf))
exit(1); /* pre-defaults pass to get -class */
@ -646,7 +646,7 @@ int main(int argc, char **argv)
if (cmdline_tooltype & TOOLTYPE_HOST_ARG)
need_config_box = !cmdline_host_ok(conf);
else
need_config_box = FALSE;
need_config_box = false;
}
if (need_config_box) {

View File

@ -130,7 +130,7 @@ void our_dialog_set_action_area(GtkWindow *dlg, GtkWidget *w)
#if !GTK_CHECK_VERSION(2,0,0)
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dlg)->action_area),
w, TRUE, TRUE, 0);
w, true, true, 0);
#elif !GTK_CHECK_VERSION(3,0,0)
@ -149,14 +149,14 @@ void our_dialog_set_action_area(GtkWindow *dlg, GtkWidget *w)
#endif
gtk_widget_show(align);
gtk_box_pack_end(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dlg))),
align, FALSE, TRUE, 0);
align, false, true, 0);
w = gtk_hseparator_new();
gtk_box_pack_end(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dlg))),
w, FALSE, TRUE, 0);
w, false, true, 0);
gtk_widget_show(w);
gtk_widget_hide(gtk_dialog_get_action_area(GTK_DIALOG(dlg)));
g_object_set(G_OBJECT(dlg), "has-separator", TRUE, (const char *)NULL);
g_object_set(G_OBJECT(dlg), "has-separator", true, (const char *)NULL);
#else /* GTK 3 */
@ -166,10 +166,10 @@ void our_dialog_set_action_area(GtkWindow *dlg, GtkWidget *w)
GtkWidget *sep;
g_object_set(G_OBJECT(w), "margin", 8, (const char *)NULL);
gtk_box_pack_end(vbox, w, FALSE, TRUE, 0);
gtk_box_pack_end(vbox, w, false, true, 0);
sep = gtk_hseparator_new();
gtk_box_pack_end(vbox, sep, FALSE, TRUE, 0);
gtk_box_pack_end(vbox, sep, false, true, 0);
gtk_widget_show(sep);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -133,7 +133,7 @@ unsigned long getticks(void);
* is _not_ implicit but requires a specific UI action. This is at
* odds with all other PuTTY front ends' defaults, but on OS X there
* is no multi-decade precedent for PuTTY working the other way. */
#define CLIPUI_DEFAULT_AUTOCOPY FALSE
#define CLIPUI_DEFAULT_AUTOCOPY false
#define CLIPUI_DEFAULT_MOUSE CLIPUI_IMPLICIT
#define CLIPUI_DEFAULT_INS CLIPUI_EXPLICIT
#define MENU_CLIPBOARD CLIP_CLIPBOARD
@ -146,7 +146,7 @@ unsigned long getticks(void);
#define CLIPNAME_EXPLICIT_OBJECT "CLIPBOARD"
/* These defaults are the ones Unix PuTTY has historically had since
* it was first thought of in 2002 */
#define CLIPUI_DEFAULT_AUTOCOPY FALSE
#define CLIPUI_DEFAULT_AUTOCOPY false
#define CLIPUI_DEFAULT_MOUSE CLIPUI_IMPLICIT
#define CLIPUI_DEFAULT_INS CLIPUI_IMPLICIT
#define MENU_CLIPBOARD CLIP_CLIPBOARD

View File

@ -22,13 +22,13 @@ void platform_get_x11_auth(struct X11Display *disp, Conf *conf)
/*
* Find the .Xauthority file.
*/
needs_free = FALSE;
needs_free = false;
xauthfile = getenv("XAUTHORITY");
if (!xauthfile) {
xauthfile = getenv("HOME");
if (xauthfile) {
xauthfile = dupcat(xauthfile, "/.Xauthority", NULL);
needs_free = TRUE;
needs_free = true;
}
}
@ -39,7 +39,7 @@ void platform_get_x11_auth(struct X11Display *disp, Conf *conf)
}
}
const int platform_uses_x11_unix_by_default = TRUE;
const int platform_uses_x11_unix_by_default = true;
int platform_make_x11_server(Plug *plug, const char *progname, int mindisp,
const char *screen_number_suffix,
@ -71,7 +71,7 @@ int platform_make_x11_server(Plug *plug, const char *progname, int mindisp,
int addrtype = ADDRTYPE_IPV4;
sockets[nsockets] = new_listener(
NULL, tcp_port, plug, FALSE, conf, addrtype);
NULL, tcp_port, plug, false, conf, addrtype);
err = sk_socket_error(sockets[nsockets]);
if (!err) {

View File

@ -19,8 +19,8 @@ int agent_exists(void)
{
const char *p = getenv("SSH_AUTH_SOCK");
if (p && *p)
return TRUE;
return FALSE;
return true;
return false;
}
static tree234 *agent_pending_queries;

View File

@ -21,7 +21,7 @@
#include "storage.h"
#include "ssh.h"
int console_batch_mode = FALSE;
int console_batch_mode = false;
static struct termios orig_termios_stderr;
static int stderr_is_a_tty;
@ -30,7 +30,7 @@ void stderr_tty_init()
{
/* Ensure that if stderr is a tty, we can get it back to a sane state. */
if ((flags & FLAG_STDERR_TTY) && isatty(STDERR_FILENO)) {
stderr_is_a_tty = TRUE;
stderr_is_a_tty = true;
tcgetattr(STDERR_FILENO, &orig_termios_stderr);
}
}

View File

@ -343,7 +343,7 @@ int open_for_write_would_lose_data(const Filename *fn)
* open the file for writing and report _that_ error, which is
* likely to be more to the point.
*/
return FALSE;
return false;
}
/*
@ -360,8 +360,8 @@ int open_for_write_would_lose_data(const Filename *fn)
* information.)
*/
if (S_ISREG(st.st_mode) && st.st_size > 0) {
return TRUE;
return true;
}
return FALSE;
return false;
}

View File

@ -297,15 +297,15 @@ static int sk_nextaddr(SockAddr *addr, SockAddrStep *step)
#ifndef NO_IPV6
if (step->ai && step->ai->ai_next) {
step->ai = step->ai->ai_next;
return TRUE;
return true;
} else
return FALSE;
return false;
#else
if (step->curraddr+1 < addr->naddresses) {
step->curraddr++;
return TRUE;
return true;
} else {
return FALSE;
return false;
}
#endif
}
@ -365,9 +365,9 @@ static SockAddr sk_extractaddr_tmp(
int sk_addr_needs_port(SockAddr *addr)
{
if (addr->superfamily == UNRESOLVED || addr->superfamily == UNIX) {
return FALSE;
return false;
} else {
return TRUE;
return true;
}
}
@ -392,9 +392,9 @@ static int sockaddr_is_loopback(struct sockaddr *sa)
return IN6_IS_ADDR_LOOPBACK(&u->sin6.sin6_addr);
#endif
case AF_UNIX:
return TRUE;
return true;
default:
return FALSE;
return false;
}
}
@ -452,7 +452,7 @@ void sk_addrcopy(SockAddr *addr, char *buf)
memcpy(buf, &((struct sockaddr_in6 *)step.ai->ai_addr)->sin6_addr,
sizeof(struct in6_addr));
else
assert(FALSE);
assert(false);
#else
struct in_addr a;
@ -536,9 +536,9 @@ static Socket *sk_net_accept(accept_ctx_t ctx, Plug *plug)
ret->frozen = 1;
ret->localhost_only = 0; /* unused, but best init anyway */
ret->pending_error = 0;
ret->oobpending = FALSE;
ret->oobpending = false;
ret->outgoingeof = EOF_NO;
ret->incomingeof = FALSE;
ret->incomingeof = false;
ret->listener = 0;
ret->parent = ret->child = NULL;
ret->addr = NULL;
@ -601,7 +601,7 @@ static int try_connect(NetSocket *sock)
cloexec(s);
if (sock->oobinline) {
int b = TRUE;
int b = true;
if (setsockopt(s, SOL_SOCKET, SO_OOBINLINE,
(void *) &b, sizeof(b)) < 0) {
err = errno;
@ -611,7 +611,7 @@ static int try_connect(NetSocket *sock)
}
if (sock->nodelay) {
int b = TRUE;
int b = true;
if (setsockopt(s, IPPROTO_TCP, TCP_NODELAY,
(void *) &b, sizeof(b)) < 0) {
err = errno;
@ -621,7 +621,7 @@ static int try_connect(NetSocket *sock)
}
if (sock->keepalive) {
int b = TRUE;
int b = true;
if (setsockopt(s, SOL_SOCKET, SO_KEEPALIVE,
(void *) &b, sizeof(b)) < 0) {
err = errno;
@ -779,9 +779,9 @@ Socket *sk_new(SockAddr *addr, int port, int privport, int oobinline,
ret->localhost_only = 0; /* unused, but best init anyway */
ret->pending_error = 0;
ret->parent = ret->child = NULL;
ret->oobpending = FALSE;
ret->oobpending = false;
ret->outgoingeof = EOF_NO;
ret->incomingeof = FALSE;
ret->incomingeof = false;
ret->listener = 0;
ret->addr = addr;
START_STEP(ret->addr, ret->step);
@ -833,9 +833,9 @@ Socket *sk_newlistener(const char *srcaddr, int port, Plug *plug,
ret->localhost_only = local_host_only;
ret->pending_error = 0;
ret->parent = ret->child = NULL;
ret->oobpending = FALSE;
ret->oobpending = false;
ret->outgoingeof = EOF_NO;
ret->incomingeof = FALSE;
ret->incomingeof = false;
ret->listener = 1;
ret->addr = NULL;
ret->s = -1;
@ -1127,7 +1127,7 @@ void try_send(NetSocket *s)
/*
* Perfectly normal: we've sent all we can for the moment.
*/
s->writable = FALSE;
s->writable = false;
return;
} else {
/*
@ -1312,7 +1312,7 @@ static void net_select_result(int fd, int event)
* when we get called for the readability event (which
* should also occur).
*/
s->oobpending = TRUE;
s->oobpending = true;
break;
case 1: /* readable; also acceptance */
if (s->listener) {
@ -1361,7 +1361,7 @@ static void net_select_result(int fd, int event)
if (s->oobinline && s->oobpending) {
atmark = 1;
if (ioctl(s->s, SIOCATMARK, &atmark) == 0 && atmark)
s->oobpending = FALSE; /* clear this indicator */
s->oobpending = false; /* clear this indicator */
} else
atmark = 1;
@ -1375,7 +1375,7 @@ static void net_select_result(int fd, int event)
if (ret < 0) {
plug_closing(s->plug, strerror(errno), errno, 0);
} else if (0 == ret) {
s->incomingeof = TRUE; /* stop trying to read now */
s->incomingeof = true; /* stop trying to read now */
uxsel_tell(s);
plug_closing(s->plug, NULL, 0, 0);
} else {
@ -1668,12 +1668,12 @@ Socket *new_unix_listener(SockAddr *listenaddr, Plug *plug)
ret->writable = 0; /* to start with */
ret->sending_oob = 0;
ret->frozen = 0;
ret->localhost_only = TRUE;
ret->localhost_only = true;
ret->pending_error = 0;
ret->parent = ret->child = NULL;
ret->oobpending = FALSE;
ret->oobpending = false;
ret->outgoingeof = EOF_NO;
ret->incomingeof = FALSE;
ret->incomingeof = false;
ret->listener = 1;
ret->addr = listenaddr;
ret->s = -1;

View File

@ -25,8 +25,8 @@ int so_peercred(int fd, int *pid, int *uid, int *gid)
*pid = cr.pid;
*uid = cr.uid;
*gid = cr.gid;
return TRUE;
return true;
}
#endif
return FALSE;
return false;
}

View File

@ -113,7 +113,7 @@ void keylist_update(void)
const char *const appname = "Pageant";
static int time_to_die = FALSE;
static int time_to_die = false;
/* Stub functions to permit linking against x11fwd.c. These never get
* used, because in LIFE_X11 mode we connect to the X server using a
@ -121,29 +121,29 @@ static int time_to_die = FALSE;
* forwarding too. */
void chan_remotely_opened_confirmation(Channel *chan) { }
void chan_remotely_opened_failure(Channel *chan, const char *err) { }
int chan_default_want_close(Channel *chan, int s, int r) { return FALSE; }
int chan_no_exit_status(Channel *ch, int s) { return FALSE; }
int chan_default_want_close(Channel *chan, int s, int r) { return false; }
int chan_no_exit_status(Channel *ch, int s) { return false; }
int chan_no_exit_signal(Channel *ch, ptrlen s, int c, ptrlen m)
{ return FALSE; }
{ return false; }
int chan_no_exit_signal_numeric(Channel *ch, int s, int c, ptrlen m)
{ return FALSE; }
int chan_no_run_shell(Channel *chan) { return FALSE; }
int chan_no_run_command(Channel *chan, ptrlen command) { return FALSE; }
int chan_no_run_subsystem(Channel *chan, ptrlen subsys) { return FALSE; }
{ return false; }
int chan_no_run_shell(Channel *chan) { return false; }
int chan_no_run_command(Channel *chan, ptrlen command) { return false; }
int chan_no_run_subsystem(Channel *chan, ptrlen subsys) { return false; }
int chan_no_enable_x11_forwarding(
Channel *chan, int oneshot, ptrlen authproto, ptrlen authdata,
unsigned screen_number) { return FALSE; }
int chan_no_enable_agent_forwarding(Channel *chan) { return FALSE; }
unsigned screen_number) { return false; }
int chan_no_enable_agent_forwarding(Channel *chan) { return false; }
int chan_no_allocate_pty(
Channel *chan, ptrlen termtype, unsigned width, unsigned height,
unsigned pixwidth, unsigned pixheight, struct ssh_ttymodes modes)
{ return FALSE; }
int chan_no_set_env(Channel *chan, ptrlen var, ptrlen value) { return FALSE; }
int chan_no_send_break(Channel *chan, unsigned length) { return FALSE; }
int chan_no_send_signal(Channel *chan, ptrlen signame) { return FALSE; }
{ return false; }
int chan_no_set_env(Channel *chan, ptrlen var, ptrlen value) { return false; }
int chan_no_send_break(Channel *chan, unsigned length) { return false; }
int chan_no_send_signal(Channel *chan, ptrlen signame) { return false; }
int chan_no_change_window_size(
Channel *chan, unsigned width, unsigned height,
unsigned pixwidth, unsigned pixheight) { return FALSE; }
unsigned pixwidth, unsigned pixheight) { return false; }
void chan_no_request_response(Channel *chan, int success) {}
/*
@ -159,7 +159,7 @@ static void x11_sent(Plug *plug, int bufsize) {}
static void x11_closing(Plug *plug, const char *error_msg, int error_code,
int calling_back)
{
time_to_die = TRUE;
time_to_die = true;
}
struct X11Connection {
Plug plug;
@ -306,10 +306,10 @@ int have_controlling_tty(void)
perror("/dev/tty: open");
exit(1);
}
return FALSE;
return false;
} else {
close(fd);
return TRUE;
return true;
}
}
@ -326,9 +326,9 @@ static char *askpass_tty(const char *prompt)
{
int ret;
prompts_t *p = new_prompts();
p->to_server = FALSE;
p->to_server = false;
p->name = dupstr("Pageant passphrase prompt");
add_prompt(p, dupcat(prompt, ": ", (const char *)NULL), FALSE);
add_prompt(p, dupcat(prompt, ": ", (const char *)NULL), false);
ret = console_get_userpass_input(p);
assert(ret >= 0);
@ -400,7 +400,7 @@ static int unix_add_keyfile(const char *filename_str)
int status, ret;
char *err;
ret = TRUE;
ret = true;
/*
* Try without a passphrase.
@ -410,7 +410,7 @@ static int unix_add_keyfile(const char *filename_str)
goto cleanup;
} else if (status == PAGEANT_ACTION_FAILURE) {
fprintf(stderr, "pageant: %s: %s\n", filename_str, err);
ret = FALSE;
ret = false;
goto cleanup;
}
@ -437,7 +437,7 @@ static int unix_add_keyfile(const char *filename_str)
goto cleanup;
} else if (status == PAGEANT_ACTION_FAILURE) {
fprintf(stderr, "pageant: %s: %s\n", filename_str, err);
ret = FALSE;
ret = false;
goto cleanup;
}
}
@ -476,9 +476,9 @@ int match_fingerprint_string(const char *string, const char *fingerprint)
while (*string == ':') string++;
while (*hash == ':') hash++;
if (!*string)
return TRUE;
return true;
if (tolower((unsigned char)*string) != tolower((unsigned char)*hash))
return FALSE;
return false;
string++;
hash++;
}
@ -502,8 +502,8 @@ struct pageant_pubkey *find_key(const char *string, char **retstr)
{
struct key_find_ctx actx, *ctx = &actx;
struct pageant_pubkey key_in, *key_ret;
int try_file = TRUE, try_fp = TRUE, try_comment = TRUE;
int file_errors = FALSE;
int try_file = true, try_fp = true, try_comment = true;
int file_errors = false;
/*
* Trim off disambiguating prefixes telling us how to interpret
@ -511,17 +511,17 @@ struct pageant_pubkey *find_key(const char *string, char **retstr)
*/
if (!strncmp(string, "file:", 5)) {
string += 5;
try_fp = try_comment = FALSE;
file_errors = TRUE; /* also report failure to load the file */
try_fp = try_comment = false;
file_errors = true; /* also report failure to load the file */
} else if (!strncmp(string, "comment:", 8)) {
string += 8;
try_file = try_fp = FALSE;
try_file = try_fp = false;
} else if (!strncmp(string, "fp:", 3)) {
string += 3;
try_file = try_comment = FALSE;
try_file = try_comment = false;
} else if (!strncmp(string, "fingerprint:", 12)) {
string += 12;
try_file = try_comment = FALSE;
try_file = try_comment = false;
}
/*
@ -632,7 +632,7 @@ void run_client(void)
{
const struct cmdline_key_action *act;
struct pageant_pubkey *key;
int errors = FALSE;
int errors = false;
char *retstr;
if (!agent_exists()) {
@ -644,14 +644,14 @@ void run_client(void)
switch (act->action) {
case KEYACT_CLIENT_ADD:
if (!unix_add_keyfile(act->filename))
errors = TRUE;
errors = true;
break;
case KEYACT_CLIENT_LIST:
if (pageant_enum_keys(key_list_callback, NULL, &retstr) ==
PAGEANT_ACTION_FAILURE) {
fprintf(stderr, "pageant: listing keys: %s\n", retstr);
sfree(retstr);
errors = TRUE;
errors = true;
}
break;
case KEYACT_CLIENT_DEL:
@ -661,7 +661,7 @@ void run_client(void)
fprintf(stderr, "pageant: deleting key '%s': %s\n",
act->filename, retstr);
sfree(retstr);
errors = TRUE;
errors = true;
}
if (key)
pageant_pubkey_free(key);
@ -673,7 +673,7 @@ void run_client(void)
fprintf(stderr, "pageant: finding key '%s': %s\n",
act->filename, retstr);
sfree(retstr);
errors = TRUE;
errors = true;
} else {
FILE *fp = stdout; /* FIXME: add a -o option? */
@ -702,7 +702,7 @@ void run_client(void)
if (pageant_delete_all_keys(&retstr) == PAGEANT_ACTION_FAILURE) {
fprintf(stderr, "pageant: deleting all keys: %s\n", retstr);
sfree(retstr);
errors = TRUE;
errors = true;
}
break;
default:
@ -734,7 +734,7 @@ void run_agent(void)
int fd;
int i, fdcount, fdsize, fdstate;
int termination_pid = -1;
int errors = FALSE;
int errors = false;
Conf *conf;
const struct cmdline_key_action *act;
@ -749,7 +749,7 @@ void run_agent(void)
for (act = keyact_head; act; act = act->next) {
assert(act->action == KEYACT_AGENT_LOAD);
if (!unix_add_keyfile(act->filename))
errors = TRUE;
errors = true;
}
if (errors)
exit(1);
@ -811,13 +811,13 @@ void run_agent(void)
smemclr(greeting, greetinglen);
sfree(greeting);
pageant_fork_and_print_env(FALSE);
pageant_fork_and_print_env(false);
} else if (life == LIFE_TTY) {
schedule_timer(TTY_LIFE_POLL_INTERVAL,
tty_life_timer, &dummy_timer_ctx);
pageant_fork_and_print_env(TRUE);
pageant_fork_and_print_env(true);
} else if (life == LIFE_PERM) {
pageant_fork_and_print_env(FALSE);
pageant_fork_and_print_env(false);
} else if (life == LIFE_DEBUG) {
pageant_print_env(getpid());
pageant_logfp = stdout;
@ -840,8 +840,8 @@ void run_agent(void)
perror("fork");
exit(1);
} else if (pid == 0) {
setenv("SSH_AUTH_SOCK", socketname, TRUE);
setenv("SSH_AGENT_PID", dupprintf("%d", (int)agentpid), TRUE);
setenv("SSH_AUTH_SOCK", socketname, true);
setenv("SSH_AGENT_PID", dupprintf("%d", (int)agentpid), true);
execvp(exec_args[0], exec_args);
perror("exec");
_exit(127);
@ -945,7 +945,7 @@ void run_agent(void)
* clean up and leave.
*/
if (!have_controlling_tty()) {
time_to_die = TRUE;
time_to_die = true;
break;
}
}
@ -977,7 +977,7 @@ void run_agent(void)
if (pid <= 0)
break;
if (pid == termination_pid)
time_to_die = TRUE;
time_to_die = true;
}
}
@ -998,7 +998,7 @@ void run_agent(void)
int main(int argc, char **argv)
{
int doing_opts = TRUE;
int doing_opts = true;
keyact curr_keyact = KEYACT_AGENT_LOAD;
const char *standalone_askpass_prompt = NULL;
@ -1063,7 +1063,7 @@ int main(int argc, char **argv)
exit(1);
}
} else if (!strcmp(p, "--")) {
doing_opts = FALSE;
doing_opts = false;
}
} else {
/*
@ -1120,19 +1120,19 @@ int main(int argc, char **argv)
* actions of KEYACT_AGENT_* type.
*/
{
int has_agent_actions = FALSE;
int has_client_actions = FALSE;
int has_lifetime = FALSE;
int has_agent_actions = false;
int has_client_actions = false;
int has_lifetime = false;
const struct cmdline_key_action *act;
for (act = keyact_head; act; act = act->next) {
if (is_agent_action(act->action))
has_agent_actions = TRUE;
has_agent_actions = true;
else
has_client_actions = TRUE;
has_client_actions = true;
}
if (life != LIFE_UNSPEC)
has_lifetime = TRUE;
has_lifetime = true;
if (has_lifetime && has_client_actions) {
fprintf(stderr, "pageant: client key actions (-a, -d, -D, -l, -L)"

View File

@ -38,7 +38,7 @@ void cmdline_error(const char *fmt, ...)
exit(1);
}
static int local_tty = FALSE; /* do we have a local tty? */
static int local_tty = false; /* do we have a local tty? */
static Backend *backend;
static Conf *conf;
@ -79,7 +79,7 @@ char *x_get_default(const char *key)
}
int term_ldisc(Terminal *term, int mode)
{
return FALSE;
return false;
}
static void plink_echoedit_update(Seat *seat, int echo, int edit)
{
@ -353,11 +353,11 @@ static int plink_output(Seat *seat, int is_stderr, const void *data, int len)
{
if (is_stderr) {
bufchain_add(&stderr_data, data, len);
return try_output(TRUE);
return try_output(true);
} else {
assert(outgoingeof == EOF_NO);
bufchain_add(&stdout_data, data, len);
return try_output(FALSE);
return try_output(false);
}
}
@ -365,8 +365,8 @@ static int plink_eof(Seat *seat)
{
assert(outgoingeof == EOF_NO);
outgoingeof = EOF_PENDING;
try_output(FALSE);
return FALSE; /* do not respond to incoming EOF with outgoing */
try_output(false);
return false; /* do not respond to incoming EOF with outgoing */
}
static int plink_get_userpass_input(Seat *seat, prompts_t *p, bufchain *input)
@ -546,10 +546,10 @@ static void version(void)
void frontend_net_error_pending(void) {}
const int share_can_be_downstream = TRUE;
const int share_can_be_upstream = TRUE;
const int share_can_be_downstream = true;
const int share_can_be_upstream = true;
const int buildinfo_gtk_relevant = FALSE;
const int buildinfo_gtk_relevant = false;
int main(int argc, char **argv)
{
@ -560,7 +560,7 @@ int main(int argc, char **argv)
int exitcode;
int errors;
int use_subsystem = 0;
int just_test_share_exists = FALSE;
int just_test_share_exists = false;
unsigned long now;
struct winsize size;
const struct BackendVtable *backvt;
@ -591,7 +591,7 @@ int main(int argc, char **argv)
*/
conf = conf_new();
do_defaults(NULL, conf);
loaded_session = FALSE;
loaded_session = false;
default_protocol = conf_get_int(conf, CONF_protocol);
default_port = conf_get_int(conf, CONF_port);
errors = 0;
@ -645,7 +645,7 @@ int main(int argc, char **argv)
provide_xrm_string(*++argv);
}
} else if (!strcmp(p, "-shareexists")) {
just_test_share_exists = TRUE;
just_test_share_exists = true;
} else if (!strcmp(p, "-fuzznet")) {
conf_set_int(conf, CONF_proxy_type, PROXY_FUZZ);
conf_set_str(conf, CONF_proxy_telnet_command, "%host");
@ -674,7 +674,7 @@ int main(int argc, char **argv)
/* change trailing blank to NUL */
conf_set_str(conf, CONF_remote_cmd, command);
conf_set_str(conf, CONF_remote_cmd2, "");
conf_set_int(conf, CONF_nopty, TRUE); /* command => no tty */
conf_set_int(conf, CONF_nopty, true); /* command => no tty */
break; /* done with cmdline */
} else {
@ -713,7 +713,7 @@ int main(int argc, char **argv)
* Apply subsystem status.
*/
if (use_subsystem)
conf_set_int(conf, CONF_ssh_subsys, TRUE);
conf_set_int(conf, CONF_ssh_subsys, true);
if (!*conf_get_str(conf, CONF_remote_cmd) &&
!*conf_get_str(conf, CONF_remote_cmd2) &&
@ -772,7 +772,7 @@ int main(int argc, char **argv)
!conf_get_int(conf, CONF_x11_forward) &&
!conf_get_int(conf, CONF_agentfwd) &&
!conf_get_str_nthstrkey(conf, CONF_portfwd, 0))
conf_set_int(conf, CONF_ssh_simple, TRUE);
conf_set_int(conf, CONF_ssh_simple, true);
if (just_test_share_exists) {
if (!backvt->test_for_upstream) {
@ -823,7 +823,7 @@ int main(int argc, char **argv)
local_tty = (tcgetattr(STDIN_FILENO, &orig_termios) == 0);
atexit(cleanup_termios);
seat_echoedit_update(plink_seat, 1, 1);
sending = FALSE;
sending = false;
now = GETTICKCOUNT();
while (1) {
@ -958,7 +958,7 @@ int main(int argc, char **argv)
exit(1);
} else if (ret == 0) {
backend_special(backend, SS_EOF, 0);
sending = FALSE; /* send nothing further after this */
sending = false; /* send nothing further after this */
} else {
if (local_tty)
from_tty(buf, ret);
@ -969,11 +969,11 @@ int main(int argc, char **argv)
}
if (FD_ISSET(STDOUT_FILENO, &wset)) {
backend_unthrottle(backend, try_output(FALSE));
backend_unthrottle(backend, try_output(false));
}
if (FD_ISSET(STDERR_FILENO, &wset)) {
backend_unthrottle(backend, try_output(TRUE));
backend_unthrottle(backend, try_output(true));
}
run_toplevel_callbacks();

View File

@ -11,7 +11,7 @@ const char *const appname = "pterm";
const int use_event_log = 0; /* pterm doesn't need it */
const int new_session = 0, saved_sessions = 0; /* or these */
const int dup_check_launchable = 0; /* no need to check host name in conf */
const int use_pty_argv = TRUE;
const int use_pty_argv = true;
const struct BackendVtable *select_backend(Conf *conf)
{

View File

@ -285,10 +285,10 @@ static void sigchld_handler(int signum)
static void pty_setup_sigchld_handler(void)
{
static int setup = FALSE;
static int setup = false;
if (!setup) {
putty_signal(SIGCHLD, sigchld_handler);
setup = TRUE;
setup = true;
}
}
@ -455,7 +455,7 @@ void pty_pre_init(void)
pty_setup_sigchld_handler();
pty->master_fd = pty->slave_fd = -1;
#ifndef OMIT_UTMP
pty_stamped_utmp = FALSE;
pty_stamped_utmp = false;
#endif
if (geteuid() != getuid() || getegid() != getgid()) {
@ -597,7 +597,7 @@ static void pty_real_select_result(Pty *pty, int fd, int event, int status)
{
char buf[4096];
int ret;
int finished = FALSE;
int finished = false;
if (event < 0) {
/*
@ -608,7 +608,7 @@ static void pty_real_select_result(Pty *pty, int fd, int event, int status)
/*
* The primary child process died.
*/
pty->child_dead = TRUE;
pty->child_dead = true;
del234(ptys_by_pid, pty);
pty->exit_code = status;
@ -625,7 +625,7 @@ static void pty_real_select_result(Pty *pty, int fd, int event, int status)
* or make configurable if necessary.
*/
if (pty->master_fd >= 0)
finished = TRUE;
finished = true;
}
} else {
if (event == 1) {
@ -667,7 +667,7 @@ static void pty_real_select_result(Pty *pty, int fd, int event, int status)
* usage model would precisely _not_ be for the
* pterm window to hang around!
*/
finished = TRUE;
finished = true;
pty_try_wait(); /* one last effort to collect exit code */
if (!pty->child_dead)
pty->exit_code = 0;
@ -696,7 +696,7 @@ static void pty_real_select_result(Pty *pty, int fd, int event, int status)
pty_close(pty);
pty->finished = TRUE;
pty->finished = true;
/*
* This is a slight layering-violation sort of hack: only
@ -862,7 +862,7 @@ Backend *pty_backend_create(
pty = new_pty_struct();
pty->master_fd = pty->slave_fd = -1;
#ifndef OMIT_UTMP
pty_stamped_utmp = FALSE;
pty_stamped_utmp = false;
#endif
}
for (i = 0; i < 6; i++)
@ -1193,8 +1193,8 @@ Backend *pty_backend_create(
_exit(127);
} else {
pty->child_pid = pid;
pty->child_dead = FALSE;
pty->finished = FALSE;
pty->child_dead = false;
pty->finished = false;
if (pty->slave_fd > 0)
close(pty->slave_fd);
if (!ptys_by_pid)
@ -1248,7 +1248,7 @@ static const char *pty_init(Seat *seat, Backend **backend_handle,
cmd = pty_argv[0];
*backend_handle= pty_backend_create(
seat, logctx, conf, pty_argv, cmd, modes, FALSE);
seat, logctx, conf, pty_argv, cmd, modes, false);
*realhost = dupstr("");
return NULL;
}
@ -1327,7 +1327,7 @@ static void pty_try_write(Pty *pty)
uxsel_del(pty->master_i);
close(pty->master_i);
pty->master_i = -1;
pty->pending_eof = FALSE;
pty->pending_eof = false;
}
pty_uxsel_setup(pty);
@ -1427,7 +1427,7 @@ static void pty_special(Backend *be, SessionSpecialCode code, int arg)
if (code == SS_EOF) {
if (pty->master_i >= 0 && pty->master_i != pty->master_fd) {
pty->pending_eof = TRUE;
pty->pending_eof = true;
pty_try_write(pty);
}
return;
@ -1473,7 +1473,7 @@ static const SessionSpecial *pty_get_specials(Backend *be)
static int pty_connected(Backend *be)
{
/* Pty *pty = container_of(be, Pty, backend); */
return TRUE;
return true;
}
static int pty_sendok(Backend *be)

View File

@ -20,7 +20,7 @@
/*
* Stubs to avoid uxpty.c needing to be linked in.
*/
const int use_pty_argv = FALSE;
const int use_pty_argv = false;
char **pty_argv; /* never used */
char *pty_osx_envrestore_prefix;
@ -48,7 +48,7 @@ const struct BackendVtable *select_backend(Conf *conf)
void initial_config_box(Conf *conf, post_dialog_fn_t after, void *afterctx)
{
char *title = dupcat(appname, " Configuration", NULL);
create_config_box(title, conf, FALSE, 0, after, afterctx);
create_config_box(title, conf, false, 0, after, afterctx);
sfree(title);
}
@ -73,8 +73,8 @@ char *platform_get_x_display(void) {
return dupstr(display);
}
const int share_can_be_downstream = TRUE;
const int share_can_be_upstream = TRUE;
const int share_can_be_downstream = true;
const int share_can_be_upstream = true;
void setup(int single)
{

View File

@ -294,7 +294,7 @@ static const char *serial_init(Seat *seat, Backend **backend_handle,
serial->seat = seat;
serial->logctx = logctx;
serial->finished = FALSE;
serial->finished = false;
serial->inbufsize = 0;
bufchain_init(&serial->output_data);
@ -361,7 +361,7 @@ static void serial_select_result(int fd, int event)
Serial *serial;
char buf[4096];
int ret;
int finished = FALSE;
int finished = false;
serial = find234(serial_by_fd, &fd, serial_find_by_fd);
@ -377,7 +377,7 @@ static void serial_select_result(int fd, int event)
* to the idea that there might be two-way devices we
* can treat _like_ serial ports which can return EOF.
*/
finished = TRUE;
finished = true;
} else if (ret < 0) {
#ifdef EAGAIN
if (errno == EAGAIN)
@ -403,7 +403,7 @@ static void serial_select_result(int fd, int event)
if (finished) {
serial_close(serial);
serial->finished = TRUE;
serial->finished = true;
seat_notify_remote_exit(serial->seat);
}

View File

@ -173,7 +173,7 @@ unsigned auth_methods(AuthPolicy *ap)
}
int auth_none(AuthPolicy *ap, ptrlen username)
{
return FALSE;
return false;
}
int auth_password(AuthPolicy *ap, ptrlen username, ptrlen password,
ptrlen *new_password_opt)
@ -211,9 +211,9 @@ int auth_publickey(AuthPolicy *ap, ptrlen username, ptrlen public_blob)
struct AuthPolicy_ssh2_pubkey *iter;
for (iter = ap->ssh2keys; iter; iter = iter->next) {
if (ptrlen_eq_ptrlen(public_blob, iter->public_blob))
return TRUE;
return true;
}
return FALSE;
return false;
}
struct RSAKey *auth_publickey_ssh1(
AuthPolicy *ap, ptrlen username, Bignum rsa_modulus)
@ -237,9 +237,9 @@ AuthKbdInt *auth_kbdint_prompts(AuthPolicy *ap, ptrlen username)
aki->nprompts = 2;
aki->prompts = snewn(aki->nprompts, AuthKbdIntPrompt);
aki->prompts[0].prompt = dupstr("Echoey prompt: ");
aki->prompts[0].echo = TRUE;
aki->prompts[0].echo = true;
aki->prompts[1].prompt = dupstr("Silent prompt: ");
aki->prompts[1].echo = FALSE;
aki->prompts[1].echo = false;
return aki;
case 1:
aki->title = dupstr("Zero-prompt step");
@ -286,7 +286,7 @@ int auth_ssh1int_response(AuthPolicy *ap, ptrlen response)
}
int auth_successful(AuthPolicy *ap, ptrlen username, unsigned method)
{
return TRUE;
return true;
}
static void safety_warning(FILE *fp)
@ -319,13 +319,13 @@ static void show_version_and_exit(void)
exit(0);
}
const int buildinfo_gtk_relevant = FALSE;
const int buildinfo_gtk_relevant = false;
static int finished = FALSE;
static int finished = false;
void server_instance_terminated(void)
{
/* FIXME: change policy here if we're running in a listening loop */
finished = TRUE;
finished = true;
}
static int longoptarg(const char *arg, const char *expected,
@ -333,21 +333,21 @@ static int longoptarg(const char *arg, const char *expected,
{
int len = strlen(expected);
if (memcmp(arg, expected, len))
return FALSE;
return false;
if (arg[len] == '=') {
*val = arg + len + 1;
return TRUE;
return true;
} else if (arg[len] == '\0') {
if (--*argcp > 0) {
*val = *++*argvp;
return TRUE;
return true;
} else {
fprintf(stderr, "%s: option %s expects an argument\n",
appname, expected);
exit(1);
}
}
return FALSE;
return false;
}
extern const SftpServerVtable unix_live_sftpserver_vt;
@ -393,7 +393,7 @@ int main(int argc, char **argv)
} else if (!strcmp(arg, "--version")) {
show_version_and_exit();
} else if (!strcmp(arg, "--verbose") || !strcmp(arg, "-v")) {
verbose = TRUE;
verbose = true;
} else if (longoptarg(arg, "--hostkey", &val, &argc, &argv)) {
Filename *keyfile;
int keytype;

View File

@ -37,7 +37,7 @@ void platform_get_x11_auth(struct X11Display *display, Conf *conf)
{
/* Do nothing, therefore no auth. */
}
const int platform_uses_x11_unix_by_default = TRUE;
const int platform_uses_x11_unix_by_default = true;
/*
* Default settings that are specific to PSFTP.
@ -415,12 +415,12 @@ char *stripslashes(const char *str, int local)
int vet_filename(const char *name)
{
if (strchr(name, '/'))
return FALSE;
return false;
if (name[0] == '.' && (!name[1] || (name[1] == '.' && !name[2])))
return FALSE;
return false;
return TRUE;
return true;
}
int create_directory(const char *name)
@ -444,7 +444,7 @@ static int ssh_sftp_do_select(int include_stdin, int no_fds_ok)
int fd, fdstate, rwx, ret, maxfd;
unsigned long now = GETTICKCOUNT();
unsigned long next;
int done_something = FALSE;
int done_something = false;
fdlist = NULL;
fdcount = fdsize = 0;
@ -555,7 +555,7 @@ static int ssh_sftp_do_select(int include_stdin, int no_fds_ok)
*/
int ssh_sftp_loop_iteration(void)
{
return ssh_sftp_do_select(FALSE, FALSE);
return ssh_sftp_do_select(false, false);
}
/*
@ -573,7 +573,7 @@ char *ssh_sftp_get_cmdline(const char *prompt, int no_fds_ok)
buflen = bufsize = 0;
while (1) {
ret = ssh_sftp_do_select(TRUE, no_fds_ok);
ret = ssh_sftp_do_select(true, no_fds_ok);
if (ret < 0) {
printf("connection died\n");
sfree(buf);
@ -608,7 +608,7 @@ void frontend_net_error_pending(void) {}
void platform_psftp_pre_conn_setup(void) {}
const int buildinfo_gtk_relevant = FALSE;
const int buildinfo_gtk_relevant = false;
/*
* Main program: do platform-specific initialisation and then call

View File

@ -107,12 +107,12 @@ static int uss_decode_handle(
unsigned char handlebuf[8];
if (handle.len != 8)
return FALSE;
return false;
memcpy(handlebuf, handle.ptr, 8);
des_decrypt_xdmauth(uss->handlekey, handlebuf, 8);
*index = toint(GET_32BIT(handlebuf));
*seq = GET_32BIT(handlebuf + 4);
return TRUE;
return true;
}
static void uss_return_new_handle(
@ -126,12 +126,12 @@ static void uss_return_new_handle(
uss->fdsopen = sresize(uss->fdsopen, uss->fdsize, int);
while (old_size < uss->fdsize) {
uss->fdseqs[old_size] = 0;
uss->fdsopen[old_size] = FALSE;
uss->fdsopen[old_size] = false;
old_size++;
}
}
assert(!uss->fdsopen[fd]);
uss->fdsopen[fd] = TRUE;
uss->fdsopen[fd] = true;
if (++uss->fdseqs[fd] == USS_DIRHANDLE_SEQ)
uss->fdseqs[fd] = 0;
uss_return_handle_raw(uss, reply, fd, uss->fdseqs[fd]);
@ -286,7 +286,7 @@ static void uss_close(SftpServer *srv, SftpReplyBuilder *reply,
} else if ((fd = uss_lookup_fd(uss, reply, handle)) >= 0) {
close(fd);
assert(0 <= fd && fd <= uss->fdsize);
uss->fdsopen[fd] = FALSE;
uss->fdsopen[fd] = false;
fxp_reply_ok(reply);
}
/* if both failed, uss_lookup_fd will have filled in an error response */
@ -424,20 +424,20 @@ static void uss_fstat(SftpServer *srv, SftpReplyBuilder *reply,
{ \
if (attrs.flags & SSH_FILEXFER_ATTR_SIZE) \
if (api_prefix(truncate)(api_arg, attrs.size) < 0) \
success = FALSE; \
success = false; \
if (attrs.flags & SSH_FILEXFER_ATTR_UIDGID) \
if (api_prefix(chown)(api_arg, attrs.uid, attrs.gid) < 0) \
success = FALSE; \
success = false; \
if (attrs.flags & SSH_FILEXFER_ATTR_PERMISSIONS) \
if (api_prefix(chmod)(api_arg, attrs.permissions) < 0) \
success = FALSE; \
success = false; \
if (attrs.flags & SSH_FILEXFER_ATTR_ACMODTIME) { \
struct timeval tv[2]; \
tv[0].tv_sec = attrs.atime; \
tv[1].tv_sec = attrs.mtime; \
tv[0].tv_usec = tv[1].tv_usec = 0; \
if (api_prefix(utimes)(api_arg, tv) < 0) \
success = FALSE; \
success = false; \
} \
} while (0)
@ -450,7 +450,7 @@ static void uss_setstat(SftpServer *srv, SftpReplyBuilder *reply,
UnixSftpServer *uss = container_of(srv, UnixSftpServer, srv);
char *pathstr = mkstr(path);
int success = TRUE;
int success = true;
SETSTAT_GUTS(PATH_PREFIX, pathstr, attrs, success);
free(pathstr);
@ -470,7 +470,7 @@ static void uss_fsetstat(SftpServer *srv, SftpReplyBuilder *reply,
if ((fd = uss_lookup_fd(uss, reply, handle)) < 0)
return;
int success = TRUE;
int success = true;
SETSTAT_GUTS(FD_PREFIX, fd, attrs, success);
if (!success) {

View File

@ -96,7 +96,7 @@ int wc_to_mb(int codepage, int flags, const wchar_t *wcstr, int wclen,
}
/*
* Return value is TRUE if pterm is to run in direct-to-font mode.
* Return value is true if pterm is to run in direct-to-font mode.
*/
int init_ucs(struct unicode_data *ucsdata, char *linecharset,
int utf8_override, int font_charset, int vtmode)

View File

@ -20,7 +20,7 @@ static LRESULT CALLBACK SizeTipWndProc(HWND hWnd, UINT nMsg,
switch (nMsg) {
case WM_ERASEBKGND:
return TRUE;
return true;
case WM_PAINT:
{
@ -80,7 +80,7 @@ static LRESULT CALLBACK SizeTipWndProc(HWND hWnd, UINT nMsg,
SetWindowPos(hWnd, NULL, 0, 0, sz.cx + 6, sz.cy + 6,
SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE);
InvalidateRect(hWnd, NULL, FALSE);
InvalidateRect(hWnd, NULL, false);
DeleteDC(hdc);
}

View File

@ -11,12 +11,12 @@
int got_crypt(void)
{
static int attempted = FALSE;
static int attempted = false;
static int successful;
static HMODULE crypt;
if (!attempted) {
attempted = TRUE;
attempted = true;
crypt = load_system32_dll("crypt32.dll");
successful = crypt &&
#ifdef COVERITY

View File

@ -157,7 +157,7 @@ void win_setup_config_box(struct controlbox *b, HWND *hwndp, int has_help,
}
}
ctrl_filesel(s, "Custom sound file to play as a bell:", NO_SHORTCUT,
FILTER_WAVE_FILES, FALSE, "Select bell sound file",
FILTER_WAVE_FILES, false, "Select bell sound file",
HELPCTX(bell_style),
conf_filesel_handler, I(CONF_bell_wavefile));
@ -396,7 +396,7 @@ void win_setup_config_box(struct controlbox *b, HWND *hwndp, int has_help,
if (!midsession && backend_vt_from_proto(PROT_SSH)) {
s = ctrl_getset(b, "Connection/SSH/X11", "x11", "X11 forwarding");
ctrl_filesel(s, "X authority file for local display", 't',
NULL, FALSE, "Select X authority file",
NULL, false, "Select X authority file",
HELPCTX(ssh_tunnels_xauthority),
conf_filesel_handler, I(CONF_xauthfile));
}

View File

@ -11,7 +11,7 @@
#include "storage.h"
#include "ssh.h"
int console_batch_mode = FALSE;
int console_batch_mode = false;
/*
* Clean up and exit.

Some files were not shown because too many files have changed in this diff Show More