Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GUACAMOLE-XXXX: Allow custom SFTP Attr Permissions per connection. #571

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/common-ssh/sftp.c
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ int guac_common_ssh_sftp_handle_file_stream(
/* Open file via SFTP */
file = libssh2_sftp_open(filesystem->sftp_session, fullpath,
LIBSSH2_FXF_WRITE | LIBSSH2_FXF_CREAT | LIBSSH2_FXF_TRUNC,
S_IRUSR | S_IWUSR);
user->sftp_attr_permissions);

/* Inform of status */
if (file != NULL) {
Expand Down
2 changes: 2 additions & 0 deletions src/libguac/guacamole/user.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,8 @@ struct guac_user {
*/
guac_object* __objects;

int sftp_attr_permissions;

/**
* Arbitrary user-specific data.
*/
Expand Down
7 changes: 7 additions & 0 deletions src/protocols/ssh/settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const char* GUAC_SSH_CLIENT_ARGS[] = {
"sftp-root-directory",
"sftp-disable-download",
"sftp-disable-upload",
"sftp-attr-permissions",
"private-key",
"passphrase",
"public-key",
Expand Down Expand Up @@ -148,6 +149,8 @@ enum SSH_ARGS_IDX {
*/
IDX_SFTP_DISABLE_UPLOAD,

IDX_SFTP_ATTR_PERMISSIONS,

/**
* The private key to use for authentication, if any.
*/
Expand Down Expand Up @@ -449,6 +452,10 @@ guac_ssh_settings* guac_ssh_parse_args(guac_user* user,
guac_user_parse_args_boolean(user, GUAC_SSH_CLIENT_ARGS, argv,
IDX_SFTP_DISABLE_UPLOAD, false);

settings->sftp_attr_permissions =
guac_user_parse_args_int(user, GUAC_SSH_CLIENT_ARGS, argv,
IDX_SFTP_ATTR_PERMISSIONS, false);

#ifdef ENABLE_SSH_AGENT
settings->enable_agent =
guac_user_parse_args_boolean(user, GUAC_SSH_CLIENT_ARGS, argv,
Expand Down
2 changes: 2 additions & 0 deletions src/protocols/ssh/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ typedef struct guac_ssh_settings {
*/
int timeout;

int sftp_attr_permissions;

/**
* The name of the user to login as, if any. If no username is specified,
* this will be NULL.
Expand Down