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/funcs.c
          +++ new/usr/src/cmd/oamuser/user/funcs.c
↓ open down ↓ 12 lines elided ↑ open up ↑
  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   22   * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
       23 + * Copyright (c) 2013 RackTop Systems.
  23   24   */
  24   25  
  25   26  #include <stdio.h>
  26   27  #include <stdlib.h>
  27   28  #include <strings.h>
  28   29  #include <auth_attr.h>
  29   30  #include <prof_attr.h>
  30   31  #include <user_attr.h>
  31   32  #include <project.h>
  32   33  #include <secdb.h>
↓ open down ↓ 140 lines elided ↑ open up ↑
 173  174   * Propose a default value for a key and get the actual value back.
 174  175   * If the proposed default value is NULL, return the actual value set.
 175  176   * The key argument is the user_attr key.
 176  177   */
 177  178  char *
 178  179  getsetdefval(const char *key, char *dflt)
 179  180  {
 180  181          int i;
 181  182  
 182  183          for (i = 0; i < NKEYS; i++)
 183      -                if (strcmp(keys[i].key, key) == 0)
      184 +                if (strcmp(keys[i].key, key) == 0) {
 184  185                          if (keys[i].newvalue != NULL)
 185  186                                  return (keys[i].newvalue);
 186  187                          else
 187  188                                  return (keys[i].newvalue = dflt);
      189 +                }
 188  190          return (NULL);
 189  191  }
 190  192  
 191  193  char *
 192  194  getusertype(char *cmdname)
 193  195  {
 194  196          static char usertype[MAX_TYPE_LENGTH];
 195  197          char *cmd;
 196  198  
 197      -        if (cmd = strrchr(cmdname, '/'))
      199 +        if ((cmd = strrchr(cmdname, '/')))
 198  200                  ++cmd;
 199  201          else
 200  202                  cmd = cmdname;
 201  203  
 202  204          /* get user type based on the program name */
 203  205          if (strncmp(cmd, CMD_PREFIX_USER,
 204  206              strlen(CMD_PREFIX_USER)) == 0)
 205  207                  strcpy(usertype, USERATTR_TYPE_NORMAL_KW);
 206  208          else
 207  209                  strcpy(usertype, USERATTR_TYPE_NONADMIN_KW);
↓ open down ↓ 309 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX