mirror of
https://github.com/PowerShell/openssh-portable.git
synced 2025-07-29 16:54:51 +02:00
parent
cb978aa057
commit
1addabd491
@ -134,6 +134,9 @@
|
|||||||
- millert@cvs.openbsd.org 2001/03/03 21:41:07
|
- millert@cvs.openbsd.org 2001/03/03 21:41:07
|
||||||
[packet.c]
|
[packet.c]
|
||||||
Dynamically allocate fd_set; deraadt@ OK
|
Dynamically allocate fd_set; deraadt@ OK
|
||||||
|
- deraadt@cvs.openbsd.org 2001/03/03 22:07:50
|
||||||
|
[sftp-server.c]
|
||||||
|
KNF
|
||||||
|
|
||||||
20010304
|
20010304
|
||||||
- (bal) Remove make-ssh-known-hosts.1 since it's no longer valid.
|
- (bal) Remove make-ssh-known-hosts.1 since it's no longer valid.
|
||||||
@ -4326,4 +4329,4 @@
|
|||||||
- Wrote replacements for strlcpy and mkdtemp
|
- Wrote replacements for strlcpy and mkdtemp
|
||||||
- Released 1.0pre1
|
- Released 1.0pre1
|
||||||
|
|
||||||
$Id: ChangeLog,v 1.892 2001/03/05 07:07:49 mouring Exp $
|
$Id: ChangeLog,v 1.893 2001/03/05 07:09:11 mouring Exp $
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
RCSID("$OpenBSD: sftp-server.c,v 1.21 2001/03/03 21:40:30 millert Exp $");
|
RCSID("$OpenBSD: sftp-server.c,v 1.22 2001/03/03 22:07:50 deraadt Exp $");
|
||||||
|
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "bufaux.h"
|
#include "bufaux.h"
|
||||||
@ -63,6 +63,7 @@ int
|
|||||||
errno_to_portable(int unixerrno)
|
errno_to_portable(int unixerrno)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
switch (unixerrno) {
|
switch (unixerrno) {
|
||||||
case 0:
|
case 0:
|
||||||
ret = SSH2_FX_OK;
|
ret = SSH2_FX_OK;
|
||||||
@ -93,6 +94,7 @@ int
|
|||||||
flags_from_portable(int pflags)
|
flags_from_portable(int pflags)
|
||||||
{
|
{
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
|
|
||||||
if ((pflags & SSH2_FXF_READ) &&
|
if ((pflags & SSH2_FXF_READ) &&
|
||||||
(pflags & SSH2_FXF_WRITE)) {
|
(pflags & SSH2_FXF_WRITE)) {
|
||||||
flags = O_RDWR;
|
flags = O_RDWR;
|
||||||
@ -125,17 +127,20 @@ struct Handle {
|
|||||||
int fd;
|
int fd;
|
||||||
char *name;
|
char *name;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
HANDLE_UNUSED,
|
HANDLE_UNUSED,
|
||||||
HANDLE_DIR,
|
HANDLE_DIR,
|
||||||
HANDLE_FILE
|
HANDLE_FILE
|
||||||
};
|
};
|
||||||
|
|
||||||
Handle handles[100];
|
Handle handles[100];
|
||||||
|
|
||||||
void
|
void
|
||||||
handle_init(void)
|
handle_init(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for(i = 0; i < sizeof(handles)/sizeof(Handle); i++)
|
for(i = 0; i < sizeof(handles)/sizeof(Handle); i++)
|
||||||
handles[i].use = HANDLE_UNUSED;
|
handles[i].use = HANDLE_UNUSED;
|
||||||
}
|
}
|
||||||
@ -144,6 +149,7 @@ int
|
|||||||
handle_new(int use, char *name, int fd, DIR *dirp)
|
handle_new(int use, char *name, int fd, DIR *dirp)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for(i = 0; i < sizeof(handles)/sizeof(Handle); i++) {
|
for(i = 0; i < sizeof(handles)/sizeof(Handle); i++) {
|
||||||
if (handles[i].use == HANDLE_UNUSED) {
|
if (handles[i].use == HANDLE_UNUSED) {
|
||||||
handles[i].use = use;
|
handles[i].use = use;
|
||||||
@ -178,6 +184,7 @@ int
|
|||||||
handle_from_string(char *handle, u_int hlen)
|
handle_from_string(char *handle, u_int hlen)
|
||||||
{
|
{
|
||||||
int val;
|
int val;
|
||||||
|
|
||||||
if (hlen != sizeof(int32_t))
|
if (hlen != sizeof(int32_t))
|
||||||
return -1;
|
return -1;
|
||||||
val = GET_32BIT(handle);
|
val = GET_32BIT(handle);
|
||||||
@ -216,6 +223,7 @@ int
|
|||||||
handle_close(int handle)
|
handle_close(int handle)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
if (handle_is_ok(handle, HANDLE_FILE)) {
|
if (handle_is_ok(handle, HANDLE_FILE)) {
|
||||||
ret = close(handles[handle].fd);
|
ret = close(handles[handle].fd);
|
||||||
handles[handle].use = HANDLE_UNUSED;
|
handles[handle].use = HANDLE_UNUSED;
|
||||||
@ -234,6 +242,7 @@ get_handle(void)
|
|||||||
char *handle;
|
char *handle;
|
||||||
int val = -1;
|
int val = -1;
|
||||||
u_int hlen;
|
u_int hlen;
|
||||||
|
|
||||||
handle = get_string(&hlen);
|
handle = get_string(&hlen);
|
||||||
if (hlen < 256)
|
if (hlen < 256)
|
||||||
val = handle_from_string(handle, hlen);
|
val = handle_from_string(handle, hlen);
|
||||||
@ -247,6 +256,7 @@ void
|
|||||||
send_msg(Buffer *m)
|
send_msg(Buffer *m)
|
||||||
{
|
{
|
||||||
int mlen = buffer_len(m);
|
int mlen = buffer_len(m);
|
||||||
|
|
||||||
buffer_put_int(&oqueue, mlen);
|
buffer_put_int(&oqueue, mlen);
|
||||||
buffer_append(&oqueue, buffer_ptr(m), mlen);
|
buffer_append(&oqueue, buffer_ptr(m), mlen);
|
||||||
buffer_consume(m, mlen);
|
buffer_consume(m, mlen);
|
||||||
@ -256,6 +266,7 @@ void
|
|||||||
send_status(u_int32_t id, u_int32_t error)
|
send_status(u_int32_t id, u_int32_t error)
|
||||||
{
|
{
|
||||||
Buffer msg;
|
Buffer msg;
|
||||||
|
|
||||||
TRACE("sent status id %d error %d", id, error);
|
TRACE("sent status id %d error %d", id, error);
|
||||||
buffer_init(&msg);
|
buffer_init(&msg);
|
||||||
buffer_put_char(&msg, SSH2_FXP_STATUS);
|
buffer_put_char(&msg, SSH2_FXP_STATUS);
|
||||||
@ -268,6 +279,7 @@ void
|
|||||||
send_data_or_handle(char type, u_int32_t id, char *data, int dlen)
|
send_data_or_handle(char type, u_int32_t id, char *data, int dlen)
|
||||||
{
|
{
|
||||||
Buffer msg;
|
Buffer msg;
|
||||||
|
|
||||||
buffer_init(&msg);
|
buffer_init(&msg);
|
||||||
buffer_put_char(&msg, type);
|
buffer_put_char(&msg, type);
|
||||||
buffer_put_int(&msg, id);
|
buffer_put_int(&msg, id);
|
||||||
@ -288,6 +300,7 @@ send_handle(u_int32_t id, int handle)
|
|||||||
{
|
{
|
||||||
char *string;
|
char *string;
|
||||||
int hlen;
|
int hlen;
|
||||||
|
|
||||||
handle_to_string(handle, &string, &hlen);
|
handle_to_string(handle, &string, &hlen);
|
||||||
TRACE("sent handle id %d handle %d", id, handle);
|
TRACE("sent handle id %d handle %d", id, handle);
|
||||||
send_data_or_handle(SSH2_FXP_HANDLE, id, string, hlen);
|
send_data_or_handle(SSH2_FXP_HANDLE, id, string, hlen);
|
||||||
@ -299,6 +312,7 @@ send_names(u_int32_t id, int count, Stat *stats)
|
|||||||
{
|
{
|
||||||
Buffer msg;
|
Buffer msg;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
buffer_init(&msg);
|
buffer_init(&msg);
|
||||||
buffer_put_char(&msg, SSH2_FXP_NAME);
|
buffer_put_char(&msg, SSH2_FXP_NAME);
|
||||||
buffer_put_int(&msg, id);
|
buffer_put_int(&msg, id);
|
||||||
@ -317,6 +331,7 @@ void
|
|||||||
send_attrib(u_int32_t id, Attrib *a)
|
send_attrib(u_int32_t id, Attrib *a)
|
||||||
{
|
{
|
||||||
Buffer msg;
|
Buffer msg;
|
||||||
|
|
||||||
TRACE("sent attrib id %d have 0x%x", id, a->flags);
|
TRACE("sent attrib id %d have 0x%x", id, a->flags);
|
||||||
buffer_init(&msg);
|
buffer_init(&msg);
|
||||||
buffer_put_char(&msg, SSH2_FXP_ATTRS);
|
buffer_put_char(&msg, SSH2_FXP_ATTRS);
|
||||||
@ -533,6 +548,7 @@ struct timeval *
|
|||||||
attrib_to_tv(Attrib *a)
|
attrib_to_tv(Attrib *a)
|
||||||
{
|
{
|
||||||
static struct timeval tv[2];
|
static struct timeval tv[2];
|
||||||
|
|
||||||
tv[0].tv_sec = a->atime;
|
tv[0].tv_sec = a->atime;
|
||||||
tv[0].tv_usec = 0;
|
tv[0].tv_usec = 0;
|
||||||
tv[1].tv_sec = a->mtime;
|
tv[1].tv_sec = a->mtime;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user