Print this page
Reduce lint

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/zoneadmd/zoneadmd.c
          +++ new/usr/src/cmd/zoneadmd/zoneadmd.c
↓ open down ↓ 840 lines elided ↑ open up ↑
 841  841          return (brand_restartinit(bh));
 842  842  }
 843  843  #endif /* XXX KEBE */
 844  844  
 845  845  /*
 846  846   * Get the app-svc-dependent flag for this zone's init process. This is a
 847  847   * zone-specific attr which controls the type of contract we create for the
 848  848   * zone's init. When true, the contract will include CT_PR_EV_EXIT in the fatal
 849  849   * set, so that when any service which is in the same contract exits, the init
 850  850   * application will be terminated.
      851 + *
      852 + * We use the global "snap_hndl", so no parameters get passed here.
 851  853   */
 852  854  static boolean_t
 853      -is_app_svc_dep(brand_handle_t bh)
      855 +is_app_svc_dep(void)
 854  856  {
 855  857          struct zone_attrtab a;
 856  858  
 857  859          bzero(&a, sizeof (a));
 858  860          (void) strlcpy(a.zone_attr_name, "app-svc-dependent",
 859  861              sizeof (a.zone_attr_name));
 860  862  
 861  863          if (zonecfg_lookup_attr(snap_hndl, &a) == Z_OK &&
 862  864              strcmp(a.zone_attr_value, "true") == 0) {
 863  865                  return (B_TRUE);
↓ open down ↓ 69 lines elided ↑ open up ↑
 933  935                  goto bad;
 934  936          }
 935  937  
 936  938          /* See if this zone's brand should restart init if it dies. */
 937  939          restart_init = brand_restartinit(bh);
 938  940  
 939  941          /*
 940  942           * See if we need to setup contract dependencies between the zone's
 941  943           * primary application and any of its services.
 942  944           */
 943      -        app_svc_dep = is_app_svc_dep(bh);
      945 +        app_svc_dep = is_app_svc_dep();
 944  946  
 945  947          brand_close(bh);
 946  948  
 947  949          err = filter_bootargs(zlogp, bootargs, nbootargs, init_file);
 948  950          if (err != Z_OK)
 949  951                  goto bad;
 950  952  
 951  953          assert(init_file[0] != '\0');
 952  954  
 953  955          /*
↓ open down ↓ 5 lines elided ↑ open up ↑
 959  961                  goto bad;
 960  962          }
 961  963  
 962  964          (void) snprintf(initpath, sizeof (initpath), "%s%s", rpath, init_file);
 963  965  
 964  966          if (lstat(initpath, &st) == -1) {
 965  967                  zerror(zlogp, B_TRUE, "could not stat %s", initpath);
 966  968                  goto bad;
 967  969          }
 968  970  
 969      -        if ((st.st_mode & S_IFMT) == S_IFLNK) {
 970      -                /* symlink, we'll have to wait and resolve when we boot */
 971      -        } else if ((st.st_mode & S_IXUSR) == 0) {
      971 +        /*
      972 +         * If a symlink, we'll have to wait and resolve when we boot,
      973 +         * otherwise check the executable bits now.
      974 +         */
      975 +        if ((st.st_mode & S_IFMT) != S_IFLNK && (st.st_mode & S_IXUSR) == 0) {
 972  976                  zerror(zlogp, B_FALSE, "%s is not executable", initpath);
 973  977                  goto bad;
 974  978          }
 975  979  
 976  980          /*
 977  981           * Exclusive stack zones interact with the dlmgmtd running in the
 978  982           * global zone.  dladm_zone_boot() tells dlmgmtd that this zone is
 979  983           * booting, and loads its datalinks from the zone's datalink
 980  984           * configuration file.
 981  985           */
↓ open down ↓ 307 lines elided ↑ open up ↑
1289 1293  /* ARGSUSED */
1290 1294  static void
1291 1295  server(void *cookie, char *args, size_t alen, door_desc_t *dp,
1292 1296      uint_t n_desc)
1293 1297  {
1294 1298          ucred_t *uc = NULL;
1295 1299          const priv_set_t *eset;
1296 1300  
1297 1301          zone_state_t zstate;
1298 1302          zone_cmd_t cmd;
1299      -        boolean_t debug;
1300 1303          int init_status;
1301 1304          zone_cmd_arg_t *zargp;
1302 1305  
1303 1306          boolean_t kernelcall;
1304 1307  
1305 1308          int rval = -1;
1306 1309          uint64_t uniqid;
1307 1310          zoneid_t zoneid = -1;
1308 1311          zlog_t zlog;
1309 1312          zlog_t *zlogp;
↓ open down ↓ 33 lines elided ↑ open up ↑
1343 1346          if (alen != sizeof (zone_cmd_arg_t)) {
1344 1347                  /*
1345 1348                   * This really shouldn't be happening.
1346 1349                   */
1347 1350                  zerror(&logsys, B_FALSE, "argument size (%d bytes) "
1348 1351                      "unexpected (expected %d bytes)", alen,
1349 1352                      sizeof (zone_cmd_arg_t));
1350 1353                  goto out;
1351 1354          }
1352 1355          cmd = zargp->cmd;
1353      -        debug = zargp->debug;
1354 1356          init_status = zargp->status;
1355 1357  
1356 1358          if (door_ucred(&uc) != 0) {
1357 1359                  zerror(&logsys, B_TRUE, "door_ucred");
1358 1360                  goto out;
1359 1361          }
1360 1362          eset = ucred_getprivset(uc, PRIV_EFFECTIVE);
1361 1363          if (ucred_getzoneid(uc) != GLOBAL_ZONEID ||
1362 1364              (eset != NULL ? !priv_ismember(eset, PRIV_SYS_CONFIG) :
1363 1365              ucred_geteuid(uc) != 0)) {
↓ open down ↓ 1078 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX