- djm@cvs.openbsd.org 2001/02/14 9:46:03
[sftp-client.c sftp-int.c sftp.1] Fix and document 'preserve modes & times' option ('-p' flag in sftp); ok markus@
This commit is contained in:
parent
6690494f21
commit
9d4f2c808c
|
@ -32,6 +32,10 @@
|
||||||
- stevesk@cvs.openbsd.org 2001/02/12 20:53:33
|
- stevesk@cvs.openbsd.org 2001/02/12 20:53:33
|
||||||
[sftp-int.c]
|
[sftp-int.c]
|
||||||
lumask now works with 1 numeric arg; ok markus@, djm@
|
lumask now works with 1 numeric arg; ok markus@, djm@
|
||||||
|
- djm@cvs.openbsd.org 2001/02/14 9:46:03
|
||||||
|
[sftp-client.c sftp-int.c sftp.1]
|
||||||
|
Fix and document 'preserve modes & times' option ('-p' flag in sftp);
|
||||||
|
ok markus@
|
||||||
|
|
||||||
20010214
|
20010214
|
||||||
- (djm) Don't try to close PAM session or delete credentials if the
|
- (djm) Don't try to close PAM session or delete credentials if the
|
||||||
|
@ -3960,4 +3964,4 @@
|
||||||
- Wrote replacements for strlcpy and mkdtemp
|
- Wrote replacements for strlcpy and mkdtemp
|
||||||
- Released 1.0pre1
|
- Released 1.0pre1
|
||||||
|
|
||||||
$Id: ChangeLog,v 1.768 2001/02/15 03:19:56 mouring Exp $
|
$Id: ChangeLog,v 1.769 2001/02/15 03:22:45 mouring Exp $
|
||||||
|
|
|
@ -29,7 +29,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.9 2001/02/10 00:41:46 djm Exp $");
|
RCSID("$OpenBSD: sftp-client.c,v 1.10 2001/02/14 09:46:03 djm Exp $");
|
||||||
|
|
||||||
#include "ssh.h"
|
#include "ssh.h"
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
|
@ -577,20 +577,6 @@ do_download(int fd_in, int fd_out, char *remote_path, char *local_path,
|
||||||
return(errno);
|
return(errno);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Override umask and utimes if asked */
|
|
||||||
if (pflag && fchmod(local_fd, mode) == -1)
|
|
||||||
error("Couldn't set mode on \"%s\": %s", local_path,
|
|
||||||
strerror(errno));
|
|
||||||
if (pflag && (a->flags & SSH2_FILEXFER_ATTR_ACMODTIME)) {
|
|
||||||
struct timeval tv;
|
|
||||||
|
|
||||||
tv.tv_sec = a->atime;
|
|
||||||
tv.tv_usec = a->mtime;
|
|
||||||
if (utimes(local_path, &tv) == -1)
|
|
||||||
error("Can't set times on \"%s\": %s", local_path,
|
|
||||||
strerror(errno));
|
|
||||||
}
|
|
||||||
|
|
||||||
buffer_init(&msg);
|
buffer_init(&msg);
|
||||||
|
|
||||||
/* Send open request */
|
/* Send open request */
|
||||||
|
@ -675,6 +661,20 @@ do_download(int fd_in, int fd_out, char *remote_path, char *local_path,
|
||||||
}
|
}
|
||||||
status = do_close(fd_in, fd_out, handle, handle_len);
|
status = do_close(fd_in, fd_out, handle, handle_len);
|
||||||
|
|
||||||
|
/* Override umask and utimes if asked */
|
||||||
|
if (pflag && fchmod(local_fd, mode) == -1)
|
||||||
|
error("Couldn't set mode on \"%s\": %s", local_path,
|
||||||
|
strerror(errno));
|
||||||
|
if (pflag && (a->flags & SSH2_FILEXFER_ATTR_ACMODTIME)) {
|
||||||
|
struct timeval tv[2];
|
||||||
|
tv[0].tv_sec = a->atime;
|
||||||
|
tv[1].tv_sec = a->mtime;
|
||||||
|
tv[0].tv_usec = tv[1].tv_usec = 0;
|
||||||
|
if (utimes(local_path, tv) == -1)
|
||||||
|
error("Can't set times on \"%s\": %s", local_path,
|
||||||
|
strerror(errno));
|
||||||
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
close(local_fd);
|
close(local_fd);
|
||||||
buffer_free(&msg);
|
buffer_free(&msg);
|
||||||
|
@ -735,10 +735,6 @@ do_upload(int fd_in, int fd_out, char *local_path, char *remote_path,
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Override umask and utimes if asked */
|
|
||||||
if (pflag)
|
|
||||||
do_fsetstat(fd_in, fd_out, handle, handle_len, &a);
|
|
||||||
|
|
||||||
/* Read from local and write to remote */
|
/* Read from local and write to remote */
|
||||||
offset = 0;
|
offset = 0;
|
||||||
for(;;) {
|
for(;;) {
|
||||||
|
@ -791,6 +787,10 @@ do_upload(int fd_in, int fd_out, char *local_path, char *remote_path,
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Override umask and utimes if asked */
|
||||||
|
if (pflag)
|
||||||
|
do_fsetstat(fd_in, fd_out, handle, handle_len, &a);
|
||||||
|
|
||||||
status = do_close(fd_in, fd_out, handle, handle_len);
|
status = do_close(fd_in, fd_out, handle, handle_len);
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
@ -798,5 +798,3 @@ done:
|
||||||
buffer_free(&msg);
|
buffer_free(&msg);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
/* XXX: recursive operations */
|
/* XXX: recursive operations */
|
||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
RCSID("$OpenBSD: sftp-int.c,v 1.21 2001/02/12 20:53:33 stevesk Exp $");
|
RCSID("$OpenBSD: sftp-int.c,v 1.22 2001/02/14 09:46:03 djm Exp $");
|
||||||
|
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "xmalloc.h"
|
#include "xmalloc.h"
|
||||||
|
@ -204,11 +204,12 @@ parse_getput_flags(const char **cpp, int *pflag)
|
||||||
/* Check for flags */
|
/* Check for flags */
|
||||||
if (cp[0] == '-' && cp[1] && strchr(WHITESPACE, cp[2])) {
|
if (cp[0] == '-' && cp[1] && strchr(WHITESPACE, cp[2])) {
|
||||||
switch (cp[1]) {
|
switch (cp[1]) {
|
||||||
|
case 'p':
|
||||||
case 'P':
|
case 'P':
|
||||||
*pflag = 1;
|
*pflag = 1;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
error("Invalid flag -%c", *cp);
|
error("Invalid flag -%c", cp[1]);
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
cp += 2;
|
cp += 2;
|
||||||
|
|
24
sftp.1
24
sftp.1
|
@ -1,4 +1,4 @@
|
||||||
.\" $OpenBSD: sftp.1,v 1.6 2001/02/10 00:45:52 djm Exp $
|
.\" $OpenBSD: sftp.1,v 1.7 2001/02/14 09:46:03 djm Exp $
|
||||||
.\"
|
.\"
|
||||||
.\" Copyright (c) 2001 Damien Miller. All rights reserved.
|
.\" Copyright (c) 2001 Damien Miller. All rights reserved.
|
||||||
.\"
|
.\"
|
||||||
|
@ -94,13 +94,20 @@ to
|
||||||
must be a numeric UID.
|
must be a numeric UID.
|
||||||
.It Ic help
|
.It Ic help
|
||||||
Display help text.
|
Display help text.
|
||||||
.It Ic get Ar remote-path Op Ar local-path
|
.It Xo Ic get
|
||||||
|
.Op Ar flags
|
||||||
|
.Ar remote-path
|
||||||
|
.Op Ar local-path
|
||||||
|
.Xc
|
||||||
Retrieve the
|
Retrieve the
|
||||||
.Ar remote-path
|
.Ar remote-path
|
||||||
and store it on the local machine.
|
and store it on the local machine.
|
||||||
If the local
|
If the local
|
||||||
path name is not specified, it is given the same name it has on the
|
path name is not specified, it is given the same name it has on the
|
||||||
remote machine.
|
remote machine. If the
|
||||||
|
.Fl P
|
||||||
|
flag is specified, then the file's full permission and access time are
|
||||||
|
copied too.
|
||||||
.It Ic lls Op Ar ls-options Op Ar path
|
.It Ic lls Op Ar ls-options Op Ar path
|
||||||
Display local directory listing of either
|
Display local directory listing of either
|
||||||
.Ar path
|
.Ar path
|
||||||
|
@ -124,11 +131,18 @@ Set local umask to
|
||||||
.It Ic mkdir Ar path
|
.It Ic mkdir Ar path
|
||||||
Create remote directory specified by
|
Create remote directory specified by
|
||||||
.Ar path .
|
.Ar path .
|
||||||
.It Ic put Ar local-path Op Ar remote-path
|
.It Xo Ic put
|
||||||
|
.Op Ar flags
|
||||||
|
.Ar local-path
|
||||||
|
.Op Ar local-path
|
||||||
|
.Xc
|
||||||
Upload
|
Upload
|
||||||
.Ar local-path
|
.Ar local-path
|
||||||
and store it on the remote machine. If the remote path name is not specified,
|
and store it on the remote machine. If the remote path name is not specified,
|
||||||
it is given the same name it has on the local machine.
|
it is given the same name it has on the local machine. If the
|
||||||
|
.Fl P
|
||||||
|
flag is specified, then the file's full permission and access time are
|
||||||
|
copied too.
|
||||||
.It Ic pwd
|
.It Ic pwd
|
||||||
Display remote working directory.
|
Display remote working directory.
|
||||||
.It Ic exit
|
.It Ic exit
|
||||||
|
|
Loading…
Reference in New Issue