# HG changeset patch # User Matt Johnston # Date 1104697556 0 # Node ID 0cfba3034be5bcfc52ed78a049caedc973288cab # Parent b9d3f725e00b015fa3a841477293ef03fef67cd9 Fixed DEBUG_TRACE macro so that we don't get semicolons left about the place diff -r b9d3f725e00b -r 0cfba3034be5 buffer.c --- a/buffer.c Sun Jan 02 17:08:27 2005 +0000 +++ b/buffer.c Sun Jan 02 20:25:56 2005 +0000 @@ -258,7 +258,7 @@ void buf_putmpint(buffer* buf, mp_int * mp) { unsigned int len, pad = 0; - TRACE(("enter buf_putmpint")); + TRACE(("enter buf_putmpint")) assert(mp != NULL); @@ -294,7 +294,7 @@ buf_incrwritepos(buf, len-pad); } - TRACE(("leave buf_putmpint")); + TRACE(("leave buf_putmpint")) } /* Retrieve an mp_int from the buffer. diff -r b9d3f725e00b -r 0cfba3034be5 circbuffer.c --- a/circbuffer.c Sun Jan 02 17:08:27 2005 +0000 +++ b/circbuffer.c Sun Jan 02 20:25:56 2005 +0000 @@ -70,7 +70,7 @@ assert(((2*cbuf->size)+cbuf->readpos-cbuf->writepos)%cbuf->size == (cbuf->size-cbuf->used)%cbuf->size); if (cbuf->used == 0) { - TRACE(("cbuf_readlen: unused buffer")); + TRACE(("cbuf_readlen: unused buffer")) return 0; } @@ -88,7 +88,7 @@ assert(((2*cbuf->size)+cbuf->readpos-cbuf->writepos)%cbuf->size == (cbuf->size-cbuf->used)%cbuf->size); if (cbuf->used == cbuf->size) { - TRACE(("cbuf_writelen: full buffer")); + TRACE(("cbuf_writelen: full buffer")) return 0; /* full */ } diff -r b9d3f725e00b -r 0cfba3034be5 cli-algo.c --- a/cli-algo.c Sun Jan 02 17:08:27 2005 +0000 +++ b/cli-algo.c Sun Jan 02 20:25:56 2005 +0000 @@ -46,7 +46,7 @@ /* get the comma-separated list from the buffer ie "algo1,algo2,algo3" */ algolist = buf_getstring(buf, &len); - TRACE(("cli_buf_match_algo: %s", algolist)); + TRACE(("cli_buf_match_algo: %s", algolist)) if (len > MAX_PROPOSED_ALGO*(MAX_NAME_LEN+1)) { goto out; /* just a sanity check, no other use */ } diff -r b9d3f725e00b -r 0cfba3034be5 cli-auth.c --- a/cli-auth.c Sun Jan 02 17:08:27 2005 +0000 +++ b/cli-auth.c Sun Jan 02 20:25:56 2005 +0000 @@ -42,7 +42,7 @@ /* Send a "none" auth request to get available methods */ void cli_auth_getmethods() { - TRACE(("enter cli_auth_getmethods")); + TRACE(("enter cli_auth_getmethods")) CHECKCLEARTOWRITE(); @@ -54,7 +54,7 @@ buf_putstring(ses.writepayload, "none", 4); /* 'none' method */ encrypt_packet(); - TRACE(("leave cli_auth_getmethods")); + TRACE(("leave cli_auth_getmethods")) } @@ -64,9 +64,9 @@ unsigned int bannerlen; unsigned int i, linecount; - TRACE(("enter recv_msg_userauth_banner")); + TRACE(("enter recv_msg_userauth_banner")) if (ses.authstate.authdone) { - TRACE(("leave recv_msg_userauth_banner: banner after auth done")); + TRACE(("leave recv_msg_userauth_banner: banner after auth done")) return; } @@ -74,7 +74,7 @@ buf_eatstring(ses.payload); /* The language string */ if (bannerlen > MAX_BANNER_SIZE) { - TRACE(("recv_msg_userauth_banner: bannerlen too long: %d", bannerlen)); + TRACE(("recv_msg_userauth_banner: bannerlen too long: %d", bannerlen)) goto out; } @@ -96,7 +96,7 @@ out: m_free(banner); - TRACE(("leave recv_msg_userauth_banner")); + TRACE(("leave recv_msg_userauth_banner")) } @@ -108,12 +108,12 @@ unsigned int partial = 0; unsigned int i = 0; - TRACE(("<- MSG_USERAUTH_FAILURE")); - TRACE(("enter recv_msg_userauth_failure")); + TRACE(("<- MSG_USERAUTH_FAILURE")) + TRACE(("enter recv_msg_userauth_failure")) if (cli_ses.state != USERAUTH_REQ_SENT) { /* Perhaps we should be more fatal? */ - TRACE(("But we didn't send a userauth request!!!!!!")); + TRACE(("But we didn't send a userauth request!!!!!!")) return; } @@ -135,7 +135,7 @@ ses.authstate.failcount++; } - TRACE(("Methods (len %d): '%s'", methlen, methods)); + TRACE(("Methods (len %d): '%s'", methlen, methods)) ses.authstate.authdone=0; ses.authstate.authtypes=0; @@ -150,7 +150,7 @@ tok = methods; /* tok stores the next method we'll compare */ for (i = 0; i <= methlen; i++) { if (methods[i] == '\0') { - TRACE(("auth method '%s'", tok)); + TRACE(("auth method '%s'", tok)) #ifdef ENABLE_CLI_PUBKEY_AUTH if (strncmp(AUTH_METHOD_PUBKEY, tok, AUTH_METHOD_PUBKEY_LEN) == 0) { @@ -173,18 +173,18 @@ cli_ses.state = USERAUTH_FAIL_RCVD; - TRACE(("leave recv_msg_userauth_failure")); + TRACE(("leave recv_msg_userauth_failure")) } void recv_msg_userauth_success() { - TRACE(("received msg_userauth_success")); + TRACE(("received msg_userauth_success")) ses.authstate.authdone = 1; cli_ses.state = USERAUTH_SUCCESS_RCVD; } void cli_auth_try() { - TRACE(("enter cli_auth_try")); + TRACE(("enter cli_auth_try")) int finished = 0; CHECKCLEARTOWRITE(); @@ -208,5 +208,5 @@ dropbear_exit("No auth methods could be used."); } - TRACE(("leave cli_auth_try")); + TRACE(("leave cli_auth_try")) } diff -r b9d3f725e00b -r 0cfba3034be5 cli-authpasswd.c --- a/cli-authpasswd.c Sun Jan 02 17:08:27 2005 +0000 +++ b/cli-authpasswd.c Sun Jan 02 20:25:56 2005 +0000 @@ -33,7 +33,7 @@ int cli_auth_password() { char* password = NULL; - TRACE(("enter cli_auth_password")); + TRACE(("enter cli_auth_password")) CHECKCLEARTOWRITE(); password = getpass("Password: "); @@ -56,7 +56,7 @@ encrypt_packet(); m_burn(password, strlen(password)); - TRACE(("leave cli_auth_password")); + TRACE(("leave cli_auth_password")) return 1; /* Password auth can always be tried */ } diff -r b9d3f725e00b -r 0cfba3034be5 cli-authpubkey.c --- a/cli-authpubkey.c Sun Jan 02 17:08:27 2005 +0000 +++ b/cli-authpubkey.c Sun Jan 02 20:25:56 2005 +0000 @@ -41,7 +41,7 @@ struct PubkeyList *keyitem; struct PubkeyList **previtem; - TRACE(("enter cli_pubkeyfail")); + TRACE(("enter cli_pubkeyfail")) previtem = &cli_opts.pubkeys; /* Find the key we failed with, and remove it */ @@ -55,7 +55,7 @@ sign_key_free(cli_ses.lastpubkey->key); /* It won't be used again */ m_free(cli_ses.lastpubkey); - TRACE(("leave cli_pubkeyfail")); + TRACE(("leave cli_pubkeyfail")) } void recv_msg_userauth_pk_ok() { @@ -67,11 +67,11 @@ int keytype; unsigned int remotelen; - TRACE(("enter recv_msg_userauth_pk_ok")); + TRACE(("enter recv_msg_userauth_pk_ok")) algotype = buf_getstring(ses.payload, &algolen); keytype = signkey_type_from_name(algotype, algolen); - TRACE(("recv_msg_userauth_pk_ok: type %d", keytype)); + TRACE(("recv_msg_userauth_pk_ok: type %d", keytype)) m_free(algotype); keybuf = buf_new(MAX_PUBKEY_SIZE); @@ -84,7 +84,7 @@ if (keyitem->type != keytype) { /* Types differed */ - TRACE(("types differed")); + TRACE(("types differed")) continue; } @@ -98,14 +98,14 @@ if (keybuf->len-4 != remotelen) { - TRACE(("lengths differed: localh %d remote %d", keybuf->len, remotelen)); + TRACE(("lengths differed: localh %d remote %d", keybuf->len, remotelen)) /* Lengths differed */ continue; } if (memcmp(buf_getptr(keybuf, remotelen), buf_getptr(ses.payload, remotelen), remotelen) != 0) { /* Data didn't match this key */ - TRACE(("data differed")); + TRACE(("data differed")) continue; } @@ -114,15 +114,15 @@ } if (keyitem != NULL) { - TRACE(("matching key")); + TRACE(("matching key")) /* XXX TODO: if it's an encrypted key, here we ask for their * password */ send_msg_userauth_pubkey(keyitem->key, keytype, 1); } else { - TRACE(("That was whacky. We got told that a key was valid, but it didn't match our list. Sounds like dodgy code on Dropbear's part")); + TRACE(("That was whacky. We got told that a key was valid, but it didn't match our list. Sounds like dodgy code on Dropbear's part")) } - TRACE(("leave recv_msg_userauth_pk_ok")); + TRACE(("leave recv_msg_userauth_pk_ok")) } /* TODO: make it take an agent reference to use as well */ @@ -132,7 +132,7 @@ int algolen; buffer* sigbuf = NULL; - TRACE(("enter send_msg_userauth_pubkey")); + TRACE(("enter send_msg_userauth_pubkey")) CHECKCLEARTOWRITE(); buf_putbyte(ses.writepayload, SSH_MSG_USERAUTH_REQUEST); @@ -154,7 +154,7 @@ buf_put_pub_key(ses.writepayload, key, type); if (realsign) { - TRACE(("realsign")); + TRACE(("realsign")) /* We put the signature as well - this contains string(session id), then * the contents of the write payload to this point */ sigbuf = buf_new(4 + SHA1_HASH_SIZE + ses.writepayload->len); @@ -165,22 +165,22 @@ } encrypt_packet(); - TRACE(("leave send_msg_userauth_pubkey")); + TRACE(("leave send_msg_userauth_pubkey")) } int cli_auth_pubkey() { - TRACE(("enter cli_auth_pubkey")); + TRACE(("enter cli_auth_pubkey")) if (cli_opts.pubkeys != NULL) { /* Send a trial request */ send_msg_userauth_pubkey(cli_opts.pubkeys->key, cli_opts.pubkeys->type, 0); cli_ses.lastpubkey = cli_opts.pubkeys; - TRACE(("leave cli_auth_pubkey-success")); + TRACE(("leave cli_auth_pubkey-success")) return 1; } else { - TRACE(("leave cli_auth_pubkey-failure")); + TRACE(("leave cli_auth_pubkey-failure")) return 0; } } diff -r b9d3f725e00b -r 0cfba3034be5 cli-channel.c --- a/cli-channel.c Sun Jan 02 17:08:27 2005 +0000 +++ b/cli-channel.c Sun Jan 02 20:25:56 2005 +0000 @@ -37,7 +37,7 @@ struct Channel *channel; unsigned int datatype; - TRACE(("enter recv_msg_channel_extended_data")); + TRACE(("enter recv_msg_channel_extended_data")) chan = buf_getint(ses.payload); channel = getchannel(chan); @@ -47,7 +47,7 @@ } if (channel->type != &clichansess) { - TRACE(("leave recv_msg_channel_extended_data: chantype is wrong")); + TRACE(("leave recv_msg_channel_extended_data: chantype is wrong")) return; /* we just ignore it */ } @@ -55,11 +55,11 @@ if (datatype != SSH_EXTENDED_DATA_STDERR) { TRACE(("leave recv_msg_channel_extended_data: wrong datatype: %d", - datatype)); + datatype)) return; } common_recv_msg_channel_data(channel, channel->errfd, channel->extrabuf); - TRACE(("leave recv_msg_channel_extended_data")); + TRACE(("leave recv_msg_channel_extended_data")) } diff -r b9d3f725e00b -r 0cfba3034be5 cli-chansession.c --- a/cli-chansession.c Sun Jan 02 17:08:27 2005 +0000 +++ b/cli-chansession.c Sun Jan 02 20:25:56 2005 +0000 @@ -59,20 +59,20 @@ unsigned char* type = NULL; int wantreply; - TRACE(("enter cli_chansessreq")); + TRACE(("enter cli_chansessreq")) type = buf_getstring(ses.payload, NULL); wantreply = buf_getbyte(ses.payload); if (strcmp(type, "exit-status") != 0) { - TRACE(("unknown request '%s'", type)); + TRACE(("unknown request '%s'", type)) send_msg_channel_failure(channel); goto out; } /* We'll just trust what they tell us */ cli_ses.retval = buf_getint(ses.payload); - TRACE(("got exit-status of '%d'", cli_ses.retval)); + TRACE(("got exit-status of '%d'", cli_ses.retval)) out: m_free(type); @@ -108,10 +108,10 @@ struct termios tio; - TRACE(("enter cli_pty_setup")); + TRACE(("enter cli_pty_setup")) if (cli_ses.tty_raw_mode == 1) { - TRACE(("leave cli_tty_setup: already in raw mode!")); + TRACE(("leave cli_tty_setup: already in raw mode!")) return; } @@ -139,15 +139,15 @@ } cli_ses.tty_raw_mode = 1; - TRACE(("leave cli_tty_setup")); + TRACE(("leave cli_tty_setup")) } void cli_tty_cleanup() { - TRACE(("enter cli_tty_cleanup")); + TRACE(("enter cli_tty_cleanup")) if (cli_ses.tty_raw_mode == 0) { - TRACE(("leave cli_tty_cleanup: not in raw mode")); + TRACE(("leave cli_tty_cleanup: not in raw mode")) return; } @@ -157,12 +157,12 @@ cli_ses.tty_raw_mode = 0; } - TRACE(("leave cli_tty_cleanup")); + TRACE(("leave cli_tty_cleanup")) } static void put_termcodes() { - TRACE(("enter put_termcodes")); + TRACE(("enter put_termcodes")) struct termios tio; unsigned int sshcode; @@ -232,7 +232,7 @@ buf_putint(ses.writepayload, bufpos2 - bufpos1 - 4); /* len(termcodes) */ buf_setpos(ses.writepayload, bufpos2); /* Back where we were */ - TRACE(("leave put_termcodes")); + TRACE(("leave put_termcodes")) } static void put_winsize() { @@ -284,7 +284,7 @@ unsigned char* term = NULL; - TRACE(("enter send_chansess_pty_req")); + TRACE(("enter send_chansess_pty_req")) start_channel_request(channel, "pty-req"); @@ -310,14 +310,14 @@ if (signal(SIGWINCH, sigwinch_handler) == SIG_ERR) { dropbear_exit("signal error"); } - TRACE(("leave send_chansess_pty_req")); + TRACE(("leave send_chansess_pty_req")) } static void send_chansess_shell_req(struct Channel *channel) { unsigned char* reqtype = NULL; - TRACE(("enter send_chansess_shell_req")); + TRACE(("enter send_chansess_shell_req")) if (cli_opts.cmd) { reqtype = "exec"; @@ -334,7 +334,7 @@ } encrypt_packet(); - TRACE(("leave send_chansess_shell_req")); + TRACE(("leave send_chansess_shell_req")) } static int cli_initchansess(struct Channel *channel) { @@ -367,7 +367,7 @@ void cli_send_chansess_request() { - TRACE(("enter cli_send_chansess_request")); + TRACE(("enter cli_send_chansess_request")) if (send_msg_channel_open_init(STDIN_FILENO, &clichansess) == DROPBEAR_FAILURE) { dropbear_exit("Couldn't open initial channel"); @@ -375,6 +375,6 @@ /* No special channel request data */ encrypt_packet(); - TRACE(("leave cli_send_chansess_request")); + TRACE(("leave cli_send_chansess_request")) } diff -r b9d3f725e00b -r 0cfba3034be5 cli-kex.c --- a/cli-kex.c Sun Jan 02 17:08:27 2005 +0000 +++ b/cli-kex.c Sun Jan 02 20:25:56 2005 +0000 @@ -65,14 +65,14 @@ unsigned char* keyblob = NULL; - TRACE(("enter recv_msg_kexdh_reply")); + TRACE(("enter recv_msg_kexdh_reply")) if (cli_ses.kex_state != KEXDH_INIT_SENT) { dropbear_exit("Received out-of-order kexdhreply"); } m_mp_init(&dh_f); type = ses.newkeys->algo_hostkey; - TRACE(("type is %d", type)); + TRACE(("type is %d", type)) hostkey = new_sign_key(); keybloblen = buf_getint(ses.payload); @@ -84,12 +84,12 @@ } if (buf_get_pub_key(ses.payload, hostkey, &type) != DROPBEAR_SUCCESS) { - TRACE(("failed getting pubkey")); + TRACE(("failed getting pubkey")) dropbear_exit("Bad KEX packet"); } if (buf_getmpint(ses.payload, &dh_f) != DROPBEAR_SUCCESS) { - TRACE(("failed getting mpint")); + TRACE(("failed getting mpint")) dropbear_exit("Bad KEX packet"); } @@ -109,7 +109,7 @@ send_msg_newkeys(); ses.requirenext = SSH_MSG_NEWKEYS; - TRACE(("leave recv_msg_kexdh_init")); + TRACE(("leave recv_msg_kexdh_init")) } static void ask_to_confirm(unsigned char* keyblob, unsigned int keybloblen) { @@ -156,7 +156,7 @@ if (errno != EEXIST) { dropbear_log(LOG_INFO, "Warning: failed creating ~/.ssh: %s", strerror(errno)); - TRACE(("mkdir didn't work: %s", strerror(errno))); + TRACE(("mkdir didn't work: %s", strerror(errno))) ask_to_confirm(keyblob, keybloblen); goto out; /* only get here on success */ } @@ -170,14 +170,14 @@ } else { /* We mightn't have been able to open it if it was read-only */ if (errno == EACCES || errno == EROFS) { - TRACE(("trying readonly: %s", strerror(errno))); + TRACE(("trying readonly: %s", strerror(errno))) readonly = 1; hostsfile = fopen(filename, "r"); } } if (hostsfile == NULL) { - TRACE(("hostsfile didn't open: %s", strerror(errno))); + TRACE(("hostsfile didn't open: %s", strerror(errno))) ask_to_confirm(keyblob, keybloblen); goto out; /* We only get here on success */ } @@ -188,7 +188,7 @@ do { if (buf_getline(line, hostsfile) == DROPBEAR_FAILURE) { - TRACE(("failed reading line: prob EOF")); + TRACE(("failed reading line: prob EOF")) break; } @@ -197,32 +197,32 @@ * buf_getfoo() past the end and die horribly - the base64 parsing * code is what tiptoes up to the end nicely */ if (line->len < (hostlen+30) ) { - TRACE(("line is too short to be sensible")); + TRACE(("line is too short to be sensible")) continue; } /* Compare hostnames */ if (strncmp(cli_opts.remotehost, buf_getptr(line, hostlen), hostlen) != 0) { - TRACE(("hosts don't match")); + TRACE(("hosts don't match")) continue; } buf_incrpos(line, hostlen); if (buf_getbyte(line) != ' ') { /* there wasn't a space after the hostname, something dodgy */ - TRACE(("missing space afte matching hostname")); + TRACE(("missing space afte matching hostname")) continue; } if ( strncmp(buf_getptr(line, algolen), algoname, algolen) != 0) { - TRACE(("algo doesn't match")); + TRACE(("algo doesn't match")) continue; } buf_incrpos(line, algolen); if (buf_getbyte(line) != ' ') { - TRACE(("missing space after algo")); + TRACE(("missing space after algo")) continue; } @@ -231,7 +231,7 @@ if (ret == DROPBEAR_SUCCESS) { /* Good matching key */ - TRACE(("good matching key")); + TRACE(("good matching key")) goto out; } @@ -244,7 +244,7 @@ /* If we get here, they said yes */ if (readonly) { - TRACE(("readonly")); + TRACE(("readonly")) goto out; } @@ -257,7 +257,7 @@ buf_putbytes(line, algoname, algolen); buf_putbyte(line, ' '); len = line->size - line->pos; - TRACE(("keybloblen %d, len %d", keybloblen, len)); + TRACE(("keybloblen %d, len %d", keybloblen, len)) /* The only failure with base64 is buffer_overflow, but buf_getwriteptr * will die horribly in the case anyway */ base64_encode(keyblob, keybloblen, buf_getwriteptr(line, len), &len); diff -r b9d3f725e00b -r 0cfba3034be5 cli-main.c --- a/cli-main.c Sun Jan 02 17:08:27 2005 +0000 +++ b/cli-main.c Sun Jan 02 20:25:56 2005 +0000 @@ -50,7 +50,7 @@ cli_getopts(argc, argv); TRACE(("user='%s' host='%s' port='%s'", cli_opts.username, - cli_opts.remotehost, cli_opts.remoteport)); + cli_opts.remotehost, cli_opts.remoteport)) if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) { dropbear_exit("signal() error"); diff -r b9d3f725e00b -r 0cfba3034be5 cli-runopts.c --- a/cli-runopts.c Sun Jan 02 17:08:27 2005 +0000 +++ b/cli-runopts.c Sun Jan 02 20:25:56 2005 +0000 @@ -116,7 +116,7 @@ #endif #ifdef ENABLE_CLI_REMOTETCPFWD if (nextisremote) { - TRACE(("nextisremote true")); + TRACE(("nextisremote true")) addforward(argv[i], &cli_opts.remotefwds); nextisremote = 0; continue; @@ -124,7 +124,7 @@ #endif #ifdef ENABLE_CLI_LOCALTCPFWD if (nextislocal) { - TRACE(("nextislocal true")); + TRACE(("nextislocal true")) addforward(argv[i], &cli_opts.localfwds); nextislocal = 0; continue; @@ -214,7 +214,7 @@ continue; /* next argument */ } else { - TRACE(("non-flag arg: '%s'", argv[i])); + TRACE(("non-flag arg: '%s'", argv[i])) /* Either the hostname or commands */ @@ -343,7 +343,7 @@ struct TCPFwdList* newfwd = NULL; char * str = NULL; - TRACE(("enter addforward")); + TRACE(("enter addforward")) /* We probably don't want to be editing argvs */ str = m_strdup(origstr); @@ -352,7 +352,7 @@ connectaddr = strchr(str, ':'); if (connectaddr == NULL) { - TRACE(("connectaddr == NULL")); + TRACE(("connectaddr == NULL")) goto fail; } @@ -361,7 +361,7 @@ connectport = strchr(connectaddr, ':'); if (connectport == NULL) { - TRACE(("connectport == NULL")); + TRACE(("connectport == NULL")) goto fail; } @@ -374,32 +374,32 @@ * the check later only checks for >= MAX_PORT */ newfwd->listenport = strtol(listenport, NULL, 10); if (errno != 0) { - TRACE(("bad listenport strtol")); + TRACE(("bad listenport strtol")) goto fail; } newfwd->connectport = strtol(connectport, NULL, 10); if (errno != 0) { - TRACE(("bad connectport strtol")); + TRACE(("bad connectport strtol")) goto fail; } newfwd->connectaddr = connectaddr; if (newfwd->listenport > 65535) { - TRACE(("listenport > 65535")); + TRACE(("listenport > 65535")) goto badport; } if (newfwd->connectport > 65535) { - TRACE(("connectport > 65535")); + TRACE(("connectport > 65535")) goto badport; } newfwd->next = *fwdlist; *fwdlist = newfwd; - TRACE(("leave addforward: done")); + TRACE(("leave addforward: done")) return; fail: diff -r b9d3f725e00b -r 0cfba3034be5 cli-service.c --- a/cli-service.c Sun Jan 02 17:08:27 2005 +0000 +++ b/cli-service.c Sun Jan 02 20:25:56 2005 +0000 @@ -33,7 +33,7 @@ void send_msg_service_request(char* servicename) { - TRACE(("enter send_msg_service_request: servicename='%s'", servicename)); + TRACE(("enter send_msg_service_request: servicename='%s'", servicename)) CHECKCLEARTOWRITE(); @@ -41,7 +41,7 @@ buf_putstring(ses.writepayload, servicename, strlen(servicename)); encrypt_packet(); - TRACE(("leave send_msg_service_request")); + TRACE(("leave send_msg_service_request")) } /* This just sets up the state variables right for the main client session loop @@ -51,7 +51,7 @@ unsigned char* servicename; unsigned int len; - TRACE(("enter recv_msg_service_accept")); + TRACE(("enter recv_msg_service_accept")) servicename = buf_getstring(ses.payload, &len); @@ -62,7 +62,7 @@ cli_ses.state = SERVICE_AUTH_ACCEPT_RCVD; m_free(servicename); - TRACE(("leave recv_msg_service_accept: done ssh-userauth")); + TRACE(("leave recv_msg_service_accept: done ssh-userauth")) return; } @@ -77,7 +77,7 @@ cli_ses.state = SERVICE_CONN_ACCEPT_RCVD; m_free(servicename); - TRACE(("leave recv_msg_service_accept: done ssh-connection")); + TRACE(("leave recv_msg_service_accept: done ssh-connection")) return; } diff -r b9d3f725e00b -r 0cfba3034be5 cli-session.c --- a/cli-session.c Sun Jan 02 17:08:27 2005 +0000 +++ b/cli-session.c Sun Jan 02 20:25:56 2005 +0000 @@ -139,7 +139,7 @@ * service, userauth and channel requests */ static void cli_sessionloop() { - TRACE(("enter cli_sessionloop")); + TRACE(("enter cli_sessionloop")) if (ses.lastpacket == SSH_MSG_KEXINIT && cli_ses.kex_state == KEX_NOTHING) { cli_ses.kex_state = KEXINIT_RCVD; @@ -151,7 +151,7 @@ * negotiation would have failed. */ send_msg_kexdh_init(); cli_ses.kex_state = KEXDH_INIT_SENT; - TRACE(("leave cli_sessionloop: done with KEXINIT_RCVD")); + TRACE(("leave cli_sessionloop: done with KEXINIT_RCVD")) return; } @@ -163,14 +163,14 @@ /* We shouldn't do anything else if a KEX is in progress */ if (cli_ses.kex_state != KEX_NOTHING) { - TRACE(("leave cli_sessionloop: kex_state != KEX_NOTHING")); + TRACE(("leave cli_sessionloop: kex_state != KEX_NOTHING")) return; } /* We should exit if we haven't donefirstkex: we shouldn't reach here * in normal operation */ if (ses.kexstate.donefirstkex == 0) { - TRACE(("XXX XXX might be bad! leave cli_sessionloop: haven't donefirstkex")); + TRACE(("XXX XXX might be bad! leave cli_sessionloop: haven't donefirstkex")) return; } @@ -181,32 +181,32 @@ * userauth */ send_msg_service_request(SSH_SERVICE_USERAUTH); cli_ses.state = SERVICE_AUTH_REQ_SENT; - TRACE(("leave cli_sessionloop: sent userauth service req")); + TRACE(("leave cli_sessionloop: sent userauth service req")) return; /* userauth code */ case SERVICE_AUTH_ACCEPT_RCVD: cli_auth_getmethods(); cli_ses.state = USERAUTH_REQ_SENT; - TRACE(("leave cli_sessionloop: sent userauth methods req")); + TRACE(("leave cli_sessionloop: sent userauth methods req")) return; case USERAUTH_FAIL_RCVD: cli_auth_try(); cli_ses.state = USERAUTH_REQ_SENT; - TRACE(("leave cli_sessionloop: cli_auth_try")); + TRACE(("leave cli_sessionloop: cli_auth_try")) return; /* case USERAUTH_SUCCESS_RCVD: send_msg_service_request(SSH_SERVICE_CONNECTION); cli_ses.state = SERVICE_CONN_REQ_SENT; - TRACE(("leave cli_sessionloop: sent ssh-connection service req")); + TRACE(("leave cli_sessionloop: sent ssh-connection service req")) return; case SERVICE_CONN_ACCEPT_RCVD: cli_send_chansess_request(); - TRACE(("leave cli_sessionloop: cli_send_chansess_request")); + TRACE(("leave cli_sessionloop: cli_send_chansess_request")) cli_ses.state = SESSION_RUNNING; return; */ @@ -219,7 +219,7 @@ setup_remotetcp(); #endif cli_send_chansess_request(); - TRACE(("leave cli_sessionloop: cli_send_chansess_request")); + TRACE(("leave cli_sessionloop: cli_send_chansess_request")) cli_ses.state = SESSION_RUNNING; return; @@ -240,7 +240,7 @@ break; } - TRACE(("leave cli_sessionloop: fell out")); + TRACE(("leave cli_sessionloop: fell out")) } diff -r b9d3f725e00b -r 0cfba3034be5 cli-tcpfwd.c --- a/cli-tcpfwd.c Sun Jan 02 17:08:27 2005 +0000 +++ b/cli-tcpfwd.c Sun Jan 02 20:25:56 2005 +0000 @@ -62,10 +62,10 @@ int ret; - TRACE(("enter setup_localtcp")); + TRACE(("enter setup_localtcp")) if (cli_opts.localfwds == NULL) { - TRACE(("cli_opts.localfwds == NULL")); + TRACE(("cli_opts.localfwds == NULL")) } while (cli_opts.localfwds != NULL) { @@ -81,7 +81,7 @@ cli_opts.localfwds = cli_opts.localfwds->next; } - TRACE(("leave setup_localtcp")); + TRACE(("leave setup_localtcp")) } @@ -105,7 +105,7 @@ if (ret == DROPBEAR_FAILURE) { m_free(tcpinfo); } - TRACE(("leave cli_localtcp: %d", ret)); + TRACE(("leave cli_localtcp: %d", ret)) return ret; } #endif /* ENABLE_CLI_LOCALTCPFWD */ @@ -113,7 +113,7 @@ #ifdef ENABLE_CLI_REMOTETCPFWD static void send_msg_global_request_remotetcp(int port) { - TRACE(("enter send_msg_global_request_remotetcp")); + TRACE(("enter send_msg_global_request_remotetcp")) CHECKCLEARTOWRITE(); buf_putbyte(ses.writepayload, SSH_MSG_GLOBAL_REQUEST); @@ -124,17 +124,17 @@ encrypt_packet(); - TRACE(("leave send_msg_global_request_remotetcp")); + TRACE(("leave send_msg_global_request_remotetcp")) } void setup_remotetcp() { struct TCPFwdList * iter = NULL; - TRACE(("enter setup_remotetcp")); + TRACE(("enter setup_remotetcp")) if (cli_opts.remotefwds == NULL) { - TRACE(("cli_opts.remotefwds == NULL")); + TRACE(("cli_opts.remotefwds == NULL")) } iter = cli_opts.remotefwds; @@ -143,7 +143,7 @@ send_msg_global_request_remotetcp(iter->listenport); iter = iter->next; } - TRACE(("leave setup_remotetcp")); + TRACE(("leave setup_remotetcp")) } static int newtcpforwarded(struct Channel * channel) { @@ -179,7 +179,7 @@ snprintf(portstring, sizeof(portstring), "%d", iter->connectport); sock = connect_remote(iter->connectaddr, portstring, 1, NULL); if (sock < 0) { - TRACE(("leave newtcpdirect: sock failed")); + TRACE(("leave newtcpdirect: sock failed")) err = SSH_OPEN_CONNECT_FAILED; goto out; } @@ -196,7 +196,7 @@ err = SSH_OPEN_IN_PROGRESS; out: - TRACE(("leave newtcpdirect: err %d", err)); + TRACE(("leave newtcpdirect: err %d", err)) return err; } #endif /* ENABLE_CLI_REMOTETCPFWD */ diff -r b9d3f725e00b -r 0cfba3034be5 common-algo.c --- a/common-algo.c Sun Jan 02 17:08:27 2005 +0000 +++ b/common-algo.c Sun Jan 02 20:25:56 2005 +0000 @@ -202,6 +202,6 @@ } str[pos]=0; /* Debug this */ - TRACE(("buf_put_algolist: %s", str)); + TRACE(("buf_put_algolist: %s", str)) buf_putstring(buf, str, pos); } diff -r b9d3f725e00b -r 0cfba3034be5 common-channel.c --- a/common-channel.c Sun Jan 02 17:08:27 2005 +0000 +++ b/common-channel.c Sun Jan 02 20:25:56 2005 +0000 @@ -81,15 +81,15 @@ unsigned int i; - TRACE(("enter chancleanup")); + TRACE(("enter chancleanup")) for (i = 0; i < ses.chansize; i++) { if (ses.channels[i] != NULL) { - TRACE(("channel %d closing", i)); + TRACE(("channel %d closing", i)) removechannel(ses.channels[i]); } } m_free(ses.channels); - TRACE(("leave chancleanup")); + TRACE(("leave chancleanup")) } /* Create a new channel entry, send a reply confirm or failure */ @@ -103,7 +103,7 @@ struct Channel * newchan; unsigned int i, j; - TRACE(("enter newchannel")); + TRACE(("enter newchannel")) /* first see if we can use existing channels */ for (i = 0; i < ses.chansize; i++) { @@ -115,7 +115,7 @@ /* otherwise extend the list */ if (i == ses.chansize) { if (ses.chansize >= MAX_CHANNELS) { - TRACE(("leave newchannel: max chans reached")); + TRACE(("leave newchannel: max chans reached")) return NULL; } @@ -157,7 +157,7 @@ ses.channels[i] = newchan; ses.chancount++; - TRACE(("leave newchannel")); + TRACE(("leave newchannel")) return newchan; } @@ -246,13 +246,13 @@ /* do all the EOF/close type stuff checking for a channel */ static void checkclose(struct Channel *channel) { - TRACE(("checkclose: infd %d, outfd %d, errfd %d, sentclosed %d, recvclosed %d", + TRACE(("checkclose: infd %d, outfd %d, errfd %d, sentclosed %d, recvclosed %d", channel->infd, channel->outfd, - channel->errfd, channel->sentclosed, channel->recvclosed)); + channel->errfd, channel->sentclosed, channel->recvclosed)) TRACE(("writebuf %d extrabuf %s extrabuf %d", cbuf_getused(channel->writebuf), channel->writebuf, - channel->writebuf ? 0 : cbuf_getused(channel->extrabuf))); + channel->writebuf ? 0 : cbuf_getused(channel->extrabuf))) if (!channel->sentclosed) { @@ -289,7 +289,7 @@ */ if (channel->recvclosed) { if (! channel->sentclosed) { - TRACE(("Sending MSG_CHANNEL_CLOSE in response to same.")); + TRACE(("Sending MSG_CHANNEL_CLOSE in response to same.")) send_msg_channel_close(channel); } removechannel(channel); @@ -306,7 +306,7 @@ int val; socklen_t vallen = sizeof(val); - TRACE(("enter checkinitdone")); + TRACE(("enter checkinitdone")) if (getsockopt(channel->infd, SOL_SOCKET, SO_ERROR, &val, &vallen) || val != 0) { @@ -314,13 +314,13 @@ SSH_OPEN_CONNECT_FAILED, "", ""); close(channel->infd); deletechannel(channel); - TRACE(("leave checkinitdone: fail")); + TRACE(("leave checkinitdone: fail")) } else { send_msg_channel_open_confirmation(channel, channel->recvwindow, channel->recvmaxpacket); channel->outfd = channel->infd; channel->initconn = 0; - TRACE(("leave checkinitdone: success")); + TRACE(("leave checkinitdone: success")) } } @@ -329,7 +329,7 @@ /* Send the close message and set the channel as closed */ static void send_msg_channel_close(struct Channel *channel) { - TRACE(("enter send_msg_channel_close")); + TRACE(("enter send_msg_channel_close")) /* XXX server */ if (channel->type->closehandler) { channel->type->closehandler(channel); @@ -344,13 +344,13 @@ channel->senteof = 1; channel->sentclosed = 1; - TRACE(("leave send_msg_channel_close")); + TRACE(("leave send_msg_channel_close")) } /* call this when trans/eof channels are closed */ static void send_msg_channel_eof(struct Channel *channel) { - TRACE(("enter send_msg_channel_eof")); + TRACE(("enter send_msg_channel_eof")) CHECKCLEARTOWRITE(); buf_putbyte(ses.writepayload, SSH_MSG_CHANNEL_EOF); @@ -360,7 +360,7 @@ channel->senteof = 1; - TRACE(("leave send_msg_channel_eof")); + TRACE(("leave send_msg_channel_eof")) } /* Called to write data out to the local side of the channel. @@ -370,7 +370,7 @@ int len, maxlen; - TRACE(("enter writechannel")); + TRACE(("enter writechannel")) maxlen = cbuf_readlen(cbuf); @@ -382,7 +382,7 @@ * that's a nasty failure too */ closeinfd(channel); } - TRACE(("leave writechannel: len <= 0")); + TRACE(("leave writechannel: len <= 0")) return; } @@ -392,7 +392,7 @@ if (fd == channel->infd && len == maxlen && channel->recveof) { /* Check if we're closing up */ closeinfd(channel); - TRACE(("leave writechannel: recveof set")); + TRACE(("leave writechannel: recveof set")) return; } @@ -410,7 +410,7 @@ channel->recvwindow <= cbuf_getavail(channel->extrabuf)); - TRACE(("leave writechannel")); + TRACE(("leave writechannel")) } /* Set the file descriptors for the main select in session.c @@ -444,7 +444,7 @@ TRACE(("infd = %d, outfd %d, errfd %d, bufused %d", channel->infd, channel->outfd, channel->errfd, - cbuf_getused(channel->writebuf) )); + cbuf_getused(channel->writebuf) )) if (channel->infd >= 0 && channel->infd != channel->outfd) { FD_SET(channel->infd, readfd); } @@ -477,7 +477,7 @@ unsigned int chan; struct Channel * channel; - TRACE(("enter recv_msg_channel_eof")); + TRACE(("enter recv_msg_channel_eof")) chan = buf_getint(ses.payload); channel = getchannel(chan); @@ -493,7 +493,7 @@ closeinfd(channel); } - TRACE(("leave recv_msg_channel_eof")); + TRACE(("leave recv_msg_channel_eof")) } @@ -503,10 +503,10 @@ unsigned int chan; struct Channel * channel; - TRACE(("enter recv_msg_channel_close")); + TRACE(("enter recv_msg_channel_close")) chan = buf_getint(ses.payload); - TRACE(("close channel = %d", chan)); + TRACE(("close channel = %d", chan)) channel = getchannel(chan); if (channel == NULL) { @@ -521,15 +521,15 @@ removechannel(channel); } - TRACE(("leave recv_msg_channel_close")); + TRACE(("leave recv_msg_channel_close")) } /* Remove a channel entry, this is only executed after both sides have sent * channel close */ static void removechannel(struct Channel * channel) { - TRACE(("enter removechannel")); - TRACE(("channel index is %d", channel->index)); + TRACE(("enter removechannel")) + TRACE(("channel index is %d", channel->index)) cbuf_free(channel->writebuf); channel->writebuf = NULL; @@ -550,7 +550,7 @@ deletechannel(channel); - TRACE(("leave removechannel")); + TRACE(("leave removechannel")) } /* Remove a channel entry */ @@ -570,7 +570,7 @@ unsigned int chan; struct Channel *channel; - TRACE(("enter recv_msg_channel_request")); + TRACE(("enter recv_msg_channel_request")) chan = buf_getint(ses.payload); channel = getchannel(chan); @@ -586,7 +586,7 @@ send_msg_channel_failure(channel); } - TRACE(("leave recv_msg_channel_request")); + TRACE(("leave recv_msg_channel_request")) } @@ -603,8 +603,8 @@ unsigned int maxlen; int fd; -/* TRACE(("enter send_msg_channel_data")); - TRACE(("extended = %d type = %d", isextended, exttype));*/ +/* TRACE(("enter send_msg_channel_data")) + TRACE(("extended = %d type = %d", isextended, exttype))*/ CHECKCLEARTOWRITE(); @@ -623,14 +623,14 @@ maxlen = MIN(maxlen, ses.writepayload->size - 1 - 4 - 4 - (isextended ? 4 : 0)); if (maxlen == 0) { - TRACE(("leave send_msg_channel_data: no window")); + TRACE(("leave send_msg_channel_data: no window")) return; /* the data will get written later */ } /* read the data */ - TRACE(("maxlen %d", maxlen)); + TRACE(("maxlen %d", maxlen)) buf = buf_new(maxlen); - TRACE(("buf pos %d data %x", buf->pos, buf->data)); + TRACE(("buf pos %d data %x", buf->pos, buf->data)) len = read(fd, buf_getwriteptr(buf, maxlen), maxlen); if (len <= 0) { /* on error/eof, send eof */ @@ -660,7 +660,7 @@ channel->transwindow -= len; encrypt_packet(); - TRACE(("leave send_msg_channel_data")); + TRACE(("leave send_msg_channel_data")) } /* We receive channel data */ @@ -689,7 +689,7 @@ unsigned int buflen; unsigned int len; - TRACE(("enter recv_msg_channel_data")); + TRACE(("enter recv_msg_channel_data")) if (channel->recveof) { dropbear_exit("received data after eof"); @@ -730,7 +730,7 @@ channel->recvwindow -= datalen; assert(channel->recvwindow <= RECV_MAXWINDOW); - TRACE(("leave recv_msg_channel_data")); + TRACE(("leave recv_msg_channel_data")) } /* Increment the outgoing data window for a channel - the remote end limits @@ -750,7 +750,7 @@ } incr = buf_getint(ses.payload); - TRACE(("received window increment %d", incr)); + TRACE(("received window increment %d", incr)) incr = MIN(incr, MAX_TRANS_WIN_INCR); channel->transwindow += incr; @@ -763,7 +763,7 @@ static void send_msg_channel_window_adjust(struct Channel* channel, unsigned int incr) { - TRACE(("sending window adjust %d", incr)); + TRACE(("sending window adjust %d", incr)) CHECKCLEARTOWRITE(); buf_putbyte(ses.writepayload, SSH_MSG_CHANNEL_WINDOW_ADJUST); @@ -787,7 +787,7 @@ int ret; - TRACE(("enter recv_msg_channel_open")); + TRACE(("enter recv_msg_channel_open")) /* get the packet contents */ type = buf_getstring(ses.payload, &typelen); @@ -815,17 +815,17 @@ } if (chantype == NULL) { - TRACE(("No matching type for '%s'", type)); + TRACE(("No matching type for '%s'", type)) goto failure; } - TRACE(("matched type '%s'", type)); + TRACE(("matched type '%s'", type)) /* create the channel */ channel = newchannel(remotechan, chantype, transwindow, transmaxpacket); if (channel == NULL) { - TRACE(("newchannel returned NULL")); + TRACE(("newchannel returned NULL")) goto failure; } @@ -838,7 +838,7 @@ } errtype = ret; deletechannel(channel); - TRACE(("inithandler returned failure %d", ret)); + TRACE(("inithandler returned failure %d", ret)) goto failure; } } @@ -849,39 +849,39 @@ goto cleanup; failure: - TRACE(("recv_msg_channel_open failure")); + TRACE(("recv_msg_channel_open failure")) send_msg_channel_open_failure(remotechan, errtype, "", ""); cleanup: m_free(type); - TRACE(("leave recv_msg_channel_open")); + TRACE(("leave recv_msg_channel_open")) } /* Send a failure message */ void send_msg_channel_failure(struct Channel *channel) { - TRACE(("enter send_msg_channel_failure")); + TRACE(("enter send_msg_channel_failure")) CHECKCLEARTOWRITE(); buf_putbyte(ses.writepayload, SSH_MSG_CHANNEL_FAILURE); buf_putint(ses.writepayload, channel->remotechan); encrypt_packet(); - TRACE(("leave send_msg_channel_failure")); + TRACE(("leave send_msg_channel_failure")) } /* Send a success message */ void send_msg_channel_success(struct Channel *channel) { - TRACE(("enter send_msg_channel_success")); + TRACE(("enter send_msg_channel_success")) CHECKCLEARTOWRITE(); buf_putbyte(ses.writepayload, SSH_MSG_CHANNEL_SUCCESS); buf_putint(ses.writepayload, channel->remotechan); encrypt_packet(); - TRACE(("leave send_msg_channel_success")); + TRACE(("leave send_msg_channel_success")) } /* Send a channel open failure message, with a corresponding reason @@ -889,7 +889,7 @@ static void send_msg_channel_open_failure(unsigned int remotechan, int reason, const unsigned char *text, const unsigned char *lang) { - TRACE(("enter send_msg_channel_open_failure")); + TRACE(("enter send_msg_channel_open_failure")) CHECKCLEARTOWRITE(); buf_putbyte(ses.writepayload, SSH_MSG_CHANNEL_OPEN_FAILURE); @@ -899,7 +899,7 @@ buf_putstring(ses.writepayload, lang, strlen((char*)lang)); encrypt_packet(); - TRACE(("leave send_msg_channel_open_failure")); + TRACE(("leave send_msg_channel_open_failure")) } /* Confirm a channel open, and let the remote end know what number we've @@ -908,7 +908,7 @@ unsigned int recvwindow, unsigned int recvmaxpacket) { - TRACE(("enter send_msg_channel_open_confirmation")); + TRACE(("enter send_msg_channel_open_confirmation")) CHECKCLEARTOWRITE(); buf_putbyte(ses.writepayload, SSH_MSG_CHANNEL_OPEN_CONFIRMATION); @@ -918,7 +918,7 @@ buf_putint(ses.writepayload, recvmaxpacket); encrypt_packet(); - TRACE(("leave send_msg_channel_open_confirmation")); + TRACE(("leave send_msg_channel_open_confirmation")) } #if defined(USING_LISTENERS) || defined(DROPBEAR_CLIENT) @@ -931,10 +931,10 @@ struct Channel* chan; - TRACE(("enter send_msg_channel_open_init()")); + TRACE(("enter send_msg_channel_open_init()")) chan = newchannel(0, type, 0, 0); if (!chan) { - TRACE(("leave send_msg_channel_open_init() - FAILED in newchannel()")); + TRACE(("leave send_msg_channel_open_init() - FAILED in newchannel()")) return DROPBEAR_FAILURE; } @@ -953,7 +953,7 @@ buf_putint(ses.writepayload, RECV_MAXWINDOW); buf_putint(ses.writepayload, RECV_MAXPACKET); - TRACE(("leave send_msg_channel_open_init()")); + TRACE(("leave send_msg_channel_open_init()")) return DROPBEAR_SUCCESS; } @@ -965,7 +965,7 @@ struct Channel * channel; int ret; - TRACE(("enter recv_msg_channel_open_confirmation")); + TRACE(("enter recv_msg_channel_open_confirmation")) chan = buf_getint(ses.payload); channel = getchannel(chan); @@ -977,19 +977,19 @@ channel->transwindow = buf_getint(ses.payload); channel->transmaxpacket = buf_getint(ses.payload); - TRACE(("new chan remote %d localho %d", channel->remotechan, chan)); + TRACE(("new chan remote %d localho %d", channel->remotechan, chan)) /* Run the inithandler callback */ if (channel->type->inithandler) { ret = channel->type->inithandler(channel); if (ret > 0) { removechannel(channel); - TRACE(("inithandler returned failure %d", ret)); + TRACE(("inithandler returned failure %d", ret)) } } - TRACE(("leave recv_msg_channel_open_confirmation")); + TRACE(("leave recv_msg_channel_open_confirmation")) } /* Notification that our channel open request failed */ @@ -1013,17 +1013,17 @@ /* don't close it if it is the same as infd, * unless infd is already set -1 */ - TRACE(("enter closeoutfd")); + TRACE(("enter closeoutfd")) closechanfd(channel, fd, 0); - TRACE(("leave closeoutfd")); + TRACE(("leave closeoutfd")) } /* close a stdin fd */ static void closeinfd(struct Channel * channel) { - TRACE(("enter closeinfd")); + TRACE(("enter closeinfd")) closechanfd(channel, channel->infd, 1); - TRACE(("leave closeinfd")); + TRACE(("leave closeinfd")) } /* close a fd, how is 0 for stdout/stderr, 1 for stdin */ diff -r b9d3f725e00b -r 0cfba3034be5 common-kex.c --- a/common-kex.c Sun Jan 02 17:08:27 2005 +0000 +++ b/common-kex.c Sun Jan 02 20:25:56 2005 +0000 @@ -114,8 +114,8 @@ encrypt_packet(); ses.dataallowed = 0; /* don't send other packets during kex */ - TRACE(("DATAALLOWED=0")); - TRACE(("-> KEXINIT")); + TRACE(("DATAALLOWED=0")) + TRACE(("-> KEXINIT")) ses.kexstate.sentkexinit = 1; } @@ -128,7 +128,7 @@ /* Bring new keys into use after a key exchange, and let the client know*/ void send_msg_newkeys() { - TRACE(("enter send_msg_newkeys")); + TRACE(("enter send_msg_newkeys")) /* generate the kexinit request */ CHECKCLEARTOWRITE(); @@ -138,42 +138,42 @@ /* set up our state */ if (ses.kexstate.recvnewkeys) { - TRACE(("while RECVNEWKEYS=1")); + TRACE(("while RECVNEWKEYS=1")) gen_new_keys(); kexinitialise(); /* we've finished with this kex */ - TRACE((" -> DATAALLOWED=1")); + TRACE((" -> DATAALLOWED=1")) ses.dataallowed = 1; /* we can send other packets again now */ ses.kexstate.donefirstkex = 1; } else { ses.kexstate.sentnewkeys = 1; - TRACE(("SENTNEWKEYS=1")); + TRACE(("SENTNEWKEYS=1")) } - TRACE(("-> MSG_NEWKEYS")); - TRACE(("leave send_msg_newkeys")); + TRACE(("-> MSG_NEWKEYS")) + TRACE(("leave send_msg_newkeys")) } /* Bring the new keys into use after a key exchange */ void recv_msg_newkeys() { - TRACE(("<- MSG_NEWKEYS")); - TRACE(("enter recv_msg_newkeys")); + TRACE(("<- MSG_NEWKEYS")) + TRACE(("enter recv_msg_newkeys")) /* simply check if we've sent SSH_MSG_NEWKEYS, and if so, * switch to the new keys */ if (ses.kexstate.sentnewkeys) { - TRACE(("while SENTNEWKEYS=1")); + TRACE(("while SENTNEWKEYS=1")) gen_new_keys(); kexinitialise(); /* we've finished with this kex */ - TRACE((" -> DATAALLOWED=1")); + TRACE((" -> DATAALLOWED=1")) ses.dataallowed = 1; /* we can send other packets again now */ ses.kexstate.donefirstkex = 1; } else { - TRACE(("RECVNEWKEYS=1")); + TRACE(("RECVNEWKEYS=1")) ses.kexstate.recvnewkeys = 1; } - TRACE(("leave recv_msg_newkeys")); + TRACE(("leave recv_msg_newkeys")) } @@ -189,7 +189,7 @@ struct timeval tv; - TRACE(("kexinitialise()")); + TRACE(("kexinitialise()")) /* sent/recv'd MSG_KEXINIT */ ses.kexstate.sentkexinit = 0; @@ -262,7 +262,7 @@ unsigned int C2S_keysize, S2C_keysize; char mactransletter, macrecvletter; /* Client or server specific */ - TRACE(("enter gen_new_keys")); + TRACE(("enter gen_new_keys")) /* the dh_K and hash are the start of all hashes, we make use of that */ sha1_init(&hs); @@ -329,7 +329,7 @@ ses.keys = ses.newkeys; ses.newkeys = NULL; - TRACE(("leave gen_new_keys")); + TRACE(("leave gen_new_keys")) } #ifndef DISABLE_ZLIB @@ -393,8 +393,8 @@ /* Belongs in common_kex.c where it should be moved after review */ void recv_msg_kexinit() { - TRACE(("<- KEXINIT")); - TRACE(("enter recv_msg_kexinit")); + TRACE(("<- KEXINIT")) + TRACE(("enter recv_msg_kexinit")) /* start the kex hash */ ses.kexhashbuf = buf_new(MAX_KEXHASHBUF); @@ -402,7 +402,7 @@ if (!ses.kexstate.sentkexinit) { /* we need to send a kex packet */ send_msg_kexinit(); - TRACE(("continue recv_msg_kexinit: sent kexinit")); + TRACE(("continue recv_msg_kexinit: sent kexinit")) } @@ -459,7 +459,7 @@ ses.kexstate.recvkexinit = 1; // ses.expecting = 0; // client matt - TRACE(("leave recv_msg_kexinit")); + TRACE(("leave recv_msg_kexinit")) } /* Initialises and generate one side of the diffie-hellman key exchange values. @@ -473,7 +473,7 @@ unsigned char randbuf[DH_P_LEN]; int dh_q_len; - TRACE(("enter send_msg_kexdh_reply")); + TRACE(("enter send_msg_kexdh_reply")) m_mp_init_multi(&dh_g, &dh_p, &dh_q, NULL); @@ -619,7 +619,7 @@ erralgo = "kex"; goto error; } - TRACE(("kex algo %s", algo->name)); + TRACE(("kex algo %s", algo->name)) ses.newkeys->algo_kex = algo->val; /* server_host_key_algorithms */ @@ -629,7 +629,7 @@ erralgo = "hostkey"; goto error; } - TRACE(("hostkey algo %s", algo->name)); + TRACE(("hostkey algo %s", algo->name)) ses.newkeys->algo_hostkey = algo->val; /* encryption_algorithms_client_to_server */ @@ -638,7 +638,7 @@ erralgo = "enc c->s"; goto error; } - TRACE(("c2s is %s", c2s_cipher_algo->name)); + TRACE(("c2s is %s", c2s_cipher_algo->name)) /* encryption_algorithms_server_to_client */ s2c_cipher_algo = ses.buf_match_algo(ses.payload, sshciphers, &goodguess); @@ -646,7 +646,7 @@ erralgo = "enc s->c"; goto error; } - TRACE(("s2c is %s", s2c_cipher_algo->name)); + TRACE(("s2c is %s", s2c_cipher_algo->name)) /* mac_algorithms_client_to_server */ c2s_hash_algo = ses.buf_match_algo(ses.payload, sshhashes, &goodguess); @@ -717,12 +717,12 @@ ses.newkeys->trans_algo_comp = s2c_comp_algo->val; } - TRACE(("enc algo recv %s", algo->name)); - TRACE(("enc algo trans %s", algo->name)); - TRACE(("mac algo recv %s", algo->name)); - TRACE(("mac algo trans %s", algo->name)); - TRACE(("comp algo recv %s", algo->name)); - TRACE(("comp algo trans %s", algo->name)); + TRACE(("enc algo recv %s", algo->name)) + TRACE(("enc algo trans %s", algo->name)) + TRACE(("mac algo recv %s", algo->name)) + TRACE(("mac algo trans %s", algo->name)) + TRACE(("comp algo recv %s", algo->name)) + TRACE(("comp algo trans %s", algo->name)) /* reserved for future extensions */ buf_getint(ses.payload); diff -r b9d3f725e00b -r 0cfba3034be5 common-session.c --- a/common-session.c Sun Jan 02 17:08:27 2005 +0000 +++ b/common-session.c Sun Jan 02 20:25:56 2005 +0000 @@ -52,7 +52,7 @@ /* called only at the start of a session, set up initial state */ void common_session_init(int sock, char* remotehost) { - TRACE(("enter session_init")); + TRACE(("enter session_init")) ses.remotehost = remotehost; @@ -110,7 +110,7 @@ ses.allowprivport = 0; - TRACE(("leave session_init")); + TRACE(("leave session_init")) } void session_loop(void(*loophandler)()) { @@ -162,7 +162,7 @@ if (val == 0) { /* timeout */ - TRACE(("select timeout")); + TRACE(("select timeout")) continue; } @@ -201,11 +201,11 @@ /* clean up a session on exit */ void common_session_cleanup() { - TRACE(("enter session_cleanup")); + TRACE(("enter session_cleanup")) /* we can't cleanup if we don't know the session state */ if (!sessinitdone) { - TRACE(("leave session_cleanup: !sessinitdone")); + TRACE(("leave session_cleanup: !sessinitdone")) return; } @@ -215,7 +215,7 @@ chancleanup(); - TRACE(("leave session_cleanup")); + TRACE(("leave session_cleanup")) } @@ -252,7 +252,7 @@ } if (!done) { - TRACE(("err: %s for '%s'\n", strerror(errno), linebuf)); + TRACE(("err: %s for '%s'\n", strerror(errno), linebuf)) dropbear_exit("Failed to get remote version"); } else { /* linebuf is already null terminated */ @@ -260,7 +260,7 @@ memcpy(ses.remoteident, linebuf, len); } - TRACE(("remoteident: %s", ses.remoteident)); + TRACE(("remoteident: %s", ses.remoteident)) } @@ -274,7 +274,7 @@ fd_set fds; struct timeval timeout; - TRACE(("enter ident_readln")); + TRACE(("enter ident_readln")) if (count < 1) { return -1; @@ -295,7 +295,7 @@ if (errno == EINTR) { continue; } - TRACE(("leave ident_readln: select error")); + TRACE(("leave ident_readln: select error")) return -1; } @@ -313,12 +313,12 @@ if (errno == EINTR) { continue; /* not a real error */ } - TRACE(("leave ident_readln: read error")); + TRACE(("leave ident_readln: read error")) return -1; } if (num == 0) { /* EOF */ - TRACE(("leave ident_readln: EOF")); + TRACE(("leave ident_readln: EOF")) return -1; } if (in == '\n') { @@ -334,7 +334,7 @@ } buf[pos] = '\0'; - TRACE(("leave ident_readln: return %d", pos+1)); + TRACE(("leave ident_readln: return %d", pos+1)) return pos+1; } @@ -363,7 +363,7 @@ if (!ses.kexstate.sentkexinit && (secs - ses.kexstate.lastkextime >= KEX_REKEY_TIMEOUT || ses.kexstate.datarecv+ses.kexstate.datatrans >= KEX_REKEY_DATA)){ - TRACE(("rekeying after timeout or max data reached")); + TRACE(("rekeying after timeout or max data reached")) send_msg_kexinit(); } } diff -r b9d3f725e00b -r 0cfba3034be5 dbutil.c --- a/dbutil.c Sun Jan 02 17:08:27 2005 +0000 +++ b/dbutil.c Sun Jan 02 20:25:56 2005 +0000 @@ -164,17 +164,17 @@ int val; int sock; - TRACE(("enter dropbear_listen")); + TRACE(("enter dropbear_listen")) memset(&hints, 0, sizeof(hints)); hints.ai_family = AF_UNSPEC; /* TODO: let them flag v4 only etc */ hints.ai_socktype = SOCK_STREAM; if (address && address[0] == '\0') { - TRACE(("dropbear_listen: local loopback")); + TRACE(("dropbear_listen: local loopback")) address = NULL; } else { - TRACE(("dropbear_listen: not local loopback")); + TRACE(("dropbear_listen: not local loopback")) hints.ai_flags = AI_PASSIVE; } err = getaddrinfo(address, port, &hints, &res0); @@ -186,7 +186,7 @@ *errstring = (char*)m_malloc(len); snprintf(*errstring, len, "Error resolving: %s", gai_strerror(err)); } - TRACE(("leave dropbear_listen: failed resolving")); + TRACE(("leave dropbear_listen: failed resolving")) return -1; } @@ -203,7 +203,7 @@ if (sock < 0) { err = errno; - TRACE(("socket() failed")); + TRACE(("socket() failed")) continue; } @@ -221,14 +221,14 @@ if (bind(sock, res->ai_addr, res->ai_addrlen) < 0) { err = errno; close(sock); - TRACE(("bind(%s) failed", port)); + TRACE(("bind(%s) failed", port)) continue; } if (listen(sock, 20) < 0) { err = errno; close(sock); - TRACE(("listen() failed")); + TRACE(("listen() failed")) continue; } @@ -243,12 +243,12 @@ len = 20 + strlen(strerror(err)); *errstring = (char*)m_malloc(len); snprintf(*errstring, len, "Error listening: %s", strerror(err)); - TRACE(("leave dropbear_listen: failure, %s", strerror(err))); + TRACE(("leave dropbear_listen: failure, %s", strerror(err))) return -1; } } - TRACE(("leave dropbear_listen: success, %d socks bound", nsock)); + TRACE(("leave dropbear_listen: success, %d socks bound", nsock)) return nsock; } @@ -264,7 +264,7 @@ int sock; int err; - TRACE(("enter connect_remote")); + TRACE(("enter connect_remote")) if (errstring != NULL) { *errstring = NULL; @@ -282,7 +282,7 @@ *errstring = (char*)m_malloc(len); snprintf(*errstring, len, "Error resolving: %s", gai_strerror(err)); } - TRACE(("Error resolving: %s", gai_strerror(err))); + TRACE(("Error resolving: %s", gai_strerror(err))) return -1; } @@ -303,14 +303,14 @@ if (errstring != NULL && *errstring == NULL) { *errstring = m_strdup("Failed non-blocking"); } - TRACE(("Failed non-blocking: %s", strerror(errno))); + TRACE(("Failed non-blocking: %s", strerror(errno))) continue; } } if (connect(sock, res->ai_addr, res->ai_addrlen) < 0) { if (errno == EINPROGRESS && nonblocking) { - TRACE(("Connect in progress")); + TRACE(("Connect in progress")) break; } else { err = errno; @@ -331,7 +331,7 @@ *errstring = (char*)m_malloc(len); snprintf(*errstring, len, "Error connecting: %s", strerror(err)); } - TRACE(("Error connecting: %s", strerror(err))); + TRACE(("Error connecting: %s", strerror(err))) } else { /* Success */ /* (err is used as a dummy var here) */ @@ -343,7 +343,7 @@ m_free(*errstring); } - TRACE(("leave connect_remote: sock %d\n", sock)); + TRACE(("leave connect_remote: sock %d\n", sock)) return sock; } @@ -503,7 +503,7 @@ int c = EOF; - TRACE(("enter buf_getline")); + TRACE(("enter buf_getline")) buf_setpos(line, 0); buf_setlen(line, 0); @@ -518,7 +518,7 @@ buf_putbyte(line, (unsigned char)c); } - TRACE(("leave getauthline: line too long")); + TRACE(("leave getauthline: line too long")) /* We return success, but the line length will be zeroed - ie we just * ignore that line */ buf_setlen(line, 0); @@ -528,10 +528,10 @@ /* if we didn't read anything before EOF or error, exit */ if (c == EOF && line->pos == 0) { - TRACE(("leave buf_getline: failure")); + TRACE(("leave buf_getline: failure")) return DROPBEAR_FAILURE; } else { - TRACE(("leave buf_getline: success")); + TRACE(("leave buf_getline: success")) buf_setpos(line, 0); return DROPBEAR_SUCCESS; } @@ -618,10 +618,10 @@ void setnonblocking(int fd) { - TRACE(("setnonblocking: %d", fd)); + TRACE(("setnonblocking: %d", fd)) if (fcntl(fd, F_SETFL, O_NONBLOCK) < 0) { dropbear_exit("Couldn't set nonblocking"); } - TRACE(("leave setnonblocking")); + TRACE(("leave setnonblocking")) } diff -r b9d3f725e00b -r 0cfba3034be5 debug.h --- a/debug.h Sun Jan 02 17:08:27 2005 +0000 +++ b/debug.h Sun Jan 02 20:25:56 2005 +0000 @@ -39,7 +39,7 @@ * Caution: Don't use this in an unfriendly environment (ie unfirewalled), * since the printing may not sanitise strings etc. This will add a reasonable * amount to your executable size. */ -/* #define DEBUG_TRACE */ + //#define DEBUG_TRACE /* All functions writing to the cleartext payload buffer call * CHECKCLEARTOWRITE() before writing. This is only really useful if you're @@ -60,7 +60,7 @@ /* you don't need to touch this block */ #ifdef DEBUG_TRACE -#define TRACE(X) (dropbear_trace X) +#define TRACE(X) dropbear_trace X; #else /*DEBUG_TRACE*/ #define TRACE(X) #endif /*DEBUG_TRACE*/ diff -r b9d3f725e00b -r 0cfba3034be5 dropbearkey.c --- a/dropbearkey.c Sun Jan 02 17:08:27 2005 +0000 +++ b/dropbearkey.c Sun Jan 02 20:25:56 2005 +0000 @@ -166,13 +166,13 @@ #ifdef DROPBEAR_RSA if (strncmp(typetext, "rsa", 3) == 0) { keytype = DROPBEAR_SIGNKEY_RSA; - TRACE(("type is rsa")); + TRACE(("type is rsa")) } #endif #ifdef DROPBEAR_DSS if (strncmp(typetext, "dss", 3) == 0) { keytype = DROPBEAR_SIGNKEY_DSS; - TRACE(("type is dss")); + TRACE(("type is dss")) } #endif } diff -r b9d3f725e00b -r 0cfba3034be5 dss.c --- a/dss.c Sun Jan 02 17:08:27 2005 +0000 +++ b/dss.c Sun Jan 02 20:25:56 2005 +0000 @@ -45,7 +45,7 @@ * Returns DROPBEAR_SUCCESS or DROPBEAR_FAILURE */ int buf_get_dss_pub_key(buffer* buf, dss_key *key) { - TRACE(("enter buf_get_dss_pub_key")); + TRACE(("enter buf_get_dss_pub_key")) assert(key != NULL); key->p = m_malloc(sizeof(mp_int)); key->q = m_malloc(sizeof(mp_int)); @@ -59,17 +59,17 @@ || buf_getmpint(buf, key->q) == DROPBEAR_FAILURE || buf_getmpint(buf, key->g) == DROPBEAR_FAILURE || buf_getmpint(buf, key->y) == DROPBEAR_FAILURE) { - TRACE(("leave buf_get_dss_pub_key: failed reading mpints")); + TRACE(("leave buf_get_dss_pub_key: failed reading mpints")) return DROPBEAR_FAILURE; } if (mp_count_bits(key->p) < MIN_DSS_KEYLEN) { dropbear_log(LOG_WARNING, "DSS key too short"); - TRACE(("leave buf_get_dss_pub_key: short key")); + TRACE(("leave buf_get_dss_pub_key: short key")) return DROPBEAR_FAILURE; } - TRACE(("leave buf_get_dss_pub_key: success")); + TRACE(("leave buf_get_dss_pub_key: success")) return DROPBEAR_SUCCESS; } @@ -98,9 +98,9 @@ /* Clear and free the memory used by a public or private key */ void dss_key_free(dss_key *key) { - TRACE(("enter dsa_key_free")); + TRACE(("enter dsa_key_free")) if (key == NULL) { - TRACE(("enter dsa_key_free: key == NULL")); + TRACE(("enter dsa_key_free: key == NULL")) return; } if (key->p) { @@ -124,7 +124,7 @@ m_free(key->x); } m_free(key); - TRACE(("leave dsa_key_free")); + TRACE(("leave dsa_key_free")) } /* put the dss public key into the buffer in the required format: @@ -171,7 +171,7 @@ char * string = NULL; int stringlen; - TRACE(("enter buf_dss_verify")); + TRACE(("enter buf_dss_verify")) assert(key != NULL); m_mp_init_multi(&val1, &val2, &val3, &val4, NULL); @@ -195,7 +195,7 @@ goto out; } if (mp_cmp(&val1, key->q) != MP_LT) { - TRACE(("verify failed, s' >= q")); + TRACE(("verify failed, s' >= q")) goto out; } /* let val2 = w = (s')^-1 mod q*/ @@ -220,7 +220,7 @@ goto out; } if (mp_cmp(&val1, key->q) != MP_LT) { - TRACE(("verify failed, r' >= q")); + TRACE(("verify failed, r' >= q")) goto out; } /* let val4 = u2 = ((r')w) mod q */ @@ -315,7 +315,7 @@ DEF_MP_INT(dss_s); hash_state hs; - TRACE(("enter buf_put_dss_sign")); + TRACE(("enter buf_put_dss_sign")) assert(key != NULL); /* hash the data */ @@ -422,7 +422,7 @@ /* create the signature to return */ - TRACE(("leave buf_put_dss_sign")); + TRACE(("leave buf_put_dss_sign")) } #endif /* DROPBEAR_DSS */ diff -r b9d3f725e00b -r 0cfba3034be5 listener.c --- a/listener.c Sun Jan 02 17:08:27 2005 +0000 +++ b/listener.c Sun Jan 02 20:25:56 2005 +0000 @@ -93,7 +93,7 @@ /* or create a new one */ if (i == ses.listensize) { if (ses.listensize > MAX_LISTENERS) { - TRACE(("leave newlistener: too many already")); + TRACE(("leave newlistener: too many already")) for (j = 0; j < nsocks; j++) { close(socks[i]); } @@ -115,7 +115,7 @@ ses.maxfd = MAX(ses.maxfd, socks[j]); } - TRACE(("new listener num %d ", i)); + TRACE(("new listener num %d ", i)) newlisten = (struct Listener*)m_malloc(sizeof(struct Listener)); newlisten->index = i; diff -r b9d3f725e00b -r 0cfba3034be5 packet.c --- a/packet.c Sun Jan 02 17:08:27 2005 +0000 +++ b/packet.c Sun Jan 02 20:25:56 2005 +0000 @@ -52,7 +52,7 @@ int len, written; buffer * writebuf = NULL; - TRACE(("enter write_packet")); + TRACE(("enter write_packet")) assert(!isempty(&ses.writequeue)); /* Get the next buffer in the queue of encrypted packets to write*/ @@ -65,7 +65,7 @@ if (written < 0) { if (errno == EINTR) { - TRACE(("leave writepacket: EINTR")); + TRACE(("leave writepacket: EINTR")) return; } else { dropbear_exit("error writing"); @@ -86,7 +86,7 @@ buf_incrpos(writebuf, written); } - TRACE(("leave write_packet")); + TRACE(("leave write_packet")) } /* Non-blocking function reading available portion of a packet into the @@ -98,7 +98,7 @@ unsigned int maxlen; unsigned char blocksize; - TRACE(("enter read_packet")); + TRACE(("enter read_packet")) blocksize = ses.keys->recv_algo_crypt->blocksize; if (ses.readbuf == NULL || ses.readbuf->len < blocksize) { @@ -111,7 +111,7 @@ /* If we don't have the length of decryptreadbuf, we didn't read * a whole blocksize and should exit */ if (ses.decryptreadbuf->len == 0) { - TRACE(("leave read_packet: packetinit done")); + TRACE(("leave read_packet: packetinit done")) return; } } @@ -128,7 +128,7 @@ if (len < 0) { if (errno == EINTR || errno == EAGAIN) { - TRACE(("leave read_packet: EINTR or EAGAIN")); + TRACE(("leave read_packet: EINTR or EAGAIN")) return; } else { dropbear_exit("error reading: %s", strerror(errno)); @@ -143,7 +143,7 @@ /* The main select() loop process_packet() to * handle the packet contents... */ } - TRACE(("leave read_packet")); + TRACE(("leave read_packet")) } /* Function used to read the initial portion of a packet, and determine the @@ -176,7 +176,7 @@ } if (len < 0) { if (errno == EINTR) { - TRACE(("leave read_packet_init: EINTR")); + TRACE(("leave read_packet_init: EINTR")) return; } dropbear_exit("error reading: %s", strerror(errno)); @@ -230,7 +230,7 @@ unsigned int padlen; unsigned int len; - TRACE(("enter decrypt_packet")); + TRACE(("enter decrypt_packet")) blocksize = ses.keys->recv_algo_crypt->blocksize; macsize = ses.keys->recv_algo_mac->hashsize; @@ -305,7 +305,7 @@ ses.recvseq++; - TRACE(("leave decrypt_packet")); + TRACE(("leave decrypt_packet")) } /* Checks the mac in hashbuf, for the data in readbuf. @@ -413,8 +413,8 @@ buffer * writebuf; /* the packet which will go on the wire */ buffer * clearwritebuf; /* unencrypted, possibly compressed */ - TRACE(("enter encrypt_packet()")); - TRACE(("encrypt_packet type is %d", ses.writepayload->data[0])); + TRACE(("enter encrypt_packet()")) + TRACE(("encrypt_packet type is %d", ses.writepayload->data[0])) blocksize = ses.keys->trans_algo_crypt->blocksize; macsize = ses.keys->trans_algo_mac->hashsize; @@ -514,7 +514,7 @@ ses.kexstate.datatrans += writebuf->len; ses.transseq++; - TRACE(("leave encrypt_packet()")); + TRACE(("leave encrypt_packet()")) } @@ -526,7 +526,7 @@ unsigned long hashsize; hmac_state hmac; - TRACE(("enter writemac")); + TRACE(("enter writemac")) macsize = ses.keys->trans_algo_mac->hashsize; @@ -561,7 +561,7 @@ } buf_incrwritepos(outputbuffer, macsize); } - TRACE(("leave writemac")); + TRACE(("leave writemac")) } #ifndef DISABLE_ZLIB @@ -572,7 +572,7 @@ unsigned int endpos = src->pos + len; int result; - TRACE(("enter buf_compress")); + TRACE(("enter buf_compress")) while (1) { @@ -606,6 +606,6 @@ buf_resize(dest, dest->size + ZLIB_COMPRESS_INCR); } - TRACE(("leave buf_compress")); + TRACE(("leave buf_compress")) } #endif diff -r b9d3f725e00b -r 0cfba3034be5 process-packet.c --- a/process-packet.c Sun Jan 02 17:08:27 2005 +0000 +++ b/process-packet.c Sun Jan 02 20:25:56 2005 +0000 @@ -45,10 +45,10 @@ unsigned char type; unsigned int i; - TRACE(("enter process_packet")); + TRACE(("enter process_packet")) type = buf_getbyte(ses.payload); - TRACE(("process_packet: packet type = %d", type)); + TRACE(("process_packet: packet type = %d", type)) ses.lastpacket = type; @@ -57,12 +57,12 @@ case SSH_MSG_IGNORE: case SSH_MSG_DEBUG: - TRACE(("received SSH_MSG_IGNORE or SSH_MSG_DEBUG")); + TRACE(("received SSH_MSG_IGNORE or SSH_MSG_DEBUG")) goto out; case SSH_MSG_UNIMPLEMENTED: /* debugging XXX */ - TRACE(("SSH_MSG_UNIMPLEMENTED")); + TRACE(("SSH_MSG_UNIMPLEMENTED")) dropbear_exit("received SSH_MSG_UNIMPLEMENTED"); case SSH_MSG_DISCONNECT: @@ -87,7 +87,7 @@ /* Check if we should ignore this packet. Used currently only for * KEX code, with first_kex_packet_follows */ if (ses.ignorenext) { - TRACE(("Ignoring packet, type = %d", type)); + TRACE(("Ignoring packet, type = %d", type)) ses.ignorenext = 0; goto out; } @@ -115,7 +115,7 @@ /* TODO do something more here? */ - TRACE(("preauth unknown packet")); + TRACE(("preauth unknown packet")) recv_unimplemented(); out: @@ -123,7 +123,7 @@ buf_free(ses.payload); ses.payload = NULL; - TRACE(("leave process_packet")); + TRACE(("leave process_packet")) } diff -r b9d3f725e00b -r 0cfba3034be5 queue.c --- a/queue.c Sun Jan 02 17:08:27 2005 +0000 +++ b/queue.c Sun Jan 02 20:25:56 2005 +0000 @@ -52,7 +52,7 @@ } else { queue->head = NULL; queue->tail = NULL; - TRACE(("empty queue dequeing")); + TRACE(("empty queue dequeing")) } m_free(oldhead); @@ -70,7 +70,7 @@ struct Link* newlink; - TRACE(("enter enqueue")); + TRACE(("enter enqueue")) newlink = (struct Link*)m_malloc(sizeof(struct Link)); newlink->item = item; @@ -85,5 +85,5 @@ queue->head = newlink; } queue->count++; - TRACE(("leave enqueue")); + TRACE(("leave enqueue")) } diff -r b9d3f725e00b -r 0cfba3034be5 rsa.c --- a/rsa.c Sun Jan 02 17:08:27 2005 +0000 +++ b/rsa.c Sun Jan 02 20:25:56 2005 +0000 @@ -47,7 +47,7 @@ * Returns DROPBEAR_SUCCESS or DROPBEAR_FAILURE */ int buf_get_rsa_pub_key(buffer* buf, rsa_key *key) { - TRACE(("enter buf_get_rsa_pub_key")); + TRACE(("enter buf_get_rsa_pub_key")) assert(key != NULL); key->e = m_malloc(sizeof(mp_int)); key->n = m_malloc(sizeof(mp_int)); @@ -60,7 +60,7 @@ if (buf_getmpint(buf, key->e) == DROPBEAR_FAILURE || buf_getmpint(buf, key->n) == DROPBEAR_FAILURE) { - TRACE(("leave buf_get_rsa_pub_key: failure")); + TRACE(("leave buf_get_rsa_pub_key: failure")) return DROPBEAR_FAILURE; } @@ -69,7 +69,7 @@ return DROPBEAR_FAILURE; } - TRACE(("leave buf_get_rsa_pub_key: success")); + TRACE(("leave buf_get_rsa_pub_key: success")) return DROPBEAR_SUCCESS; } @@ -81,17 +81,17 @@ assert(key != NULL); - TRACE(("enter buf_get_rsa_priv_key")); + TRACE(("enter buf_get_rsa_priv_key")) if (buf_get_rsa_pub_key(buf, key) == DROPBEAR_FAILURE) { - TRACE(("leave buf_get_rsa_priv_key: pub: ret == DROPBEAR_FAILURE")); + TRACE(("leave buf_get_rsa_priv_key: pub: ret == DROPBEAR_FAILURE")) return DROPBEAR_FAILURE; } key->d = m_malloc(sizeof(mp_int)); m_mp_init(key->d); if (buf_getmpint(buf, key->d) == DROPBEAR_FAILURE) { - TRACE(("leave buf_get_rsa_priv_key: d: ret == DROPBEAR_FAILURE")); + TRACE(("leave buf_get_rsa_priv_key: d: ret == DROPBEAR_FAILURE")) return DROPBEAR_FAILURE; } @@ -105,17 +105,17 @@ m_mp_init_multi(key->p, key->q, NULL); if (buf_getmpint(buf, key->p) == DROPBEAR_FAILURE) { - TRACE(("leave buf_get_rsa_priv_key: p: ret == DROPBEAR_FAILURE")); + TRACE(("leave buf_get_rsa_priv_key: p: ret == DROPBEAR_FAILURE")) return DROPBEAR_FAILURE; } if (buf_getmpint(buf, key->q) == DROPBEAR_FAILURE) { - TRACE(("leave buf_get_rsa_priv_key: q: ret == DROPBEAR_FAILURE")); + TRACE(("leave buf_get_rsa_priv_key: q: ret == DROPBEAR_FAILURE")) return DROPBEAR_FAILURE; } } - TRACE(("leave buf_get_rsa_priv_key")); + TRACE(("leave buf_get_rsa_priv_key")) return DROPBEAR_SUCCESS; } @@ -123,10 +123,10 @@ /* Clear and free the memory used by a public or private key */ void rsa_key_free(rsa_key *key) { - TRACE(("enter rsa_key_free")); + TRACE(("enter rsa_key_free")) if (key == NULL) { - TRACE(("leave rsa_key_free: key == NULL")); + TRACE(("leave rsa_key_free: key == NULL")) return; } if (key->d) { @@ -150,7 +150,7 @@ m_free(key->q); } m_free(key); - TRACE(("leave rsa_key_free")); + TRACE(("leave rsa_key_free")) } /* Put the public rsa key into the buffer in the required format: @@ -161,21 +161,21 @@ */ void buf_put_rsa_pub_key(buffer* buf, rsa_key *key) { - TRACE(("enter buf_put_rsa_pub_key")); + TRACE(("enter buf_put_rsa_pub_key")) assert(key != NULL); buf_putstring(buf, SSH_SIGNKEY_RSA, SSH_SIGNKEY_RSA_LEN); buf_putmpint(buf, key->e); buf_putmpint(buf, key->n); - TRACE(("leave buf_put_rsa_pub_key")); + TRACE(("leave buf_put_rsa_pub_key")) } /* Same as buf_put_rsa_pub_key, but with the private "x" key appended */ void buf_put_rsa_priv_key(buffer* buf, rsa_key *key) { - TRACE(("enter buf_put_rsa_priv_key")); + TRACE(("enter buf_put_rsa_priv_key")) assert(key != NULL); buf_put_rsa_pub_key(buf, key); @@ -190,7 +190,7 @@ } - TRACE(("leave buf_put_rsa_priv_key")); + TRACE(("leave buf_put_rsa_priv_key")) } @@ -206,7 +206,7 @@ mp_int *rsa_em = NULL; int ret = DROPBEAR_FAILURE; - TRACE(("enter buf_rsa_verify")); + TRACE(("enter buf_rsa_verify")) assert(key != NULL); @@ -214,19 +214,19 @@ slen = buf_getint(buf); if (slen != (unsigned int)mp_unsigned_bin_size(key->n)) { - TRACE(("bad size")); + TRACE(("bad size")) goto out; } if (mp_read_unsigned_bin(&rsa_s, buf_getptr(buf, buf->len - buf->pos), buf->len - buf->pos) != MP_OKAY) { - TRACE(("failed reading rsa_s")); + TRACE(("failed reading rsa_s")) goto out; } /* check that s <= n-1 */ if (mp_cmp(&rsa_s, key->n) != MP_LT) { - TRACE(("s > n-1")); + TRACE(("s > n-1")) goto out; } @@ -234,13 +234,13 @@ rsa_em = rsa_pad_em(key, data, len); if (mp_exptmod(&rsa_s, key->e, key->n, &rsa_mdash) != MP_OKAY) { - TRACE(("failed exptmod rsa_s")); + TRACE(("failed exptmod rsa_s")) goto out; } if (mp_cmp(rsa_em, &rsa_mdash) == MP_EQ) { /* signature is valid */ - TRACE(("success!")); + TRACE(("success!")) ret = DROPBEAR_SUCCESS; } @@ -250,7 +250,7 @@ m_free(rsa_em); } mp_clear_multi(&rsa_mdash, &rsa_s, NULL); - TRACE(("leave buf_rsa_verify: ret %d", ret)); + TRACE(("leave buf_rsa_verify: ret %d", ret)) return ret; } @@ -266,7 +266,7 @@ DEF_MP_INT(rsa_s); mp_int *rsa_em = NULL; - TRACE(("enter buf_put_rsa_sign")); + TRACE(("enter buf_put_rsa_sign")) assert(key != NULL); rsa_em = rsa_pad_em(key, data, len); @@ -306,7 +306,7 @@ #endif - TRACE(("leave buf_put_rsa_sign")); + TRACE(("leave buf_put_rsa_sign")) } /* Creates the message value as expected by PKCS, see rfc2437 etc */ diff -r b9d3f725e00b -r 0cfba3034be5 signkey.c --- a/signkey.c Sun Jan 02 17:08:27 2005 +0000 +++ b/signkey.c Sun Jan 02 20:25:56 2005 +0000 @@ -94,7 +94,7 @@ int keytype; int ret = DROPBEAR_FAILURE; - TRACE(("enter buf_get_pub_key")); + TRACE(("enter buf_get_pub_key")) ident = buf_getstring(buf, &len); keytype = signkey_type_from_name(ident, len); @@ -130,7 +130,7 @@ } #endif - TRACE(("leave buf_get_pub_key")); + TRACE(("leave buf_get_pub_key")) return ret; @@ -146,14 +146,14 @@ int keytype; int ret = DROPBEAR_FAILURE; - TRACE(("enter buf_get_priv_key")); + TRACE(("enter buf_get_priv_key")) ident = buf_getstring(buf, &len); keytype = signkey_type_from_name(ident, len); m_free(ident); if (*type != DROPBEAR_SIGNKEY_ANY && *type != keytype) { - TRACE(("wrong key type: %d %d", *type, keytype)); + TRACE(("wrong key type: %d %d", *type, keytype)) return DROPBEAR_FAILURE; } @@ -183,7 +183,7 @@ } #endif - TRACE(("leave buf_get_priv_key")); + TRACE(("leave buf_get_priv_key")) return ret; @@ -194,7 +194,7 @@ buffer *pubkeys; - TRACE(("enter buf_put_pub_key")); + TRACE(("enter buf_put_pub_key")) pubkeys = buf_new(MAX_PUBKEY_SIZE); #ifdef DROPBEAR_DSS @@ -216,26 +216,26 @@ pubkeys->len); buf_free(pubkeys); - TRACE(("leave buf_put_pub_key")); + TRACE(("leave buf_put_pub_key")) } /* type is either DROPBEAR_SIGNKEY_DSS or DROPBEAR_SIGNKEY_RSA */ void buf_put_priv_key(buffer* buf, sign_key *key, int type) { - TRACE(("enter buf_put_priv_key")); - TRACE(("type is %d", type)); + TRACE(("enter buf_put_priv_key")) + TRACE(("type is %d", type)) #ifdef DROPBEAR_DSS if (type == DROPBEAR_SIGNKEY_DSS) { buf_put_dss_priv_key(buf, key->dsskey); - TRACE(("leave buf_put_priv_key: dss done")); + TRACE(("leave buf_put_priv_key: dss done")) return; } #endif #ifdef DROPBEAR_RSA if (type == DROPBEAR_SIGNKEY_RSA) { buf_put_rsa_priv_key(buf, key->rsakey); - TRACE(("leave buf_put_priv_key: rsa done")); + TRACE(("leave buf_put_priv_key: rsa done")) return; } #endif @@ -244,7 +244,7 @@ void sign_key_free(sign_key *key) { - TRACE(("enter sign_key_free")); + TRACE(("enter sign_key_free")) #ifdef DROPBEAR_DSS dss_key_free(key->dsskey); @@ -256,7 +256,7 @@ #endif m_free(key); - TRACE(("leave sign_key_free")); + TRACE(("leave sign_key_free")) } static char hexdig(unsigned char x) { @@ -393,7 +393,7 @@ unsigned char * ident = NULL; unsigned int identlen = 0; - TRACE(("enter buf_verify")); + TRACE(("enter buf_verify")) bloblen = buf_getint(buf); ident = buf_getstring(buf, &identlen); @@ -442,17 +442,17 @@ if (base64_decode(buf_getptr(line, len), len, buf_getwriteptr(decodekey, decodekey->size), &decodekeylen) != CRYPT_OK) { - TRACE(("checkpubkey: base64 decode failed")); + TRACE(("checkpubkey: base64 decode failed")) goto out; } - TRACE(("checkpubkey: base64_decode success")); + TRACE(("checkpubkey: base64_decode success")) buf_incrlen(decodekey, decodekeylen); /* compare the keys */ if ( ( decodekeylen != keybloblen ) || memcmp( buf_getptr(decodekey, decodekey->len), keyblob, decodekey->len) != 0) { - TRACE(("checkpubkey: compare failed")); + TRACE(("checkpubkey: compare failed")) goto out; } @@ -461,7 +461,7 @@ filealgolen = buf_getint(decodekey); filealgo = buf_getptr(decodekey, filealgolen); if (filealgolen != algolen || memcmp(filealgo, algoname, algolen) != 0) { - TRACE(("checkpubkey: algo match failed")); + TRACE(("checkpubkey: algo match failed")) goto out; } diff -r b9d3f725e00b -r 0cfba3034be5 svr-agentfwd.c --- a/svr-agentfwd.c Sun Jan 02 17:08:27 2005 +0000 +++ b/svr-agentfwd.c Sun Jan 02 20:25:56 2005 +0000 @@ -101,7 +101,7 @@ fd = accept(sock, NULL, NULL); if (fd < 0) { - TRACE(("accept failed")); + TRACE(("accept failed")) return; } diff -r b9d3f725e00b -r 0cfba3034be5 svr-algo.c --- a/svr-algo.c Sun Jan 02 17:08:27 2005 +0000 +++ b/svr-algo.c Sun Jan 02 20:25:56 2005 +0000 @@ -47,7 +47,7 @@ /* get the comma-separated list from the buffer ie "algo1,algo2,algo3" */ algolist = buf_getstring(buf, &len); /* Debug this */ - TRACE(("buf_match_algo: %s", algolist)); + TRACE(("buf_match_algo: %s", algolist)) if (len > MAX_PROPOSED_ALGO*(MAX_NAME_LEN+1)) { goto out; /* just a sanity check, no other use */ } diff -r b9d3f725e00b -r 0cfba3034be5 svr-auth.c --- a/svr-auth.c Sun Jan 02 17:08:27 2005 +0000 +++ b/svr-auth.c Sun Jan 02 20:25:56 2005 +0000 @@ -67,9 +67,9 @@ * ignore this, but possibly serves as a legal "no trespassing" sign */ static void send_msg_userauth_banner() { - TRACE(("enter send_msg_userauth_banner")); + TRACE(("enter send_msg_userauth_banner")) if (svr_opts.banner == NULL) { - TRACE(("leave send_msg_userauth_banner: banner is NULL")); + TRACE(("leave send_msg_userauth_banner: banner is NULL")) return; } @@ -84,7 +84,7 @@ buf_free(svr_opts.banner); svr_opts.banner = NULL; - TRACE(("leave send_msg_userauth_banner")); + TRACE(("leave send_msg_userauth_banner")) } /* handle a userauth request, check validity, pass to password or pubkey @@ -94,11 +94,11 @@ unsigned char *username = NULL, *servicename = NULL, *methodname = NULL; unsigned int userlen, servicelen, methodlen; - TRACE(("enter recv_msg_userauth_request")); + TRACE(("enter recv_msg_userauth_request")) /* ignore packets if auth is already done */ if (ses.authstate.authdone == 1) { - TRACE(("leave recv_msg_userauth_request: authdone already")); + TRACE(("leave recv_msg_userauth_request: authdone already")) return; } @@ -128,7 +128,7 @@ if (methodlen == AUTH_METHOD_NONE_LEN && strncmp(methodname, AUTH_METHOD_NONE, AUTH_METHOD_NONE_LEN) == 0) { - TRACE(("recv_msg_userauth_request: 'none' request")); + TRACE(("recv_msg_userauth_request: 'none' request")) send_msg_userauth_failure(0, 0); goto out; } @@ -136,7 +136,7 @@ /* check username is good before continuing */ if (checkusername(username, userlen) == DROPBEAR_FAILURE) { /* username is invalid/no shell/etc - send failure */ - TRACE(("sending checkusername failure")); + TRACE(("sending checkusername failure")) send_msg_userauth_failure(0, 1); goto out; } @@ -195,7 +195,7 @@ char* listshell = NULL; char* usershell = NULL; - TRACE(("enter checkusername")); + TRACE(("enter checkusername")) if (userlen > MAX_USERNAME_LEN) { return DROPBEAR_FAILURE; } @@ -217,7 +217,7 @@ /* check that user exists */ if (ses.authstate.pw == NULL) { - TRACE(("leave checkusername: user '%s' doesn't exist", username)); + TRACE(("leave checkusername: user '%s' doesn't exist", username)) dropbear_log(LOG_WARNING, "login attempt for nonexistent user from %s", svr_ses.addrstring); @@ -230,7 +230,7 @@ /* check for non-root if desired */ if (svr_opts.norootlogin && ses.authstate.pw->pw_uid == 0) { - TRACE(("leave checkusername: root login disabled")); + TRACE(("leave checkusername: root login disabled")) dropbear_log(LOG_WARNING, "root login rejected"); send_msg_userauth_failure(0, 1); return DROPBEAR_FAILURE; @@ -238,14 +238,14 @@ /* check for an empty password */ if (ses.authstate.pw->pw_passwd[0] == '\0') { - TRACE(("leave checkusername: empty pword")); + TRACE(("leave checkusername: empty pword")) dropbear_log(LOG_WARNING, "user '%s' has blank password, rejected", ses.authstate.printableuser); send_msg_userauth_failure(0, 1); return DROPBEAR_FAILURE; } - TRACE(("shell is %s", ses.authstate.pw->pw_shell)); + TRACE(("shell is %s", ses.authstate.pw->pw_shell)) /* check that the shell is set */ usershell = ses.authstate.pw->pw_shell; @@ -259,7 +259,7 @@ * is platform-specific) */ setusershell(); while ((listshell = getusershell()) != NULL) { - TRACE(("test shell is '%s'", listshell)); + TRACE(("test shell is '%s'", listshell)) if (strcmp(listshell, usershell) == 0) { /* have a match */ goto goodshell; @@ -267,7 +267,7 @@ } /* no matching shell */ endusershell(); - TRACE(("no matching shell")); + TRACE(("no matching shell")) dropbear_log(LOG_WARNING, "user '%s' has invalid shell, rejected", ses.authstate.printableuser); send_msg_userauth_failure(0, 1); @@ -275,10 +275,10 @@ goodshell: endusershell(); - TRACE(("matching shell")); + TRACE(("matching shell")) - TRACE(("uid = %d", ses.authstate.pw->pw_uid)); - TRACE(("leave checkusername")); + TRACE(("uid = %d", ses.authstate.pw->pw_uid)) + TRACE(("leave checkusername")) return DROPBEAR_SUCCESS; } @@ -292,7 +292,7 @@ buffer *typebuf = NULL; - TRACE(("enter send_msg_userauth_failure")); + TRACE(("enter send_msg_userauth_failure")) CHECKCLEARTOWRITE(); @@ -331,7 +331,7 @@ if (ses.authstate.failcount >= MAX_AUTH_TRIES) { char * userstr; /* XXX - send disconnect ? */ - TRACE(("Max auth tries reached, exiting")); + TRACE(("Max auth tries reached, exiting")) if (ses.authstate.printableuser == NULL) { userstr = "is invalid"; @@ -342,13 +342,13 @@ userstr, svr_ses.addrstring); } - TRACE(("leave send_msg_userauth_failure")); + TRACE(("leave send_msg_userauth_failure")) } /* Send a success message to the user, and set the "authdone" flag */ void send_msg_userauth_success() { - TRACE(("enter send_msg_userauth_success")); + TRACE(("enter send_msg_userauth_success")) CHECKCLEARTOWRITE(); @@ -368,6 +368,6 @@ * logins - a nasty situation. */ m_close(svr_ses.childpipe); - TRACE(("leave send_msg_userauth_success")); + TRACE(("leave send_msg_userauth_success")) } diff -r b9d3f725e00b -r 0cfba3034be5 svr-authpam.c --- a/svr-authpam.c Sun Jan 02 17:08:27 2005 +0000 +++ b/svr-authpam.c Sun Jan 02 20:25:56 2005 +0000 @@ -57,7 +57,7 @@ const char* message = (*msg)->msg; - TRACE(("enter pamConvFunc")); + TRACE(("enter pamConvFunc")) if (num_msg != 1) { /* If you're getting here - Dropbear probably can't support your pam @@ -67,11 +67,11 @@ return PAM_CONV_ERR; } - TRACE(("msg_style is %d", (*msg)->msg_style)); + TRACE(("msg_style is %d", (*msg)->msg_style)) if (message) { - TRACE(("message is '%s'", message)); + TRACE(("message is '%s'", message)) } else { - TRACE(("null message")); + TRACE(("null message")) } switch((*msg)->msg_style) { @@ -79,7 +79,7 @@ case PAM_PROMPT_ECHO_OFF: if (strcmp(message, "Password:") != 0) { - TRACE(("PAM_PROMPT_ECHO_OFF: unrecognized prompt")); + TRACE(("PAM_PROMPT_ECHO_OFF: unrecognized prompt")) rc = PAM_CONV_ERR; break; } @@ -102,7 +102,7 @@ if ((strcmp(message, "login: " ) != 0) && (strcmp(message, "login:" ) != 0) && (strcmp(message, "Please enter username: " ) != 0)) { - TRACE(("PAM_PROMPT_ECHO_ON: unrecognized prompt")); + TRACE(("PAM_PROMPT_ECHO_ON: unrecognized prompt")) rc = PAM_CONV_ERR; break; } @@ -117,17 +117,17 @@ /* Safe to just use the direct pointer (no strdup) since * it shouldn't be getting munged at all */ resp->resp = m_strdup(userDatap->user); - TRACE(("userDatap->user='%s'", userDatap->user)); + TRACE(("userDatap->user='%s'", userDatap->user)) (*respp) = resp; break; default: - TRACE(("Unknown message type")); + TRACE(("Unknown message type")) rc = PAM_CONV_ERR; break; } - TRACE(("leave pamConvFunc, rc %d", rc)); + TRACE(("leave pamConvFunc, rc %d", rc)) return rc; } @@ -224,7 +224,7 @@ m_free(password); } if (pamHandlep != NULL) { - TRACE(("pam_end")); + TRACE(("pam_end")) (void) pam_end(pamHandlep, 0 /* pam_status */); } } diff -r b9d3f725e00b -r 0cfba3034be5 svr-authpubkey.c --- a/svr-authpubkey.c Sun Jan 02 17:08:27 2005 +0000 +++ b/svr-authpubkey.c Sun Jan 02 20:25:56 2005 +0000 @@ -60,7 +60,7 @@ char* fp = NULL; int type = -1; - TRACE(("enter pubkeyauth")); + TRACE(("enter pubkeyauth")) /* 0 indicates user just wants to check if key can be used, 1 is an * actual attempt*/ @@ -127,7 +127,7 @@ sign_key_free(key); key = NULL; } - TRACE(("leave pubkeyauth")); + TRACE(("leave pubkeyauth")) } /* Reply that the key is valid for auth, this is sent when the user sends @@ -136,7 +136,7 @@ static void send_msg_userauth_pk_ok(unsigned char* algo, unsigned int algolen, unsigned char* keyblob, unsigned int keybloblen) { - TRACE(("enter send_msg_userauth_pk_ok")); + TRACE(("enter send_msg_userauth_pk_ok")) CHECKCLEARTOWRITE(); buf_putbyte(ses.writepayload, SSH_MSG_USERAUTH_PK_OK); @@ -144,7 +144,7 @@ buf_putstring(ses.writepayload, keyblob, keybloblen); encrypt_packet(); - TRACE(("leave send_msg_userauth_pk_ok")); + TRACE(("leave send_msg_userauth_pk_ok")) } @@ -160,7 +160,7 @@ buffer * line = NULL; unsigned int len, pos; - TRACE(("enter checkpubkey")); + TRACE(("enter checkpubkey")) /* check that we can use the algo */ if (have_algo(algo, algolen, sshhostkey) == DROPBEAR_FAILURE) { @@ -172,7 +172,7 @@ /* check file permissions, also whether file exists */ if (checkpubkeyperms() == DROPBEAR_FAILURE) { - TRACE(("bad authorized_keys permissions, or file doesn't exist")); + TRACE(("bad authorized_keys permissions, or file doesn't exist")) goto out; } @@ -190,7 +190,7 @@ if (authfile == NULL) { goto out; } - TRACE(("checkpubkey: opened authorized_keys OK")); + TRACE(("checkpubkey: opened authorized_keys OK")) line = buf_new(MAX_AUTHKEYS_LINE); @@ -199,12 +199,12 @@ if (buf_getline(line, authfile) == DROPBEAR_FAILURE) { /* EOF reached */ - TRACE(("checkpubkey: authorized_keys EOF reached")); + TRACE(("checkpubkey: authorized_keys EOF reached")) break; } if (line->len < MIN_AUTHKEYS_LINE) { - TRACE(("checkpubkey: line too short")); + TRACE(("checkpubkey: line too short")) continue; /* line is too short for it to be a valid key */ } @@ -217,7 +217,7 @@ /* check for space (' ') character */ if (buf_getbyte(line) != ' ') { - TRACE(("checkpubkey: space character expected, isn't there")); + TRACE(("checkpubkey: space character expected, isn't there")) continue; } @@ -229,7 +229,7 @@ buf_setpos(line, pos); buf_setlen(line, line->pos + len); - TRACE(("checkpubkey: line pos = %d len = %d", line->pos, line->len)); + TRACE(("checkpubkey: line pos = %d len = %d", line->pos, line->len)) ret = cmp_base64_key(keyblob, keybloblen, algo, algolen, line); if (ret == DROPBEAR_SUCCESS) { @@ -248,7 +248,7 @@ buf_free(line); } m_free(filename); - TRACE(("leave checkpubkey: ret=%d", ret)); + TRACE(("leave checkpubkey: ret=%d", ret)) return ret; } @@ -264,7 +264,7 @@ int ret = DROPBEAR_FAILURE; unsigned int len; - TRACE(("enter checkpubkeyperms")); + TRACE(("enter checkpubkeyperms")) assert(ses.authstate.pw); if (ses.authstate.pw->pw_dir == NULL) { @@ -303,7 +303,7 @@ out: m_free(filename); - TRACE(("leave checkpubkeyperms")); + TRACE(("leave checkpubkeyperms")) return ret; } @@ -313,24 +313,24 @@ static int checkfileperm(char * filename) { struct stat filestat; - TRACE(("enter checkfileperm(%s)", filename)); + TRACE(("enter checkfileperm(%s)", filename)) if (stat(filename, &filestat) != 0) { - TRACE(("leave checkfileperm: stat() != 0")); + TRACE(("leave checkfileperm: stat() != 0")) return DROPBEAR_FAILURE; } /* check ownership - user or root only*/ if (filestat.st_uid != ses.authstate.pw->pw_uid && filestat.st_uid != 0) { - TRACE(("leave checkfileperm: wrong ownership")); + TRACE(("leave checkfileperm: wrong ownership")) return DROPBEAR_FAILURE; } /* check permissions - don't want group or others +w */ if (filestat.st_mode & (S_IWGRP | S_IWOTH)) { - TRACE(("leave checkfileperm: wrong perms")); + TRACE(("leave checkfileperm: wrong perms")) return DROPBEAR_FAILURE; } - TRACE(("leave checkfileperm: success")); + TRACE(("leave checkfileperm: success")) return DROPBEAR_SUCCESS; } diff -r b9d3f725e00b -r 0cfba3034be5 svr-chansession.c --- a/svr-chansession.c Sun Jan 02 17:08:27 2005 +0000 +++ b/svr-chansession.c Sun Jan 02 20:25:56 2005 +0000 @@ -87,7 +87,7 @@ struct sigaction sa_chld; struct exitinfo *exit = NULL; - TRACE(("enter sigchld handler")); + TRACE(("enter sigchld handler")) while ((pid = waitpid(-1, &status, WNOHANG)) > 0) { /* find the corresponding chansess */ for (i = 0; i < svr_ses.childpidsize; i++) { @@ -126,7 +126,7 @@ sa_chld.sa_handler = sesssigchild_handler; sa_chld.sa_flags = SA_NOCLDSTOP; sigaction(SIGCHLD, &sa_chld, NULL); - TRACE(("leave sigchld handler")); + TRACE(("leave sigchld handler")) } /* send the exit status or the signal causing termination for a session */ @@ -248,9 +248,9 @@ send_exitsignalstatus(channel); - TRACE(("enter closechansess")); + TRACE(("enter closechansess")) if (chansess == NULL) { - TRACE(("leave closechansess: chansess == NULL")); + TRACE(("leave closechansess: chansess == NULL")) return; } @@ -280,8 +280,8 @@ for (i = 0; i < svr_ses.childpidsize; i++) { if (svr_ses.childpids[i].chansess == chansess) { assert(svr_ses.childpids[i].pid > 0); - TRACE(("closing pid %d", svr_ses.childpids[i].pid)); - TRACE(("exitpid = %d", chansess->exit.exitpid)); + TRACE(("closing pid %d", svr_ses.childpids[i].pid)) + TRACE(("exitpid = %d", chansess->exit.exitpid)) svr_ses.childpids[i].pid = -1; svr_ses.childpids[i].chansess = NULL; } @@ -289,7 +289,7 @@ m_free(chansess); - TRACE(("leave closechansess")); + TRACE(("leave closechansess")) } /* Handle requests for a channel. These can be execution requests, @@ -302,19 +302,19 @@ int ret = 1; struct ChanSess *chansess; - TRACE(("enter chansessionrequest")); + TRACE(("enter chansessionrequest")) type = buf_getstring(ses.payload, &typelen); wantreply = buf_getbyte(ses.payload); if (typelen > MAX_NAME_LEN) { - TRACE(("leave chansessionrequest: type too long")); /* XXX send error?*/ + TRACE(("leave chansessionrequest: type too long")) /* XXX send error?*/ goto out; } chansess = (struct ChanSess*)channel->typedata; assert(chansess != NULL); - TRACE(("type is %s", type)); + TRACE(("type is %s", type)) if (strcmp(type, "window-change") == 0) { ret = sessionwinchange(chansess); @@ -351,7 +351,7 @@ } m_free(type); - TRACE(("leave chansessionrequest")); + TRACE(("leave chansessionrequest")) } @@ -421,7 +421,7 @@ const struct TermCode * termcode; unsigned int len; - TRACE(("enter get_termmodes")); + TRACE(("enter get_termmodes")) /* Term modes */ /* We'll ignore errors and continue if we can't set modes. @@ -438,7 +438,7 @@ } if (len == 0) { - TRACE(("leave get_termmodes: empty terminal modes string")); + TRACE(("leave get_termmodes: empty terminal modes string")) } while (((opcode = buf_getbyte(ses.payload)) != 0x00) && opcode <= 159) { @@ -500,7 +500,7 @@ if (tcsetattr(chansess->master, TCSANOW, &termio) < 0) { dropbear_log(LOG_INFO, "error setting terminal attributes"); } - TRACE(("leave get_termmodes")); + TRACE(("leave get_termmodes")) } /* Set up a session pty which will be used to execute the shell or program. @@ -511,11 +511,11 @@ unsigned int termlen; unsigned char namebuf[65]; - TRACE(("enter sessionpty")); + TRACE(("enter sessionpty")) chansess->term = buf_getstring(ses.payload, &termlen); if (termlen > MAX_TERM_LEN) { /* TODO send disconnect ? */ - TRACE(("leave sessionpty: term len too long")); + TRACE(("leave sessionpty: term len too long")) return DROPBEAR_FAILURE; } @@ -524,7 +524,7 @@ dropbear_exit("multiple pty requests"); } if (pty_allocate(&chansess->master, &chansess->slave, namebuf, 64) == 0) { - TRACE(("leave sessionpty: failed to allocate pty")); + TRACE(("leave sessionpty: failed to allocate pty")) return DROPBEAR_FAILURE; } @@ -541,7 +541,7 @@ /* Read the terminal modes */ get_termmodes(chansess); - TRACE(("leave sessionpty")); + TRACE(("leave sessionpty")) return DROPBEAR_SUCCESS; } @@ -555,7 +555,7 @@ unsigned int cmdlen; int ret; - TRACE(("enter sessioncommand")); + TRACE(("enter sessioncommand")) if (chansess->cmd != NULL) { /* Note that only one command can _succeed_. The client might try @@ -612,7 +612,7 @@ pid_t pid; unsigned int i; - TRACE(("enter noptycommand")); + TRACE(("enter noptycommand")) /* redirect stdin/stdout/stderr */ if (pipe(infds) != 0) @@ -635,7 +635,7 @@ if ((dup2(infds[FDIN], STDIN_FILENO) < 0) || (dup2(outfds[FDOUT], STDOUT_FILENO) < 0) || (dup2(errfds[FDOUT], STDERR_FILENO) < 0)) { - TRACE(("leave noptycommand: error redirecting FDs")); + TRACE(("leave noptycommand: error redirecting FDs")) return DROPBEAR_FAILURE; } @@ -651,7 +651,7 @@ } else { /* parent */ - TRACE(("continue noptycommand: parent")); + TRACE(("continue noptycommand: parent")) chansess->pid = pid; addchildpid(chansess, pid); @@ -687,7 +687,7 @@ #undef FDIN #undef FDOUT - TRACE(("leave noptycommand")); + TRACE(("leave noptycommand")) return DROPBEAR_SUCCESS; } @@ -705,7 +705,7 @@ char *hushpath = NULL; #endif - TRACE(("enter ptycommand")); + TRACE(("enter ptycommand")) /* we need to have a pty allocated */ if (chansess->master == -1 || chansess->tty == NULL) { @@ -728,7 +728,7 @@ if ((dup2(chansess->slave, STDIN_FILENO) < 0) || (dup2(chansess->slave, STDERR_FILENO) < 0) || (dup2(chansess->slave, STDOUT_FILENO) < 0)) { - TRACE(("leave ptycommand: error redirecting filedesc")); + TRACE(("leave ptycommand: error redirecting filedesc")) return DROPBEAR_FAILURE; } @@ -776,7 +776,7 @@ } else { /* parent */ - TRACE(("continue ptycommand: parent")); + TRACE(("continue ptycommand: parent")) chansess->pid = pid; /* add a child pid */ @@ -792,7 +792,7 @@ } - TRACE(("leave ptycommand")); + TRACE(("leave ptycommand")) return DROPBEAR_SUCCESS; } diff -r b9d3f725e00b -r 0cfba3034be5 svr-kex.c --- a/svr-kex.c Sun Jan 02 17:08:27 2005 +0000 +++ b/svr-kex.c Sun Jan 02 20:25:56 2005 +0000 @@ -46,7 +46,7 @@ DEF_MP_INT(dh_e); - TRACE(("enter recv_msg_kexdh_init")); + TRACE(("enter recv_msg_kexdh_init")) if (!ses.kexstate.recvkexinit) { dropbear_exit("Premature kexdh_init message received"); } @@ -60,7 +60,7 @@ send_msg_newkeys(); ses.requirenext = SSH_MSG_NEWKEYS; - TRACE(("leave recv_msg_kexdh_init")); + TRACE(("leave recv_msg_kexdh_init")) } /* Generate our side of the diffie-hellman key exchange value (dh_f), and @@ -74,7 +74,7 @@ DEF_MP_INT(dh_y); DEF_MP_INT(dh_f); - TRACE(("enter send_msg_kexdh_reply")); + TRACE(("enter send_msg_kexdh_reply")) m_mp_init_multi(&dh_y, &dh_f, NULL); gen_kexdh_vals(&dh_f, &dh_y); @@ -99,6 +99,6 @@ /* the SSH_MSG_KEXDH_REPLY is done */ encrypt_packet(); - TRACE(("leave send_msg_kexdh_reply")); + TRACE(("leave send_msg_kexdh_reply")) } diff -r b9d3f725e00b -r 0cfba3034be5 svr-main.c --- a/svr-main.c Sun Jan 02 17:08:27 2005 +0000 +++ b/svr-main.c Sun Jan 02 20:25:56 2005 +0000 @@ -247,7 +247,7 @@ } if (pipe(childpipe) < 0) { - TRACE(("error creating child pipe")); + TRACE(("error creating child pipe")) close(childsock); continue; } @@ -369,11 +369,11 @@ unsigned int sockpos = 0; int nsock; - TRACE(("listensockets: %d to try\n", svr_opts.portcount)); + TRACE(("listensockets: %d to try\n", svr_opts.portcount)) for (i = 0; i < svr_opts.portcount; i++) { - TRACE(("listening on '%s'", svr_opts.ports[i])); + TRACE(("listening on '%s'", svr_opts.ports[i])) nsock = dropbear_listen(NULL, svr_opts.ports[i], &sock[sockpos], sockcount - sockpos, diff -r b9d3f725e00b -r 0cfba3034be5 svr-runopts.c --- a/svr-runopts.c Sun Jan 02 17:08:27 2005 +0000 +++ b/svr-runopts.c Sun Jan 02 20:25:56 2005 +0000 @@ -270,7 +270,7 @@ int ret; int type; - TRACE(("enter loadhostkeys")); + TRACE(("enter loadhostkeys")) svr_opts.hostkey = new_sign_key(); @@ -300,5 +300,5 @@ dropbear_exit("No hostkeys available"); } - TRACE(("leave loadhostkeys")); + TRACE(("leave loadhostkeys")) } diff -r b9d3f725e00b -r 0cfba3034be5 svr-service.c --- a/svr-service.c Sun Jan 02 17:08:27 2005 +0000 +++ b/svr-service.c Sun Jan 02 20:25:56 2005 +0000 @@ -39,7 +39,7 @@ unsigned char * name; unsigned int len; - TRACE(("enter recv_msg_service_request")); + TRACE(("enter recv_msg_service_request")) name = buf_getstring(ses.payload, &len); @@ -49,7 +49,7 @@ send_msg_service_accept(name, len); m_free(name); - TRACE(("leave recv_msg_service_request: done ssh-userauth")); + TRACE(("leave recv_msg_service_request: done ssh-userauth")) return; } @@ -62,7 +62,7 @@ send_msg_service_accept(name, len); m_free(name); - TRACE(("leave recv_msg_service_request: done ssh-connection")); + TRACE(("leave recv_msg_service_request: done ssh-connection")) return; } @@ -75,7 +75,7 @@ static void send_msg_service_accept(unsigned char *name, int len) { - TRACE(("accepting service %s", name)); + TRACE(("accepting service %s", name)) CHECKCLEARTOWRITE(); diff -r b9d3f725e00b -r 0cfba3034be5 svr-tcpfwd.c --- a/svr-tcpfwd.c Sun Jan 02 17:08:27 2005 +0000 +++ b/svr-tcpfwd.c Sun Jan 02 20:25:56 2005 +0000 @@ -70,10 +70,10 @@ unsigned int wantreply = 0; int ret = DROPBEAR_FAILURE; - TRACE(("enter recv_msg_global_request_remotetcp")); + TRACE(("enter recv_msg_global_request_remotetcp")) if (opts.noremotetcp) { - TRACE(("leave recv_msg_global_request_remotetcp: remote tcp forwarding disabled")); + TRACE(("leave recv_msg_global_request_remotetcp: remote tcp forwarding disabled")) goto out; } @@ -81,7 +81,7 @@ wantreply = buf_getbyte(ses.payload); if (namelen > MAXNAMLEN) { - TRACE(("name len is wrong: %d", namelen)); + TRACE(("name len is wrong: %d", namelen)) goto out; } @@ -90,7 +90,7 @@ } else if (strcmp("cancel-tcpip-forward", reqname) == 0) { ret = svr_cancelremotetcp(); } else { - TRACE(("reqname isn't tcpip-forward: '%s'", reqname)); + TRACE(("reqname isn't tcpip-forward: '%s'", reqname)) } out: @@ -104,7 +104,7 @@ m_free(reqname); - TRACE(("leave recv_msg_global_request")); + TRACE(("leave recv_msg_global_request")) } @@ -143,11 +143,11 @@ struct Listener * listener = NULL; struct TCPListener tcpinfo; - TRACE(("enter cancelremotetcp")); + TRACE(("enter cancelremotetcp")) bindaddr = buf_getstring(ses.payload, &addrlen); if (addrlen > MAX_IP_LEN) { - TRACE(("addr len too long: %d", addrlen)); + TRACE(("addr len too long: %d", addrlen)) goto out; } @@ -163,7 +163,7 @@ out: m_free(bindaddr); - TRACE(("leave cancelremotetcp")); + TRACE(("leave cancelremotetcp")) return ret; } @@ -175,12 +175,12 @@ struct TCPListener *tcpinfo = NULL; unsigned int port; - TRACE(("enter remotetcpreq")); + TRACE(("enter remotetcpreq")) /* NOTE: at this stage, we ignore bindaddr. see below and listen_tcpfwd */ bindaddr = buf_getstring(ses.payload, &addrlen); if (addrlen > MAX_IP_LEN) { - TRACE(("addr len too long: %d", addrlen)); + TRACE(("addr len too long: %d", addrlen)) goto out; } @@ -192,12 +192,12 @@ } if (port < 1 || port > 65535) { - TRACE(("invalid port: %d", port)); + TRACE(("invalid port: %d", port)) goto out; } if (!ses.allowprivport && port < IPPORT_RESERVED) { - TRACE(("can't assign port < 1024 for non-root")); + TRACE(("can't assign port < 1024 for non-root")) goto out; } @@ -218,7 +218,7 @@ m_free(tcpinfo->sendaddr); m_free(tcpinfo); } - TRACE(("leave remotetcpreq")); + TRACE(("leave remotetcpreq")) return ret; } @@ -236,13 +236,13 @@ int err = SSH_OPEN_ADMINISTRATIVELY_PROHIBITED; if (opts.nolocaltcp) { - TRACE(("leave newtcpdirect: local tcp forwarding disabled")); + TRACE(("leave newtcpdirect: local tcp forwarding disabled")) goto out; } desthost = buf_getstring(ses.payload, &len); if (len > MAX_HOST_LEN) { - TRACE(("leave newtcpdirect: desthost too long")); + TRACE(("leave newtcpdirect: desthost too long")) goto out; } @@ -250,7 +250,7 @@ orighost = buf_getstring(ses.payload, &len); if (len > MAX_HOST_LEN) { - TRACE(("leave newtcpdirect: orighost too long")); + TRACE(("leave newtcpdirect: orighost too long")) goto out; } @@ -258,7 +258,7 @@ /* best be sure */ if (origport > 65535 || destport > 65535) { - TRACE(("leave newtcpdirect: port > 65535")); + TRACE(("leave newtcpdirect: port > 65535")) goto out; } @@ -266,7 +266,7 @@ sock = connect_remote(desthost, portstring, 1, NULL); if (sock < 0) { err = SSH_OPEN_CONNECT_FAILED; - TRACE(("leave newtcpdirect: sock failed")); + TRACE(("leave newtcpdirect: sock failed")) goto out; } @@ -284,7 +284,7 @@ out: m_free(desthost); m_free(orighost); - TRACE(("leave newtcpdirect: err %d", err)); + TRACE(("leave newtcpdirect: err %d", err)) return err; } diff -r b9d3f725e00b -r 0cfba3034be5 svr-x11fwd.c --- a/svr-x11fwd.c Sun Jan 02 17:08:27 2005 +0000 +++ b/svr-x11fwd.c Sun Jan 02 20:25:56 2005 +0000 @@ -170,7 +170,7 @@ m_free(chansess->x11authprot); m_free(chansess->x11authcookie); - TRACE(("chansess %s", chansess)); + TRACE(("chansess %s", chansess)) if (chansess->x11listener != NULL) { remove_listener(chansess->x11listener); chansess->x11listener = NULL; diff -r b9d3f725e00b -r 0cfba3034be5 tcp-accept.c --- a/tcp-accept.c Sun Jan 02 17:08:27 2005 +0000 +++ b/tcp-accept.c Sun Jan 02 20:25:56 2005 +0000 @@ -87,7 +87,7 @@ int nsocks; char* errstring = NULL; - TRACE(("enter listen_tcpfwd")); + TRACE(("enter listen_tcpfwd")) /* first we try to bind, so don't need to do so much cleanup on failure */ snprintf(portstring, sizeof(portstring), "%d", tcpinfo->listenport); @@ -100,7 +100,7 @@ if (nsocks < 0) { dropbear_log(LOG_INFO, "TCP forward failed: %s", errstring); m_free(errstring); - TRACE(("leave listen_tcpfwd: dropbear_listen failed")); + TRACE(("leave listen_tcpfwd: dropbear_listen failed")) return DROPBEAR_FAILURE; } @@ -109,11 +109,11 @@ if (listener == NULL) { m_free(tcpinfo); - TRACE(("leave listen_tcpfwd: listener failed")); + TRACE(("leave listen_tcpfwd: listener failed")) return DROPBEAR_FAILURE; } - TRACE(("leave listen_tcpfwd: success")); + TRACE(("leave listen_tcpfwd: success")) return DROPBEAR_SUCCESS; }