Print this page
2989 Eliminate use of LOGNAME_MAX in ON
1166 useradd have warning with name more 8 chars

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/newtask/newtask.c
          +++ new/usr/src/cmd/newtask/newtask.c
↓ open down ↓ 12 lines elided ↑ open up ↑
  13   13   *
  14   14   * When distributing Covered Code, include this CDDL HEADER in each
  15   15   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16   16   * If applicable, add the following below this CDDL HEADER, with the
  17   17   * fields enclosed by brackets "[]" replaced with your own identifying
  18   18   * information: Portions Copyright [yyyy] [name of copyright owner]
  19   19   *
  20   20   * CDDL HEADER END
  21   21   */
  22   22  /*
       23 + * Copyright (c) 2013 Gary Mills
       24 + *
  23   25   * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
  24   26   * Use is subject to license terms.
  25   27   */
  26   28  
  27      -#pragma ident   "%Z%%M% %I%     %E% SMI"
  28      -
  29   29  #include <sys/types.h>
  30   30  #include <sys/task.h>
  31   31  
  32   32  #include <alloca.h>
  33   33  #include <libproc.h>
  34   34  #include <libintl.h>
  35   35  #include <libgen.h>
  36   36  #include <limits.h>
  37   37  #include <project.h>
  38   38  #include <pwd.h>
↓ open down ↓ 650 lines elided ↑ open up ↑
 689  689           * If projname wasn't supplied, we've done our best, so just return
 690  690           * what we've got now. Alternatively, if newtask's invoker has
 691  691           * superuser privileges, return the pw structure we've got now, with
 692  692           * no further checking from inproj(). Superuser should be able to
 693  693           * join any project, and the subsequent call to setproject() will
 694  694           * allow this.
 695  695           */
 696  696          if (projname == NULL || getuid() == (uid_t)0)
 697  697                  return (pw);
 698  698  
 699      -        (void) strcpy(username, pw->pw_name);
      699 +        (void) strlcpy(username, pw->pw_name, sizeof (username));
 700  700  
 701  701          if (inproj(username, projname, prbuf, PROJECT_BUFSZ) == 0) {
 702  702                  char **u;
 703  703                  tmp_name = NULL;
 704  704  
 705  705                  /*
 706  706                   * If the previous guesses didn't work, walk through all
 707  707                   * project members and test for UID-equivalence.
 708  708                   */
 709  709  
↓ open down ↓ 94 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX