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 /support/nfs/cacheio.c | |
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 'support/nfs/cacheio.c')
-rw-r--r-- | support/nfs/cacheio.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/support/nfs/cacheio.c b/support/nfs/cacheio.c index bdf5d84..0587ecb 100644 --- a/support/nfs/cacheio.c +++ b/support/nfs/cacheio.c @@ -148,6 +148,11 @@ void qword_printint(FILE *f, int num) fprintf(f, "%d ", num); } +void qword_printuint(FILE *f, unsigned int num) +{ + fprintf(f, "%u ", num); +} + int qword_eol(FILE *f) { int err; @@ -236,6 +241,20 @@ int qword_get_int(char **bpp, int *anint) return 0; } +int qword_get_uint(char *bpp, unsigned int *anint) +{ + char buf[50]; + char *ep; + unsigned int rv; + int len = qword_get(bpp, buf, 50); + if (len < 0) return -1; + if (len ==0) return -1; + rv = strtoul(buf, &ep, 0); + if (*ep) return -1; + *anint = rv; + return 0; +} + #define READLINE_BUFFER_INCREMENT 2048 int readline(int fd, char **buf, int *lenp) |