Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP2:GA
util-linux.3352
util-linux-libmount-uid-gid-translation.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File util-linux-libmount-uid-gid-translation.patch of Package util-linux.3352
From 440a355a3d3934d99f7ef82adf02342e6f2f7983 Mon Sep 17 00:00:00 2001 From: Karel Zak <kzak@redhat.com> Date: Mon, 12 Oct 2015 11:42:13 +0200 Subject: [PATCH] libmount: fix uid= and gid= translation The current libmount version returns error when no able to convert username/groupname to uid/git. # mount mount /dev/sda1 /mnt/test -o uid=ignore # mount: failed to parse mount options This is regression, the original mount(8) has ignored possible unknown user/group names and the option has been used unconverted (with the original value). For example UDF kernel driver depends on this behavior and "uid=ignore" (or "forgot") is a valid mount option. Fixed version (unit test): ./test_mount_optstr --fix uid=kzak,gid=forgot,aaa,bbb optstr: uid=kzak,gid=forgot,aaa,bbb fixed: uid=1000,gid=forgot,aaa,bbb Reported-By: Anthony DeRobertis <anthony@derobert.net> Addresses: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=801527 Signed-off-by: Karel Zak <kzak@redhat.com> --- libmount/src/optstr.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/libmount/src/optstr.c b/libmount/src/optstr.c index 198890d..9b21e63 100644 --- a/libmount/src/optstr.c +++ b/libmount/src/optstr.c @@ -959,7 +959,6 @@ static int set_uint_value(char **optstr, unsigned int num, */ int mnt_optstr_fix_uid(char **optstr, char *value, size_t valsz, char **next) { - int rc = 0; char *end; if (!optstr || !*optstr || !value || !valsz) @@ -971,10 +970,11 @@ int mnt_optstr_fix_uid(char **optstr, char *value, size_t valsz, char **next) if (valsz == 7 && !strncmp(value, "useruid", 7) && (*(value + 7) == ',' || !*(value + 7))) - rc = set_uint_value(optstr, getuid(), value, end, next); + return set_uint_value(optstr, getuid(), value, end, next); else if (!isdigit(*value)) { uid_t id; + int rc; char *p = strndup(value, valsz); if (!p) return -ENOMEM; @@ -982,16 +982,17 @@ int mnt_optstr_fix_uid(char **optstr, char *value, size_t valsz, char **next) free(p); if (!rc) - rc = set_uint_value(optstr, id, value, end, next); + return set_uint_value(optstr, id, value, end, next); + } - } else if (next) { - /* nothing */ + if (next) { + /* no change, let's keep the original value */ *next = value + valsz; if (**next == ',') (*next)++; } - return rc; + return 0; } /* @@ -1006,7 +1007,6 @@ int mnt_optstr_fix_uid(char **optstr, char *value, size_t valsz, char **next) */ int mnt_optstr_fix_gid(char **optstr, char *value, size_t valsz, char **next) { - int rc = 0; char *end; if (!optstr || !*optstr || !value || !valsz) @@ -1018,9 +1018,10 @@ int mnt_optstr_fix_gid(char **optstr, char *value, size_t valsz, char **next) if (valsz == 7 && !strncmp(value, "usergid", 7) && (*(value + 7) == ',' || !*(value + 7))) - rc = set_uint_value(optstr, getgid(), value, end, next); + return set_uint_value(optstr, getgid(), value, end, next); else if (!isdigit(*value)) { + int rc; gid_t id; char *p = strndup(value, valsz); if (!p) @@ -1029,15 +1030,17 @@ int mnt_optstr_fix_gid(char **optstr, char *value, size_t valsz, char **next) free(p); if (!rc) - rc = set_uint_value(optstr, id, value, end, next); + return set_uint_value(optstr, id, value, end, next); + + } - } else if (next) { + if (next) { /* nothing */ *next = value + valsz; if (**next == ',') (*next)++; } - return rc; + return 0; } /* -- 2.8.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor