summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan McDonald <danmcd@mnx.io>2022-09-21 11:37:47 -0400
committerDan McDonald <danmcd@mnx.io>2022-09-21 11:37:47 -0400
commit403156d2e0eb3784e3f0ee378b5cc9e6c4003c2d (patch)
tree69849516aa4e5667bfedcceeac60615ff67333b7
parentde07d52142cd7c4906bac33a9fafc168ae2c1c15 (diff)
parente98897e3ff64095f1d7afa3f16c8c3dcbd805e3e (diff)
downloadillumos-joyent-release-20220922.tar.gz
[illumos-gate merge]release-20220922
commit e98897e3ff64095f1d7afa3f16c8c3dcbd805e3e 14972 some diskinfo error messages run into the next line commit bf2b3a2a0b16c017abff41fdb4f8c82e2aef82fd 14961 validate_pkg crashes with bad manifest commit 663b59f48c396b41650fffe9e2f20a85e9710c85 14986 SMB Shares appear to be rename-able from Clients
-rw-r--r--usr/src/cmd/diskinfo/diskinfo.c98
-rw-r--r--usr/src/lib/smbsrv/libfksmbsrv/common/fake_vnode.c10
-rw-r--r--usr/src/tools/scripts/validate_pkg.py9
-rw-r--r--usr/src/uts/common/fs/smbsrv/smb_fsops.c8
4 files changed, 66 insertions, 59 deletions
diff --git a/usr/src/cmd/diskinfo/diskinfo.c b/usr/src/cmd/diskinfo/diskinfo.c
index f7b352c0e6..2246d9f8b7 100644
--- a/usr/src/cmd/diskinfo/diskinfo.c
+++ b/usr/src/cmd/diskinfo/diskinfo.c
@@ -12,6 +12,7 @@
/*
* Copyright (c) 2018 Joyent Inc., All rights reserved.
* Copyright 2021 RackTop Systems, Inc.
+ * Copyright 2022 Oxide Computer Company
*/
#include <sys/types.h>
@@ -26,6 +27,7 @@
#include <ctype.h>
#include <stdarg.h>
#include <strings.h>
+#include <err.h>
#include <libdiskmgt.h>
#include <sys/nvpair.h>
@@ -55,18 +57,6 @@ typedef struct di_phys {
int dp_locate;
} di_phys_t;
-static void __NORETURN
-fatal(int rv, const char *fmt, ...)
-{
- va_list ap;
-
- va_start(ap, fmt);
- (void) vfprintf(stderr, fmt, ap);
- va_end(ap);
-
- exit(rv);
-}
-
static void
usage(const char *execname)
{
@@ -115,7 +105,7 @@ disk_walker(topo_hdl_t *hp, tnode_t *np, void *arg)
tnode_t *ppnp;
topo_faclist_t fl;
topo_faclist_t *lp;
- int err;
+ int e;
topo_led_state_t mode;
topo_led_type_t type;
char *name, *slotname, *serial;
@@ -124,7 +114,7 @@ disk_walker(topo_hdl_t *hp, tnode_t *np, void *arg)
return (TOPO_WALK_NEXT);
if (topo_prop_get_string(np, TOPO_PGROUP_STORAGE,
- TOPO_STORAGE_LOGICAL_DISK_NAME, &name, &err) != 0) {
+ TOPO_STORAGE_LOGICAL_DISK_NAME, &name, &e) != 0) {
return (TOPO_WALK_NEXT);
}
@@ -132,7 +122,7 @@ disk_walker(topo_hdl_t *hp, tnode_t *np, void *arg)
return (TOPO_WALK_NEXT);
if (topo_prop_get_string(np, TOPO_PGROUP_STORAGE,
- TOPO_STORAGE_SERIAL_NUM, &serial, &err) == 0) {
+ TOPO_STORAGE_SERIAL_NUM, &serial, &e) == 0) {
pp->dp_serial = serial;
}
@@ -141,21 +131,21 @@ disk_walker(topo_hdl_t *hp, tnode_t *np, void *arg)
pp->dp_chassis = topo_node_instance(ppnp);
if (strcmp(topo_node_name(pnp), BAY) == 0) {
if (topo_node_facility(hp, pnp, TOPO_FAC_TYPE_INDICATOR,
- TOPO_FAC_TYPE_ANY, &fl, &err) == 0) {
+ TOPO_FAC_TYPE_ANY, &fl, &e) == 0) {
for (lp = topo_list_next(&fl.tf_list); lp != NULL;
lp = topo_list_next(lp)) {
uint32_t prop;
if (topo_prop_get_uint32(lp->tf_node,
TOPO_PGROUP_FACILITY, TOPO_FACILITY_TYPE,
- &prop, &err) != 0) {
+ &prop, &e) != 0) {
continue;
}
type = (topo_led_type_t)prop;
if (topo_prop_get_uint32(lp->tf_node,
TOPO_PGROUP_FACILITY, TOPO_LED_MODE,
- &prop, &err) != 0) {
+ &prop, &e) != 0) {
continue;
}
mode = (topo_led_state_t)prop;
@@ -174,14 +164,14 @@ disk_walker(topo_hdl_t *hp, tnode_t *np, void *arg)
}
if (topo_prop_get_string(pnp, TOPO_PGROUP_PROTOCOL,
- TOPO_PROP_LABEL, &slotname, &err) == 0) {
+ TOPO_PROP_LABEL, &slotname, &e) == 0) {
pp->dp_slotname = slotname;
}
pp->dp_slot = topo_node_instance(pnp);
} else if (strcmp(topo_node_name(pnp), USB_DEVICE) == 0) {
if (topo_prop_get_string(pnp, TOPO_PGROUP_PROTOCOL,
- TOPO_PROP_LABEL, &slotname, &err) == 0) {
+ TOPO_PROP_LABEL, &slotname, &e) == 0) {
pp->dp_slotname = slotname;
}
@@ -199,24 +189,24 @@ disk_walker(topo_hdl_t *hp, tnode_t *np, void *arg)
static void
populate_physical(topo_hdl_t *hp, di_phys_t *pp)
{
- int err;
+ int e;
topo_walk_t *wp;
pp->dp_faulty = pp->dp_locate = -1;
pp->dp_chassis = pp->dp_slot = -1;
- err = 0;
- wp = topo_walk_init(hp, FM_FMRI_SCHEME_HC, disk_walker, pp, &err);
+ e = 0;
+ wp = topo_walk_init(hp, FM_FMRI_SCHEME_HC, disk_walker, pp, &e);
if (wp == NULL) {
- fatal(-1, "unable to initialise topo walker: %s",
- topo_strerror(err));
+ errx(-1, "unable to initialise topo walker: %s",
+ topo_strerror(e));
}
- while ((err = topo_walk_step(wp, TOPO_WALK_CHILD)) == TOPO_WALK_NEXT)
+ while ((e = topo_walk_step(wp, TOPO_WALK_CHILD)) == TOPO_WALK_NEXT)
;
- if (err == TOPO_WALK_ERR)
- fatal(-1, "topo walk failed");
+ if (e == TOPO_WALK_ERR)
+ errx(-1, "topo walk failed");
topo_walk_fini(wp);
}
@@ -226,7 +216,7 @@ enumerate_disks(di_opts_t *opts)
{
topo_hdl_t *hp;
dm_descriptor_t *media;
- int err, i;
+ int e, i;
int filter[] = { DM_DT_FIXED, -1 };
dm_descriptor_t *disk, *controller;
nvlist_t *mattrs, *dattrs, *cattrs = NULL;
@@ -245,29 +235,27 @@ enumerate_disks(di_opts_t *opts)
di_phys_t phys;
size_t len;
- err = 0;
- if ((media = dm_get_descriptors(DM_MEDIA, filter, &err)) == NULL) {
- fatal(-1, "failed to obtain media descriptors: %s\n",
- strerror(err));
+ e = 0;
+ if ((media = dm_get_descriptors(DM_MEDIA, filter, &e)) == NULL) {
+ errno = e;
+ err(-1, "failed to obtain media descriptors");
}
- err = 0;
- hp = topo_open(TOPO_VERSION, NULL, &err);
+ e = 0;
+ hp = topo_open(TOPO_VERSION, NULL, &e);
if (hp == NULL) {
- fatal(-1, "unable to obtain topo handle: %s",
- topo_strerror(err));
+ errx(-1, "unable to obtain topo handle: %s", topo_strerror(e));
}
- err = 0;
- (void) topo_snap_hold(hp, NULL, &err);
- if (err != 0) {
- fatal(-1, "unable to hold topo snapshot: %s",
- topo_strerror(err));
+ e = 0;
+ (void) topo_snap_hold(hp, NULL, &e);
+ if (e != 0) {
+ errx(-1, "unable to hold topo snapshot: %s", topo_strerror(e));
}
for (i = 0; media != NULL && media[i] != 0; i++) {
if ((disk = dm_get_associated_descriptors(media[i],
- DM_DRIVE, &err)) == NULL) {
+ DM_DRIVE, &e)) == NULL) {
continue;
}
@@ -276,17 +264,17 @@ enumerate_disks(di_opts_t *opts)
* info with DKIOCGMEDIAINFO which may not be the case for
* disks which are failing.
*/
- if ((mattrs = dm_get_attributes(media[i], &err)) == NULL) {
+ if ((mattrs = dm_get_attributes(media[i], &e)) == NULL) {
continue;
}
- err = nvlist_lookup_uint64(mattrs, DM_SIZE, &size);
- assert(err == 0);
- err = nvlist_lookup_uint32(mattrs, DM_BLOCKSIZE, &blocksize);
- assert(err == 0);
+ e = nvlist_lookup_uint64(mattrs, DM_SIZE, &size);
+ assert(e == 0);
+ e = nvlist_lookup_uint32(mattrs, DM_BLOCKSIZE, &blocksize);
+ assert(e == 0);
nvlist_free(mattrs);
- dattrs = dm_get_attributes(disk[0], &err);
+ dattrs = dm_get_attributes(disk[0], &e);
nvlist_query_string(dattrs, DM_VENDOR_ID, &vid);
nvlist_query_string(dattrs, DM_PRODUCT_ID, &pid);
@@ -301,8 +289,8 @@ enumerate_disks(di_opts_t *opts)
ssd = B_TRUE;
if ((controller = dm_get_associated_descriptors(disk[0],
- DM_CONTROLLER, &err)) != NULL) {
- cattrs = dm_get_attributes(controller[0], &err);
+ DM_CONTROLLER, &e)) != NULL) {
+ cattrs = dm_get_attributes(controller[0], &e);
nvlist_query_string(cattrs, DM_CTYPE, &ctype);
ctype = strdup(ctype);
for (c = ctype; *c != '\0'; c++)
@@ -438,7 +426,7 @@ main(int argc, char *argv[])
case 'c':
if (opts.di_physical) {
usage(argv[0]);
- fatal(1, "-c and -P are mutually exclusive\n");
+ errx(1, "-c and -P are mutually exclusive");
}
opts.di_condensed = B_TRUE;
break;
@@ -448,7 +436,7 @@ main(int argc, char *argv[])
case 'P':
if (opts.di_condensed) {
usage(argv[0]);
- fatal(1, "-c and -P are mutually exclusive\n");
+ errx(1, "-c and -P are mutually exclusive");
}
opts.di_physical = B_TRUE;
break;
@@ -457,9 +445,9 @@ main(int argc, char *argv[])
break;
case '?':
usage(argv[0]);
- fatal(1, "unknown option -%c\n", optopt);
+ errx(1, "unknown option -%c", optopt);
default:
- fatal(-1, "unexpected error on option -%c\n", optopt);
+ errx(-1, "unexpected error on option -%c", optopt);
}
}
diff --git a/usr/src/lib/smbsrv/libfksmbsrv/common/fake_vnode.c b/usr/src/lib/smbsrv/libfksmbsrv/common/fake_vnode.c
index 533a40fb28..ef04758481 100644
--- a/usr/src/lib/smbsrv/libfksmbsrv/common/fake_vnode.c
+++ b/usr/src/lib/smbsrv/libfksmbsrv/common/fake_vnode.c
@@ -11,6 +11,7 @@
/*
* Copyright 2013 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2019 RackTop Systems.
*/
#include <sys/types.h>
@@ -49,9 +50,14 @@ vn_compare(vnode_t *vp1, vnode_t *vp2)
return (VN_CMP(vp1, vp2));
}
-/* ARGSUSED */
+int
+vn_ismntpt(vnode_t *vp __unused)
+{
+ return (0);
+}
+
vfs_t *
-vn_mountedvfs(vnode_t *vp)
+vn_mountedvfs(vnode_t *vp __unused)
{
return (NULL);
}
diff --git a/usr/src/tools/scripts/validate_pkg.py b/usr/src/tools/scripts/validate_pkg.py
index 18a2c0cc77..058a8f6542 100644
--- a/usr/src/tools/scripts/validate_pkg.py
+++ b/usr/src/tools/scripts/validate_pkg.py
@@ -25,7 +25,7 @@
# Use is subject to license terms.
#
-# Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
+# Copyright 2022 OmniOS Community Edition (OmniOSce) Association.
#
# Compare the content generated by a build to a set of manifests
@@ -34,6 +34,8 @@
import getopt
+import gettext
+import locale
import os
import stat
import sys
@@ -41,7 +43,6 @@ import sys
from pkg import actions
from pkg import manifest
-
#
# Dictionary used to map action names to output format. Each entry is
# indexed by action name, and consists of a list of tuples that map
@@ -889,6 +890,10 @@ def main(argv):
trees[0].compare(trees[1])
if __name__ == '__main__':
+ locale.setlocale(locale.LC_ALL, "")
+ gettext.install("pkg", "/usr/share/locale",
+ codeset=locale.getpreferredencoding())
+
try:
main(sys.argv[1:])
except KeyboardInterrupt:
diff --git a/usr/src/uts/common/fs/smbsrv/smb_fsops.c b/usr/src/uts/common/fs/smbsrv/smb_fsops.c
index 4d6ffa5754..b5ada1db91 100644
--- a/usr/src/uts/common/fs/smbsrv/smb_fsops.c
+++ b/usr/src/uts/common/fs/smbsrv/smb_fsops.c
@@ -1194,6 +1194,14 @@ smb_fsop_rename(
if (rc != 0)
return (rc);
+ /*
+ * Make sure "from" vp is not a mount point.
+ */
+ if (from_vp->v_type == VDIR && vn_ismntpt(from_vp)) {
+ VN_RELE(from_vp);
+ return (EACCES);
+ }
+
if (from_attr.sa_dosattr & FILE_ATTRIBUTE_REPARSE_POINT) {
VN_RELE(from_vp);
return (EACCES);