mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-20 12:11:26 +00:00
Sync with the latest IET (r207-211):
- Fix CHAP account handling bugs - Fix bugs in multi PDU handling code git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@722 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -13,4 +13,4 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#define ISCSI_VERSION_STRING "1.0.1/0.4.17r206"
|
||||
#define ISCSI_VERSION_STRING "1.0.1/0.4.17r211"
|
||||
|
||||
@@ -179,6 +179,8 @@ int config_account_list(u32 tid, int dir, u32 *cnt, u32 *overflow,
|
||||
return -ENOENT;
|
||||
|
||||
list_for_each_entry(user, list, ulist) {
|
||||
if (user->tid != tid)
|
||||
continue;
|
||||
if (buf_sz >= ISCSI_NAME_LEN) {
|
||||
strncpy(buf, user->name, ISCSI_NAME_LEN);
|
||||
buf_sz -= ISCSI_NAME_LEN;
|
||||
@@ -255,15 +257,16 @@ int config_account_add(u32 tid, int dir, char *name, char *pass)
|
||||
|
||||
user->tid = tid;
|
||||
list = account_list_get(tid, dir);
|
||||
|
||||
if (dir == AUTH_DIR_OUTGOING && !list_empty(list)) {
|
||||
struct user *old;
|
||||
log_warning("Only one outgoing %s account is supported."
|
||||
" Replacing the old one.\n",
|
||||
tid ? "target" : "discovery");
|
||||
|
||||
old = list_entry(list->q_forw, struct user, ulist);
|
||||
account_destroy(old);
|
||||
if (dir == AUTH_DIR_OUTGOING) {
|
||||
struct user *old, *tmp;
|
||||
list_for_each_entry_safe(old, tmp, list, ulist) {
|
||||
if (tid != old->tid)
|
||||
continue;
|
||||
log_warning("Only one outgoing %s account is supported."
|
||||
" Replacing the old one.\n",
|
||||
tid ? "target" : "discovery");
|
||||
account_destroy(old);
|
||||
}
|
||||
}
|
||||
|
||||
insque(user, list);
|
||||
|
||||
@@ -569,9 +569,10 @@ static void cmnd_reject(struct connection *conn, u8 reason)
|
||||
struct iscsi_reject_hdr *rej =
|
||||
(struct iscsi_reject_hdr *)&conn->rsp.bhs;
|
||||
size_t data_sz = sizeof(struct iscsi_hdr);
|
||||
struct buf_segment *seg = conn_alloc_buf_segment(conn, data_sz);
|
||||
struct buf_segment *seg;
|
||||
|
||||
conn_free_rsp_buf_list(conn);
|
||||
seg = conn_alloc_buf_segment(conn, data_sz);
|
||||
|
||||
memset(rej, 0x0, sizeof *rej);
|
||||
rej->opcode = ISCSI_OP_REJECT_MSG;
|
||||
@@ -590,7 +591,6 @@ static void cmnd_reject(struct connection *conn, u8 reason)
|
||||
|
||||
memcpy(seg->data, &conn->req.bhs, data_sz);
|
||||
seg->len = data_sz;
|
||||
list_add_tail(&seg->entry, &conn->rsp_buf_list);
|
||||
}
|
||||
|
||||
static int cmnd_exec_auth(struct connection *conn)
|
||||
@@ -969,7 +969,7 @@ int cmnd_execute(struct connection *conn)
|
||||
if (!list_empty(&conn->rsp_buf_list)) {
|
||||
seg = list_entry(conn->rsp_buf_list.q_forw,
|
||||
struct buf_segment, entry);
|
||||
list_del(&seg->entry);
|
||||
list_del_init(&seg->entry);
|
||||
conn->rsp.datasize = seg->len;
|
||||
conn->rsp.data = seg->data;
|
||||
} else {
|
||||
@@ -993,7 +993,9 @@ void cmnd_finish(struct connection *conn)
|
||||
|
||||
if (conn->rsp.data) {
|
||||
seg = container_of(conn->rsp.data, struct buf_segment, data);
|
||||
list_del(&seg->entry);
|
||||
free(seg);
|
||||
conn->rsp.data = NULL;
|
||||
}
|
||||
|
||||
switch (conn->state) {
|
||||
|
||||
@@ -68,6 +68,11 @@ static inline int list_length_is_one(const struct __qelem *head)
|
||||
|
||||
#define list_del(elem) remque(elem)
|
||||
|
||||
#define list_del_init(elem) do { \
|
||||
remque(elem); \
|
||||
INIT_LIST_HEAD(elem); \
|
||||
} while (0)
|
||||
|
||||
#define list_add(new, head) insque (new, head)
|
||||
|
||||
#define list_add_tail(new, head) insque(new, (head)->q_back)
|
||||
|
||||
Reference in New Issue
Block a user