nfs4idmap.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685
  1. /*
  2. * fs/nfsd/nfs4idmap.c
  3. *
  4. * Mapping of UID/GIDs to name and vice versa.
  5. *
  6. * Copyright (c) 2002, 2003 The Regents of the University of
  7. * Michigan. All rights reserved.
  8. *
  9. * Marius Aamodt Eriksen <marius@umich.edu>
  10. *
  11. * Redistribution and use in source and binary forms, with or without
  12. * modification, are permitted provided that the following conditions
  13. * are met:
  14. *
  15. * 1. Redistributions of source code must retain the above copyright
  16. * notice, this list of conditions and the following disclaimer.
  17. * 2. Redistributions in binary form must reproduce the above copyright
  18. * notice, this list of conditions and the following disclaimer in the
  19. * documentation and/or other materials provided with the distribution.
  20. * 3. Neither the name of the University nor the names of its
  21. * contributors may be used to endorse or promote products derived
  22. * from this software without specific prior written permission.
  23. *
  24. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
  25. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  26. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  27. * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  28. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  29. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  30. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
  31. * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  32. * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  33. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  34. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  35. */
  36. #include <linux/module.h>
  37. #include <linux/init.h>
  38. #include <linux/mm.h>
  39. #include <linux/utsname.h>
  40. #include <linux/errno.h>
  41. #include <linux/string.h>
  42. #include <linux/sunrpc/clnt.h>
  43. #include <linux/nfs.h>
  44. #include <linux/nfs4.h>
  45. #include <linux/nfs_fs.h>
  46. #include <linux/nfs_page.h>
  47. #include <linux/sunrpc/cache.h>
  48. #include <linux/nfsd_idmap.h>
  49. #include <linux/list.h>
  50. #include <linux/time.h>
  51. #include <linux/seq_file.h>
  52. #include <linux/sunrpc/svcauth.h>
  53. /*
  54. * Cache entry
  55. */
  56. /*
  57. * XXX we know that IDMAP_NAMESZ < PAGE_SIZE, but it's ugly to rely on
  58. * that.
  59. */
  60. #define IDMAP_TYPE_USER 0
  61. #define IDMAP_TYPE_GROUP 1
  62. struct ent {
  63. struct cache_head h;
  64. int type; /* User / Group */
  65. uid_t id;
  66. char name[IDMAP_NAMESZ];
  67. char authname[IDMAP_NAMESZ];
  68. };
  69. /* Common entry handling */
  70. #define ENT_HASHBITS 8
  71. #define ENT_HASHMAX (1 << ENT_HASHBITS)
  72. #define ENT_HASHMASK (ENT_HASHMAX - 1)
  73. static void
  74. ent_init(struct cache_head *cnew, struct cache_head *citm)
  75. {
  76. struct ent *new = container_of(cnew, struct ent, h);
  77. struct ent *itm = container_of(citm, struct ent, h);
  78. new->id = itm->id;
  79. new->type = itm->type;
  80. strlcpy(new->name, itm->name, sizeof(new->name));
  81. strlcpy(new->authname, itm->authname, sizeof(new->name));
  82. }
  83. static void
  84. ent_put(struct kref *ref)
  85. {
  86. struct ent *map = container_of(ref, struct ent, h.ref);
  87. kfree(map);
  88. }
  89. static struct cache_head *
  90. ent_alloc(void)
  91. {
  92. struct ent *e = kmalloc(sizeof(*e), GFP_KERNEL);
  93. if (e)
  94. return &e->h;
  95. else
  96. return NULL;
  97. }
  98. /*
  99. * ID -> Name cache
  100. */
  101. static struct cache_head *idtoname_table[ENT_HASHMAX];
  102. static uint32_t
  103. idtoname_hash(struct ent *ent)
  104. {
  105. uint32_t hash;
  106. hash = hash_str(ent->authname, ENT_HASHBITS);
  107. hash = hash_long(hash ^ ent->id, ENT_HASHBITS);
  108. /* Flip LSB for user/group */
  109. if (ent->type == IDMAP_TYPE_GROUP)
  110. hash ^= 1;
  111. return hash;
  112. }
  113. static void
  114. idtoname_request(struct cache_detail *cd, struct cache_head *ch, char **bpp,
  115. int *blen)
  116. {
  117. struct ent *ent = container_of(ch, struct ent, h);
  118. char idstr[11];
  119. qword_add(bpp, blen, ent->authname);
  120. snprintf(idstr, sizeof(idstr), "%u", ent->id);
  121. qword_add(bpp, blen, ent->type == IDMAP_TYPE_GROUP ? "group" : "user");
  122. qword_add(bpp, blen, idstr);
  123. (*bpp)[-1] = '\n';
  124. }
  125. static int
  126. idtoname_upcall(struct cache_detail *cd, struct cache_head *ch)
  127. {
  128. return sunrpc_cache_pipe_upcall(cd, ch, idtoname_request);
  129. }
  130. static int
  131. idtoname_match(struct cache_head *ca, struct cache_head *cb)
  132. {
  133. struct ent *a = container_of(ca, struct ent, h);
  134. struct ent *b = container_of(cb, struct ent, h);
  135. return (a->id == b->id && a->type == b->type &&
  136. strcmp(a->authname, b->authname) == 0);
  137. }
  138. static int
  139. idtoname_show(struct seq_file *m, struct cache_detail *cd, struct cache_head *h)
  140. {
  141. struct ent *ent;
  142. if (h == NULL) {
  143. seq_puts(m, "#domain type id [name]\n");
  144. return 0;
  145. }
  146. ent = container_of(h, struct ent, h);
  147. seq_printf(m, "%s %s %u", ent->authname,
  148. ent->type == IDMAP_TYPE_GROUP ? "group" : "user",
  149. ent->id);
  150. if (test_bit(CACHE_VALID, &h->flags))
  151. seq_printf(m, " %s", ent->name);
  152. seq_printf(m, "\n");
  153. return 0;
  154. }
  155. static void
  156. warn_no_idmapd(struct cache_detail *detail, int has_died)
  157. {
  158. printk("nfsd: nfsv4 idmapping failing: has idmapd %s?\n",
  159. has_died ? "died" : "not been started");
  160. }
  161. static int idtoname_parse(struct cache_detail *, char *, int);
  162. static struct ent *idtoname_lookup(struct ent *);
  163. static struct ent *idtoname_update(struct ent *, struct ent *);
  164. static struct cache_detail idtoname_cache = {
  165. .owner = THIS_MODULE,
  166. .hash_size = ENT_HASHMAX,
  167. .hash_table = idtoname_table,
  168. .name = "nfs4.idtoname",
  169. .cache_put = ent_put,
  170. .cache_upcall = idtoname_upcall,
  171. .cache_parse = idtoname_parse,
  172. .cache_show = idtoname_show,
  173. .warn_no_listener = warn_no_idmapd,
  174. .match = idtoname_match,
  175. .init = ent_init,
  176. .update = ent_init,
  177. .alloc = ent_alloc,
  178. };
  179. static int
  180. idtoname_parse(struct cache_detail *cd, char *buf, int buflen)
  181. {
  182. struct ent ent, *res;
  183. char *buf1, *bp;
  184. int len;
  185. int error = -EINVAL;
  186. if (buf[buflen - 1] != '\n')
  187. return (-EINVAL);
  188. buf[buflen - 1]= '\0';
  189. buf1 = kmalloc(PAGE_SIZE, GFP_KERNEL);
  190. if (buf1 == NULL)
  191. return (-ENOMEM);
  192. memset(&ent, 0, sizeof(ent));
  193. /* Authentication name */
  194. if (qword_get(&buf, buf1, PAGE_SIZE) <= 0)
  195. goto out;
  196. memcpy(ent.authname, buf1, sizeof(ent.authname));
  197. /* Type */
  198. if (qword_get(&buf, buf1, PAGE_SIZE) <= 0)
  199. goto out;
  200. ent.type = strcmp(buf1, "user") == 0 ?
  201. IDMAP_TYPE_USER : IDMAP_TYPE_GROUP;
  202. /* ID */
  203. if (qword_get(&buf, buf1, PAGE_SIZE) <= 0)
  204. goto out;
  205. ent.id = simple_strtoul(buf1, &bp, 10);
  206. if (bp == buf1)
  207. goto out;
  208. /* expiry */
  209. ent.h.expiry_time = get_expiry(&buf);
  210. if (ent.h.expiry_time == 0)
  211. goto out;
  212. error = -ENOMEM;
  213. res = idtoname_lookup(&ent);
  214. if (!res)
  215. goto out;
  216. /* Name */
  217. error = -EINVAL;
  218. len = qword_get(&buf, buf1, PAGE_SIZE);
  219. if (len < 0)
  220. goto out;
  221. if (len == 0)
  222. set_bit(CACHE_NEGATIVE, &ent.h.flags);
  223. else if (len >= IDMAP_NAMESZ)
  224. goto out;
  225. else
  226. memcpy(ent.name, buf1, sizeof(ent.name));
  227. error = -ENOMEM;
  228. res = idtoname_update(&ent, res);
  229. if (res == NULL)
  230. goto out;
  231. cache_put(&res->h, &idtoname_cache);
  232. error = 0;
  233. out:
  234. kfree(buf1);
  235. return error;
  236. }
  237. static struct ent *
  238. idtoname_lookup(struct ent *item)
  239. {
  240. struct cache_head *ch = sunrpc_cache_lookup(&idtoname_cache,
  241. &item->h,
  242. idtoname_hash(item));
  243. if (ch)
  244. return container_of(ch, struct ent, h);
  245. else
  246. return NULL;
  247. }
  248. static struct ent *
  249. idtoname_update(struct ent *new, struct ent *old)
  250. {
  251. struct cache_head *ch = sunrpc_cache_update(&idtoname_cache,
  252. &new->h, &old->h,
  253. idtoname_hash(new));
  254. if (ch)
  255. return container_of(ch, struct ent, h);
  256. else
  257. return NULL;
  258. }
  259. /*
  260. * Name -> ID cache
  261. */
  262. static struct cache_head *nametoid_table[ENT_HASHMAX];
  263. static inline int
  264. nametoid_hash(struct ent *ent)
  265. {
  266. return hash_str(ent->name, ENT_HASHBITS);
  267. }
  268. static void
  269. nametoid_request(struct cache_detail *cd, struct cache_head *ch, char **bpp,
  270. int *blen)
  271. {
  272. struct ent *ent = container_of(ch, struct ent, h);
  273. qword_add(bpp, blen, ent->authname);
  274. qword_add(bpp, blen, ent->type == IDMAP_TYPE_GROUP ? "group" : "user");
  275. qword_add(bpp, blen, ent->name);
  276. (*bpp)[-1] = '\n';
  277. }
  278. static int
  279. nametoid_upcall(struct cache_detail *cd, struct cache_head *ch)
  280. {
  281. return sunrpc_cache_pipe_upcall(cd, ch, nametoid_request);
  282. }
  283. static int
  284. nametoid_match(struct cache_head *ca, struct cache_head *cb)
  285. {
  286. struct ent *a = container_of(ca, struct ent, h);
  287. struct ent *b = container_of(cb, struct ent, h);
  288. return (a->type == b->type && strcmp(a->name, b->name) == 0 &&
  289. strcmp(a->authname, b->authname) == 0);
  290. }
  291. static int
  292. nametoid_show(struct seq_file *m, struct cache_detail *cd, struct cache_head *h)
  293. {
  294. struct ent *ent;
  295. if (h == NULL) {
  296. seq_puts(m, "#domain type name [id]\n");
  297. return 0;
  298. }
  299. ent = container_of(h, struct ent, h);
  300. seq_printf(m, "%s %s %s", ent->authname,
  301. ent->type == IDMAP_TYPE_GROUP ? "group" : "user",
  302. ent->name);
  303. if (test_bit(CACHE_VALID, &h->flags))
  304. seq_printf(m, " %u", ent->id);
  305. seq_printf(m, "\n");
  306. return 0;
  307. }
  308. static struct ent *nametoid_lookup(struct ent *);
  309. static struct ent *nametoid_update(struct ent *, struct ent *);
  310. static int nametoid_parse(struct cache_detail *, char *, int);
  311. static struct cache_detail nametoid_cache = {
  312. .owner = THIS_MODULE,
  313. .hash_size = ENT_HASHMAX,
  314. .hash_table = nametoid_table,
  315. .name = "nfs4.nametoid",
  316. .cache_put = ent_put,
  317. .cache_upcall = nametoid_upcall,
  318. .cache_parse = nametoid_parse,
  319. .cache_show = nametoid_show,
  320. .warn_no_listener = warn_no_idmapd,
  321. .match = nametoid_match,
  322. .init = ent_init,
  323. .update = ent_init,
  324. .alloc = ent_alloc,
  325. };
  326. static int
  327. nametoid_parse(struct cache_detail *cd, char *buf, int buflen)
  328. {
  329. struct ent ent, *res;
  330. char *buf1;
  331. int error = -EINVAL;
  332. if (buf[buflen - 1] != '\n')
  333. return (-EINVAL);
  334. buf[buflen - 1]= '\0';
  335. buf1 = kmalloc(PAGE_SIZE, GFP_KERNEL);
  336. if (buf1 == NULL)
  337. return (-ENOMEM);
  338. memset(&ent, 0, sizeof(ent));
  339. /* Authentication name */
  340. if (qword_get(&buf, buf1, PAGE_SIZE) <= 0)
  341. goto out;
  342. memcpy(ent.authname, buf1, sizeof(ent.authname));
  343. /* Type */
  344. if (qword_get(&buf, buf1, PAGE_SIZE) <= 0)
  345. goto out;
  346. ent.type = strcmp(buf1, "user") == 0 ?
  347. IDMAP_TYPE_USER : IDMAP_TYPE_GROUP;
  348. /* Name */
  349. error = qword_get(&buf, buf1, PAGE_SIZE);
  350. if (error <= 0 || error >= IDMAP_NAMESZ)
  351. goto out;
  352. memcpy(ent.name, buf1, sizeof(ent.name));
  353. /* expiry */
  354. ent.h.expiry_time = get_expiry(&buf);
  355. if (ent.h.expiry_time == 0)
  356. goto out;
  357. /* ID */
  358. error = get_int(&buf, &ent.id);
  359. if (error == -EINVAL)
  360. goto out;
  361. if (error == -ENOENT)
  362. set_bit(CACHE_NEGATIVE, &ent.h.flags);
  363. error = -ENOMEM;
  364. res = nametoid_lookup(&ent);
  365. if (res == NULL)
  366. goto out;
  367. res = nametoid_update(&ent, res);
  368. if (res == NULL)
  369. goto out;
  370. cache_put(&res->h, &nametoid_cache);
  371. error = 0;
  372. out:
  373. kfree(buf1);
  374. return (error);
  375. }
  376. static struct ent *
  377. nametoid_lookup(struct ent *item)
  378. {
  379. struct cache_head *ch = sunrpc_cache_lookup(&nametoid_cache,
  380. &item->h,
  381. nametoid_hash(item));
  382. if (ch)
  383. return container_of(ch, struct ent, h);
  384. else
  385. return NULL;
  386. }
  387. static struct ent *
  388. nametoid_update(struct ent *new, struct ent *old)
  389. {
  390. struct cache_head *ch = sunrpc_cache_update(&nametoid_cache,
  391. &new->h, &old->h,
  392. nametoid_hash(new));
  393. if (ch)
  394. return container_of(ch, struct ent, h);
  395. else
  396. return NULL;
  397. }
  398. /*
  399. * Exported API
  400. */
  401. int
  402. nfsd_idmap_init(void)
  403. {
  404. int rv;
  405. rv = cache_register(&idtoname_cache);
  406. if (rv)
  407. return rv;
  408. rv = cache_register(&nametoid_cache);
  409. if (rv)
  410. cache_unregister(&idtoname_cache);
  411. return rv;
  412. }
  413. void
  414. nfsd_idmap_shutdown(void)
  415. {
  416. cache_unregister(&idtoname_cache);
  417. cache_unregister(&nametoid_cache);
  418. }
  419. /*
  420. * Deferred request handling
  421. */
  422. struct idmap_defer_req {
  423. struct cache_req req;
  424. struct cache_deferred_req deferred_req;
  425. wait_queue_head_t waitq;
  426. atomic_t count;
  427. };
  428. static inline void
  429. put_mdr(struct idmap_defer_req *mdr)
  430. {
  431. if (atomic_dec_and_test(&mdr->count))
  432. kfree(mdr);
  433. }
  434. static inline void
  435. get_mdr(struct idmap_defer_req *mdr)
  436. {
  437. atomic_inc(&mdr->count);
  438. }
  439. static void
  440. idmap_revisit(struct cache_deferred_req *dreq, int toomany)
  441. {
  442. struct idmap_defer_req *mdr =
  443. container_of(dreq, struct idmap_defer_req, deferred_req);
  444. wake_up(&mdr->waitq);
  445. put_mdr(mdr);
  446. }
  447. static struct cache_deferred_req *
  448. idmap_defer(struct cache_req *req)
  449. {
  450. struct idmap_defer_req *mdr =
  451. container_of(req, struct idmap_defer_req, req);
  452. mdr->deferred_req.revisit = idmap_revisit;
  453. get_mdr(mdr);
  454. return (&mdr->deferred_req);
  455. }
  456. static inline int
  457. do_idmap_lookup(struct ent *(*lookup_fn)(struct ent *), struct ent *key,
  458. struct cache_detail *detail, struct ent **item,
  459. struct idmap_defer_req *mdr)
  460. {
  461. *item = lookup_fn(key);
  462. if (!*item)
  463. return -ENOMEM;
  464. return cache_check(detail, &(*item)->h, &mdr->req);
  465. }
  466. static inline int
  467. do_idmap_lookup_nowait(struct ent *(*lookup_fn)(struct ent *),
  468. struct ent *key, struct cache_detail *detail,
  469. struct ent **item)
  470. {
  471. int ret = -ENOMEM;
  472. *item = lookup_fn(key);
  473. if (!*item)
  474. goto out_err;
  475. ret = -ETIMEDOUT;
  476. if (!test_bit(CACHE_VALID, &(*item)->h.flags)
  477. || (*item)->h.expiry_time < get_seconds()
  478. || detail->flush_time > (*item)->h.last_refresh)
  479. goto out_put;
  480. ret = -ENOENT;
  481. if (test_bit(CACHE_NEGATIVE, &(*item)->h.flags))
  482. goto out_put;
  483. return 0;
  484. out_put:
  485. cache_put(&(*item)->h, detail);
  486. out_err:
  487. *item = NULL;
  488. return ret;
  489. }
  490. static int
  491. idmap_lookup(struct svc_rqst *rqstp,
  492. struct ent *(*lookup_fn)(struct ent *), struct ent *key,
  493. struct cache_detail *detail, struct ent **item)
  494. {
  495. struct idmap_defer_req *mdr;
  496. int ret;
  497. mdr = kzalloc(sizeof(*mdr), GFP_KERNEL);
  498. if (!mdr)
  499. return -ENOMEM;
  500. atomic_set(&mdr->count, 1);
  501. init_waitqueue_head(&mdr->waitq);
  502. mdr->req.defer = idmap_defer;
  503. ret = do_idmap_lookup(lookup_fn, key, detail, item, mdr);
  504. if (ret == -EAGAIN) {
  505. wait_event_interruptible_timeout(mdr->waitq,
  506. test_bit(CACHE_VALID, &(*item)->h.flags), 1 * HZ);
  507. ret = do_idmap_lookup_nowait(lookup_fn, key, detail, item);
  508. }
  509. put_mdr(mdr);
  510. return ret;
  511. }
  512. static char *
  513. rqst_authname(struct svc_rqst *rqstp)
  514. {
  515. struct auth_domain *clp;
  516. clp = rqstp->rq_gssclient ? rqstp->rq_gssclient : rqstp->rq_client;
  517. return clp->name;
  518. }
  519. static int
  520. idmap_name_to_id(struct svc_rqst *rqstp, int type, const char *name, u32 namelen,
  521. uid_t *id)
  522. {
  523. struct ent *item, key = {
  524. .type = type,
  525. };
  526. int ret;
  527. if (namelen + 1 > sizeof(key.name))
  528. return -EINVAL;
  529. memcpy(key.name, name, namelen);
  530. key.name[namelen] = '\0';
  531. strlcpy(key.authname, rqst_authname(rqstp), sizeof(key.authname));
  532. ret = idmap_lookup(rqstp, nametoid_lookup, &key, &nametoid_cache, &item);
  533. if (ret == -ENOENT)
  534. ret = -ESRCH; /* nfserr_badname */
  535. if (ret)
  536. return ret;
  537. *id = item->id;
  538. cache_put(&item->h, &nametoid_cache);
  539. return 0;
  540. }
  541. static int
  542. idmap_id_to_name(struct svc_rqst *rqstp, int type, uid_t id, char *name)
  543. {
  544. struct ent *item, key = {
  545. .id = id,
  546. .type = type,
  547. };
  548. int ret;
  549. strlcpy(key.authname, rqst_authname(rqstp), sizeof(key.authname));
  550. ret = idmap_lookup(rqstp, idtoname_lookup, &key, &idtoname_cache, &item);
  551. if (ret == -ENOENT)
  552. return sprintf(name, "%u", id);
  553. if (ret)
  554. return ret;
  555. ret = strlen(item->name);
  556. BUG_ON(ret > IDMAP_NAMESZ);
  557. memcpy(name, item->name, ret);
  558. cache_put(&item->h, &idtoname_cache);
  559. return ret;
  560. }
  561. int
  562. nfsd_map_name_to_uid(struct svc_rqst *rqstp, const char *name, size_t namelen,
  563. __u32 *id)
  564. {
  565. return idmap_name_to_id(rqstp, IDMAP_TYPE_USER, name, namelen, id);
  566. }
  567. int
  568. nfsd_map_name_to_gid(struct svc_rqst *rqstp, const char *name, size_t namelen,
  569. __u32 *id)
  570. {
  571. return idmap_name_to_id(rqstp, IDMAP_TYPE_GROUP, name, namelen, id);
  572. }
  573. int
  574. nfsd_map_uid_to_name(struct svc_rqst *rqstp, __u32 id, char *name)
  575. {
  576. return idmap_id_to_name(rqstp, IDMAP_TYPE_USER, id, name);
  577. }
  578. int
  579. nfsd_map_gid_to_name(struct svc_rqst *rqstp, __u32 id, char *name)
  580. {
  581. return idmap_id_to_name(rqstp, IDMAP_TYPE_GROUP, id, name);
  582. }