- deraadt@cvs.openbsd.org 2002/11/21 23:03:51
[auth-krb5.c auth1.c hostfile.h monitor_wrap.c sftp-client.c sftp-int.c ssh-add.c ssh-rsa.c sshconnect.c] KNF
This commit is contained in:
parent
064496feaa
commit
93576d9538
|
@ -16,6 +16,10 @@
|
||||||
- markus@cvs.openbsd.org 2002/11/21 22:45:31
|
- markus@cvs.openbsd.org 2002/11/21 22:45:31
|
||||||
[cipher.c kex.c packet.c sshconnect.c sshconnect2.c]
|
[cipher.c kex.c packet.c sshconnect.c sshconnect2.c]
|
||||||
debug->debug2, unify debug messages
|
debug->debug2, unify debug messages
|
||||||
|
- deraadt@cvs.openbsd.org 2002/11/21 23:03:51
|
||||||
|
[auth-krb5.c auth1.c hostfile.h monitor_wrap.c sftp-client.c sftp-int.c ssh-add.c ssh-rsa.c
|
||||||
|
sshconnect.c]
|
||||||
|
KNF
|
||||||
|
|
||||||
20021205
|
20021205
|
||||||
- (djm) PERL-free fixpaths from stuge-openssh-unix-dev@cdy.org
|
- (djm) PERL-free fixpaths from stuge-openssh-unix-dev@cdy.org
|
||||||
|
@ -851,4 +855,4 @@
|
||||||
save auth method before monitor_reset_key_state(); bugzilla bug #284;
|
save auth method before monitor_reset_key_state(); bugzilla bug #284;
|
||||||
ok provos@
|
ok provos@
|
||||||
|
|
||||||
$Id: ChangeLog,v 1.2519 2002/12/23 02:04:22 mouring Exp $
|
$Id: ChangeLog,v 1.2520 2002/12/23 02:06:19 mouring Exp $
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
RCSID("$OpenBSD: auth-krb5.c,v 1.9 2002/09/09 06:48:06 itojun Exp $");
|
RCSID("$OpenBSD: auth-krb5.c,v 1.10 2002/11/21 23:03:51 deraadt Exp $");
|
||||||
|
|
||||||
#include "ssh.h"
|
#include "ssh.h"
|
||||||
#include "ssh1.h"
|
#include "ssh1.h"
|
||||||
|
@ -107,7 +107,7 @@ auth_krb5(Authctxt *authctxt, krb5_data *auth, char **client, krb5_data *reply)
|
||||||
if (problem)
|
if (problem)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
problem = krb5_sname_to_principal(authctxt->krb5_ctx, NULL, NULL ,
|
problem = krb5_sname_to_principal(authctxt->krb5_ctx, NULL, NULL,
|
||||||
KRB5_NT_SRV_HST, &server);
|
KRB5_NT_SRV_HST, &server);
|
||||||
if (problem)
|
if (problem)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
4
auth1.c
4
auth1.c
|
@ -10,7 +10,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
RCSID("$OpenBSD: auth1.c,v 1.44 2002/09/26 11:38:43 markus Exp $");
|
RCSID("$OpenBSD: auth1.c,v 1.45 2002/11/21 23:03:51 deraadt Exp $");
|
||||||
|
|
||||||
#include "xmalloc.h"
|
#include "xmalloc.h"
|
||||||
#include "rsa.h"
|
#include "rsa.h"
|
||||||
|
@ -150,7 +150,7 @@ do_authloop(Authctxt *authctxt)
|
||||||
snprintf(info, sizeof(info),
|
snprintf(info, sizeof(info),
|
||||||
" tktuser %.100s",
|
" tktuser %.100s",
|
||||||
client_user);
|
client_user);
|
||||||
|
|
||||||
/* Send response to client */
|
/* Send response to client */
|
||||||
packet_start(
|
packet_start(
|
||||||
SSH_SMSG_AUTH_KERBEROS_RESPONSE);
|
SSH_SMSG_AUTH_KERBEROS_RESPONSE);
|
||||||
|
|
12
hostfile.h
12
hostfile.h
|
@ -1,4 +1,4 @@
|
||||||
/* $OpenBSD: hostfile.h,v 1.12 2002/09/08 20:24:08 markus Exp $ */
|
/* $OpenBSD: hostfile.h,v 1.13 2002/11/21 23:03:51 deraadt Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
||||||
|
@ -19,10 +19,10 @@ typedef enum {
|
||||||
} HostStatus;
|
} HostStatus;
|
||||||
|
|
||||||
int hostfile_read_key(char **, u_int *, Key *);
|
int hostfile_read_key(char **, u_int *, Key *);
|
||||||
HostStatus
|
HostStatus check_host_in_hostfile(const char *, const char *,
|
||||||
check_host_in_hostfile(const char *, const char *, Key *, Key *, int *);
|
Key *, Key *, int *);
|
||||||
int add_host_to_hostfile(const char *, const char *, Key *);
|
int add_host_to_hostfile(const char *, const char *, Key *);
|
||||||
int
|
int lookup_key_in_hostfile_by_type(const char *, const char *,
|
||||||
lookup_key_in_hostfile_by_type(const char *, const char *, int , Key *, int *);
|
int, Key *, int *);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
RCSID("$OpenBSD: monitor_wrap.c,v 1.19 2002/09/26 11:38:43 markus Exp $");
|
RCSID("$OpenBSD: monitor_wrap.c,v 1.20 2002/11/21 23:03:51 deraadt Exp $");
|
||||||
|
|
||||||
#include <openssl/bn.h>
|
#include <openssl/bn.h>
|
||||||
#include <openssl/dh.h>
|
#include <openssl/dh.h>
|
||||||
|
@ -969,7 +969,7 @@ mm_auth_krb4(Authctxt *authctxt, void *_auth, char **client, void *_reply)
|
||||||
xfree(p);
|
xfree(p);
|
||||||
}
|
}
|
||||||
buffer_free(&m);
|
buffer_free(&m);
|
||||||
return (success);
|
return (success);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
/* XXX: copy between two remote sites */
|
/* XXX: copy between two remote sites */
|
||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
RCSID("$OpenBSD: sftp-client.c,v 1.36 2002/11/05 20:10:37 markus Exp $");
|
RCSID("$OpenBSD: sftp-client.c,v 1.37 2002/11/21 23:03:51 deraadt Exp $");
|
||||||
|
|
||||||
#include "openbsd-compat/sys-queue.h"
|
#include "openbsd-compat/sys-queue.h"
|
||||||
|
|
||||||
|
@ -857,9 +857,9 @@ do_download(struct sftp_conn *conn, char *remote_path, char *local_path,
|
||||||
(unsigned long long)req->offset + len - 1);
|
(unsigned long long)req->offset + len - 1);
|
||||||
if (len > req->len)
|
if (len > req->len)
|
||||||
fatal("Received more data than asked for "
|
fatal("Received more data than asked for "
|
||||||
"%u > %u", len, req->len);
|
"%u > %u", len, req->len);
|
||||||
if ((lseek(local_fd, req->offset, SEEK_SET) == -1 ||
|
if ((lseek(local_fd, req->offset, SEEK_SET) == -1 ||
|
||||||
atomicio(write, local_fd, data, len) != len) &&
|
atomicio(write, local_fd, data, len) != len) &&
|
||||||
!write_error) {
|
!write_error) {
|
||||||
write_errno = errno;
|
write_errno = errno;
|
||||||
write_error = 1;
|
write_error = 1;
|
||||||
|
@ -930,7 +930,7 @@ do_download(struct sftp_conn *conn, char *remote_path, char *local_path,
|
||||||
if (pflag && chmod(local_path, mode) == -1)
|
if (pflag && chmod(local_path, mode) == -1)
|
||||||
#endif /* HAVE_FCHMOD */
|
#endif /* HAVE_FCHMOD */
|
||||||
error("Couldn't set mode on \"%s\": %s", local_path,
|
error("Couldn't set mode on \"%s\": %s", local_path,
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
if (pflag && (a->flags & SSH2_FILEXFER_ATTR_ACMODTIME)) {
|
if (pflag && (a->flags & SSH2_FILEXFER_ATTR_ACMODTIME)) {
|
||||||
struct timeval tv[2];
|
struct timeval tv[2];
|
||||||
tv[0].tv_sec = a->atime;
|
tv[0].tv_sec = a->atime;
|
||||||
|
@ -938,7 +938,7 @@ do_download(struct sftp_conn *conn, char *remote_path, char *local_path,
|
||||||
tv[0].tv_usec = tv[1].tv_usec = 0;
|
tv[0].tv_usec = tv[1].tv_usec = 0;
|
||||||
if (utimes(local_path, tv) == -1)
|
if (utimes(local_path, tv) == -1)
|
||||||
error("Can't set times on \"%s\": %s",
|
error("Can't set times on \"%s\": %s",
|
||||||
local_path, strerror(errno));
|
local_path, strerror(errno));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
close(local_fd);
|
close(local_fd);
|
||||||
|
@ -1047,7 +1047,7 @@ do_upload(struct sftp_conn *conn, char *local_path, char *remote_path,
|
||||||
buffer_put_string(&msg, data, len);
|
buffer_put_string(&msg, data, len);
|
||||||
send_msg(conn->fd_out, &msg);
|
send_msg(conn->fd_out, &msg);
|
||||||
debug3("Sent message SSH2_FXP_WRITE I:%u O:%llu S:%u",
|
debug3("Sent message SSH2_FXP_WRITE I:%u O:%llu S:%u",
|
||||||
id, (unsigned long long)offset, len);
|
id, (unsigned long long)offset, len);
|
||||||
} else if (TAILQ_FIRST(&acks) == NULL)
|
} else if (TAILQ_FIRST(&acks) == NULL)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1081,7 +1081,7 @@ do_upload(struct sftp_conn *conn, char *local_path, char *remote_path,
|
||||||
|
|
||||||
if (status != SSH2_FX_OK) {
|
if (status != SSH2_FX_OK) {
|
||||||
error("Couldn't write to remote file \"%s\": %s",
|
error("Couldn't write to remote file \"%s\": %s",
|
||||||
remote_path, fx2txt(status));
|
remote_path, fx2txt(status));
|
||||||
do_close(conn, handle, handle_len);
|
do_close(conn, handle, handle_len);
|
||||||
close(local_fd);
|
close(local_fd);
|
||||||
goto done;
|
goto done;
|
||||||
|
|
28
sftp-int.c
28
sftp-int.c
|
@ -25,7 +25,7 @@
|
||||||
/* XXX: recursive operations */
|
/* XXX: recursive operations */
|
||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
RCSID("$OpenBSD: sftp-int.c,v 1.49 2002/09/12 00:13:06 djm Exp $");
|
RCSID("$OpenBSD: sftp-int.c,v 1.50 2002/11/21 23:03:51 deraadt Exp $");
|
||||||
|
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "xmalloc.h"
|
#include "xmalloc.h"
|
||||||
|
@ -550,7 +550,7 @@ sdirent_comp(const void *aa, const void *bb)
|
||||||
SFTP_DIRENT *a = *(SFTP_DIRENT **)aa;
|
SFTP_DIRENT *a = *(SFTP_DIRENT **)aa;
|
||||||
SFTP_DIRENT *b = *(SFTP_DIRENT **)bb;
|
SFTP_DIRENT *b = *(SFTP_DIRENT **)bb;
|
||||||
|
|
||||||
return (strcmp(a->filename, b->filename));
|
return (strcmp(a->filename, b->filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* sftp ls.1 replacement for directories */
|
/* sftp ls.1 replacement for directories */
|
||||||
|
@ -563,7 +563,7 @@ do_ls_dir(struct sftp_conn *conn, char *path, char *strip_path, int lflag)
|
||||||
if ((n = do_readdir(conn, path, &d)) != 0)
|
if ((n = do_readdir(conn, path, &d)) != 0)
|
||||||
return (n);
|
return (n);
|
||||||
|
|
||||||
/* Count entries for sort */
|
/* Count entries for sort */
|
||||||
for (n = 0; d[n] != NULL; n++)
|
for (n = 0; d[n] != NULL; n++)
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -571,7 +571,7 @@ do_ls_dir(struct sftp_conn *conn, char *path, char *strip_path, int lflag)
|
||||||
|
|
||||||
for (n = 0; d[n] != NULL; n++) {
|
for (n = 0; d[n] != NULL; n++) {
|
||||||
char *tmp, *fname;
|
char *tmp, *fname;
|
||||||
|
|
||||||
tmp = path_append(path, d[n]->filename);
|
tmp = path_append(path, d[n]->filename);
|
||||||
fname = path_strip(tmp, strip_path);
|
fname = path_strip(tmp, strip_path);
|
||||||
xfree(tmp);
|
xfree(tmp);
|
||||||
|
@ -589,7 +589,7 @@ do_ls_dir(struct sftp_conn *conn, char *path, char *strip_path, int lflag)
|
||||||
/* XXX - multicolumn display would be nice here */
|
/* XXX - multicolumn display would be nice here */
|
||||||
printf("%s\n", fname);
|
printf("%s\n", fname);
|
||||||
}
|
}
|
||||||
|
|
||||||
xfree(fname);
|
xfree(fname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -599,7 +599,7 @@ do_ls_dir(struct sftp_conn *conn, char *path, char *strip_path, int lflag)
|
||||||
|
|
||||||
/* sftp ls.1 replacement which handles path globs */
|
/* sftp ls.1 replacement which handles path globs */
|
||||||
static int
|
static int
|
||||||
do_globbed_ls(struct sftp_conn *conn, char *path, char *strip_path,
|
do_globbed_ls(struct sftp_conn *conn, char *path, char *strip_path,
|
||||||
int lflag)
|
int lflag)
|
||||||
{
|
{
|
||||||
glob_t g;
|
glob_t g;
|
||||||
|
@ -609,23 +609,23 @@ do_globbed_ls(struct sftp_conn *conn, char *path, char *strip_path,
|
||||||
|
|
||||||
memset(&g, 0, sizeof(g));
|
memset(&g, 0, sizeof(g));
|
||||||
|
|
||||||
if (remote_glob(conn, path, GLOB_MARK|GLOB_NOCHECK|GLOB_BRACE,
|
if (remote_glob(conn, path, GLOB_MARK|GLOB_NOCHECK|GLOB_BRACE,
|
||||||
NULL, &g)) {
|
NULL, &g)) {
|
||||||
error("Can't ls: \"%s\" not found", path);
|
error("Can't ls: \"%s\" not found", path);
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the glob returns a single match, which is the same as the
|
* If the glob returns a single match, which is the same as the
|
||||||
* input glob, and it is a directory, then just list its contents
|
* input glob, and it is a directory, then just list its contents
|
||||||
*/
|
*/
|
||||||
if (g.gl_pathc == 1 &&
|
if (g.gl_pathc == 1 &&
|
||||||
strncmp(path, g.gl_pathv[0], strlen(g.gl_pathv[0]) - 1) == 0) {
|
strncmp(path, g.gl_pathv[0], strlen(g.gl_pathv[0]) - 1) == 0) {
|
||||||
if ((a = do_lstat(conn, path, 1)) == NULL) {
|
if ((a = do_lstat(conn, path, 1)) == NULL) {
|
||||||
globfree(&g);
|
globfree(&g);
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
if ((a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) &&
|
if ((a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) &&
|
||||||
S_ISDIR(a->perm)) {
|
S_ISDIR(a->perm)) {
|
||||||
globfree(&g);
|
globfree(&g);
|
||||||
return (do_ls_dir(conn, path, strip_path, lflag));
|
return (do_ls_dir(conn, path, strip_path, lflag));
|
||||||
|
@ -640,8 +640,8 @@ do_globbed_ls(struct sftp_conn *conn, char *path, char *strip_path,
|
||||||
if (lflag) {
|
if (lflag) {
|
||||||
/*
|
/*
|
||||||
* XXX: this is slow - 1 roundtrip per path
|
* XXX: this is slow - 1 roundtrip per path
|
||||||
* A solution to this is to fork glob() and
|
* A solution to this is to fork glob() and
|
||||||
* build a sftp specific version which keeps the
|
* build a sftp specific version which keeps the
|
||||||
* attribs (which currently get thrown away)
|
* attribs (which currently get thrown away)
|
||||||
* that the server returns as well as the filenames.
|
* that the server returns as well as the filenames.
|
||||||
*/
|
*/
|
||||||
|
@ -666,7 +666,7 @@ do_globbed_ls(struct sftp_conn *conn, char *path, char *strip_path,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
parse_args(const char **cpp, int *pflag, int *lflag,
|
parse_args(const char **cpp, int *pflag, int *lflag,
|
||||||
unsigned long *n_arg, char **path1, char **path2)
|
unsigned long *n_arg, char **path1, char **path2)
|
||||||
{
|
{
|
||||||
const char *cmd, *cp = *cpp;
|
const char *cmd, *cp = *cpp;
|
||||||
|
@ -900,7 +900,7 @@ parse_dispatch_command(struct sftp_conn *conn, const char *cmd, char **pwd)
|
||||||
do_globbed_ls(conn, *pwd, *pwd, lflag);
|
do_globbed_ls(conn, *pwd, *pwd, lflag);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Strip pwd off beginning of non-absolute paths */
|
/* Strip pwd off beginning of non-absolute paths */
|
||||||
tmp = NULL;
|
tmp = NULL;
|
||||||
if (*path1 != '/')
|
if (*path1 != '/')
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
RCSID("$OpenBSD: ssh-add.c,v 1.63 2002/09/19 15:51:23 markus Exp $");
|
RCSID("$OpenBSD: ssh-add.c,v 1.64 2002/11/21 23:03:51 deraadt Exp $");
|
||||||
|
|
||||||
#include <openssl/evp.h>
|
#include <openssl/evp.h>
|
||||||
|
|
||||||
|
@ -169,7 +169,7 @@ add_file(AuthenticationConnection *ac, const char *filename)
|
||||||
fprintf(stderr, "Identity added: %s (%s)\n", filename, comment);
|
fprintf(stderr, "Identity added: %s (%s)\n", filename, comment);
|
||||||
ret = 0;
|
ret = 0;
|
||||||
if (lifetime != 0)
|
if (lifetime != 0)
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Lifetime set to %d seconds\n", lifetime);
|
"Lifetime set to %d seconds\n", lifetime);
|
||||||
} else if (ssh_add_identity(ac, private, comment)) {
|
} else if (ssh_add_identity(ac, private, comment)) {
|
||||||
fprintf(stderr, "Identity added: %s (%s)\n", filename, comment);
|
fprintf(stderr, "Identity added: %s (%s)\n", filename, comment);
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
RCSID("$OpenBSD: ssh-rsa.c,v 1.26 2002/08/27 17:13:56 stevesk Exp $");
|
RCSID("$OpenBSD: ssh-rsa.c,v 1.27 2002/11/21 23:03:51 deraadt Exp $");
|
||||||
|
|
||||||
#include <openssl/evp.h>
|
#include <openssl/evp.h>
|
||||||
#include <openssl/err.h>
|
#include <openssl/err.h>
|
||||||
|
@ -37,7 +37,7 @@ RCSID("$OpenBSD: ssh-rsa.c,v 1.26 2002/08/27 17:13:56 stevesk Exp $");
|
||||||
#include "compat.h"
|
#include "compat.h"
|
||||||
#include "ssh.h"
|
#include "ssh.h"
|
||||||
|
|
||||||
static int openssh_RSA_verify(int, u_char *, u_int, u_char *, u_int , RSA *);
|
static int openssh_RSA_verify(int, u_char *, u_int, u_char *, u_int, RSA *);
|
||||||
|
|
||||||
/* RSASSA-PKCS1-v1_5 (PKCS #1 v2.0 signature) with SHA1 */
|
/* RSASSA-PKCS1-v1_5 (PKCS #1 v2.0 signature) with SHA1 */
|
||||||
int
|
int
|
||||||
|
|
10
sshconnect.c
10
sshconnect.c
|
@ -13,7 +13,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
RCSID("$OpenBSD: sshconnect.c,v 1.136 2002/11/21 22:45:31 markus Exp $");
|
RCSID("$OpenBSD: sshconnect.c,v 1.137 2002/11/21 23:03:51 deraadt Exp $");
|
||||||
|
|
||||||
#include <openssl/bn.h>
|
#include <openssl/bn.h>
|
||||||
|
|
||||||
|
@ -649,10 +649,10 @@ check_host_key(char *host, struct sockaddr *hostaddr, Key *host_key,
|
||||||
"%s key fingerprint is %s.\n"
|
"%s key fingerprint is %s.\n"
|
||||||
"Are you sure you want to continue connecting "
|
"Are you sure you want to continue connecting "
|
||||||
"(yes/no)? ",
|
"(yes/no)? ",
|
||||||
host, ip,
|
host, ip,
|
||||||
has_keys ? ",\nbut keys of different type are already "
|
has_keys ? ",\nbut keys of different type are already "
|
||||||
"known for this host." : ".",
|
"known for this host." : ".",
|
||||||
type, fp);
|
type, fp);
|
||||||
xfree(fp);
|
xfree(fp);
|
||||||
if (!confirm(msg))
|
if (!confirm(msg))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
Loading…
Reference in New Issue