diff options
Diffstat (limited to 'source3/smbwrapper')
-rw-r--r-- | source3/smbwrapper/README | 20 | ||||
-rw-r--r-- | source3/smbwrapper/smbw.c | 11 | ||||
-rw-r--r-- | source3/smbwrapper/smbw.h | 4 | ||||
-rw-r--r-- | source3/smbwrapper/smbw_stat.c | 7 |
4 files changed, 36 insertions, 6 deletions
diff --git a/source3/smbwrapper/README b/source3/smbwrapper/README index e9a52fb247..9f18c33036 100644 --- a/source3/smbwrapper/README +++ b/source3/smbwrapper/README @@ -30,7 +30,8 @@ happens. If you set SMBW_WORKGROUP to your workgroup or have workgroup set in yoru smb.conf then listing /smb/ should list all SMB servers in your workgroup. -Environment variables + +ENVIRONMENT VARIABLES --------------------- SMBW_USER @@ -58,6 +59,23 @@ SMBW_WORKGROUP /smb/ directory). It defaults to the one set in smb.conf. +ATTRIBUTE MAPPING +----------------- + +smbwrapper does an inverse attribute maping to what Samba does. This +means that the archive bit appears as the user execute bit, the system +bit appears as the group execute bit and the hidden bit appears as the +other execute bit. You can control these with chmod. The mapping can +be enabled an disabled using the normal smb.conf controls (ie. "map +archive", "map system" and "map hidden"). + +Read-only files appear as non-writeable by everyone. Writeable files +appear as writeable by the current user. + + +WHAT WORKS +---------- + Things that I have tried and do seem to work include: emacs, tar, ls, cmp, cp, rsync, du, cat, rm, mv, less, more, wc, head, diff --git a/source3/smbwrapper/smbw.c b/source3/smbwrapper/smbw.c index d6b377a0b5..ab2b807f6c 100644 --- a/source3/smbwrapper/smbw.c +++ b/source3/smbwrapper/smbw.c @@ -1059,13 +1059,18 @@ int smbw_chmod(const char *fname, mode_t newmode) goto failed; } - if (!cli_getatr(&srv->cli, path, &mode, NULL, NULL)) { + mode = 0; + + if (!(newmode & (S_IWUSR | S_IWGRP | S_IWOTH))) mode |= aRONLY; + if ((newmode & S_IXUSR) && lp_map_archive(-1)) mode |= aARCH; + if ((newmode & S_IXGRP) && lp_map_system(-1)) mode |= aSYSTEM; + if ((newmode & S_IXOTH) && lp_map_hidden(-1)) mode |= aHIDDEN; + + if (!cli_setatr(&srv->cli, path, mode, 0)) { errno = smbw_errno(&srv->cli); goto failed; } - /* assume success for the moment - need to add attribute mapping */ - smbw_busy--; return 0; diff --git a/source3/smbwrapper/smbw.h b/source3/smbwrapper/smbw.h index 2f16efd216..43fb14bce0 100644 --- a/source3/smbwrapper/smbw.h +++ b/source3/smbwrapper/smbw.h @@ -25,8 +25,8 @@ #define SMBW_CLI_FD 512 #define SMBW_MAX_OPEN 8192 -#define SMBW_FILE_MODE (S_IFREG | 0644) -#define SMBW_DIR_MODE (S_IFDIR | 0755) +#define SMBW_FILE_MODE (S_IFREG | 0444) +#define SMBW_DIR_MODE (S_IFDIR | 0555) #define SMBW_PWD_ENV "PWD" diff --git a/source3/smbwrapper/smbw_stat.c b/source3/smbwrapper/smbw_stat.c index ab351d56b1..a6d01f66d6 100644 --- a/source3/smbwrapper/smbw_stat.c +++ b/source3/smbwrapper/smbw_stat.c @@ -33,6 +33,8 @@ setup basic info in a stat structure void smbw_setup_stat(struct stat *st, char *fname, size_t size, int mode) { ZERO_STRUCTP(st); + + st->st_mode = 0; if (IS_DOS_DIR(mode)) { st->st_mode = SMBW_DIR_MODE; @@ -40,6 +42,11 @@ void smbw_setup_stat(struct stat *st, char *fname, size_t size, int mode) st->st_mode = SMBW_FILE_MODE; } + if (IS_DOS_ARCHIVE(mode)) st->st_mode |= S_IXUSR; + if (IS_DOS_SYSTEM(mode)) st->st_mode |= S_IXGRP; + if (IS_DOS_HIDDEN(mode)) st->st_mode |= S_IXOTH; + if (!IS_DOS_READONLY(mode)) st->st_mode |= S_IWUSR; + st->st_size = size; st->st_blksize = 512; st->st_blocks = (size+511)/512; |