summaryrefslogtreecommitdiff
path: root/source3/utils/net_usershare.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2009-05-14 15:34:42 +0200
committerVolker Lendecke <vl@samba.org>2009-05-26 17:48:23 +0200
commit49ca690b4b22ee6e597179059c9442e94c5bd423 (patch)
treead233a9bcfee2d467824290448ca366219dbd301 /source3/utils/net_usershare.c
parent52f2f9449f8d53aa9181d656a4b54a007c80fa81 (diff)
downloadsamba-49ca690b4b22ee6e597179059c9442e94c5bd423.tar.gz
samba-49ca690b4b22ee6e597179059c9442e94c5bd423.tar.bz2
samba-49ca690b4b22ee6e597179059c9442e94c5bd423.zip
Introduce "struct stat_ex" as a replacement for SMB_STRUCT_STAT
This patch introduces struct stat_ex { dev_t st_ex_dev; ino_t st_ex_ino; mode_t st_ex_mode; nlink_t st_ex_nlink; uid_t st_ex_uid; gid_t st_ex_gid; dev_t st_ex_rdev; off_t st_ex_size; struct timespec st_ex_atime; struct timespec st_ex_mtime; struct timespec st_ex_ctime; struct timespec st_ex_btime; /* birthtime */ blksize_t st_ex_blksize; blkcnt_t st_ex_blocks; }; typedef struct stat_ex SMB_STRUCT_STAT; It is really large because due to the friendly libc headers playing macro tricks with fields like st_ino, so I renamed them to st_ex_xxx. Why this change? To support birthtime, we already have quite a few #ifdef's at places where it does not really belong. With a stat struct that we control, we can consolidate the nanosecond timestamps and the birthtime deep in the VFS stat calls. At this moment it is triggered by a request to support the birthtime field for GPFS. GPFS does not extend the system level struct stat, but instead has a separate call that gets us the additional information beyond posix. Without being able to do that within the VFS stat calls, that support would have to be scattered around the main smbd code. It will very likely break all the onefs modules, but I think the changes will be reasonably easy to do.
Diffstat (limited to 'source3/utils/net_usershare.c')
-rw-r--r--source3/utils/net_usershare.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/source3/utils/net_usershare.c b/source3/utils/net_usershare.c
index dadb88303b..992a03d813 100644
--- a/source3/utils/net_usershare.c
+++ b/source3/utils/net_usershare.c
@@ -250,13 +250,13 @@ static int get_share_list(TALLOC_CTX *ctx, const char *wcard, bool only_ours)
continue;
}
- if (!S_ISREG(sbuf.st_mode)) {
+ if (!S_ISREG(sbuf.st_ex_mode)) {
d_fprintf(stderr, "get_share_list: file %s is not a regular file. Ignoring.\n",
path );
continue;
}
- if (only_ours && sbuf.st_uid != myuid) {
+ if (only_ours && sbuf.st_ex_uid != myuid) {
continue;
}
@@ -364,7 +364,7 @@ static int info_fn(struct file_list *fl, void *priv)
return -1;
}
- if (!S_ISREG(sbuf.st_mode)) {
+ if (!S_ISREG(sbuf.st_ex_mode)) {
d_fprintf(stderr, "info_fn: file %s is not a regular file. Ignoring.\n",
basepath );
close(fd);
@@ -574,7 +574,7 @@ static int count_num_usershares(void)
continue;
}
- if (!S_ISREG(sbuf.st_mode)) {
+ if (!S_ISREG(sbuf.st_ex_mode)) {
d_fprintf(stderr, "count_num_usershares: file %s is not a regular file. Ignoring.\n",
path );
continue;
@@ -738,7 +738,7 @@ static int net_usershare_add(struct net_context *c, int argc, const char **argv)
return -1;
}
- if (!S_ISDIR(sbuf.st_mode)) {
+ if (!S_ISDIR(sbuf.st_ex_mode)) {
d_fprintf(stderr, "net usershare add: path %s is not a directory.\n",
us_path );
TALLOC_FREE(ctx);
@@ -749,7 +749,7 @@ static int net_usershare_add(struct net_context *c, int argc, const char **argv)
/* If we're not root, check if we're restricted to sharing out directories
that we own only. */
- if ((myeuid != 0) && lp_usershare_owner_only() && (myeuid != sbuf.st_uid)) {
+ if ((myeuid != 0) && lp_usershare_owner_only() && (myeuid != sbuf.st_ex_uid)) {
d_fprintf(stderr, "net usershare add: cannot share path %s as "
"we are restricted to only sharing directories we own.\n"
"\tAsk the administrator to add the line \"usershare owner only = false\" \n"
@@ -887,7 +887,7 @@ static int net_usershare_add(struct net_context *c, int argc, const char **argv)
return -1;
}
- if (!S_ISREG(sbuf.st_mode) || sbuf.st_dev != lsbuf.st_dev || sbuf.st_ino != lsbuf.st_ino) {
+ if (!S_ISREG(sbuf.st_ex_mode) || sbuf.st_ex_dev != lsbuf.st_ex_dev || sbuf.st_ex_ino != lsbuf.st_ex_ino) {
d_fprintf(stderr, "net usershare add: tmp file %s is not a regular file ?\n",
full_path_tmp );
TALLOC_FREE(ctx);