- if (strlen(cargv[1]) < 6) {
- chanservstdmessage(sender, QM_PWTOSHORT); /* new password to short */
- cs_log(sender,"NEWPASS FAIL username %s password to short %s (%d characters)",rup->username,cargv[1],strlen(cargv[1]));
+ if (!strcmp(cargv[0],cargv[1])) {
+ /* If they are the same then continue anyway but don't send the hook later. */
+ same=1;
+ }
+
+ pq = csa_checkpasswordquality(cargv[1]);
+ if(pq == QM_PWTOSHORT) {
+ chanservstdmessage(sender, QM_PWTOSHORT); /* new password too short */
+ cs_log(sender,"NEWPASS FAIL username %s password too short %s (%zu characters)",rup->username,cargv[1],strlen(cargv[1]));
+ return CMD_ERROR;
+ } else if(pq == QM_PWTOWEAK) {
+ chanservstdmessage(sender, QM_PWTOWEAK); /* new password is weak */
+ cs_log(sender,"NEWPASS FAIL username %s password too weak %s",rup->username,cargv[1]);
+ return CMD_ERROR;
+ } else if(pq == QM_PWTOLONG) {
+ chanservstdmessage(sender, QM_PWTOLONG); /* new password too long */
+ cs_log(sender,"NEWPASS FAIL username %s password too long %s",rup->username,cargv[1]);
+ return CMD_ERROR;
+ } else if(pq == QM_PWINVALID) {
+ chanservstdmessage(sender, QM_PWINVALID);
+ cs_log(sender,"NEWPASS FAIL username %s password invalid %s",rup->username,cargv[1]);
+ return CMD_ERROR;
+ } else if(pq == -1) {
+ /* all good */
+ } else {
+ chanservsendmessage(sender, "unknown error in newpass.c... contact #help");