Print this page
3691 setgroups() needs a sorted GID list for more than 16 groups
Reviewed-By: Marcel Telka <marcel@telka.sk>
Reviewed-By: Richard Lowe <richlowe@richlowe.net>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/os/cred.c
          +++ new/usr/src/uts/common/os/cred.c
↓ open down ↓ 11 lines elided ↑ open up ↑
  12   12   *
  13   13   * When distributing Covered Code, include this CDDL HEADER in each
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
       22 + * Copyright (c) 2013, Ira Cooper.  All rights reserved.
       23 + */
       24 +/*
  22   25   * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
  23   26   */
  24   27  
  25   28  /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
  26   29  /*        All Rights Reserved   */
  27   30  
  28   31  /*
  29   32   * University Copyright- Copyright (c) 1982, 1986, 1988
  30   33   * The Regents of the University of California
  31   34   * All Rights Reserved
↓ open down ↓ 1401 lines elided ↑ open up ↑
1433 1436          ASSERT(n > 0);
1434 1437  
1435 1438          mem = kmem_alloc(sz, KM_SLEEP);
1436 1439  
1437 1440          if (copyin(gidset, mem->crg_groups, sizeof (gid_t) * n)) {
1438 1441                  kmem_free(mem, sz);
1439 1442                  return (NULL);
1440 1443          }
1441 1444          mem->crg_ref = 1;
1442 1445          mem->crg_ngroups = n;
     1446 +        qsort(mem->crg_groups, n, sizeof (gid_t), gidcmp);
1443 1447          return (mem);
1444 1448  }
1445 1449  
1446 1450  const gid_t *
1447 1451  crgetggroups(const credgrp_t *grps)
1448 1452  {
1449 1453          return (grps->crg_groups);
1450 1454  }
1451 1455  
1452 1456  void
↓ open down ↓ 22 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX