diff options
author | Steve Dickson <steved@redhat.com> | 2010-03-08 11:22:46 -0500 |
---|---|---|
committer | Steve Dickson <steved@redhat.com> | 2010-03-08 11:22:46 -0500 |
commit | 6ca440c2661dccb05ae74ffb65817e9c30f05c8a (patch) | |
tree | 2076bdce6631e3dd162ebd7f9aaa9830a4106512 /utils/mountd | |
parent | 84346b7d7e69c113d6dbf03f2646a47b0e74a6b8 (diff) | |
download | nfs-utils-6ca440c2661dccb05ae74ffb65817e9c30f05c8a.tar.gz nfs-utils-6ca440c2661dccb05ae74ffb65817e9c30f05c8a.tar.xz nfs-utils-6ca440c2661dccb05ae74ffb65817e9c30f05c8a.zip |
mountd: fix --manage-gids hang due to int/uint bug
A uid or gid should be represented as unsigned, not signed.
The conversion to signed here could cause a hang on access by an unknown
user to a server running mountd with --manage-gids; such a user is
likely to be mapped to 232-1, which may be converted to 231-1 when
represented as an int, resulting in a downcall for uid 231-1, hence the
original rpc hanging forever waiting for a cache downcall for 232-1.
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Steve Dickson <steved@redhat.com>
Diffstat (limited to 'utils/mountd')
-rw-r--r-- | utils/mountd/cache.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c index d63e10a..b6c148f 100644 --- a/utils/mountd/cache.c +++ b/utils/mountd/cache.c @@ -125,7 +125,7 @@ void auth_unix_gid(FILE *f) * reply is * uid expiry count list of group ids */ - int uid; + uid_t uid; struct passwd *pw; gid_t glist[100], *groups = glist; int ngroups = 100; @@ -136,7 +136,7 @@ void auth_unix_gid(FILE *f) return; cp = lbuf; - if (qword_get_int(&cp, &uid) != 0) + if (qword_get_uint(&cp, &uid) != 0) return; pw = getpwuid(uid); @@ -153,14 +153,14 @@ void auth_unix_gid(FILE *f) groups, &ngroups); } } - qword_printint(f, uid); - qword_printint(f, time(0)+30*60); + qword_printuint(f, uid); + qword_printuint(f, time(0)+30*60); if (rv >= 0) { - qword_printint(f, ngroups); + qword_printuint(f, ngroups); for (i=0; i<ngroups; i++) - qword_printint(f, groups[i]); + qword_printuint(f, groups[i]); } else - qword_printint(f, 0); + qword_printuint(f, 0); qword_eol(f); if (groups != glist) |