nfs4idmap.c 15 KB

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