From 7ba6c9f001f8093f4174659531a7be2825d28ae8 Mon Sep 17 00:00:00 2001 From: danieldg Date: Mon, 12 Oct 2009 02:50:14 +0000 Subject: Fix automatic SID generation when generated value is less than 100 git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11850 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/inspircd.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/inspircd.cpp') diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 857009744..7e9d56734 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -568,15 +568,16 @@ InspIRCd::InspIRCd(int argc, char** argv) : if (Config->sid.empty()) { // Generate one - size_t sid = 0; + int sid = 0; + char sidstr[4]; for (const char* x = Config->ServerName.c_str(); *x; ++x) sid = 5 * sid + *x; for (const char* y = Config->ServerDesc.c_str(); *y; ++y) sid = 5 * sid + *y; - sid = sid % 999; + sprintf(sidstr, "%03d", sid % 1000); - Config->sid = ConvToStr(sid); + Config->sid = sidstr; } /* set up fake client again this time with the correct uid */ -- cgit v1.2.3