Lines 220-225
Link Here
|
220 |
int ext_statvfs; |
220 |
int ext_statvfs; |
221 |
int ext_hardlink; |
221 |
int ext_hardlink; |
222 |
mode_t mnt_mode; |
222 |
mode_t mnt_mode; |
|
|
223 |
unsigned int remote_dmask; |
224 |
unsigned int remote_fmask; |
223 |
|
225 |
|
224 |
/* statistics */ |
226 |
/* statistics */ |
225 |
uint64_t bytes_sent; |
227 |
uint64_t bytes_sent; |
Lines 314-319
Link Here
|
314 |
SSHFS_OPT("no_check_root", no_check_root, 1), |
316 |
SSHFS_OPT("no_check_root", no_check_root, 1), |
315 |
SSHFS_OPT("password_stdin", password_stdin, 1), |
317 |
SSHFS_OPT("password_stdin", password_stdin, 1), |
316 |
SSHFS_OPT("delay_connect", delay_connect, 1), |
318 |
SSHFS_OPT("delay_connect", delay_connect, 1), |
|
|
319 |
SSHFS_OPT("remote_dmask=%o", remote_dmask, 0), |
320 |
SSHFS_OPT("remote_fmask=%o", remote_fmask, 0), |
317 |
|
321 |
|
318 |
FUSE_OPT_KEY("-p ", KEY_PORT), |
322 |
FUSE_OPT_KEY("-p ", KEY_PORT), |
319 |
FUSE_OPT_KEY("-C", KEY_COMPRESS), |
323 |
FUSE_OPT_KEY("-C", KEY_COMPRESS), |
Lines 1939-1944
Link Here
|
1939 |
return err; |
1943 |
return err; |
1940 |
} |
1944 |
} |
1941 |
|
1945 |
|
|
|
1946 |
|
1947 |
|
1948 |
static int sshfs_chmod(const char *path, mode_t mode) |
1949 |
{ |
1950 |
int err; |
1951 |
struct buffer buf; |
1952 |
buf_init(&buf, 0); |
1953 |
buf_add_path(&buf, path); |
1954 |
buf_add_uint32(&buf, SSH_FILEXFER_ATTR_PERMISSIONS); |
1955 |
buf_add_uint32(&buf, mode); |
1956 |
err = sftp_request(SSH_FXP_SETSTAT, &buf, SSH_FXP_STATUS, NULL); |
1957 |
buf_free(&buf); |
1958 |
return err; |
1959 |
} |
1960 |
|
1961 |
|
1942 |
static int sshfs_mkdir(const char *path, mode_t mode) |
1962 |
static int sshfs_mkdir(const char *path, mode_t mode) |
1943 |
{ |
1963 |
{ |
1944 |
int err; |
1964 |
int err; |
Lines 1949-1954
Link Here
|
1949 |
buf_add_uint32(&buf, mode); |
1969 |
buf_add_uint32(&buf, mode); |
1950 |
err = sftp_request(SSH_FXP_MKDIR, &buf, SSH_FXP_STATUS, NULL); |
1970 |
err = sftp_request(SSH_FXP_MKDIR, &buf, SSH_FXP_STATUS, NULL); |
1951 |
buf_free(&buf); |
1971 |
buf_free(&buf); |
|
|
1972 |
if (!err && sshfs.remote_dmask > 0) { |
1973 |
err = sshfs_chmod(path, sshfs.remote_dmask); |
1974 |
} |
1975 |
|
1952 |
return err; |
1976 |
return err; |
1953 |
} |
1977 |
} |
1954 |
|
1978 |
|
Lines 1978-1983
Link Here
|
1978 |
buf_free(&handle); |
2002 |
buf_free(&handle); |
1979 |
} |
2003 |
} |
1980 |
buf_free(&buf); |
2004 |
buf_free(&buf); |
|
|
2005 |
|
1981 |
return err; |
2006 |
return err; |
1982 |
} |
2007 |
} |
1983 |
|
2008 |
|
Lines 2100-2117
Link Here
|
2100 |
return err; |
2125 |
return err; |
2101 |
} |
2126 |
} |
2102 |
|
2127 |
|
2103 |
static int sshfs_chmod(const char *path, mode_t mode) |
|
|
2104 |
{ |
2105 |
int err; |
2106 |
struct buffer buf; |
2107 |
buf_init(&buf, 0); |
2108 |
buf_add_path(&buf, path); |
2109 |
buf_add_uint32(&buf, SSH_FILEXFER_ATTR_PERMISSIONS); |
2110 |
buf_add_uint32(&buf, mode); |
2111 |
err = sftp_request(SSH_FXP_SETSTAT, &buf, SSH_FXP_STATUS, NULL); |
2112 |
buf_free(&buf); |
2113 |
return err; |
2114 |
} |
2115 |
|
2128 |
|
2116 |
static int sshfs_chown(const char *path, uid_t uid, gid_t gid) |
2129 |
static int sshfs_chown(const char *path, uid_t uid, gid_t gid) |
2117 |
{ |
2130 |
{ |
Lines 2649-2656
Link Here
|
2649 |
#if FUSE_VERSION >= 25 |
2662 |
#if FUSE_VERSION >= 25 |
2650 |
static int sshfs_create(const char *path, mode_t mode, |
2663 |
static int sshfs_create(const char *path, mode_t mode, |
2651 |
struct fuse_file_info *fi) |
2664 |
struct fuse_file_info *fi) |
2652 |
{ |
2665 |
{ |
2653 |
return sshfs_open_common(path, mode, fi); |
2666 |
int err; |
|
|
2667 |
err = sshfs_open_common(path, mode, fi); |
2668 |
if (!err && sshfs.remote_fmask > 0) { |
2669 |
err = sshfs_chmod(path, sshfs.remote_fmask); |
2670 |
} |
2671 |
return err; |
2672 |
|
2654 |
} |
2673 |
} |
2655 |
|
2674 |
|
2656 |
static int sshfs_ftruncate(const char *path, off_t size, |
2675 |
static int sshfs_ftruncate(const char *path, off_t size, |
Lines 2919-2924
Link Here
|
2919 |
" -o no_check_root don't check for existence of 'dir' on server\n" |
2938 |
" -o no_check_root don't check for existence of 'dir' on server\n" |
2920 |
" -o password_stdin read password from stdin (only for pam_mount!)\n" |
2939 |
" -o password_stdin read password from stdin (only for pam_mount!)\n" |
2921 |
" -o SSHOPT=VAL ssh options (see man ssh_config)\n" |
2940 |
" -o SSHOPT=VAL ssh options (see man ssh_config)\n" |
|
|
2941 |
" -o remote_dmask=M force directory permissions for remote directory (octal)\n" |
2942 |
" -o remote_fmask=M force file permissions for remote file (octal)\n" |
2922 |
"\n", progname); |
2943 |
"\n", progname); |
2923 |
} |
2944 |
} |
2924 |
|
2945 |
|