diff options
author | Andrew Tridgell <tridge@samba.org> | 1998-10-06 11:14:52 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 1998-10-06 11:14:52 +0000 |
commit | 58f6c75babebcf05c9ef5bb50dc433e55156b6ec (patch) | |
tree | b43eee685ae5c6204e831b16f87beea9b1c889ac /source3 | |
parent | ed75bab8e22c1cbebe0238a689f7994f3817ee8f (diff) | |
download | samba-58f6c75babebcf05c9ef5bb50dc433e55156b6ec.tar.gz samba-58f6c75babebcf05c9ef5bb50dc433e55156b6ec.tar.xz samba-58f6c75babebcf05c9ef5bb50dc433e55156b6ec.zip |
implemented attribute mapping and chmod. file attributes are mapped in
the same manner as smbd. See the README for a full explanation.
(This used to be commit 0a5dcddd3fa23081d7cd214acc32b8046125a74e)
Diffstat (limited to 'source3')
-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 e9a52fb2473..9f18c330363 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 d6b377a0b50..ab2b807f6c6 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 2f16efd216b..43fb14bce07 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 ab351d56b1e..a6d01f66d69 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; |