[X2serv-cvs] [CVS] Module x3: Change committed
Brought to you by:
sirvulcan
From: Alex S. <ru...@us...> - 2005-03-12 21:11:07
|
Committer : Alex Schumann <ru...@us...> CVSROOT : /cvsroot/x2serv Module : x3 Commit time: 2005-03-12 21:10:58 UTC Modified files: ChangeLog.X3 src/nickserv.c Log message: fixed registration process (uncommitted code from afternets x3 applied) ---------------------- diff included ---------------------- Index: x3/ChangeLog.X3 diff -u x3/ChangeLog.X3:1.4 x3/ChangeLog.X3:1.5 --- x3/ChangeLog.X3:1.4 Sat Mar 12 12:19:03 2005 +++ x3/ChangeLog.X3 Sat Mar 12 13:10:47 2005 @@ -3,6 +3,10 @@ 2005-03-07 Alex Schumann <ru...@af...> + * src/nickserv.c: Applied patch to bring up to date with + local uncommitted changes on afternets srvx2 tree. improved + cookie gen code and removed /play from cookie messages. + * src/all, src/Makefile*, Makefile.in: changed srvx to x3 in a bunch more places. @@ -19,5 +23,5 @@ ***********************************************************************/ -#define CVS_VERSION "$Revision: 1.4 $" +#define CVS_VERSION "$Revision: 1.5 $" Index: x3/src/nickserv.c diff -u x3/src/nickserv.c:1.18 x3/src/nickserv.c:1.19 --- x3/src/nickserv.c:1.18 Sat Mar 12 12:13:14 2005 +++ x3/src/nickserv.c Sat Mar 12 13:10:47 2005 @@ -309,7 +309,7 @@ "This email has been sent to verify that this email address belongs to the person who tried to register an account on %1$s. Your cookie is:\n" "%2$s\n" "To verify your email address and complete the account registration, visit the following URL:\n" - "http://www.afternet.org/play/index.php?option=com_registration&task=activate&username=%5$s&cookie=%2$s\n" + "http://www.afternet.org/index.php?option=com_registration&task=activate&username=%5$s&cookie=%2$s\n" "\n" "If you did NOT request this account, you do not need to do anything.\n" "Please contact the %1$s staff if you have questions, and be sure to check our website." }, @@ -323,7 +323,7 @@ { "NSEMAIL_PASSWORD_CHANGE_BODY_WEB", "This email has been sent to verify that you wish to change the password on your account %5$s. Your cookie is %2$s.\n" "To complete the password change, click the following URL:\n" - "http://www.afternet.org/play/index.php?option=com_registration&task=passcookie&username=%5$s&cookie=%2$s\n" + "http://www.afternet.org/index.php?option=com_registration&task=passcookie&username=%5$s&cookie=%2$s\n" "If you did NOT request your password to be changed, you do not need to do anything.\n" "Please contact the %1$s staff if you have questions." }, { "NSEMAIL_EMAIL_CHANGE_SUBJECT", "Email address change verification for %s" }, @@ -1036,6 +1036,27 @@ timeq_add(cookie->expires, nickserv_free_cookie, cookie); } +/* Contributed by the great sneep of afternet ;) */ +/* Since this gets used in a URL, we want to avoid stuff that confuses + * email clients such as ] and ?. a-z, 0-9 only. + */ +void genpass(char *str, int len) +{ + int i = 0; + char c = 0; + + for(i = 0; i < len; i++) + { + do + { + c = (char)((float)rand() / (float)RAND_MAX * (float)256); + } while(!((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9'))); + str[i] = c; + } + str[i] = '\0'; + return; +} + static void nickserv_make_cookie(struct userNode *user, struct handle_info *hi, enum cookie_type type, const char *cookie_data, int weblink) { @@ -1053,9 +1074,14 @@ cookie->hi = hi; cookie->type = type; cookie->data = cookie_data ? strdup(cookie_data) : NULL; + cookie->expires = now + nickserv_conf.cookie_timeout; - inttobase64(cookie->cookie, rand(), 5); - inttobase64(cookie->cookie+5, rand(), 5); + /* Adding dedicated password gen function for more control -Rubin */ + genpass(cookie->cookie, 10); + /* + *inttobase64(cookie->cookie, rand(), 5); + *inttobase64(cookie->cookie+5, rand(), 5); + */ netname = nickserv_conf.network_name; subject[0] = 0; ----------------------- End of diff ----------------------- |