sync with 2.3.2.
This commit is contained in:
parent
e5eae0162b
commit
e3045c89d8
10
crypto/dist/ssh/auth1.c
vendored
10
crypto/dist/ssh/auth1.c
vendored
@ -10,7 +10,7 @@
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
RCSID("$OpenBSD: auth1.c,v 1.14 2001/01/22 23:06:39 markus Exp $");
|
||||
RCSID("$OpenBSD: auth1.c,v 1.15 2001/02/07 22:35:45 markus Exp $");
|
||||
|
||||
#include "xmalloc.h"
|
||||
#include "rsa.h"
|
||||
@ -336,14 +336,6 @@ do_authentication()
|
||||
|
||||
setproctitle("%s", user);
|
||||
|
||||
#ifdef AFS
|
||||
/* If machine has AFS, set process authentication group. */
|
||||
if (k_hasafs()) {
|
||||
k_setpag();
|
||||
k_unlog();
|
||||
}
|
||||
#endif /* AFS */
|
||||
|
||||
/* Verify that the user is a valid user. */
|
||||
pw = getpwnam(user);
|
||||
if (pw && allowed_user(pw)) {
|
||||
|
11
crypto/dist/ssh/auth2.c
vendored
11
crypto/dist/ssh/auth2.c
vendored
@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
RCSID("$OpenBSD: auth2.c,v 1.36 2001/02/04 15:32:22 stevesk Exp $");
|
||||
RCSID("$OpenBSD: auth2.c,v 1.39 2001/02/08 18:20:01 markus Exp $");
|
||||
|
||||
#include <openssl/evp.h>
|
||||
|
||||
@ -113,13 +113,6 @@ do_authentication2()
|
||||
if (options.challenge_reponse_authentication)
|
||||
options.kbd_interactive_authentication = 1;
|
||||
|
||||
#ifdef AFS
|
||||
/* If machine has AFS, set process authentication group. */
|
||||
if (k_hasafs()) {
|
||||
k_setpag();
|
||||
k_unlog();
|
||||
}
|
||||
#endif
|
||||
dispatch_init(&protocol_error);
|
||||
dispatch_set(SSH2_MSG_SERVICE_REQUEST, &input_service_request);
|
||||
dispatch_run(DISPATCH_BLOCK, &authctxt->success, authctxt);
|
||||
@ -281,7 +274,7 @@ userauth_reply(Authctxt *authctxt, int authenticated)
|
||||
char *methods;
|
||||
|
||||
/* XXX todo: check if multiple auth methods are needed */
|
||||
if (authenticated) {
|
||||
if (authenticated == 1) {
|
||||
/* turn off userauth */
|
||||
dispatch_set(SSH2_MSG_USERAUTH_REQUEST, &protocol_error);
|
||||
packet_start(SSH2_MSG_USERAUTH_SUCCESS);
|
||||
|
5
crypto/dist/ssh/pathnames.h
vendored
5
crypto/dist/ssh/pathnames.h
vendored
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: pathnames.h,v 1.2 2001/01/29 01:58:17 niklas Exp $ */
|
||||
/* $OpenBSD: pathnames.h,v 1.3 2001/02/08 00:04:52 markus Exp $ */
|
||||
|
||||
/*
|
||||
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
||||
@ -105,5 +105,8 @@
|
||||
/* for scp */
|
||||
#define _PATH_CP "cp"
|
||||
|
||||
/* for sftp */
|
||||
#define _PATH_SFTP_SERVER "/usr/libexec/sftp-server"
|
||||
|
||||
#define _PATH_RSH "/usr/bin/rsh"
|
||||
#define _PATH_URANDOM "/dev/urandom"
|
||||
|
18
crypto/dist/ssh/readconf.c
vendored
18
crypto/dist/ssh/readconf.c
vendored
@ -12,7 +12,7 @@
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
RCSID("$OpenBSD: readconf.c,v 1.60 2001/01/28 20:36:16 stevesk Exp $");
|
||||
RCSID("$OpenBSD: readconf.c,v 1.61 2001/02/08 14:39:36 deraadt Exp $");
|
||||
|
||||
#include "ssh.h"
|
||||
#include "xmalloc.h"
|
||||
@ -715,6 +715,8 @@ initialize_options(Options * options)
|
||||
void
|
||||
fill_default_options(Options * options)
|
||||
{
|
||||
int len;
|
||||
|
||||
if (options->forward_agent == -1)
|
||||
options->forward_agent = 0;
|
||||
if (options->forward_x11 == -1)
|
||||
@ -781,16 +783,18 @@ fill_default_options(Options * options)
|
||||
options->protocol = SSH_PROTO_1|SSH_PROTO_2|SSH_PROTO_1_PREFERRED;
|
||||
if (options->num_identity_files == 0) {
|
||||
if (options->protocol & SSH_PROTO_1) {
|
||||
len = 2 + strlen(_PATH_SSH_CLIENT_IDENTITY) + 1;
|
||||
options->identity_files[options->num_identity_files] =
|
||||
xmalloc(2 + strlen(_PATH_SSH_CLIENT_IDENTITY) + 1);
|
||||
sprintf(options->identity_files[options->num_identity_files++],
|
||||
"~/%.100s", _PATH_SSH_CLIENT_IDENTITY);
|
||||
xmalloc(len);
|
||||
snprintf(options->identity_files[options->num_identity_files++],
|
||||
len, "~/%.100s", _PATH_SSH_CLIENT_IDENTITY);
|
||||
}
|
||||
if (options->protocol & SSH_PROTO_2) {
|
||||
len = 2 + strlen(_PATH_SSH_CLIENT_ID_DSA) + 1;
|
||||
options->identity_files[options->num_identity_files] =
|
||||
xmalloc(2 + strlen(_PATH_SSH_CLIENT_ID_DSA) + 1);
|
||||
sprintf(options->identity_files[options->num_identity_files++],
|
||||
"~/%.100s", _PATH_SSH_CLIENT_ID_DSA);
|
||||
xmalloc(len);
|
||||
snprintf(options->identity_files[options->num_identity_files++],
|
||||
len, "~/%.100s", _PATH_SSH_CLIENT_ID_DSA);
|
||||
}
|
||||
}
|
||||
if (options->escape_char == -1)
|
||||
|
39
crypto/dist/ssh/scp.c
vendored
39
crypto/dist/ssh/scp.c
vendored
@ -75,7 +75,7 @@
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
RCSID("$OpenBSD: scp.c,v 1.53 2001/02/04 23:56:22 deraadt Exp $");
|
||||
RCSID("$OpenBSD: scp.c,v 1.55 2001/02/08 14:38:54 deraadt Exp $");
|
||||
|
||||
#include "xmalloc.h"
|
||||
#include "atomicio.h"
|
||||
@ -312,7 +312,8 @@ main(argc, argv)
|
||||
|
||||
remin = remout = -1;
|
||||
/* Command to be executed on remote system using "ssh". */
|
||||
(void) sprintf(cmd, "scp%s%s%s%s", verbose_mode ? " -v" : "",
|
||||
(void) snprintf(cmd, sizeof cmd, "scp%s%s%s%s",
|
||||
verbose_mode ? " -v" : "",
|
||||
iamrecursive ? " -r" : "", pflag ? " -p" : "",
|
||||
targetshouldbedirectory ? " -d" : "");
|
||||
|
||||
@ -383,16 +384,18 @@ toremote(targ, argc, argv)
|
||||
suser = pwd->pw_name;
|
||||
else if (!okname(suser))
|
||||
continue;
|
||||
sprintf(bp,
|
||||
"%s%s -x -o'FallBackToRsh no' -n -l %s %s %s %s '%s%s%s:%s'",
|
||||
snprintf(bp, len,
|
||||
"%s%s -x -o'FallBackToRsh no' -n "
|
||||
"-l %s %s %s %s '%s%s%s:%s'",
|
||||
ssh_program, verbose_mode ? " -v" : "",
|
||||
suser, host, cmd, src,
|
||||
tuser ? tuser : "", tuser ? "@" : "",
|
||||
thost, targ);
|
||||
} else {
|
||||
host = cleanhostname(argv[i]);
|
||||
sprintf(bp,
|
||||
"exec %s%s -x -o'FallBackToRsh no' -n %s %s %s '%s%s%s:%s'",
|
||||
snprintf(bp, len,
|
||||
"exec %s%s -x -o'FallBackToRsh no' -n %s "
|
||||
"%s %s '%s%s%s:%s'",
|
||||
ssh_program, verbose_mode ? " -v" : "",
|
||||
host, cmd, src,
|
||||
tuser ? tuser : "", tuser ? "@" : "",
|
||||
@ -406,7 +409,7 @@ toremote(targ, argc, argv)
|
||||
if (remin == -1) {
|
||||
len = strlen(targ) + CMDNEEDS + 20;
|
||||
bp = xmalloc(len);
|
||||
(void) sprintf(bp, "%s -t %s", cmd, targ);
|
||||
(void) snprintf(bp, len, "%s -t %s", cmd, targ);
|
||||
host = cleanhostname(thost);
|
||||
if (do_cmd(host, tuser, bp, &remin,
|
||||
&remout, argc) < 0)
|
||||
@ -433,7 +436,7 @@ tolocal(argc, argv)
|
||||
len = strlen(_PATH_CP) + strlen(argv[i]) +
|
||||
strlen(argv[argc - 1]) + 20;
|
||||
bp = xmalloc(len);
|
||||
(void) sprintf(bp, "exec %s%s%s %s %s", _PATH_CP,
|
||||
(void) snprintf(bp, len, "exec %s%s%s %s %s", _PATH_CP,
|
||||
iamrecursive ? " -r" : "", pflag ? " -p" : "",
|
||||
argv[i], argv[argc - 1]);
|
||||
if (verbose_mode)
|
||||
@ -460,7 +463,7 @@ tolocal(argc, argv)
|
||||
host = cleanhostname(host);
|
||||
len = strlen(src) + CMDNEEDS + 20;
|
||||
bp = xmalloc(len);
|
||||
(void) sprintf(bp, "%s -f %s", cmd, src);
|
||||
(void) snprintf(bp, len, "%s -f %s", cmd, src);
|
||||
if (do_cmd(host, suser, bp, &remin, &remout, argc) < 0) {
|
||||
(void) xfree(bp);
|
||||
++errs;
|
||||
@ -517,7 +520,7 @@ syserr: run_err("%s: %s", name, strerror(errno));
|
||||
* Make it compatible with possible future
|
||||
* versions expecting microseconds.
|
||||
*/
|
||||
(void) sprintf(buf, "T%lu 0 %lu 0\n",
|
||||
(void) snprintf(buf, sizeof buf, "T%lu 0 %lu 0\n",
|
||||
(u_long) stb.st_mtime,
|
||||
(u_long) stb.st_atime);
|
||||
(void) atomic_write(remout, buf, strlen(buf));
|
||||
@ -525,7 +528,7 @@ syserr: run_err("%s: %s", name, strerror(errno));
|
||||
goto next;
|
||||
}
|
||||
#define FILEMODEMASK (S_ISUID|S_ISGID|S_IRWXU|S_IRWXG|S_IRWXO)
|
||||
sprintf(buf, "C%04o %lu %s\n",
|
||||
snprintf(buf, sizeof buf, "C%04o %lu %s\n",
|
||||
(u_int) (stb.st_mode & FILEMODEMASK),
|
||||
(u_long) stb.st_size, last);
|
||||
if (verbose_mode) {
|
||||
@ -594,7 +597,7 @@ rsource(name, statp)
|
||||
else
|
||||
last++;
|
||||
if (pflag) {
|
||||
(void) sprintf(path, "T%lu 0 %lu 0\n",
|
||||
(void) snprintf(path, sizeof(path), "T%lu 0 %lu 0\n",
|
||||
(u_long) statp->st_mtime,
|
||||
(u_long) statp->st_atime);
|
||||
(void) atomic_write(remout, path, strlen(path));
|
||||
@ -603,7 +606,7 @@ rsource(name, statp)
|
||||
return;
|
||||
}
|
||||
}
|
||||
(void) sprintf(path, "D%04o %d %.1024s\n",
|
||||
(void) snprintf(path, sizeof path, "D%04o %d %.1024s\n",
|
||||
(u_int) (statp->st_mode & FILEMODEMASK), 0, last);
|
||||
if (verbose_mode)
|
||||
fprintf(stderr, "Entering directory: %s", path);
|
||||
@ -621,7 +624,7 @@ rsource(name, statp)
|
||||
run_err("%s/%s: name too long", name, dp->d_name);
|
||||
continue;
|
||||
}
|
||||
(void) sprintf(path, "%s/%s", name, dp->d_name);
|
||||
(void) snprintf(path, sizeof path, "%s/%s", name, dp->d_name);
|
||||
vect[0] = path;
|
||||
source(1, vect);
|
||||
}
|
||||
@ -751,9 +754,13 @@ sink(argc, argv)
|
||||
size_t need;
|
||||
|
||||
need = strlen(targ) + strlen(cp) + 250;
|
||||
if (need > cursize)
|
||||
if (need > cursize) {
|
||||
if (namebuf)
|
||||
xfree(namebuf);
|
||||
namebuf = xmalloc(need);
|
||||
(void) sprintf(namebuf, "%s%s%s", targ,
|
||||
cursize = need;
|
||||
}
|
||||
(void) snprintf(namebuf, need, "%s%s%s", targ,
|
||||
*targ ? "/" : "", cp);
|
||||
np = namebuf;
|
||||
} else
|
||||
|
6
crypto/dist/ssh/session.c
vendored
6
crypto/dist/ssh/session.c
vendored
@ -33,7 +33,7 @@
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
RCSID("$OpenBSD: session.c,v 1.53 2001/02/04 15:32:25 stevesk Exp $");
|
||||
RCSID("$OpenBSD: session.c,v 1.54 2001/02/08 17:11:23 stevesk Exp $");
|
||||
|
||||
#include "ssh.h"
|
||||
#include "ssh1.h"
|
||||
@ -1206,7 +1206,7 @@ session_open(int chanid)
|
||||
}
|
||||
s->pw = auth_get_user();
|
||||
if (s->pw == NULL)
|
||||
fatal("no user for session %i", s->self);
|
||||
fatal("no user for session %d", s->self);
|
||||
debug("session_open: session %d: link with channel %d", s->self, chanid);
|
||||
s->chanid = chanid;
|
||||
return 1;
|
||||
@ -1516,7 +1516,7 @@ session_pty_cleanup(Session *s)
|
||||
if (s == NULL || s->ttyfd == -1)
|
||||
return;
|
||||
|
||||
debug("session_pty_cleanup: session %i release %s", s->self, s->tty);
|
||||
debug("session_pty_cleanup: session %d release %s", s->self, s->tty);
|
||||
|
||||
/* Cancel the cleanup function. */
|
||||
fatal_remove_cleanup(pty_cleanup_proc, (void *)s);
|
||||
|
6
crypto/dist/ssh/sftp-client.c
vendored
6
crypto/dist/ssh/sftp-client.c
vendored
@ -29,7 +29,7 @@
|
||||
/* XXX: copy between two remote sites */
|
||||
|
||||
#include "includes.h"
|
||||
RCSID("$OpenBSD: sftp-client.c,v 1.5 2001/02/07 10:55:12 djm Exp $");
|
||||
RCSID("$OpenBSD: sftp-client.c,v 1.8 2001/02/08 17:11:23 stevesk Exp $");
|
||||
|
||||
#include "ssh.h"
|
||||
#include "buffer.h"
|
||||
@ -338,7 +338,9 @@ do_ls(int fd_in, int fd_out, char *path)
|
||||
SSH2_FXP_NAME, type);
|
||||
|
||||
count = buffer_get_int(&msg);
|
||||
debug3("Received %i SSH2_FXP_NAME responses", count);
|
||||
if (count == 0)
|
||||
break;
|
||||
debug3("Received %d SSH2_FXP_NAME responses", count);
|
||||
for(i = 0; i < count; i++) {
|
||||
char *filename, *longname;
|
||||
Attrib *a;
|
||||
|
110
crypto/dist/ssh/sftp-int.c
vendored
110
crypto/dist/ssh/sftp-int.c
vendored
@ -28,7 +28,7 @@
|
||||
/* XXX: recursive operations */
|
||||
|
||||
#include "includes.h"
|
||||
RCSID("$OpenBSD: sftp-int.c,v 1.12 2001/02/07 13:12:29 djm Exp $");
|
||||
RCSID("$OpenBSD: sftp-int.c,v 1.17 2001/02/08 17:57:59 stevesk Exp $");
|
||||
|
||||
#include "buffer.h"
|
||||
#include "xmalloc.h"
|
||||
@ -71,29 +71,29 @@ struct CMD {
|
||||
};
|
||||
|
||||
const struct CMD cmds[] = {
|
||||
{ "CD", I_CHDIR },
|
||||
{ "CHDIR", I_CHDIR },
|
||||
{ "CHGRP", I_CHGRP },
|
||||
{ "CHMOD", I_CHMOD },
|
||||
{ "CHOWN", I_CHOWN },
|
||||
{ "DIR", I_LS },
|
||||
{ "EXIT", I_QUIT },
|
||||
{ "GET", I_GET },
|
||||
{ "HELP", I_HELP },
|
||||
{ "LCD", I_LCHDIR },
|
||||
{ "LCHDIR", I_LCHDIR },
|
||||
{ "LLS", I_LLS },
|
||||
{ "LMKDIR", I_LMKDIR },
|
||||
{ "LPWD", I_LPWD },
|
||||
{ "LS", I_LS },
|
||||
{ "LUMASK", I_LUMASK },
|
||||
{ "MKDIR", I_MKDIR },
|
||||
{ "PUT", I_PUT },
|
||||
{ "PWD", I_PWD },
|
||||
{ "QUIT", I_QUIT },
|
||||
{ "RENAME", I_RENAME },
|
||||
{ "RM", I_RM },
|
||||
{ "RMDIR", I_RMDIR },
|
||||
{ "cd", I_CHDIR },
|
||||
{ "chdir", I_CHDIR },
|
||||
{ "chgrp", I_CHGRP },
|
||||
{ "chmod", I_CHMOD },
|
||||
{ "chown", I_CHOWN },
|
||||
{ "dir", I_LS },
|
||||
{ "exit", I_QUIT },
|
||||
{ "get", I_GET },
|
||||
{ "help", I_HELP },
|
||||
{ "lcd", I_LCHDIR },
|
||||
{ "lchdir", I_LCHDIR },
|
||||
{ "lls", I_LLS },
|
||||
{ "lmkdir", I_LMKDIR },
|
||||
{ "lpwd", I_LPWD },
|
||||
{ "ls", I_LS },
|
||||
{ "lumask", I_LUMASK },
|
||||
{ "mkdir", I_MKDIR },
|
||||
{ "put", I_PUT },
|
||||
{ "pwd", I_PWD },
|
||||
{ "quit", I_QUIT },
|
||||
{ "rename", I_RENAME },
|
||||
{ "rm", I_RM },
|
||||
{ "rmdir", I_RMDIR },
|
||||
{ "!", I_SHELL },
|
||||
{ "?", I_HELP },
|
||||
{ NULL, -1}
|
||||
@ -103,28 +103,29 @@ static void
|
||||
help(void)
|
||||
{
|
||||
printf("Available commands:\n");
|
||||
printf("CD path Change remote directory to 'path'\n");
|
||||
printf("LCD path Change local directory to 'path'\n");
|
||||
printf("CHGRP grp path Change group of file 'path' to 'grp'\n");
|
||||
printf("CHMOD mode path Change permissions of file 'path' to 'mode'\n");
|
||||
printf("CHOWN own path Change owner of file 'path' to 'own'\n");
|
||||
printf("HELP Display this help text\n");
|
||||
printf("GET remote-path [local-path] Download file\n");
|
||||
printf("LLS [ls options] [path] Display local directory listing\n");
|
||||
printf("LMKDIR path Create local directory\n");
|
||||
printf("LPWD Print local working directory\n");
|
||||
printf("LS [path] Display remote directory listing\n");
|
||||
printf("LUMASK umask Set local umask to 'umask'\n");
|
||||
printf("MKDIR path Create remote directory\n");
|
||||
printf("PUT local-path [remote-path] Upload file\n");
|
||||
printf("PWD Display remote working directory\n");
|
||||
printf("EXIT Quit sftp\n");
|
||||
printf("QUIT Quit sftp\n");
|
||||
printf("RENAME oldpath newpath Rename remote file\n");
|
||||
printf("RMDIR path Remove remote directory\n");
|
||||
printf("RM path Delete remote file\n");
|
||||
printf("cd path Change remote directory to 'path'\n");
|
||||
printf("lcd path Change local directory to 'path'\n");
|
||||
printf("chgrp grp path Change group of file 'path' to 'grp'\n");
|
||||
printf("chmod mode path Change permissions of file 'path' to 'mode'\n");
|
||||
printf("chown own path Change owner of file 'path' to 'own'\n");
|
||||
printf("help Display this help text\n");
|
||||
printf("get remote-path [local-path] Download file\n");
|
||||
printf("lls [ls-options [path]] Display local directory listing\n");
|
||||
printf("lmkdir path Create local directory\n");
|
||||
printf("lpwd Print local working directory\n");
|
||||
printf("ls [path] Display remote directory listing\n");
|
||||
printf("lumask umask Set local umask to 'umask'\n");
|
||||
printf("mkdir path Create remote directory\n");
|
||||
printf("put local-path [remote-path] Upload file\n");
|
||||
printf("pwd Display remote working directory\n");
|
||||
printf("exit Quit sftp\n");
|
||||
printf("quit Quit sftp\n");
|
||||
printf("rename oldpath newpath Rename remote file\n");
|
||||
printf("rmdir path Remove remote directory\n");
|
||||
printf("rm path Delete remote file\n");
|
||||
printf("!command Execute 'command' in local shell\n");
|
||||
printf("! Escape to local shell\n");
|
||||
printf("? Synonym for help\n");
|
||||
}
|
||||
|
||||
static void
|
||||
@ -170,11 +171,13 @@ local_do_ls(const char *args)
|
||||
if (!args || !*args)
|
||||
local_do_shell("ls");
|
||||
else {
|
||||
char *buf = xmalloc(8 + strlen(args) + 1);
|
||||
int len = sizeof("/bin/ls ") + strlen(args) + 1;
|
||||
char *buf = xmalloc(len);
|
||||
|
||||
/* XXX: quoting - rip quoting code from ftp? */
|
||||
sprintf(buf, "/bin/ls %s", args);
|
||||
snprintf(buf, len, "/bin/ls %s", args);
|
||||
local_do_shell(buf);
|
||||
xfree(buf);
|
||||
}
|
||||
}
|
||||
|
||||
@ -226,7 +229,6 @@ get_pathname(const char **cpp, char **path)
|
||||
if (!*cp) {
|
||||
*cpp = cp;
|
||||
*path = NULL;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -239,19 +241,16 @@ get_pathname(const char **cpp, char **path)
|
||||
error("Unterminated quote");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (cp == end) {
|
||||
error("Empty quotes");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
*cpp = end + 1 + strspn(end + 1, WHITESPACE);
|
||||
} else {
|
||||
/* Read to end of filename */
|
||||
end = strpbrk(cp, WHITESPACE);
|
||||
if (end == NULL)
|
||||
end = strchr(cp, '\0');
|
||||
|
||||
*cpp = end + strspn(end, WHITESPACE);
|
||||
}
|
||||
|
||||
@ -260,12 +259,10 @@ get_pathname(const char **cpp, char **path)
|
||||
*path = xmalloc(i + 1);
|
||||
memcpy(*path, cp, i);
|
||||
(*path)[i] = '\0';
|
||||
|
||||
return(0);
|
||||
|
||||
fail:
|
||||
*path = NULL;
|
||||
|
||||
return (-1);
|
||||
}
|
||||
|
||||
@ -277,7 +274,6 @@ infer_path(const char *p, char **ifp)
|
||||
debug("XXX: P = \"%s\"", p);
|
||||
|
||||
cp = strrchr(p, '/');
|
||||
|
||||
if (cp == NULL) {
|
||||
*ifp = xstrdup(p);
|
||||
return(0);
|
||||
@ -428,7 +424,6 @@ parse_args(const char **cpp, int *pflag, unsigned long *n_arg,
|
||||
}
|
||||
|
||||
*cpp = cp;
|
||||
|
||||
return(cmdnum);
|
||||
}
|
||||
|
||||
@ -524,7 +519,7 @@ parse_dispatch_command(int in, int out, const char *cmd, char **pwd)
|
||||
break;
|
||||
case I_LMKDIR:
|
||||
if (mkdir(path1, 0777) == -1)
|
||||
error("Couldn't create local directory to "
|
||||
error("Couldn't create local directory "
|
||||
"\"%s\": %s", path1, strerror(errno));
|
||||
break;
|
||||
case I_LLS:
|
||||
@ -589,7 +584,6 @@ parse_dispatch_command(int in, int out, const char *cmd, char **pwd)
|
||||
xfree(path1);
|
||||
if (path2)
|
||||
xfree(path2);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
@ -603,8 +597,8 @@ interactive_loop(int fd_in, int fd_out)
|
||||
if (pwd == NULL)
|
||||
fatal("Need cwd");
|
||||
|
||||
setlinebuf(stdout);
|
||||
setlinebuf(stdin);
|
||||
setvbuf(stdout, NULL, _IOLBF, 0);
|
||||
setvbuf(stdin, NULL, _IOLBF, 0);
|
||||
|
||||
for(;;) {
|
||||
char *cp;
|
||||
|
2
crypto/dist/ssh/sftp-server.c
vendored
2
crypto/dist/ssh/sftp-server.c
vendored
@ -22,7 +22,7 @@
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include "includes.h"
|
||||
RCSID("$OpenBSD: sftp-server.c,v 1.18 2001/02/04 22:21:19 stevesk Exp $");
|
||||
RCSID("$OpenBSD: sftp-server.c,v 1.19 2001/02/07 18:01:18 itojun Exp $");
|
||||
|
||||
#include "buffer.h"
|
||||
#include "bufaux.h"
|
||||
|
42
crypto/dist/ssh/sftp.c
vendored
42
crypto/dist/ssh/sftp.c
vendored
@ -24,7 +24,7 @@
|
||||
|
||||
#include "includes.h"
|
||||
|
||||
RCSID("$OpenBSD: sftp.c,v 1.5 2001/02/06 23:53:54 djm Exp $");
|
||||
RCSID("$OpenBSD: sftp.c,v 1.7 2001/02/08 00:04:52 markus Exp $");
|
||||
|
||||
/* XXX: commandline mode */
|
||||
/* XXX: copy between two remote hosts (commandline) */
|
||||
@ -40,6 +40,10 @@ RCSID("$OpenBSD: sftp.c,v 1.5 2001/02/06 23:53:54 djm Exp $");
|
||||
#include "sftp-client.h"
|
||||
#include "sftp-int.h"
|
||||
|
||||
int use_ssh1 = 0;
|
||||
char *ssh_program = _PATH_SSH_PROGRAM;
|
||||
char *sftp_server = NULL;
|
||||
|
||||
static void
|
||||
connect_to_server(char **args, int *in, int *out, pid_t *sshpid)
|
||||
{
|
||||
@ -72,8 +76,8 @@ connect_to_server(char **args, int *in, int *out, pid_t *sshpid)
|
||||
close(*out);
|
||||
close(c_in);
|
||||
close(c_out);
|
||||
execv(_PATH_SSH_PROGRAM, args);
|
||||
fprintf(stderr, "exec: %s", strerror(errno));
|
||||
execv(ssh_program, args);
|
||||
fprintf(stderr, "exec: %s: %s\n", ssh_program, strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@ -87,16 +91,24 @@ make_ssh_args(char *add_arg)
|
||||
static char **args = NULL;
|
||||
static int nargs = 0;
|
||||
char debug_buf[4096];
|
||||
int i;
|
||||
int i, use_subsystem = 1;
|
||||
|
||||
/* no subsystem if protocol 1 or the server-spec contains a '/' */
|
||||
if (use_ssh1 ||
|
||||
(sftp_server != NULL && strchr(sftp_server, '/') != NULL))
|
||||
use_subsystem = 0;
|
||||
|
||||
/* Init args array */
|
||||
if (args == NULL) {
|
||||
nargs = 4;
|
||||
nargs = use_subsystem ? 6 : 5;
|
||||
i = 0;
|
||||
args = xmalloc(sizeof(*args) * nargs);
|
||||
args[i++] = "ssh";
|
||||
args[i++] = "-oProtocol=2";
|
||||
args[i++] = use_ssh1 ? "-oProtocol=1" : "-oProtocol=2";
|
||||
if (use_subsystem)
|
||||
args[i++] = "-s";
|
||||
args[i++] = "-oForwardAgent=no";
|
||||
args[i++] = "-oForwardX11=no";
|
||||
args[i++] = NULL;
|
||||
}
|
||||
|
||||
@ -110,6 +122,9 @@ make_ssh_args(char *add_arg)
|
||||
}
|
||||
|
||||
/* Otherwise finish up and return the arg array */
|
||||
if (sftp_server != NULL)
|
||||
make_ssh_args(sftp_server);
|
||||
else
|
||||
make_ssh_args("sftp");
|
||||
|
||||
/* XXX: overflow - doesn't grow debug_buf */
|
||||
@ -128,7 +143,7 @@ make_ssh_args(char *add_arg)
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
fprintf(stderr, "usage: sftp [-vC] [-osshopt=value] [user@]host\n");
|
||||
fprintf(stderr, "usage: sftp [-1vC] [-osshopt=value] [user@]host\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@ -144,7 +159,7 @@ main(int argc, char **argv)
|
||||
|
||||
debug_level = compress_flag = 0;
|
||||
|
||||
while ((ch = getopt(argc, argv, "hCvo:")) != -1) {
|
||||
while ((ch = getopt(argc, argv, "1hvCo:s:S:")) != -1) {
|
||||
switch (ch) {
|
||||
case 'C':
|
||||
compress_flag = 1;
|
||||
@ -156,6 +171,17 @@ main(int argc, char **argv)
|
||||
make_ssh_args("-o");
|
||||
make_ssh_args(optarg);
|
||||
break;
|
||||
case '1':
|
||||
use_ssh1 = 1;
|
||||
if (sftp_server == NULL)
|
||||
sftp_server = _PATH_SFTP_SERVER;
|
||||
break;
|
||||
case 's':
|
||||
sftp_server = optarg;
|
||||
break;
|
||||
case 'S':
|
||||
ssh_program = optarg;
|
||||
break;
|
||||
case 'h':
|
||||
default:
|
||||
usage();
|
||||
|
6
crypto/dist/ssh/ssh-keyscan.c
vendored
6
crypto/dist/ssh/ssh-keyscan.c
vendored
@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
RCSID("$OpenBSD: ssh-keyscan.c,v 1.12 2001/02/04 15:32:26 stevesk Exp $");
|
||||
RCSID("$OpenBSD: ssh-keyscan.c,v 1.14 2001/02/07 22:43:16 markus Exp $");
|
||||
|
||||
#include <sys/queue.h>
|
||||
#include <errno.h>
|
||||
@ -138,7 +138,7 @@ Linebuf_lineno(Linebuf * lb)
|
||||
}
|
||||
|
||||
static inline char *
|
||||
getline(Linebuf * lb)
|
||||
Linebuf_getline(Linebuf * lb)
|
||||
{
|
||||
int n = 0;
|
||||
|
||||
@ -527,7 +527,7 @@ nexthost(int argc, char **argv)
|
||||
error("ignoring invalid/misplaced option `%s'", argv[argno++]);
|
||||
} else {
|
||||
char *line;
|
||||
line = getline(lb);
|
||||
line = Linebuf_getline(lb);
|
||||
if (line)
|
||||
return (line);
|
||||
Linebuf_free(lb);
|
||||
|
2
crypto/dist/ssh/sshconnect.c
vendored
2
crypto/dist/ssh/sshconnect.c
vendored
@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
RCSID("$OpenBSD: sshconnect.c,v 1.93 2001/02/04 15:32:26 stevesk Exp $");
|
||||
RCSID("$OpenBSD: sshconnect.c,v 1.94 2001/02/08 10:47:04 itojun Exp $");
|
||||
|
||||
#include <openssl/bn.h>
|
||||
|
||||
|
2
crypto/dist/ssh/sshconnect1.c
vendored
2
crypto/dist/ssh/sshconnect1.c
vendored
@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
RCSID("$OpenBSD: sshconnect1.c,v 1.22 2001/02/03 10:08:37 markus Exp $");
|
||||
RCSID("$OpenBSD: sshconnect1.c,v 1.23 2001/02/08 10:47:04 itojun Exp $");
|
||||
|
||||
#include <openssl/bn.h>
|
||||
#include <openssl/evp.h>
|
||||
|
2
crypto/dist/ssh/sshconnect2.c
vendored
2
crypto/dist/ssh/sshconnect2.c
vendored
@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
RCSID("$OpenBSD: sshconnect2.c,v 1.42 2001/02/06 22:26:17 markus Exp $");
|
||||
RCSID("$OpenBSD: sshconnect2.c,v 1.43 2001/02/08 10:47:05 itojun Exp $");
|
||||
|
||||
#include <openssl/bn.h>
|
||||
#include <openssl/md5.h>
|
||||
|
9
crypto/dist/ssh/sshd.c
vendored
9
crypto/dist/ssh/sshd.c
vendored
@ -40,7 +40,7 @@
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
RCSID("$OpenBSD: sshd.c,v 1.163 2001/02/04 23:56:23 deraadt Exp $");
|
||||
RCSID("$OpenBSD: sshd.c,v 1.164 2001/02/07 22:35:46 markus Exp $");
|
||||
|
||||
#include <openssl/dh.h>
|
||||
#include <openssl/bn.h>
|
||||
@ -1129,6 +1129,13 @@ main(int ac, char **av)
|
||||
options.kerberos_authentication = 0;
|
||||
}
|
||||
#endif /* KRB4 */
|
||||
#ifdef AFS
|
||||
/* If machine has AFS, set process authentication group. */
|
||||
if (k_hasafs()) {
|
||||
k_setpag();
|
||||
k_unlog();
|
||||
}
|
||||
#endif /* AFS */
|
||||
|
||||
packet_set_nonblocking();
|
||||
|
||||
|
6
crypto/dist/ssh/version.h
vendored
6
crypto/dist/ssh/version.h
vendored
@ -1,7 +1,7 @@
|
||||
/* $OpenBSD: version.h,v 1.16 2001/01/08 22:29:05 markus Exp $ */
|
||||
/* $OpenBSD: version.h,v 1.17 2001/02/08 18:15:22 markus Exp $ */
|
||||
|
||||
#define __OPENSSH_VERSION "OpenSSH_2.3.1"
|
||||
#define __NETBSDSSH_VERSION "NetBSD_Secure_Shell-20010208"
|
||||
#define __OPENSSH_VERSION "OpenSSH_2.3.2"
|
||||
#define __NETBSDSSH_VERSION "NetBSD_Secure_Shell-20010209"
|
||||
|
||||
/*
|
||||
* it is important to retain OpenSSH version identification part, it is
|
||||
|
6
crypto/dist/ssh/xmalloc.c
vendored
6
crypto/dist/ssh/xmalloc.c
vendored
@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
RCSID("$OpenBSD: xmalloc.c,v 1.12 2001/02/07 08:57:26 deraadt Exp $");
|
||||
RCSID("$OpenBSD: xmalloc.c,v 1.14 2001/02/07 18:04:50 itojun Exp $");
|
||||
|
||||
#include "xmalloc.h"
|
||||
#include "log.h"
|
||||
@ -37,7 +37,7 @@ xrealloc(void *ptr, size_t new_size)
|
||||
void *new_ptr;
|
||||
|
||||
if (new_size == 0)
|
||||
fatal("xmalloc: zero size");
|
||||
fatal("xrealloc: zero size");
|
||||
if (ptr == NULL)
|
||||
fatal("xrealloc: NULL pointer given as argument");
|
||||
new_ptr = realloc(ptr, new_size);
|
||||
@ -61,7 +61,7 @@ xstrdup(const char *str)
|
||||
char *cp;
|
||||
|
||||
if (len == 0)
|
||||
fatal("xmalloc: zero size");
|
||||
fatal("xstrdup: zero size");
|
||||
cp = xmalloc(len);
|
||||
strlcpy(cp, str, len);
|
||||
return cp;
|
||||
|
Loading…
Reference in New Issue
Block a user