summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDennis Friis <peavey@inspircd.org>2009-05-25 00:09:44 +0200
committerDennis Friis <peavey@inspircd.org>2009-05-25 05:34:53 +0200
commit8e171b1546aee046967fd01752432481c1e2dc2f (patch)
tree45cc1631a041636499e7c24be1450402335ab573 /src
parent0298e319dc3c3715cc42029609e2ab3abd122560 (diff)
downloadtmwa-8e171b1546aee046967fd01752432481c1e2dc2f.tar.gz
tmwa-8e171b1546aee046967fd01752432481c1e2dc2f.tar.bz2
tmwa-8e171b1546aee046967fd01752432481c1e2dc2f.tar.xz
tmwa-8e171b1546aee046967fd01752432481c1e2dc2f.zip
Add inter protocol code for changing account password charserv->loginserv.
Diffstat (limited to 'src')
-rw-r--r--src/login/login.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/login/login.c b/src/login/login.c
index e4eb24b..29e3959 100644
--- a/src/login/login.c
+++ b/src/login/login.c
@@ -1671,6 +1671,54 @@ int parse_fromchar(int fd) {
}
return 0;
+ // request from char-server to change account password
+ case 0x2740: // 0x2740 <account_id>.L <actual_password>.24B <new_password>.24B
+ if (RFIFOREST(fd) < 54)
+ return 0;
+ {
+ int acc;
+ char actual_pass[24], new_pass[24];
+ acc = RFIFOL(fd,2);
+ memcpy(actual_pass, RFIFOP(fd,6), 24);
+ actual_pass[23] = '\0';
+ remove_control_chars(actual_pass);
+ memcpy(new_pass, RFIFOP(fd,30), 24);
+ new_pass[23] = '\0';
+ remove_control_chars(new_pass);
+
+ int status = 0;
+
+ for(i = 0; i < auth_num; i++) {
+ if (auth_dat[i].account_id == acc) {
+ if (strcmpi(auth_dat[i].pass, actual_pass) == 0) {
+ if (strlen(new_pass) < 4)
+ status = 3;
+ else {
+ status = 1;
+ memcpy(auth_dat[i].pass, new_pass, 24);
+ login_log("Char-server '%s': Change pass success (account: %d (%s), ip: %s." RETCODE,
+ server[id].name, acc, auth_dat[i].userid, ip);
+ // Save
+ mmo_auth_sync();
+ }
+ } else {
+ status = 2;
+ login_log("Char-server '%s': Attempt to modify a pass failed, wrong password. (account: %d (%s), ip: %s)." RETCODE,
+ server[id].name, acc, auth_dat[i].userid, ip);
+ }
+ break;
+ }
+ }
+ unsigned char buf[16];
+ WBUFW(buf,0) = 0x2741;
+ WBUFL(buf,2) = acc;
+ WBUFB(buf,6) = status; // 0: acc not found, 1: success, 2: password mismatch, 3: pass too short
+ charif_sendallwos(-1, buf, 7);
+ }
+
+ RFIFOSKIP(fd, 54);
+ break;
+
default:
{
FILE *logfp;