5712 * in addition to the general call from parse_and_run(), which doesn't need
5713 * things saved. Since the parameters are standardized, we distinguish by
5714 * having commit_func() call here with cmd->cmd_arg set to "save" to indicate
5715 * that a save is needed.
5716 */
5717 void
5718 verify_func(cmd_t *cmd)
5719 {
5720 struct zone_nwiftab nwiftab;
5721 struct zone_fstab fstab;
5722 struct zone_attrtab attrtab;
5723 struct zone_rctltab rctltab;
5724 struct zone_dstab dstab;
5725 struct zone_psettab psettab;
5726 struct zone_admintab admintab;
5727 char zonepath[MAXPATHLEN];
5728 char sched[MAXNAMELEN];
5729 char brand[MAXNAMELEN];
5730 char hostidp[HW_HOSTID_LEN];
5731 char fsallowedp[ZONE_FS_ALLOWED_MAX];
5732 int err, ret_val = Z_OK, arg;
5733 int pset_res;
5734 boolean_t save = B_FALSE;
5735 boolean_t arg_err = B_FALSE;
5736 zone_iptype_t iptype;
5737 boolean_t has_cpu_shares = B_FALSE;
5738 boolean_t has_cpu_cap = B_FALSE;
5739 struct xif *tmp;
5740
5741 optind = 0;
5742 while ((arg = getopt(cmd->cmd_argc, cmd->cmd_argv, "?")) != EOF) {
5743 switch (arg) {
5744 case '?':
5745 longer_usage(CMD_VERIFY);
5746 arg_err = B_TRUE;
5747 break;
5748 default:
5749 short_usage(CMD_VERIFY);
5750 arg_err = B_TRUE;
5751 break;
5779 zerr(gettext("%s cannot be empty."), pt_to_str(PT_ZONEPATH));
5780 ret_val = Z_REQD_RESOURCE_MISSING;
5781 saw_error = B_TRUE;
5782 }
5783
5784 if ((err = zonecfg_get_brand(handle, brand, sizeof (brand))) != Z_OK) {
5785 zone_perror(zone, err, B_TRUE);
5786 return;
5787 }
5788 if ((err = brand_verify(handle)) != Z_OK) {
5789 zone_perror(zone, err, B_TRUE);
5790 return;
5791 }
5792
5793 if (zonecfg_get_iptype(handle, &iptype) != Z_OK) {
5794 zerr("%s %s", gettext("cannot get"), pt_to_str(PT_IPTYPE));
5795 ret_val = Z_REQD_RESOURCE_MISSING;
5796 saw_error = B_TRUE;
5797 }
5798
5799 if (zonecfg_get_hostid(handle, hostidp,
5800 sizeof (hostidp)) == Z_INVALID_PROPERTY) {
5801 zerr(gettext("%s: invalid hostid: %s"),
5802 zone, hostidp);
5803 return;
5804 }
5805
5806 if (zonecfg_get_fs_allowed(handle, fsallowedp,
5807 sizeof (fsallowedp)) == Z_INVALID_PROPERTY) {
5808 zerr(gettext("%s: invalid fs-allowed: %s"),
5809 zone, fsallowedp);
5810 return;
5811 }
5812
5813 if ((err = zonecfg_setfsent(handle)) != Z_OK) {
5814 zone_perror(zone, err, B_TRUE);
5815 return;
5816 }
5817 while (zonecfg_getfsent(handle, &fstab) == Z_OK) {
5818 check_reqd_prop(fstab.zone_fs_dir, RT_FS, PT_DIR, &ret_val);
|
5712 * in addition to the general call from parse_and_run(), which doesn't need
5713 * things saved. Since the parameters are standardized, we distinguish by
5714 * having commit_func() call here with cmd->cmd_arg set to "save" to indicate
5715 * that a save is needed.
5716 */
5717 void
5718 verify_func(cmd_t *cmd)
5719 {
5720 struct zone_nwiftab nwiftab;
5721 struct zone_fstab fstab;
5722 struct zone_attrtab attrtab;
5723 struct zone_rctltab rctltab;
5724 struct zone_dstab dstab;
5725 struct zone_psettab psettab;
5726 struct zone_admintab admintab;
5727 char zonepath[MAXPATHLEN];
5728 char sched[MAXNAMELEN];
5729 char brand[MAXNAMELEN];
5730 char hostidp[HW_HOSTID_LEN];
5731 char fsallowedp[ZONE_FS_ALLOWED_MAX];
5732 priv_set_t *privs;
5733 char *privname = NULL;
5734 int err, ret_val = Z_OK, arg;
5735 int pset_res;
5736 boolean_t save = B_FALSE;
5737 boolean_t arg_err = B_FALSE;
5738 zone_iptype_t iptype;
5739 boolean_t has_cpu_shares = B_FALSE;
5740 boolean_t has_cpu_cap = B_FALSE;
5741 struct xif *tmp;
5742
5743 optind = 0;
5744 while ((arg = getopt(cmd->cmd_argc, cmd->cmd_argv, "?")) != EOF) {
5745 switch (arg) {
5746 case '?':
5747 longer_usage(CMD_VERIFY);
5748 arg_err = B_TRUE;
5749 break;
5750 default:
5751 short_usage(CMD_VERIFY);
5752 arg_err = B_TRUE;
5753 break;
5781 zerr(gettext("%s cannot be empty."), pt_to_str(PT_ZONEPATH));
5782 ret_val = Z_REQD_RESOURCE_MISSING;
5783 saw_error = B_TRUE;
5784 }
5785
5786 if ((err = zonecfg_get_brand(handle, brand, sizeof (brand))) != Z_OK) {
5787 zone_perror(zone, err, B_TRUE);
5788 return;
5789 }
5790 if ((err = brand_verify(handle)) != Z_OK) {
5791 zone_perror(zone, err, B_TRUE);
5792 return;
5793 }
5794
5795 if (zonecfg_get_iptype(handle, &iptype) != Z_OK) {
5796 zerr("%s %s", gettext("cannot get"), pt_to_str(PT_IPTYPE));
5797 ret_val = Z_REQD_RESOURCE_MISSING;
5798 saw_error = B_TRUE;
5799 }
5800
5801 if ((privs = priv_allocset()) == NULL) {
5802 zerr(gettext("%s: priv_allocset failed"), zone);
5803 return;
5804 }
5805 if (zonecfg_get_privset(handle, privs, &privname) != Z_OK) {
5806 zerr(gettext("%s: invalid privilege: %s"), zone, privname);
5807 priv_freeset(privs);
5808 free(privname);
5809 return;
5810 }
5811 priv_freeset(privs);
5812
5813 if (zonecfg_get_hostid(handle, hostidp,
5814 sizeof (hostidp)) == Z_INVALID_PROPERTY) {
5815 zerr(gettext("%s: invalid hostid: %s"),
5816 zone, hostidp);
5817 return;
5818 }
5819
5820 if (zonecfg_get_fs_allowed(handle, fsallowedp,
5821 sizeof (fsallowedp)) == Z_INVALID_PROPERTY) {
5822 zerr(gettext("%s: invalid fs-allowed: %s"),
5823 zone, fsallowedp);
5824 return;
5825 }
5826
5827 if ((err = zonecfg_setfsent(handle)) != Z_OK) {
5828 zone_perror(zone, err, B_TRUE);
5829 return;
5830 }
5831 while (zonecfg_getfsent(handle, &fstab) == Z_OK) {
5832 check_reqd_prop(fstab.zone_fs_dir, RT_FS, PT_DIR, &ret_val);
|