X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=utils%2Fmountd%2Fcache.c;h=629d56746d4f498890ae5683e506d88c84fcdb37;hb=66d8e2870b8d3e91c27a66ebc85e012a3cda9c69;hp=6947203c0f9b91ee362458602a405173f3a816f6;hpb=e91ff0175602cc56f223f1d92de6511099fa40d1;p=nfs-utils.git diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c index 6947203..629d567 100644 --- a/utils/mountd/cache.c +++ b/utils/mountd/cache.c @@ -21,6 +21,8 @@ #include #include #include +#include +#include #include "misc.h" #include "nfslib.h" #include "exportfs.h" @@ -101,6 +103,53 @@ void auth_unix_ip(FILE *f) } +void auth_unix_gid(FILE *f) +{ + /* Request are + * uid + * reply is + * uid expiry count list of group ids + */ + int uid; + struct passwd *pw; + gid_t glist[100], *groups = glist; + int ngroups = 100; + int rv, i; + char *cp; + + if (readline(fileno(f), &lbuf, &lbuflen) != 1) + return; + + cp = lbuf; + if (qword_get_int(&cp, &uid) != 0) + return; + + pw = getpwuid(uid); + if (!pw) + rv = -1; + else { + rv = getgrouplist(pw->pw_name, pw->pw_gid, groups, &ngroups); + if (rv == -1 && ngroups >= 100) { + groups = malloc(sizeof(gid_t)*ngroups); + if (!groups) + rv = -1; + else + rv = getgrouplist(pw->pw_name, pw->pw_gid, + groups, &ngroups); + } + } + qword_printint(f, uid); + qword_printint(f, time(0)+30*60); + if (rv >= 0) { + qword_printint(f, ngroups); + for (i=0; im_export.e_maptype != CLE_MAP_IDENT) { xlog(L_ERROR, "%s: unsupported mapping; kernel supports only 'identity' (default)", exp->m_export.m_path); - return; + return -1; } f = fopen("/proc/net/rpc/auth.unix.ip/channel", "w");