static void add_keyfile(char *filename)
{
char passphrase[PASSPHRASE_MAXLEN];
- struct RSAKey *rkey;
- struct ssh2_userkey *skey;
+ struct RSAKey *rkey = NULL;
+ struct ssh2_userkey *skey = NULL;
int needs_pass;
int ret;
int attempts;
if (ver == 1) {
if (already_running) {
unsigned char *request, *response;
+ void *vresponse;
int reqlen, clen, resplen;
clen = strlen(rkey->comment);
reqlen += 4 + clen;
PUT_32BIT(request, reqlen - 4);
- agent_query(request, reqlen, &response, &resplen);
+ agent_query(request, reqlen, &vresponse, &resplen);
+ response = vresponse;
if (resplen < 5 || response[4] != SSH_AGENT_SUCCESS)
MessageBox(NULL, "The already running Pageant "
"refused to add the key.", APPNAME,
} else {
if (already_running) {
unsigned char *request, *response;
+ void *vresponse;
int reqlen, alglen, clen, keybloblen, resplen;
alglen = strlen(skey->alg->name);
clen = strlen(skey->comment);
PUT_32BIT(request, reqlen - 4);
reqlen += clen + 4;
- agent_query(request, reqlen, &response, &resplen);
+ agent_query(request, reqlen, &vresponse, &resplen);
+ response = vresponse;
if (resplen < 5 || response[4] != SSH_AGENT_SUCCESS)
MessageBox(NULL, "The already running Pageant"
"refused to add the key.", APPNAME,
return c;
}
-static void error(char *s)
-{
- MessageBox(hwnd, s, APPNAME, MB_OK | MB_ICONERROR);
-}
-
/*
* Prompt for a key file to add, and add it.
*/
COPYDATASTRUCT *cds;
char *mapname;
void *p;
- HANDLE filemap, proc;
+ HANDLE filemap;
+#ifndef NO_SECURITY
+ HANDLE proc;
PSID mapowner, procowner;
PSECURITY_DESCRIPTOR psd1 = NULL, psd2 = NULL;
+#endif
int ret = 0;
cds = (COPYDATASTRUCT *) lParam;
debug(("filemap is %p\n", filemap));
#endif
if (filemap != NULL && filemap != INVALID_HANDLE_VALUE) {
- int rc;
#ifndef NO_SECURITY
+ int rc;
if (has_security) {
if ((proc = OpenProcess(MAXIMUM_ALLOWED, FALSE,
GetCurrentProcessId())) ==
NULL, NULL, show) <= (HINSTANCE) 32) {
TCHAR sMsg[140];
sprintf(sMsg, _T("Failed to run \"%.100s\", Error: %d"), cmdline,
- GetLastError());
+ (int)GetLastError());
MessageBox(NULL, sMsg, APPNAME, MB_OK | MB_ICONEXCLAMATION);
}
}
{
char *p;
int inquotes = 0;
- int ignorearg = 0;
p = cmdline;
while (*p) {
while (*p && isspace(*p))
debug(("hwnd is %p\n", hwnd));
if (!hwnd)
return;
- sprintf(mapname, "PageantRequest%08x", GetCurrentThreadId());
+ sprintf(mapname, "PageantRequest%08x", (unsigned)GetCurrentThreadId());
filemap = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE,
0, AGENT_MAX_MSGLEN, mapname);
if (!filemap)
case 3:
position = PHASE3START + progress * p->phase3mult;
break;
+ default:
+ /*
+ * Shouldn't happen, but having a default clause placates
+ * gcc -Wall, which would otherwise complain that
+ * `position' might be used uninitialised.
+ */
+ return;
}
SendMessage(p->progbar, PBM_SETPOS, position / DIVISOR, 0);
char *comment;
struct PassphraseProcStruct pps;
struct RSAKey newkey1;
- struct ssh2_userkey *newkey2;
+ struct ssh2_userkey *newkey2 = NULL;
ver = keyfile_version(filename);
if (ver == 0) {
static void raw_size(void);
-static int sb_opt, sb_len;
-static char *sb_buf = NULL;
-static int sb_size = 0;
-#define SB_DELTA 1024
-
static void c_write(char *buf, int len)
{
from_backend(0, buf, len);
static void rlogin_size(void);
-static int sb_opt, sb_len;
-static char *sb_buf = NULL;
-static int sb_size = 0;
-#define SB_DELTA 1024
-
static void c_write(char *buf, int len)
{
from_backend(0, buf, len);
static void tell_char(FILE * stream, char c);
static void tell_str(FILE * stream, char *str);
static void tell_user(FILE * stream, char *fmt, ...);
-static void send_char_msg(unsigned int msg_id, char c);
-static void send_str_msg(unsigned int msg_id, char *str);
static void gui_update_stats(char *name, unsigned long size,
int percentage, unsigned long elapsed);
if (response())
return;
- if (statistics) {
- stat_bytes = 0;
- stat_starttime = time(NULL);
- stat_lasttime = 0;
- }
+ stat_bytes = 0;
+ stat_starttime = time(NULL);
+ stat_lasttime = 0;
for (i = 0; i < size; i += 4096) {
char transbuf[4096];
back->send("", 1);
- if (statistics) {
- stat_bytes = 0;
- stat_starttime = time(NULL);
- stat_lasttime = 0;
- if ((stat_name = strrchr(namebuf, '/')) == NULL)
- stat_name = namebuf;
- else
- stat_name++;
- if (strrchr(stat_name, '\\') != NULL)
- stat_name = strrchr(stat_name, '\\') + 1;
- }
+ stat_bytes = 0;
+ stat_starttime = time(NULL);
+ stat_lasttime = 0;
+ if ((stat_name = strrchr(namebuf, '/')) == NULL)
+ stat_name = namebuf;
+ else
+ stat_name++;
+ if (strrchr(stat_name, '\\') != NULL)
+ stat_name = strrchr(stat_name, '\\') + 1;
for (i = 0; i < size; i += 4096) {
char transbuf[4096];
gppi(sesskey, "SunkenEdge", 0, &cfg->sunken_edge);
gppi(sesskey, "CurType", 0, &cfg->cursor_type);
gppi(sesskey, "BlinkCur", 0, &cfg->blink_cur);
- gppi(sesskey, "Beep", 1, &cfg->beep);
+ /* pedantic compiler tells me I can't use &cfg->beep as an int * :-) */
+ gppi(sesskey, "Beep", 1, &i); cfg->beep = i;
gpps(sesskey, "BellWaveFile", "", cfg->bell_wavefile,
sizeof(cfg->bell_wavefile));
gppi(sesskey, "BellOverload", 1, &cfg->bellovl);
static int do_ssh_init(unsigned char c)
{
- static char vslen;
+ static int vslen;
static char version[10];
static char *vstring;
static int vstrsize;
*/
static int do_ssh1_login(unsigned char *in, int inlen, int ispkt)
{
- int i, j, len;
- unsigned char *rsabuf, *keystr1, *keystr2;
+ int i, j;
+ static int len;
+ static unsigned char *rsabuf, *keystr1, *keystr2;
unsigned char cookie[8];
struct RSAKey servkey, hostkey;
struct MD5Context md5c;
static unsigned long supported_ciphers_mask, supported_auths_mask;
static int tried_publickey;
static unsigned char session_id[16];
- int cipher_type;
+ static int cipher_type;
static char username[100];
crBegin;
ssh1_read_bignum(pktin.body, &challenge);
{
char *agentreq, *q, *ret;
+ void *vret;
int len, retlen;
len = 1 + 4; /* message type, bit count */
len += ssh1_bignum_length(key.exponent);
memcpy(q, session_id, 16);
q += 16;
PUT_32BIT(q, 1); /* response format */
- agent_query(agentreq, len + 4, &ret, &retlen);
+ agent_query(agentreq, len + 4, &vret, &retlen);
+ ret = vret;
sfree(agentreq);
if (ret) {
if (ret[4] == SSH1_AGENT_RSA_RESPONSE) {
*/
static void do_ssh2_authconn(unsigned char *in, int inlen, int ispkt)
{
- static unsigned long remote_winsize;
- static unsigned long remote_maxpkt;
static enum {
AUTH_INVALID, AUTH_PUBLICKEY_AGENT, AUTH_PUBLICKEY_FILE,
AUTH_PASSWORD
static int pklen, alglen, commentlen;
static int siglen, retlen, len;
static char *q, *agentreq, *ret;
+ void *vret;
{
char buf[64];
q += pktout.length - 5;
/* And finally the (zero) flags word. */
PUT_32BIT(q, 0);
- agent_query(agentreq, len + 4, &ret, &retlen);
+ agent_query(agentreq, len + 4, &vret, &retlen);
+ ret = vret;
sfree(agentreq);
if (ret) {
if (ret[4] == SSH2_AGENT_SIGN_RESPONSE) {
* Variables.
*/
static Bignum x, e, p, q, qmask, g;
-static int need_to_free_pg;
/*
* Common DH initialisation.
} else {
int b, nb;
x = bn_power_2(nbits);
- nb = 0;
+ b = nb = 0;
for (i = 0; i < nbits; i++) {
if (nb == 0) {
nb = 8;
st->npending -= i;
defermatch.len = 0;
+ deferchr = '\0';
while (len > 0) {
/* Don't even look for a match, if we're not compressing. */
*/
i = -1;
j = sizeof(lencodes) / sizeof(*lencodes);
- while (j - i >= 2) {
+ while (1) {
+ assert(j - i >= 2);
k = (j + i) / 2;
if (thislen < lencodes[k].min)
j = k;
*/
i = -1;
j = sizeof(distcodes) / sizeof(*distcodes);
- while (j - i >= 2) {
+ while (1) {
+ assert(j - i >= 2);
k = (j + i) / 2;
if (distance < distcodes[k].min)
j = k;
out->firstblock = 0;
in_block = FALSE;
- }
+ } else
+ in_block = TRUE;
if (out->comp_disabled) {
if (in_block)
*/
void term_size(int newrows, int newcols, int newsavelines)
{
- tree234 *newsb, *newscreen, *newalt;
- unsigned long *newdisp, *oldline, *line;
- int i, j, ccols;
+ tree234 *newalt;
+ unsigned long *newdisp, *line;
+ int i, j;
int sblen;
int save_alt_which = alt_which;
case ANSI('5', '#'):
nlattr = LATTR_NORM;
break;
- case ANSI('6', '#'):
+ default: /* spiritually case ANSI('6', '#'): */
nlattr = LATTR_WIDE;
break;
}
val = c - 'A' + 10;
else if (c >= 'a' && c <= 'a' + max - 10)
val = c - 'a' + 10;
- else
+ else {
termstate = TOPLEVEL;
+ break;
+ }
osc_string[osc_strlen++] = val;
if (osc_strlen >= 7) {
palette_set(osc_string[0],
ATTR_BLINK)));
break;
#endif
+ default: break; /* placate gcc warning about enum use */
}
if (selstate != NO_SELECTION) {
pos cursplus = curs;
case MBT_WHEEL_DOWN:
encstate = 0x61;
break;
+ default: break; /* placate gcc warning about enum use */
}
switch (a) {
case MA_DRAG:
return;
is_down = b;
break;
+ default: break; /* placate gcc warning about enum use */
}
if (shift)
encstate += 0x04;
if (cp_name && *cp_name) {
d = cp_name;
- if (strnicmp(d, "cp", 2) == 0)
+ if (tolower(d[0]) == 'c' && tolower(d[1]) == 'p')
d += 2;
- if (strnicmp(d, "ibm", 3) == 0)
+ if (tolower(d[0]) == 'i' && tolower(d[1]) == 'b'
+ && tolower(d[1]) == 'm')
d += 3;
for (s = d; *s >= '0' && *s <= '9'; s++);
if (*s == 0 && s != d)
return cfg.mouse_is_xterm ? MBT_PASTE : MBT_EXTEND;
if (button == MBT_RIGHT)
return cfg.mouse_is_xterm ? MBT_EXTEND : MBT_PASTE;
+ return 0; /* shouldn't happen */
}
static void show_mouseptr(int show)
button = MBT_RIGHT;
press = 0;
break;
+ default:
+ button = press = 0; /* shouldn't happen */
}
show_mouseptr(1);
if (press) {
clipdata = NULL;
return;
} else if (OpenClipboard(NULL)) {
- if (clipdata = GetClipboardData(CF_UNICODETEXT)) {
+ if ((clipdata = GetClipboardData(CF_UNICODETEXT))) {
CloseClipboard();
*p = GlobalLock(clipdata);
if (*p) {
*len = p2 - *p;
return;
}
- } else if (clipdata = GetClipboardData(CF_TEXT)) {
+ } else if ( (clipdata = GetClipboardData(CF_TEXT)) ) {
char *s;
int i;
CloseClipboard();
*/
if (ret->family == 0) {
/*debug(("Resolving \"%s\" with gethostbyname() (IPv4 only)...\n", host)); */
- if (h = gethostbyname(host))
+ if ( (h = gethostbyname(host)) )
ret->family = AF_INET;
}
}
*/
}
-void sk_tcp_close(Socket s);
-void sk_tcp_write(Socket s, char *data, int len);
-void sk_tcp_write_oob(Socket s, char *data, int len);
-char *sk_tcp_socket_error(Socket s);
+static void sk_tcp_close(Socket s);
+static void sk_tcp_write(Socket s, char *data, int len);
+static void sk_tcp_write_oob(Socket s, char *data, int len);
+static char *sk_tcp_socket_error(Socket s);
Socket sk_new(SockAddr addr, int port, int privport, int oobinline,
Plug plug)