summaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
authorDukePyrolator <DukePyrolator@5417fbe8-f217-4b02-8779-1006273d7864>2010-01-09 08:49:00 +0000
committerDukePyrolator <DukePyrolator@5417fbe8-f217-4b02-8779-1006273d7864>2010-01-09 08:49:00 +0000
commit5e62e8f22e94c975159e1800732cb2740c18d50b (patch)
treef3551b11b8a21f36afa8f5d8b594536e4ccc7b9c /src/tools
parenta4b015b39d0e232121e060466a979277f0f28ce2 (diff)
changed all password fields to std::string and reworked the way how the enc modules handle the passwords
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2740 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/db-convert.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/tools/db-convert.c b/src/tools/db-convert.c
index 4a82d0f82..926d263c2 100644
--- a/src/tools/db-convert.c
+++ b/src/tools/db-convert.c
@@ -353,7 +353,7 @@ int main(int argc, char *argv[])
NickCore *nc;
char **access;
Memo *memos;
- int j;
+ int j, len;
char cpass[5000]; // if it's ever this long, I will commit suicide
for (nc = nclists[i]; nc; nc = nc->next)
{
@@ -370,7 +370,18 @@ int main(int argc, char *argv[])
}
// Enc pass
- b64_encode(nc->pass, hashm == "plain" ? strlen(nc->pass) : 32, (char *)cpass, 5000);
+ if (hashm == "plain")
+ len = strlen(nc->pass);
+ else if (hashm == "md5")
+ len = 16;
+ else if (hashm == "sha1")
+ len = 20;
+ else if (hashm == "old")
+ len = 16;
+ else
+ len = 32;
+
+ b64_encode(nc->pass, len, (char *)cpass, 5000);
fs << "NC " << nc->display << " " << hashm << ":" << cpass << " ";
fs << " " << GetLanguageID(nc->language) << " " << nc->memos.memomax << " " << nc->channelcount << std::endl;