summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorattilamolnar <attilamolnar@hush.com>2012-05-27 23:05:12 +0200
committerattilamolnar <attilamolnar@hush.com>2012-05-27 23:05:12 +0200
commit1a339033f34d0ce6719ef4f5308b757ef43cbfd2 (patch)
tree9282e5ee3e77a3b862f4f067eff44eaf3244e2b4
parenta441c1b1be087a9974dad211aa3706e1909d6ab3 (diff)
Fix generating invalid UIDs after current_uid is 000Z99999 (next UID became 000[AAAAA)
-rw-r--r--src/server.cpp14
1 files changed, 3 insertions, 11 deletions
diff --git a/src/server.cpp b/src/server.cpp
index dab920bb6..092826361 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -101,20 +101,12 @@ void InspIRCd::IncrementUID(int pos)
* A again, in an iterative fashion.. so..
* AAA9 -> AABA, and so on. -- w00t
*/
- if (pos == 3)
+ if ((pos == 3) && (current_uid[3] == '9'))
{
// At pos 3, if we hit '9', we've run out of available UIDs, and need to reset to AAA..AAA.
- if (current_uid[pos] == '9')
+ for (int i = 3; i < UUID_LENGTH-1; i++)
{
- for (int i = 3; i < (UUID_LENGTH - 1); i++)
- {
- current_uid[i] = 'A';
- }
- }
- else
- {
- // Buf if we haven't, just keep incrementing merrily.
- current_uid[pos]++;
+ current_uid[i] = 'A';
}
}
else