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) Typo in $(top_builddir)
Added ../gl/libgnu.a to _LDADD (bug #31537, Added ../gl/libgnu.a to _LDADD (bug #31537,
thanks Tomi). 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) 2012-01-12 Werner Baumann (werner.baumann@onlinehome.de)
* dav_coda.c, dav_fuse.c: * 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", syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "Alignment of dav_node: %i",
alignment); alignment);


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


default_file_mode = args->file_mode; default_file_mode = args->file_mode;
default_dir_mode = args->dir_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) { if (init_coda(dev, msg_loop, mdata) != 0) {
error(0, 0, _("trying fuse kernel file system")); error(0, 0, _("trying fuse kernel file system"));
if (init_fuse(dev, msg_loop, mdata, buf_size, url, mpoint, 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) { == 0) {
free(*kernel_fs); free(*kernel_fs);
*kernel_fs = strdup("fuse"); *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) { } else if (strcmp(*kernel_fs, "fuse") == 0) {


if (init_fuse(dev, msg_loop, mdata, buf_size, url, mpoint, args->mopts, 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; mounted = 1;
} else { } else {
error(0, 0, _("trying coda kernel file system")); 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) if (args->mopts != n_args->mopts)
error(EXIT_FAILURE, 0, _("different mount options in %s"), error(EXIT_FAILURE, 0, _("different mount options in %s"),
_PATH_MNTTAB); _PATH_MNTTAB);
if (args->uid != n_args->uid) if (args->fsuid != n_args->fsuid)
error(EXIT_FAILURE, 0, _("different uid in %s"), _PATH_MNTTAB); 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); error(EXIT_FAILURE, 0, _("different gid in %s"), _PATH_MNTTAB);
if (args->dir_mode != n_args->dir_mode) if (args->dir_mode != n_args->dir_mode)
error(EXIT_FAILURE, 0, _("different dir_mode in %s"), _PATH_MNTTAB); error(EXIT_FAILURE, 0, _("different dir_mode in %s"), _PATH_MNTTAB);
@ -784,19 +784,19 @@ check_permissions(dav_args *args)
if (getuid() == 0) if (getuid() == 0)
return; return;


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


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


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

View File

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