Print this page
4078 groupadd execs getent unnecessarily
Reviewed by: Rich Lowe <richlowe@richlowe.net>
Reviewed by: Gary Mills <gary_mills@fastmail.fm>
Reviewed by: Milan Jurik <milan.jurik@xylab.cz>
Reviewed by: Gordon Ross <Gordon.W.Ross@gmail.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/oamuser/user/val_lgrp.c
          +++ new/usr/src/cmd/oamuser/user/val_lgrp.c
↓ open down ↓ 18 lines elided ↑ open up ↑
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  23   23   * Use is subject to license terms.
  24   24   */
  25   25  
  26   26  /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
  27   27  /*        All Rights Reserved   */
  28   28  
       29 +/*
       30 + * Copyright (c) 2013 RackTop Systems.
       31 + */
       32 +
  29   33  
  30   34  #include        <sys/types.h>
  31   35  #include        <stdio.h>
  32   36  #include        <stdlib.h>
  33   37  #include        <sys/param.h>
  34   38  #include        <unistd.h>
  35   39  #include        <users.h>
  36   40  #include        <userdefs.h>
  37   41  #include        "messages.h"
  38   42  
↓ open down ↓ 14 lines elided ↑ open up ↑
  53   57          int dup_prim = 0; /* we don't duplicate our primary as a supplemental */
  54   58  
  55   59          if( !list || !*list )
  56   60                  return( (int **) NULL );
  57   61  
  58   62          if (ngroups_max == 0) {
  59   63                  ngroups_max = sysconf(_SC_NGROUPS_MAX);
  60   64                  grplist = malloc((ngroups_max + 1) * sizeof (gid_t));
  61   65          }
  62   66  
  63      -        while (ptr = strtok(((i || n_invalid || dup_prim)? NULL: list), ",")) {
       67 +        while ((ptr = strtok((i || n_invalid || dup_prim)? NULL: list, ","))) {
  64   68  
  65   69                  switch (valid_group(ptr, &g_ptr, &warning)) {
  66   70                  case INVALID:
  67   71                          errmsg( M_INVALID, ptr, "group id" );
  68   72                          n_invalid++;
  69   73                          break;
  70   74                  case TOOBIG:
  71   75                          errmsg( M_TOOBIG, "gid", ptr );
  72   76                          n_invalid++;
  73   77                          break;
↓ open down ↓ 44 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX