diff options
author | bde <bde@FreeBSD.org> | 1998-06-30 17:21:48 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1998-06-30 17:21:48 +0000 |
commit | e9a40050062581b56f20f85567ecdda138916450 (patch) | |
tree | 7b97a2f9eb9b90d621ffe55a4e9b1e36ff686bd5 /lib | |
parent | 2312b6276f8fe01173a4443cd48d7dea5b7f85d9 (diff) | |
download | FreeBSD-src-e9a40050062581b56f20f85567ecdda138916450.zip FreeBSD-src-e9a40050062581b56f20f85567ecdda138916450.tar.gz |
Fixed scanf format errors. The error handling is not quite bug for bug
compatible. I think small negative uids are handled compatibly but
other out of bounds ones are truncated differently for certain sizes of
uid_t.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/rpc/netnamer.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/libc/rpc/netnamer.c b/lib/libc/rpc/netnamer.c index 41c5146..26e58b0 100644 --- a/lib/libc/rpc/netnamer.c +++ b/lib/libc/rpc/netnamer.c @@ -76,6 +76,7 @@ netname2user(netname, uidp, gidp, gidlenp, gidlist) char *p; int gidlen; uid_t uid; + long luid; struct passwd *pwd; char val[1024]; char *val1, *val2; @@ -126,14 +127,10 @@ netname2user(netname, uidp, gidp, gidlenp, gidlist) if (strcmp(val2 + 1, domain)) return (0); /* wrong domain */ - /* XXX: uid_t have different sizes on different OS's. sigh! */ - if (sizeof (uid_t) == sizeof (short)) { - if (sscanf(val, "%hd", (short *)&uid) != 1) - return (0); - } else { - if (sscanf(val, "%ld", &uid) != 1) + if (sscanf(val, "%ld", &luid) != 1) return (0); - } + uid = luid; + /* use initgroups method */ pwd = getpwuid(uid); if (pwd == NULL) |