Rename members uid and gid of args into fsuid and fsgid

This commit is contained in:
wbaumann 2012-01-14 17:00:31 +00:00
parent 0ac5316bf5
commit 9c2a748122
5 changed files with 24 additions and 22 deletions

View File

@ -6,6 +6,8 @@ ChangeLog for davfs2
Typo in $(top_builddir)
Added ../gl/libgnu.a to _LDADD (bug #31537,
thanks Tomi).
mount_davfs.h, mount_davfs.c, cache.c, kernel_interface.c:
Rename members uid and gid of args into fsuid and fsgid.

2012-01-12 Werner Baumann (werner.baumann@onlinehome.de)
* dav_coda.c, dav_fuse.c:

View File

@ -591,8 +591,8 @@ dav_init_cache(const dav_args *args, const char *mpoint)
syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "Alignment of dav_node: %i",
alignment);

default_uid = args->uid;
default_gid = args->gid;
default_uid = args->fsuid;
default_gid = args->fsgid;

default_file_mode = args->file_mode;
default_dir_mode = args->dir_mode;

View File

@ -112,7 +112,7 @@ dav_init_kernel_interface(int *dev, dav_run_msgloop_fn *msg_loop, void **mdata,
if (init_coda(dev, msg_loop, mdata) != 0) {
error(0, 0, _("trying fuse kernel file system"));
if (init_fuse(dev, msg_loop, mdata, buf_size, url, mpoint,
args->mopts, args->uid, args->gid, args->dir_mode)
args->mopts, args->fsuid, args->fsgid, args->dir_mode)
== 0) {
free(*kernel_fs);
*kernel_fs = strdup("fuse");
@ -127,7 +127,7 @@ dav_init_kernel_interface(int *dev, dav_run_msgloop_fn *msg_loop, void **mdata,
} else if (strcmp(*kernel_fs, "fuse") == 0) {

if (init_fuse(dev, msg_loop, mdata, buf_size, url, mpoint, args->mopts,
args->uid, args->gid, args->dir_mode) == 0) {
args->fsuid, args->fsgid, args->dir_mode) == 0) {
mounted = 1;
} else {
error(0, 0, _("trying coda kernel file system"));

View File

@ -730,9 +730,9 @@ check_fstab(const dav_args *args)
if (args->mopts != n_args->mopts)
error(EXIT_FAILURE, 0, _("different mount options in %s"),
_PATH_MNTTAB);
if (args->uid != n_args->uid)
if (args->fsuid != n_args->fsuid)
error(EXIT_FAILURE, 0, _("different uid in %s"), _PATH_MNTTAB);
if (args->gid != n_args->gid)
if (args->fsgid != n_args->fsgid)
error(EXIT_FAILURE, 0, _("different gid in %s"), _PATH_MNTTAB);
if (args->dir_mode != n_args->dir_mode)
error(EXIT_FAILURE, 0, _("different dir_mode in %s"), _PATH_MNTTAB);
@ -784,19 +784,19 @@ check_permissions(dav_args *args)
if (getuid() == 0)
return;

if (args->uid != getuid())
if (args->fsuid != getuid())
error(EXIT_FAILURE, 0,
_("you can't set file owner different from your uid"));
if (args->debug & DAV_DBG_CONFIG)
syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "uid ok");

if (getgid() != args->gid) {
if (getgid() != args->fsgid) {
struct passwd *pw = getpwuid(getuid());
if (!pw)
error(EXIT_FAILURE, errno, _("can't read user data base"));
if (!pw->pw_name)
error(EXIT_FAILURE, 0, _("can't read user data base"));
struct group *grp = getgrgid(args->gid);
struct group *grp = getgrgid(args->fsgid);
if (!grp)
error(EXIT_FAILURE, 0, _("can't read group data base"));
char **members = grp->gr_mem;
@ -1584,13 +1584,13 @@ get_options(dav_args *args, char *option)
case UID:
pwd = getpwnam(argument);
if (!pwd) {
args->uid = arg_to_int(argument, 10, suboptions[so]);
args->fsuid = arg_to_int(argument, 10, suboptions[so]);
} else {
args->uid = pwd->pw_uid;
args->fsuid = pwd->pw_uid;
}
if (asprintf(&add_mopts, "%s,uid=%i",
(args->add_mopts) ? args->add_mopts : "",
args->uid) < 0)
args->fsuid) < 0)
abort();
if (args->add_mopts)
free(args->add_mopts);
@ -1600,13 +1600,13 @@ get_options(dav_args *args, char *option)
case GID:
grp = getgrnam(argument);
if (!grp) {
args->gid = arg_to_int(argument, 10, suboptions[so]);
args->fsgid = arg_to_int(argument, 10, suboptions[so]);
} else {
args->gid = grp->gr_gid;
args->fsgid = grp->gr_gid;
}
if (asprintf(&add_mopts, "%s,gid=%i",
(args->add_mopts) ? args->add_mopts : "",
args->gid) < 0)
args->fsgid) < 0)
abort();
if (args->add_mopts)
free(args->add_mopts);
@ -1710,8 +1710,8 @@ new_args(void)
args->kernel_fs = NULL;
args->buf_size = 0;

args->uid = getuid();
args->gid = getgid();
args->fsuid = getuid();
args->fsgid = getgid();
args->dir_umask = 0;
args->file_umask = 0;
args->dir_mode = 0;
@ -1815,9 +1815,9 @@ log_dbg_config(char *argv[], dav_args *args)
syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG),
" buf_size: %i KiB", args->buf_size);
syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG),
" uid: %i", args->uid);
" uid: %i", args->fsuid);
syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG),
" gid: %i", args->gid);
" gid: %i", args->fsgid);
syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG),
" dir_umask: %#o", args->dir_umask);
syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG),

View File

@ -38,15 +38,15 @@ typedef struct {
char *conf; /* Command line */
/* Mount options */
int user; /* Command line */
int users; /* Command line */
int users; /* Command line */
int netdev; /* Command line */
unsigned long int mopts; /* Command line */
char *add_mopts;
char *kernel_fs; /* User config file, system config file */
size_t buf_size; /* User config file, system config file */
/* File mode */
uid_t uid; /* Command line */
gid_t gid; /* Command line */
uid_t fsuid; /* Command line */
gid_t fsgid; /* Command line */
mode_t dir_umask;
mode_t file_umask;
mode_t dir_mode; /* Command line */