From d22a2aee3c2482b1ad165110cf0447071002760e Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Thu, 27 Jan 2011 11:02:16 +1100 Subject: [PATCH] When initializing a new session, default to set the "random" ISID randomly. Dont assume that users will never create multiple contexts concurrently, in which case the previous getpid()^time(NULL) would create duplicates. --- lib/init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/init.c b/lib/init.c index d1dc6f2..df32edf 100644 --- a/lib/init.c +++ b/lib/init.c @@ -50,7 +50,7 @@ iscsi_create_context(const char *initiator_name) iscsi->fd = -1; /* initialize to a "random" isid */ - iscsi_set_isid_random(iscsi, getpid() ^ time(NULL), 0); + iscsi_set_isid_random(iscsi, random(), 0); /* assume we start in security negotiation phase */ iscsi->current_phase = ISCSI_PDU_LOGIN_CSG_SECNEG;