zoneadm.c (fa9e4066f08beec538e775443c5be79dd423fcab) | zoneadm.c (b5abaf04a772d89637585be7f29c3d99cc69822a) |
---|---|
1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * --- 836 unchanged lines hidden (view full) --- 845 rppath); 846 err = B_TRUE; 847 } 848 849 if (statvfs(rpath, &vfsbuf) != 0) { 850 zperror(rpath, B_FALSE); 851 return (Z_ERR); 852 } | 1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * --- 836 unchanged lines hidden (view full) --- 845 rppath); 846 err = B_TRUE; 847 } 848 849 if (statvfs(rpath, &vfsbuf) != 0) { 850 zperror(rpath, B_FALSE); 851 return (Z_ERR); 852 } |
853 if (strncmp(vfsbuf.f_basetype, "nfs", 3) == 0) { 854 (void) fprintf(stderr, gettext("Zonepath %s is over NFS, " 855 "which is not currently supported.\n"), rpath); | 853 if (strcmp(vfsbuf.f_basetype, MNTTYPE_NFS) == 0) { 854 (void) fprintf(stderr, gettext("Zonepath %s is on a NFS " 855 "mounted file system.\n" 856 "\tA local file system must be used.\n"), rpath); |
856 return (Z_ERR); 857 } | 857 return (Z_ERR); 858 } |
859 if (vfsbuf.f_flag & ST_NOSUID) { 860 (void) fprintf(stderr, gettext("Zonepath %s is on a nosuid " 861 "file system.\n"), rpath); 862 return (Z_ERR); 863 } |
|
858 859 if ((res = zone_get_state(target_zone, &state)) != Z_OK) { 860 errno = res; 861 zperror2(target_zone, gettext("could not get state")); 862 return (Z_ERR); 863 } 864 /* 865 * The existence of the root path is only bad in the configured state, --- 807 unchanged lines hidden (view full) --- 1673 } 1674 /* 1675 * zoneadmd should be the one to decide whether or not to proceed, 1676 * so even though it seems that the fourth parameter below should 1677 * perhaps be B_TRUE, it really shouldn't be. 1678 */ 1679 if (sanity_check(target_zone, CMD_REBOOT, B_TRUE, B_FALSE) != Z_OK) 1680 return (Z_ERR); | 864 865 if ((res = zone_get_state(target_zone, &state)) != Z_OK) { 866 errno = res; 867 zperror2(target_zone, gettext("could not get state")); 868 return (Z_ERR); 869 } 870 /* 871 * The existence of the root path is only bad in the configured state, --- 807 unchanged lines hidden (view full) --- 1679 } 1680 /* 1681 * zoneadmd should be the one to decide whether or not to proceed, 1682 * so even though it seems that the fourth parameter below should 1683 * perhaps be B_TRUE, it really shouldn't be. 1684 */ 1685 if (sanity_check(target_zone, CMD_REBOOT, B_TRUE, B_FALSE) != Z_OK) 1686 return (Z_ERR); |
1687 if (verify_details(CMD_REBOOT) != Z_OK) 1688 return (Z_ERR); |
|
1681 1682 zarg.cmd = Z_REBOOT; 1683 return ((call_zoneadmd(target_zone, &zarg) == 0) ? Z_OK : Z_ERR); 1684} 1685 1686static int 1687verify_rctls(zone_dochandle_t handle) 1688{ --- 116 unchanged lines hidden (view full) --- 1805 zerror(gettext("WARNING: pool '%s' not found. " 1806 "using default pool"), poolname); 1807 } 1808 1809 return (Z_OK); 1810} 1811 1812static int | 1689 1690 zarg.cmd = Z_REBOOT; 1691 return ((call_zoneadmd(target_zone, &zarg) == 0) ? Z_OK : Z_ERR); 1692} 1693 1694static int 1695verify_rctls(zone_dochandle_t handle) 1696{ --- 116 unchanged lines hidden (view full) --- 1813 zerror(gettext("WARNING: pool '%s' not found. " 1814 "using default pool"), poolname); 1815 } 1816 1817 return (Z_OK); 1818} 1819 1820static int |
1821verify_ipd(zone_dochandle_t handle) 1822{ 1823 int return_code = Z_OK; 1824 struct zone_fstab fstab; 1825 struct stat st; 1826 char specdir[MAXPATHLEN]; 1827 1828 if (zonecfg_setipdent(handle) != Z_OK) { 1829 (void) fprintf(stderr, gettext("cannot verify " 1830 "inherit-pkg-dirs: unable to enumerate mounts\n")); 1831 return (Z_ERR); 1832 } 1833 while (zonecfg_getipdent(handle, &fstab) == Z_OK) { 1834 /* 1835 * Verify fs_dir exists. 1836 */ 1837 (void) snprintf(specdir, sizeof (specdir), "%s%s", 1838 zonecfg_get_root(), fstab.zone_fs_dir); 1839 if (stat(specdir, &st) != 0) { 1840 (void) fprintf(stderr, gettext("cannot verify " 1841 "inherit-pkg-dir %s: %s\n"), 1842 fstab.zone_fs_dir, strerror(errno)); 1843 return_code = Z_ERR; 1844 } 1845 if (strcmp(st.st_fstype, MNTTYPE_NFS) == 0) { 1846 (void) fprintf(stderr, gettext("cannot verify " 1847 "inherit-pkg-dir %s: NFS mounted file system.\n" 1848 "\tA local file system must be used.\n"), 1849 fstab.zone_fs_dir); 1850 return_code = Z_ERR; 1851 } 1852 } 1853 (void) zonecfg_endipdent(handle); 1854 1855 return (return_code); 1856} 1857 1858static int |
|
1813verify_filesystems(zone_dochandle_t handle) 1814{ 1815 int return_code = Z_OK; 1816 struct zone_fstab fstab; 1817 char cmdbuf[MAXPATHLEN]; 1818 struct stat st; 1819 1820 /* --- 66 unchanged lines hidden (view full) --- 1887 (stat(cmdbuf, &st) != 0 || !S_ISREG(st.st_mode))) { 1888 (void) fprintf(stderr, gettext("cannot verify fs %s: " 1889 "'raw' device specified but " 1890 "no fsck executable exists for %s\n"), 1891 fstab.zone_fs_dir, fstab.zone_fs_type); 1892 return_code = Z_ERR; 1893 goto next_fs; 1894 } | 1859verify_filesystems(zone_dochandle_t handle) 1860{ 1861 int return_code = Z_OK; 1862 struct zone_fstab fstab; 1863 char cmdbuf[MAXPATHLEN]; 1864 struct stat st; 1865 1866 /* --- 66 unchanged lines hidden (view full) --- 1933 (stat(cmdbuf, &st) != 0 || !S_ISREG(st.st_mode))) { 1934 (void) fprintf(stderr, gettext("cannot verify fs %s: " 1935 "'raw' device specified but " 1936 "no fsck executable exists for %s\n"), 1937 fstab.zone_fs_dir, fstab.zone_fs_type); 1938 return_code = Z_ERR; 1939 goto next_fs; 1940 } |
1941 /* 1942 * Verify fs_special and optionally fs_raw, exists. 1943 */ 1944 if (stat(fstab.zone_fs_special, &st) != 0) { 1945 (void) fprintf(stderr, gettext("cannot verify fs %s: " 1946 "can't access %s: %s\n"), fstab.zone_fs_dir, 1947 fstab.zone_fs_special, strerror(errno)); 1948 return_code = Z_ERR; 1949 goto next_fs; 1950 } 1951 if (strcmp(st.st_fstype, MNTTYPE_NFS) == 0) { 1952 (void) fprintf(stderr, gettext("cannot verify " 1953 "fs %s: NFS mounted file system.\n" 1954 "\tA local file system must be used.\n"), 1955 fstab.zone_fs_special); 1956 return_code = Z_ERR; 1957 goto next_fs; 1958 } 1959 if (fstab.zone_fs_raw[0] != '\0' && 1960 stat(fstab.zone_fs_raw, &st) != 0) { 1961 (void) fprintf(stderr, gettext("cannot verify fs %s: " 1962 "can't access %s: %s\n"), fstab.zone_fs_dir, 1963 fstab.zone_fs_raw, strerror(errno)); 1964 return_code = Z_ERR; 1965 goto next_fs; 1966 } |
|
1895next_fs: 1896 zonecfg_free_fs_option_list(fstab.zone_fs_options); 1897 } 1898 (void) zonecfg_endfsent(handle); 1899 1900 return (return_code); 1901} 1902 --- 209 unchanged lines hidden (view full) --- 2112 } 2113 (void) close(so); 2114 } 2115 (void) zonecfg_endnwifent(handle); 2116no_net: 2117 2118 if (verify_filesystems(handle) != Z_OK) 2119 return_code = Z_ERR; | 1967next_fs: 1968 zonecfg_free_fs_option_list(fstab.zone_fs_options); 1969 } 1970 (void) zonecfg_endfsent(handle); 1971 1972 return (return_code); 1973} 1974 --- 209 unchanged lines hidden (view full) --- 2184 } 2185 (void) close(so); 2186 } 2187 (void) zonecfg_endnwifent(handle); 2188no_net: 2189 2190 if (verify_filesystems(handle) != Z_OK) 2191 return_code = Z_ERR; |
2192 if (verify_ipd(handle) != Z_OK) 2193 return_code = Z_ERR; |
|
2120 if (!in_alt_root && verify_rctls(handle) != Z_OK) 2121 return_code = Z_ERR; 2122 if (!in_alt_root && verify_pool(handle) != Z_OK) 2123 return_code = Z_ERR; 2124 if (!in_alt_root && verify_datasets(handle) != Z_OK) 2125 return_code = Z_ERR; 2126 zonecfg_fini_handle(handle); 2127 if (return_code == Z_ERR) --- 460 unchanged lines hidden --- | 2194 if (!in_alt_root && verify_rctls(handle) != Z_OK) 2195 return_code = Z_ERR; 2196 if (!in_alt_root && verify_pool(handle) != Z_OK) 2197 return_code = Z_ERR; 2198 if (!in_alt_root && verify_datasets(handle) != Z_OK) 2199 return_code = Z_ERR; 2200 zonecfg_fini_handle(handle); 2201 if (return_code == Z_ERR) --- 460 unchanged lines hidden --- |