int pri;
if (cmdline_password) {
- memset(cmdline_password, 0, strlen(cmdline_password));
+ smemclr(cmdline_password, strlen(cmdline_password));
sfree(cmdline_password);
cmdline_password = NULL;
}
return 0;
prompt_set_result(p->prompts[0], cmdline_password);
- memset(cmdline_password, 0, strlen(cmdline_password));
+ smemclr(cmdline_password, strlen(cmdline_password));
sfree(cmdline_password);
cmdline_password = NULL;
tried_once = 1;
SAVEABLE(0);
conf_set_str(conf, CONF_loghost, value);
}
+ if (!strcmp(p, "-hostkey")) {
+ char *dup;
+ RETURN(2);
+ UNAVAILABLE_IN(TOOLTYPE_NONNETWORK);
+ SAVEABLE(0);
+ dup = dupstr(value);
+ if (!validate_manual_hostkey(dup)) {
+ cmdline_error("'%s' is not a valid format for a manual host "
+ "key specification", value);
+ sfree(dup);
+ return ret;
+ }
+ conf_set_str_str(conf, CONF_ssh_manual_hostkeys, dup, "");
+ sfree(dup);
+ }
if ((!strcmp(p, "-L") || !strcmp(p, "-R") || !strcmp(p, "-D"))) {
char type, *q, *qq, *key, *val;
RETURN(2);
type = p[1]; /* 'L' or 'R' */
- q = qq = strchr(value, ':');
+ q = qq = host_strchr(value, ':');
while (qq) {
- char *qqq = strchr(qq+1, ':');
+ char *qqq = host_strchr(qq+1, ':');
if (qqq)
q = qq;
qq = qqq;
return ret;
}
- key = dupprintf("%c%.*s", type, q - value, value);
+ key = dupprintf("%c%.*s", type, (int)(q - value), value);
val = dupstr(q+1);
} else {
/*
UNAVAILABLE_IN(TOOLTYPE_FILETRANSFER | TOOLTYPE_NONNETWORK);
SAVEABLE(0);
- portp = strchr(value, ':');
+ portp = host_strchr(value, ':');
if (!portp) {
cmdline_error("-nc expects argument of form 'host:port'");
return ret;
}
- host = dupprintf("%.*s", portp - value, value);
+ host = dupprintf("%.*s", (int)(portp - value), value);
conf_set_str(conf, CONF_ssh_nc_host, host);
conf_set_int(conf, CONF_ssh_nc_port, atoi(portp + 1));
sfree(host);
/* Assuming that `value' is directly from argv, make a good faith
* attempt to trample it, to stop it showing up in `ps' output
* on Unix-like systems. Not guaranteed, of course. */
- memset(value, 0, strlen(value));
+ smemclr(value, strlen(value));
}
}
nextitem += length + skip;
}
}
+
+ if (!strcmp(p, "-sessionlog")) {
+ Filename *fn;
+ RETURN(2);
+ UNAVAILABLE_IN(TOOLTYPE_FILETRANSFER);
+ /* but available even in TOOLTYPE_NONNETWORK, cf pterm "-log" */
+ SAVEABLE(0);
+ fn = filename_from_str(value);
+ conf_set_filename(conf, CONF_logfilename, fn);
+ conf_set_int(conf, CONF_logtype, LGTYP_DEBUG);
+ filename_free(fn);
+ }
+
+ if (!strcmp(p, "-sshlog") ||
+ !strcmp(p, "-sshrawlog")) {
+ Filename *fn;
+ RETURN(2);
+ UNAVAILABLE_IN(TOOLTYPE_NONNETWORK);
+ SAVEABLE(0);
+ fn = filename_from_str(value);
+ conf_set_filename(conf, CONF_logfilename, fn);
+ conf_set_int(conf, CONF_logtype,
+ !strcmp(p, "-sshlog") ? LGTYP_PACKETS :
+ /* !strcmp(p, "-sshrawlog") ? */ LGTYP_SSHRAW);
+ filename_free(fn);
+ }
+
return ret; /* unrecognised */
}