Page MenuHomeFreeBSD

D34762.id104550.diff
No OneTemporary

D34762.id104550.diff

Index: usr.sbin/ctld/kernel.c
===================================================================
--- usr.sbin/ctld/kernel.c
+++ usr.sbin/ctld/kernel.c
@@ -365,22 +365,42 @@
} else if (strcmp(name, "physical_port") == 0) {
if (str == NULL)
log_errx(1, "%s: %s missing its argument", __func__, name);
- cur_port->pp = strtoul(str, NULL, 0);
+ if (str) {
+ cur_port->pp = strtoul(str, NULL, 0);
+ }
+ else {
+ cur_port->pp = 0;
+ }
} else if (strcmp(name, "virtual_port") == 0) {
if (str == NULL)
log_errx(1, "%s: %s missing its argument", __func__, name);
- cur_port->vp = strtoul(str, NULL, 0);
+ if (str) {
+ cur_port->vp = strtoul(str, NULL, 0);
+ }
+ else {
+ cur_port->vp = 0;
+ }
} else if (strcmp(name, "cfiscsi_target") == 0) {
cur_port->cfiscsi_target = str;
str = NULL;
} else if (strcmp(name, "cfiscsi_state") == 0) {
if (str == NULL)
log_errx(1, "%s: %s missing its argument", __func__, name);
- cur_port->cfiscsi_state = strtoul(str, NULL, 0);
+ if (str) {
+ cur_port->cfiscsi_state = strtoul(str, NULL, 0);
+ }
+ else {
+ cur_port->cfiscsi_state = 0;
+ }
} else if (strcmp(name, "cfiscsi_portal_group_tag") == 0) {
if (str == NULL)
log_errx(1, "%s: %s missing its argument", __func__, name);
- cur_port->cfiscsi_portal_group_tag = strtoul(str, NULL, 0);
+ if (str) {
+ cur_port->cfiscsi_portal_group_tag = strtoul(str, NULL, 0);
+ }
+ else {
+ cur_port->cfiscsi_portal_group_tag = 0;
+ }
} else if (strcmp(name, "ctld_portal_group_name") == 0) {
cur_port->ctld_portal_group_name = str;
str = NULL;
@@ -697,13 +717,13 @@
req.reqdata.create.device_type = lun->l_device_type;
if (lun->l_serial != NULL) {
- strncpy(req.reqdata.create.serial_num, lun->l_serial,
+ strlcpy(req.reqdata.create.serial_num, lun->l_serial,
sizeof(req.reqdata.create.serial_num));
req.reqdata.create.flags |= CTL_LUN_FLAG_SERIAL_NUM;
}
if (lun->l_device_id != NULL) {
- strncpy(req.reqdata.create.device_id, lun->l_device_id,
+ strlcpy(req.reqdata.create.device_id, lun->l_device_id,
sizeof(req.reqdata.create.device_id));
req.reqdata.create.flags |= CTL_LUN_FLAG_DEVID;
}
@@ -785,7 +805,9 @@
bzero(&req, sizeof(req));
- strlcpy(req.backend, lun->l_backend, sizeof(req.backend));
+ if (lun->l_backend) {
+ strlcpy(req.backend, lun->l_backend, sizeof(req.backend));
+ }
req.reqtype = CTL_LUNREQ_MODIFY;
req.reqdata.modify.lun_id = lun->l_ctl_lun;

File Metadata

Mime Type
text/plain
Expires
Sun, Apr 5, 7:23 AM (18 h, 47 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30877900
Default Alt Text
D34762.id104550.diff (2 KB)

Event Timeline