o early checkin for drive redirection
o basic drive redirection is working o functions currently supported: open: read, write, create, get/set attribute o requires latest NeutrinoRDP to work o note: clipboard is broken because of the move from linked lists to inodes in the FUSE code
This commit is contained in:
parent
b53cefbea4
commit
78d4e19258
@ -101,7 +101,6 @@ struct stream
|
|||||||
#define s_mark_end(s) \
|
#define s_mark_end(s) \
|
||||||
(s)->end = (s)->p
|
(s)->end = (s)->p
|
||||||
|
|
||||||
/******************************************************************************/
|
|
||||||
#define in_sint8(s, v) do \
|
#define in_sint8(s, v) do \
|
||||||
{ \
|
{ \
|
||||||
(v) = *((signed char*)((s)->p)); \
|
(v) = *((signed char*)((s)->p)); \
|
||||||
@ -303,4 +302,102 @@ struct stream
|
|||||||
(s)->p += (n); \
|
(s)->p += (n); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @brief allocate a new stream
|
||||||
|
*
|
||||||
|
* @param _s opaque handle to the new stream
|
||||||
|
* @param _l length of new stream
|
||||||
|
******************************************************************************/
|
||||||
|
#define stream_new(_s, _l) \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
|
make_stream((_s)); \
|
||||||
|
init_stream((_s), (_l)); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief release a previously allocated stream
|
||||||
|
*
|
||||||
|
* @param _s opaque handle returned by stream_new()
|
||||||
|
*****************************************************************************/
|
||||||
|
#define stream_free(_s) free_stream(_s)
|
||||||
|
|
||||||
|
#define stream_rd_u8(_s, _var) in_uint8(_s, _var)
|
||||||
|
#define stream_rd_u16_le(_s, _var) in_uint16_le(_s, _var)
|
||||||
|
#define stream_rd_u32_le(_s, _var) in_uint32_le(_s, _var)
|
||||||
|
|
||||||
|
#define stream_rd_s8_le(_s, _var) in_sint8(_s, _var)
|
||||||
|
#define stream_rd_s16_le(_s, _var) in_sint16_le(_s, _var)
|
||||||
|
#define stream_rd_s32_le(_s, _var) TODO
|
||||||
|
|
||||||
|
#define stream_wr_u8(_s, _var) out_uint8(_s, _var)
|
||||||
|
#define stream_wr_u16_le(_s, _var) out_uint16_le(_s, _var)
|
||||||
|
#define stream_wr_u32_le(_s, _var) out_uint32_le(_s, _var)
|
||||||
|
|
||||||
|
#define stream_wr_s8(_s, _var) TODO
|
||||||
|
#define stream_wr_s16_le(_s, _var) TODO
|
||||||
|
#define stream_wr_s32_le(_s, _var) TODO
|
||||||
|
|
||||||
|
#define stream_rd_u64_le(_s, _v) \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
|
_v = \
|
||||||
|
(tui64)(*((unsigned char *)_s->p)) | \
|
||||||
|
(((tui64) (*(((unsigned char *)_s->p) + 1))) << 8) | \
|
||||||
|
(((tui64) (*(((unsigned char *)_s->p) + 2))) << 16) | \
|
||||||
|
(((tui64) (*(((unsigned char *)_s->p) + 3))) << 24) | \
|
||||||
|
(((tui64) (*(((unsigned char *)_s->p) + 4))) << 32) | \
|
||||||
|
(((tui64) (*(((unsigned char *)_s->p) + 5))) << 40) | \
|
||||||
|
(((tui64) (*(((unsigned char *)_s->p) + 6))) << 48) | \
|
||||||
|
(((tui64) (*(((unsigned char *)_s->p) + 7))) << 56); \
|
||||||
|
_s->p += 8; \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define stream_wr_u64_le(_s, _v) \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
|
*(((unsigned char *) _s->p) + 0) = (unsigned char) ((_v >> 0) & 0xff); \
|
||||||
|
*(((unsigned char *) _s->p) + 1) = (unsigned char) ((_v >> 8) & 0xff); \
|
||||||
|
*(((unsigned char *) _s->p) + 2) = (unsigned char) ((_v >> 16) & 0xff); \
|
||||||
|
*(((unsigned char *) _s->p) + 3) = (unsigned char) ((_v >> 24) & 0xff); \
|
||||||
|
*(((unsigned char *) _s->p) + 4) = (unsigned char) ((_v >> 32) & 0xff); \
|
||||||
|
*(((unsigned char *) _s->p) + 5) = (unsigned char) ((_v >> 40) & 0xff); \
|
||||||
|
*(((unsigned char *) _s->p) + 6) = (unsigned char) ((_v >> 48) & 0xff); \
|
||||||
|
*(((unsigned char *) _s->p) + 7) = (unsigned char) ((_v >> 56) & 0xff); \
|
||||||
|
_s->p += 8; \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
/* copy data into stream */
|
||||||
|
#define stream_copyin(_s, _dest, _len) \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
|
memcpy((_s)->p, (_dest), (_len)); \
|
||||||
|
(_s)->p += (_len); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
/* copy data out of stream */
|
||||||
|
#define stream_copyout(_dest, _s, _len) \
|
||||||
|
{ \
|
||||||
|
do \
|
||||||
|
memcpy((_dest), (_s)->p, (_len)); \
|
||||||
|
(_s)->p += (_len); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define stream_rd_string(_dest, _s, _len) \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
|
memcpy((_dest), (_s)->p, (_len)); \
|
||||||
|
(_s)->p += (_len); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define stream_wr_string(_s, _src, _len) \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
|
memcpy((_s)->p, (_src), (_len)); \
|
||||||
|
(_s)->p += (_len); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define stream_len(_s) (int) ((_s)->p - (_s)->data)
|
||||||
|
#define stream_seek(_s, _len) (_s)->p += (_len)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -376,7 +376,7 @@ process_message_channel_setup(struct stream *s)
|
|||||||
if (g_cliprdr_index >= 0)
|
if (g_cliprdr_index >= 0)
|
||||||
{
|
{
|
||||||
clipboard_init();
|
clipboard_init();
|
||||||
fuse_init();
|
xfuse_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_rdpsnd_index >= 0)
|
if (g_rdpsnd_index >= 0)
|
||||||
@ -387,6 +387,7 @@ process_message_channel_setup(struct stream *s)
|
|||||||
if (g_rdpdr_index >= 0)
|
if (g_rdpdr_index >= 0)
|
||||||
{
|
{
|
||||||
dev_redir_init();
|
dev_redir_init();
|
||||||
|
xfuse_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_rail_index >= 0)
|
if (g_rail_index >= 0)
|
||||||
@ -953,7 +954,7 @@ channel_thread_loop(void *in_val)
|
|||||||
xcommon_check_wait_objs();
|
xcommon_check_wait_objs();
|
||||||
sound_check_wait_objs();
|
sound_check_wait_objs();
|
||||||
dev_redir_check_wait_objs();
|
dev_redir_check_wait_objs();
|
||||||
fuse_check_wait_objs();
|
xfuse_check_wait_objs();
|
||||||
timeout = -1;
|
timeout = -1;
|
||||||
num_objs = 0;
|
num_objs = 0;
|
||||||
objs[num_objs] = g_term_event;
|
objs[num_objs] = g_term_event;
|
||||||
@ -965,8 +966,8 @@ channel_thread_loop(void *in_val)
|
|||||||
xcommon_get_wait_objs(objs, &num_objs, &timeout);
|
xcommon_get_wait_objs(objs, &num_objs, &timeout);
|
||||||
sound_get_wait_objs(objs, &num_objs, &timeout);
|
sound_get_wait_objs(objs, &num_objs, &timeout);
|
||||||
dev_redir_get_wait_objs(objs, &num_objs, &timeout);
|
dev_redir_get_wait_objs(objs, &num_objs, &timeout);
|
||||||
fuse_get_wait_objs(objs, &num_objs, &timeout);
|
xfuse_get_wait_objs(objs, &num_objs, &timeout);
|
||||||
}
|
} /* end while (g_obj_wait(objs, num_objs, 0, 0, timeout) == 0) */
|
||||||
}
|
}
|
||||||
|
|
||||||
trans_delete(g_lis_trans);
|
trans_delete(g_lis_trans);
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,23 +1,60 @@
|
|||||||
|
/**
|
||||||
|
* xrdp: A Remote Desktop Protocol server.
|
||||||
|
*
|
||||||
|
* Copyright (C) Laxmikant Rashinkar 2013
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
#if !defined(CHANSRV_FUSE_H)
|
#ifndef _CHANSRV_FUSE_H
|
||||||
#define CHANSRV_FUSE_H
|
#define _CHANSRV_FUSE_H
|
||||||
|
|
||||||
int APP_CC
|
/* a file or dir entry in the xrdp file system */
|
||||||
fuse_clear_clip_dir(void);
|
struct xrdp_inode
|
||||||
int APP_CC
|
{
|
||||||
fuse_add_clip_dir_item(char *filename, int flags, int size, int lindex);
|
tui32 parent_inode; /* Parent serial number. */
|
||||||
int APP_CC
|
tui32 inode; /* File serial number. */
|
||||||
fuse_get_wait_objs(tbus *objs, int *count, int *timeout);
|
tui32 mode; /* File mode. */
|
||||||
int APP_CC
|
tui32 nlink; /* symbolic link count. */
|
||||||
fuse_check_wait_objs(void);
|
tui32 nentries; /* number of entries in a dir */
|
||||||
int APP_CC
|
tui32 uid; /* User ID of the file's owner. */
|
||||||
fuse_init(void);
|
tui32 gid; /* Group ID of the file's group. */
|
||||||
int APP_CC
|
size_t size; /* Size of file, in bytes. */
|
||||||
fuse_deinit(void);
|
time_t atime; /* Time of last access. */
|
||||||
|
time_t mtime; /* Time of last modification. */
|
||||||
|
time_t ctime; /* Time of last status change. */
|
||||||
|
char name[256]; /* Dir or filename */
|
||||||
|
tui32 device_id; /* for file system redirection */
|
||||||
|
char is_synced; /* dir struct has been read from */
|
||||||
|
/* remote device, done just once */
|
||||||
|
};
|
||||||
|
typedef struct xrdp_inode XRDP_INODE; // LK_TODO use this instead of using struct xrdp_inode
|
||||||
|
|
||||||
int APP_CC
|
int xfuse_init();
|
||||||
fuse_file_contents_size(int stream_id, int file_size);
|
int xfuse_deinit();
|
||||||
int APP_CC
|
int xfuse_check_wait_objs(void);
|
||||||
fuse_file_contents_range(int stream_id, char *data, int data_bytes);
|
int xfuse_get_wait_objs(tbus *objs, int *count, int *timeout);
|
||||||
|
int xfuse_create_share(tui32 share_id, char *dirname);
|
||||||
|
|
||||||
|
int xfuse_clear_clip_dir(void);
|
||||||
|
int xfuse_file_contents_range(int stream_id, char *data, int data_bytes);
|
||||||
|
int xfuse_file_contents_size(int stream_id, int file_size);
|
||||||
|
int xfuse_add_clip_dir_item(char *filename, int flags, int size, int lindex);
|
||||||
|
|
||||||
|
/* functions that are inovked from devredir */
|
||||||
|
void xfuse_devredir_cb_enum_dir(void *vp, struct xrdp_inode *xinode);
|
||||||
|
void xfuse_devredir_cb_enum_dir_done(void *vp, tui32 IoStatus);
|
||||||
|
void xfuse_devredir_cb_open_file(void *vp, tui32 DeviceId, tui32 FileId);
|
||||||
|
void xfuse_devredir_cb_read_file(void *vp, char *buf, size_t length);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -320,7 +320,7 @@ clipboard_init(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
fuse_init();
|
xfuse_init();
|
||||||
xcommon_init();
|
xcommon_init();
|
||||||
g_incr_max_req_size = XMaxRequestSize(g_display) * 4 - 24;
|
g_incr_max_req_size = XMaxRequestSize(g_display) * 4 - 24;
|
||||||
g_memset(&g_clip_c2s, 0, sizeof(g_clip_c2s));
|
g_memset(&g_clip_c2s, 0, sizeof(g_clip_c2s));
|
||||||
@ -464,7 +464,7 @@ clipboard_deinit(void)
|
|||||||
g_wnd = 0;
|
g_wnd = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
fuse_deinit();
|
xfuse_deinit();
|
||||||
|
|
||||||
g_free(g_clip_c2s.data);
|
g_free(g_clip_c2s.data);
|
||||||
g_clip_c2s.data = 0;
|
g_clip_c2s.data = 0;
|
||||||
@ -968,7 +968,7 @@ clipboard_process_format_announce(struct stream *s, int clip_msg_status,
|
|||||||
LLOGLN(10, ("clipboard_process_format_announce %d", clip_msg_len));
|
LLOGLN(10, ("clipboard_process_format_announce %d", clip_msg_len));
|
||||||
clipboard_send_format_ack();
|
clipboard_send_format_ack();
|
||||||
|
|
||||||
fuse_clear_clip_dir();
|
xfuse_clear_clip_dir();
|
||||||
g_clip_c2s.converted = 0;
|
g_clip_c2s.converted = 0;
|
||||||
|
|
||||||
desc[0] = 0;
|
desc[0] = 0;
|
||||||
|
@ -534,13 +534,13 @@ clipboard_process_file_response(struct stream *s, int clip_msg_status,
|
|||||||
in_uint32_le(s, file_size);
|
in_uint32_le(s, file_size);
|
||||||
LLOGLN(10, ("clipboard_process_file_response: streamId %d "
|
LLOGLN(10, ("clipboard_process_file_response: streamId %d "
|
||||||
"file_size %d", streamId, file_size));
|
"file_size %d", streamId, file_size));
|
||||||
fuse_file_contents_size(streamId, file_size);
|
xfuse_file_contents_size(streamId, file_size);
|
||||||
}
|
}
|
||||||
else if (g_file_request_sent_type == CB_FILECONTENTS_RANGE)
|
else if (g_file_request_sent_type == CB_FILECONTENTS_RANGE)
|
||||||
{
|
{
|
||||||
g_file_request_sent_type = 0;
|
g_file_request_sent_type = 0;
|
||||||
in_uint32_le(s, streamId);
|
in_uint32_le(s, streamId);
|
||||||
fuse_file_contents_range(streamId, s->p, clip_msg_len - 4);
|
xfuse_file_contents_range(streamId, s->p, clip_msg_len - 4);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -604,7 +604,7 @@ clipboard_c2s_in_files(struct stream *s, char *file_list)
|
|||||||
LLOGLN(0, ("clipboard_c2s_in_files: error cItems %d too big", cItems));
|
LLOGLN(0, ("clipboard_c2s_in_files: error cItems %d too big", cItems));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
fuse_clear_clip_dir();
|
xfuse_clear_clip_dir();
|
||||||
LLOGLN(10, ("clipboard_c2s_in_files: cItems %d", cItems));
|
LLOGLN(10, ("clipboard_c2s_in_files: cItems %d", cItems));
|
||||||
cfd = (struct clip_file_desc *)
|
cfd = (struct clip_file_desc *)
|
||||||
g_malloc(sizeof(struct clip_file_desc), 0);
|
g_malloc(sizeof(struct clip_file_desc), 0);
|
||||||
@ -620,7 +620,7 @@ clipboard_c2s_in_files(struct stream *s, char *file_list)
|
|||||||
"supported [%s]", cfd->cFileName));
|
"supported [%s]", cfd->cFileName));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
fuse_add_clip_dir_item(cfd->cFileName, 0, cfd->fileSizeLow, lindex);
|
xfuse_add_clip_dir_item(cfd->cFileName, 0, cfd->fileSizeLow, lindex);
|
||||||
|
|
||||||
g_strcpy(ptr, "file://");
|
g_strcpy(ptr, "file://");
|
||||||
ptr += 7;
|
ptr += 7;
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,9 @@
|
|||||||
/**
|
/**
|
||||||
* xrdp: A Remote Desktop Protocol server.
|
* xrdp: A Remote Desktop Protocol server.
|
||||||
*
|
*
|
||||||
* Copyright (C) Jay Sorg 2009-2012
|
* xrdp device redirection - we mainly use it for drive redirection
|
||||||
|
*
|
||||||
|
* Copyright (C) Laxmikant Rashinkar 2013
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -19,19 +21,372 @@
|
|||||||
#if !defined(DEVREDIR_H)
|
#if !defined(DEVREDIR_H)
|
||||||
#define DEVREDIR_H
|
#define DEVREDIR_H
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include "arch.h"
|
#include "arch.h"
|
||||||
#include "parse.h"
|
#include "parse.h"
|
||||||
|
#include "os_calls.h"
|
||||||
|
#include "log.h"
|
||||||
|
#include "chansrv_fuse.h"
|
||||||
|
|
||||||
int APP_CC
|
typedef struct fuse_data FUSE_DATA;
|
||||||
dev_redir_init(void);
|
struct fuse_data
|
||||||
int APP_CC
|
{
|
||||||
dev_redir_deinit(void);
|
void *data_ptr;
|
||||||
int APP_CC
|
FUSE_DATA *next;
|
||||||
dev_redir_data_in(struct stream* s, int chan_id, int chan_flags, int length,
|
};
|
||||||
int total_length);
|
|
||||||
int APP_CC
|
/* An I/O Resource Packet to track dev_dir I/O calls */
|
||||||
dev_redir_get_wait_objs(tbus* objs, int* count, int* timeout);
|
|
||||||
int APP_CC
|
typedef struct irp IRP;
|
||||||
dev_redir_check_wait_objs(void);
|
|
||||||
|
struct irp
|
||||||
|
{
|
||||||
|
tui32 completion_id; /* unique number */
|
||||||
|
char completion_type; /* describes I/O type */
|
||||||
|
tui32 FileId; /* RDP client provided unique number */
|
||||||
|
//void *fusep; /* opaque FUSE info */
|
||||||
|
char pathname[256]; /* absolute pathname */
|
||||||
|
tui32 device_id; /* identifies remote device */
|
||||||
|
FUSE_DATA *fd_head; /* point to first FUSE opaque object */
|
||||||
|
FUSE_DATA *fd_tail; /* point to last FUSE opaque object */
|
||||||
|
IRP *next; /* point to next IRP */
|
||||||
|
IRP *prev; /* point to previous IRP */
|
||||||
|
};
|
||||||
|
|
||||||
|
void *dev_redir_fuse_data_peek(IRP *irp);
|
||||||
|
void *dev_redir_fuse_data_dequeue(IRP *irp);
|
||||||
|
int dev_redir_fuse_data_enqueue(IRP *irp, void *vp);
|
||||||
|
|
||||||
|
IRP * dev_redir_irp_new();
|
||||||
|
IRP * dev_redir_irp_find(tui32 completion_id);
|
||||||
|
IRP * dev_redir_irp_find_by_fileid(tui32 FileId);
|
||||||
|
IRP * dev_redir_irp_get_last();
|
||||||
|
int dev_redir_irp_delete(IRP *irp);
|
||||||
|
void dev_redir_irp_dump();
|
||||||
|
|
||||||
|
int APP_CC dev_redir_init(void);
|
||||||
|
int APP_CC dev_redir_deinit(void);
|
||||||
|
|
||||||
|
int APP_CC dev_redir_data_in(struct stream* s, int chan_id, int chan_flags,
|
||||||
|
int length, int total_length);
|
||||||
|
|
||||||
|
int APP_CC dev_redir_get_wait_objs(tbus* objs, int* count, int* timeout);
|
||||||
|
int APP_CC dev_redir_check_wait_objs(void);
|
||||||
|
|
||||||
|
void dev_redir_send_server_core_cap_req();
|
||||||
|
void dev_redir_send_server_clientID_confirm();
|
||||||
|
void dev_redir_send_server_user_logged_on();
|
||||||
|
void dev_redir_send_server_device_announce_resp(tui32 device_id);
|
||||||
|
|
||||||
|
void dev_redir_send_drive_dir_request(IRP *irp, tui32 device_id,
|
||||||
|
tui32 InitialQuery, char *Path);
|
||||||
|
|
||||||
|
int dev_redir_send_drive_create_request(tui32 device_id, char *path,
|
||||||
|
tui32 DesiredAccess,
|
||||||
|
tui32 CreateOptions,
|
||||||
|
tui32 CreateDisposition,
|
||||||
|
tui32 completion_id);
|
||||||
|
|
||||||
|
int dev_redir_send_drive_close_request(tui16 Component, tui16 PacketId,
|
||||||
|
tui32 DeviceId,
|
||||||
|
tui32 FileId,
|
||||||
|
tui32 CompletionId,
|
||||||
|
tui32 MajorFunction,
|
||||||
|
tui32 MinorFunc,
|
||||||
|
int pad_len);
|
||||||
|
|
||||||
|
void dev_redir_proc_client_devlist_announce_req(struct stream *s);
|
||||||
|
void dev_redir_proc_client_core_cap_resp(struct stream *s);
|
||||||
|
void dev_redir_proc_device_iocompletion(struct stream *s);
|
||||||
|
|
||||||
|
void dev_redir_proc_query_dir_response(IRP *irp,
|
||||||
|
struct stream *s,
|
||||||
|
tui32 DeviceId,
|
||||||
|
tui32 CompletionId,
|
||||||
|
tui32 IoStatus);
|
||||||
|
|
||||||
|
/* misc stuff */
|
||||||
|
void dev_redir_insert_dev_io_req_header(struct stream *s,
|
||||||
|
tui32 DeviceId,
|
||||||
|
tui32 FileId,
|
||||||
|
tui32 CompletionId,
|
||||||
|
tui32 MajorFunction,
|
||||||
|
tui32 MinorFunction);
|
||||||
|
|
||||||
|
void devredir_cvt_to_unicode(char *unicode, char *path);
|
||||||
|
void devredir_cvt_from_unicode_len(char *path, char *unicode, int len);
|
||||||
|
int dev_redir_string_ends_with(char *string, char c);
|
||||||
|
|
||||||
|
void dev_redir_insert_rdpdr_header(struct stream *s, tui16 Component,
|
||||||
|
tui16 PacketId);
|
||||||
|
|
||||||
|
/* called from FUSE module */
|
||||||
|
int dev_redir_get_dir_listing(void *fusep, tui32 device_id, char *path);
|
||||||
|
|
||||||
|
int dev_redir_file_open(void *fusep, tui32 device_id, char *path,
|
||||||
|
int mode, int type);
|
||||||
|
|
||||||
|
int dev_redir_file_read(void *fusep, tui32 device_id, tui32 FileId,
|
||||||
|
tui32 Length, tui64 Offset);
|
||||||
|
|
||||||
|
/* module based logging */
|
||||||
|
#define LOG_ERROR 0
|
||||||
|
#define LOG_INFO 1
|
||||||
|
#define LOG_DEBUG 2
|
||||||
|
|
||||||
|
#ifndef LOG_LEVEL
|
||||||
|
#define LOG_LEVEL LOG_ERROR
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define log_error(_params...) \
|
||||||
|
{ \
|
||||||
|
g_write("[%10.10u]: DEV_REDIR %s: %d : ERROR: ", \
|
||||||
|
g_time3(), __func__, __LINE__); \
|
||||||
|
g_writeln (_params); \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define log_info(_params...) \
|
||||||
|
{ \
|
||||||
|
if (LOG_INFO <= LOG_LEVEL) \
|
||||||
|
{ \
|
||||||
|
g_write("[%10.10u]: DEV_REDIR %s: %d : ", \
|
||||||
|
g_time3(), __func__, __LINE__); \
|
||||||
|
g_writeln (_params); \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define log_debug(_params...) \
|
||||||
|
{ \
|
||||||
|
if (LOG_DEBUG <= LOG_LEVEL) \
|
||||||
|
{ \
|
||||||
|
g_write("[%10.10u]: DEV_REDIR %s: %d : ", \
|
||||||
|
g_time3(), __func__, __LINE__); \
|
||||||
|
g_writeln (_params); \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
int send_channel_data(int chan_id, char *data, int size);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* RDPDR_HEADER definitions
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* device redirector core component; most of the packets in this protocol */
|
||||||
|
/* are sent under this component ID */
|
||||||
|
#define RDPDR_CTYP_CORE 0x4472
|
||||||
|
|
||||||
|
/* printing component. the packets that use this ID are typically about */
|
||||||
|
/* printer cache management and identifying XPS printers */
|
||||||
|
#define RDPDR_CTYP_PRN 0x5052
|
||||||
|
|
||||||
|
/* Server Announce Request, as specified in section 2.2.2.2 */
|
||||||
|
#define PAKID_CORE_SERVER_ANNOUNCE 0x496E
|
||||||
|
|
||||||
|
/* Client Announce Reply and Server Client ID Confirm, as specified in */
|
||||||
|
/* sections 2.2.2.3 and 2.2.2.6. */
|
||||||
|
#define PAKID_CORE_CLIENTID_CONFIRM 0x4343
|
||||||
|
|
||||||
|
/* Client Name Request, as specified in section 2.2.2.4 */
|
||||||
|
#define PAKID_CORE_CLIENT_NAME 0x434E
|
||||||
|
|
||||||
|
/* Client Device List Announce Request, as specified in section 2.2.2.9 */
|
||||||
|
#define PAKID_CORE_DEVICELIST_ANNOUNCE 0x4441
|
||||||
|
|
||||||
|
/* Server Device Announce Response, as specified in section 2.2.2.1 */
|
||||||
|
#define PAKID_CORE_DEVICE_REPLY 0x6472
|
||||||
|
|
||||||
|
/* Device I/O Request, as specified in section 2.2.1.4 */
|
||||||
|
#define PAKID_CORE_DEVICE_IOREQUEST 0x4952
|
||||||
|
|
||||||
|
/* Device I/O Response, as specified in section 2.2.1.5 */
|
||||||
|
#define PAKID_CORE_DEVICE_IOCOMPLETION 0x4943
|
||||||
|
|
||||||
|
/* Server Core Capability Request, as specified in section 2.2.2.7 */
|
||||||
|
#define PAKID_CORE_SERVER_CAPABILITY 0x5350
|
||||||
|
|
||||||
|
/* Client Core Capability Response, as specified in section 2.2.2.8 */
|
||||||
|
#define PAKID_CORE_CLIENT_CAPABILITY 0x4350
|
||||||
|
|
||||||
|
/* Client Drive Device List Remove, as specified in section 2.2.3.2 */
|
||||||
|
#define PAKID_CORE_DEVICELIST_REMOVE 0x444D
|
||||||
|
|
||||||
|
/* Add Printer Cachedata, as specified in [MS-RDPEPC] section 2.2.2.3 */
|
||||||
|
#define PAKID_PRN_CACHE_DATA 0x5043
|
||||||
|
|
||||||
|
/* Server User Logged On, as specified in section 2.2.2.5 */
|
||||||
|
#define PAKID_CORE_USER_LOGGEDON 0x554C
|
||||||
|
|
||||||
|
/* Server Printer Set XPS Mode, as specified in [MS-RDPEPC] section 2.2.2.2 */
|
||||||
|
#define PAKID_PRN_USING_XPS 0x5543
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Capability header definitions
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define CAP_GENERAL_TYPE 0x0001 /* General cap set - GENERAL_CAPS_SET */
|
||||||
|
#define CAP_PRINTER_TYPE 0x0002 /* Print cap set - PRINTER_CAPS_SET */
|
||||||
|
#define CAP_PORT_TYPE 0x0003 /* Port cap set - PORT_CAPS_SET */
|
||||||
|
#define CAP_DRIVE_TYPE 0x0004 /* Drive cap set - DRIVE_CAPS_SET */
|
||||||
|
#define CAP_SMARTCARD_TYPE 0x0005 /* Smart card cap set - SMARTCARD_CAPS_SET */
|
||||||
|
|
||||||
|
/* client minor versions */
|
||||||
|
#define RDP_CLIENT_50 0x0002
|
||||||
|
#define RDP_CLIENT_51 0x0005
|
||||||
|
#define RDP_CLIENT_52 0x000a
|
||||||
|
#define RDP_CLIENT_60_61 0x000c
|
||||||
|
|
||||||
|
/* used in device announce list */
|
||||||
|
#define RDPDR_DTYP_SERIAL 0x0001
|
||||||
|
#define RDPDR_DTYP_PARALLEL 0x0002
|
||||||
|
#define RDPDR_DTYP_PRINT 0x0004
|
||||||
|
#define RDPDR_DTYP_FILESYSTEM 0x0008
|
||||||
|
#define RDPDR_DTYP_SMARTCARD 0x0020
|
||||||
|
|
||||||
|
/*
|
||||||
|
* DesiredAccess Mask [MS-SMB2] section 2.2.13.1.1
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define DA_FILE_READ_DATA 0x00000001
|
||||||
|
#define DA_FILE_WRITE_DATA 0x00000002
|
||||||
|
#define DA_FILE_APPEND_DATA 0x00000004
|
||||||
|
#define DA_FILE_READ_EA 0x00000008 /* rd extended attributes */
|
||||||
|
#define DA_FILE_WRITE_EA 0x00000010 /* wr extended attributes */
|
||||||
|
#define DA_FILE_EXECUTE 0x00000020
|
||||||
|
#define DA_FILE_READ_ATTRIBUTES 0x00000080
|
||||||
|
#define DA_FILE_WRITE_ATTRIBUTES 0x00000100
|
||||||
|
#define DA_DELETE 0x00010000
|
||||||
|
#define DA_READ_CONTROL 0x00020000 /* rd security descriptor */
|
||||||
|
#define DA_WRITE_DAC 0x00040000
|
||||||
|
#define DA_WRITE_OWNER 0x00080000
|
||||||
|
#define DA_SYNCHRONIZE 0x00100000
|
||||||
|
#define DA_ACCESS_SYSTEM_SECURITY 0x01000000
|
||||||
|
#define DA_MAXIMUM_ALLOWED 0x02000000
|
||||||
|
#define DA_GENERIC_ALL 0x10000000
|
||||||
|
#define DA_GENERIC_EXECUTE 0x20000000
|
||||||
|
#define DA_GENERIC_WRITE 0x40000000
|
||||||
|
#define DA_GENERIC_READ 0x80000000
|
||||||
|
|
||||||
|
/*
|
||||||
|
* CreateOptions Mask [MS-SMB2] section 2.2.13 SMB2 CREATE Request
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define CO_FILE_DIRECTORY_FILE 0x00000001
|
||||||
|
#define CO_FILE_WRITE_THROUGH 0x00000002
|
||||||
|
#define CO_FILE_SYNCHRONOUS_IO_NONALERT 0x00000020
|
||||||
|
|
||||||
|
/*
|
||||||
|
* CreateDispositions Mask [MS-SMB2] section 2.2.13
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define CD_FILE_SUPERSEDE 0x00000000
|
||||||
|
#define CD_FILE_OPEN 0x00000001
|
||||||
|
#define CD_FILE_CREATE 0x00000002
|
||||||
|
#define CD_FILE_OPEN_IF 0x00000003
|
||||||
|
#define CD_FILE_OVERWRITE 0x00000004
|
||||||
|
#define CD_FILE_OVERWRITE_IF 0x00000005
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Device I/O Request MajorFunction definitions
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define IRP_MJ_CREATE 0x00000000
|
||||||
|
#define IRP_MJ_CLOSE 0x00000002
|
||||||
|
#define IRP_MJ_READ 0x00000003
|
||||||
|
#define IRP_MJ_WRITE 0x00000004
|
||||||
|
#define IRP_MJ_DEVICE_CONTROL 0x0000000E
|
||||||
|
#define IRP_MJ_QUERY_VOLUME_INFORMATION 0x0000000A
|
||||||
|
#define IRP_MJ_SET_VOLUME_INFORMATION 0x0000000B
|
||||||
|
#define IRP_MJ_QUERY_INFORMATION 0x00000005
|
||||||
|
#define IRP_MJ_SET_INFORMATION 0x00000006
|
||||||
|
#define IRP_MJ_DIRECTORY_CONTROL 0x0000000C
|
||||||
|
#define IRP_MJ_LOCK_CONTROL 0x00000011
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Device I/O Request MinorFunction definitions
|
||||||
|
*
|
||||||
|
* Only valid when MajorFunction code = IRP_MJ_DIRECTORY_CONTROL
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define IRP_MN_QUERY_DIRECTORY 0x00000001
|
||||||
|
#define IRP_MN_NOTIFY_CHANGE_DIRECTORY 0x00000002
|
||||||
|
|
||||||
|
/*
|
||||||
|
* NTSTATUS codes (used by IoStatus)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define NT_STATUS_SUCCESS 0x00000000
|
||||||
|
#define NT_STATUS_UNSUCCESSFUL 0xC0000001
|
||||||
|
|
||||||
|
/*
|
||||||
|
* CompletionID types, used in IRPs to indicate I/O operation
|
||||||
|
*/
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
CID_CREATE_DIR_REQ = 1,
|
||||||
|
CID_CREATE_OPEN_REQ,
|
||||||
|
CID_READ,
|
||||||
|
CID_WRITE,
|
||||||
|
CID_DIRECTORY_CONTROL,
|
||||||
|
CID_CLOSE
|
||||||
|
};
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
#define CID_CLOSE 0x0002
|
||||||
|
#define CID_READ 0x0003
|
||||||
|
#define CID_WRITE 0x0004
|
||||||
|
#define CID_DEVICE_CONTROL 0x0005
|
||||||
|
#define CID_QUERY_VOLUME_INFORMATION 0x0006
|
||||||
|
#define CID_SET_VOLUME_INFORMATION 0x0007
|
||||||
|
#define CID_QUERY_INFORMATION 0x0008
|
||||||
|
#define CID_SET_INFORMATION 0x0009
|
||||||
|
#define CID_DIRECTORY_CONTROL 0x000a
|
||||||
|
#define CID_LOCK_CONTROL 0x000b
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* constants for drive dir query
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Basic information about a file or directory. Basic information is */
|
||||||
|
/* defined as the file's name, time stamp, and size, or its attributes */
|
||||||
|
#define FileDirectoryInformation 0x00000001
|
||||||
|
|
||||||
|
/* Full information about a file or directory. Full information is defined */
|
||||||
|
/* as all the basic information, plus extended attribute size. */
|
||||||
|
#define FileFullDirectoryInformation 0x00000002
|
||||||
|
|
||||||
|
/* Basic information plus extended attribute size and short name */
|
||||||
|
/* about a file or directory. */
|
||||||
|
#define FileBothDirectoryInformation 0x00000003
|
||||||
|
|
||||||
|
/* Detailed information on the names of files in a directory. */
|
||||||
|
#define FileNamesInformation 0x0000000C
|
||||||
|
|
||||||
|
/*
|
||||||
|
* NTSTATUS Codes of interest to us
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* No more files were found which match the file specification */
|
||||||
|
#define STATUS_NO_MORE_FILES 0x80000006
|
||||||
|
|
||||||
|
/* Windows file attributes */
|
||||||
|
#define W_FILE_ATTRIBUTE_DIRECTORY 0x00000010
|
||||||
|
#define W_FILE_ATTRIBUTE_READONLY 0x00000001
|
||||||
|
|
||||||
|
#define WINDOWS_TO_LINUX_FILE_PERM(_a) \
|
||||||
|
(((_a) & W_FILE_ATTRIBUTE_DIRECTORY) ? S_IFDIR | 0100 : S_IFREG) |\
|
||||||
|
(((_a) & W_FILE_ATTRIBUTE_READONLY) ? 0444 : 0644)
|
||||||
|
|
||||||
|
/* winodws time starts on Jan 1, 1601 */
|
||||||
|
/* Linux time starts on Jan 1, 1970 */
|
||||||
|
#define EPOCH_DIFF 11644473600LL
|
||||||
|
#define WINDOWS_TO_LINUX_TIME(_t) ((_t) / 10000000) - EPOCH_DIFF;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -49,6 +49,12 @@ cliprdr=true
|
|||||||
rail=true
|
rail=true
|
||||||
xrdpvr=true
|
xrdpvr=true
|
||||||
|
|
||||||
|
# for debugging xrdp, in section [xrdp1], change port=-1 to this:
|
||||||
|
# port=/tmp/.xrdp/xrdp_display_10
|
||||||
|
|
||||||
|
# for debugging xrdp, add following line to section [xrdp1]
|
||||||
|
# chansrvport=/tmp/.xrdp/xrdp_chansrv_socket_7210
|
||||||
|
|
||||||
[xrdp1]
|
[xrdp1]
|
||||||
name=sesman-X11rdp
|
name=sesman-X11rdp
|
||||||
lib=libxup.so
|
lib=libxup.so
|
||||||
|
Loading…
Reference in New Issue
Block a user