From: Date: April 25 2007 4:39pm Subject: bk commit into 5.1 tree (lzhou:1.2488) BUG#27207 List-Archive: http://lists.mysql.com/commits/25365 X-Bug: 27207 Message-Id: <200704251439.l3PEdbd2021322@dev3-63.dev.cn.tlan> Below is the list of changes that have just been committed into a local 5.1 repository of zhl. When zhl does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet@stripped, 2007-04-25 14:39:16+00:00, lzhou@dev3-63.(none) +1 -0 BUG#27207 Return correct error message when ndb_mgmd start with wrong config.ini parameter in TCP section storage/ndb/src/mgmsrv/ConfigInfo.cpp@stripped, 2007-04-25 14:39:10+00:00, lzhou@dev3-63.(none) +29 -4 return false when configuration is wrong in TCP section # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: lzhou # Host: dev3-63.(none) # Root: /home/zhl/mysql/mysql-5.1/bug27207 --- 1.102/storage/ndb/src/mgmsrv/ConfigInfo.cpp 2007-04-25 14:39:36 +00:00 +++ 1.103/storage/ndb/src/mgmsrv/ConfigInfo.cpp 2007-04-25 14:39:36 +00:00 @@ -2889,25 +2889,50 @@ static bool fixNodeId(InitConfigFilePars char buf[] = "NodeIdX"; buf[6] = data[sizeof("NodeI")]; char sysbuf[] = "SystemX"; sysbuf[6] = data[sizeof("NodeI")]; const char* nodeId; - require(ctx.m_currentSection->get(buf, &nodeId)); + if(!ctx.m_currentSection->get(buf, &nodeId)) + { + ctx.reportError("Mandatory parameter %s missing from section" + "[%s] starting at line: %d", + buf, ctx.fname, ctx.m_sectionLineno); + return false; + } char tmpLine[MAX_LINE_LENGTH]; strncpy(tmpLine, nodeId, MAX_LINE_LENGTH); char* token1 = strtok(tmpLine, "."); char* token2 = strtok(NULL, "."); Uint32 id; - + + if(!token1) + { + ctx.reportError("Value for mandatory parameter %s missing from section " + "[%s] starting at line: %d", + buf, ctx.fname, ctx.m_sectionLineno); + return false; + } if (token2 == NULL) { // Only a number given errno = 0; char* p; id = strtol(token1, &p, 10); - if (errno != 0) warning("STRTOK1", nodeId); + if (errno != 0 || id <= 0x0 || id > MAX_NODES) + { + ctx.reportError("Illegal value for mandatory parameter %s from section " + "[%s] starting at line: %d", + buf, ctx.fname, ctx.m_sectionLineno); + return false; + } require(ctx.m_currentSection->put(buf, id, true)); } else { // A pair given (e.g. "uppsala.32") errno = 0; char* p; id = strtol(token2, &p, 10); - if (errno != 0) warning("STRTOK2", nodeId); + if (errno != 0 || id <= 0x0 || id > MAX_NODES) + { + ctx.reportError("Illegal value for mandatory parameter %s from section " + "[%s] starting at line: %d", + buf, ctx.fname, ctx.m_sectionLineno); + return false; + } require(ctx.m_currentSection->put(buf, id, true)); require(ctx.m_currentSection->put(sysbuf, token1)); }