Print this page
10133 smatch fixes for usr/src/cmd/fs.d

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/fs.d/smbclnt/chacl/chacl.c
          +++ new/usr/src/cmd/fs.d/smbclnt/chacl/chacl.c
↓ open down ↓ 17 lines elided ↑ open up ↑
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  24   24   * Use is subject to license terms.
  25   25   */
  26   26  
  27   27  /*
       28 + * Copyright (c) 2018, Joyent, Inc.
       29 + */
       30 +
       31 +/*
  28   32   * This is the smbfs/chacl command.
  29   33   * (just for testing - not installed)
  30   34   *
  31   35   * Works like chmod(1), but only supporting A=... forms.
  32   36   * i.e. chacl A=everyone@:full_set:fd:allow /mnt/foo
  33   37   *
  34   38   * Some more test cases:
  35   39   *      /usr/lib/fs/smbfs/chacl -v
  36   40   *      A=user:2147483649:rwxpdDaARWcCos::allow,
  37   41   *      user:2147483653:raRcs::allow,
↓ open down ↓ 93 lines elided ↑ open up ↑
 131  135          }
 132  136          if (acl->acl_type != ACE_T) {
 133  137                  fprintf(stderr, "%s: ACL not ACE_T type: %s\n",
 134  138                      progname, acl_arg);
 135  139                  exit(1);
 136  140          }
 137  141  
 138  142          /*
 139  143           * Which parts of the SD are being modified?
 140  144           */
 141      -        selector = 0;
 142      -        if (acl)
 143      -                selector |= DACL_SECURITY_INFORMATION;
      145 +        selector = DACL_SECURITY_INFORMATION;
      146 +
 144  147          if (uid != (uid_t)-1)
 145  148                  selector |= OWNER_SECURITY_INFORMATION;
 146  149          if (gid != (gid_t)-1)
 147  150                  selector |= GROUP_SECURITY_INFORMATION;
 148  151  
 149  152          if (optind == argc)
 150  153                  usage();
 151  154          for (; optind < argc; optind++)
 152  155                  chacl(argv[optind], selector, uid, gid, acl);
 153  156  
↓ open down ↓ 85 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX