summaryrefslogtreecommitdiff
path: root/src/cracklib.cpp
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2015-07-31 15:30:32 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2015-07-31 15:30:32 +0200
commit9f624560ffb625d7766480c4621169025df32c33 (patch)
treee7ee8a6b90eabf375052ac79829544354fdc3006 /src/cracklib.cpp
parent54a304276fb361f95332c5c1f8c6f67026b1d96c (diff)
downloadaCms-9f624560ffb625d7766480c4621169025df32c33.tar.gz
aCms-9f624560ffb625d7766480c4621169025df32c33.tar.bz2
checking password with cracklib now
added printName (the visible name of the user in registration and login)
Diffstat (limited to 'src/cracklib.cpp')
-rw-r--r--src/cracklib.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/cracklib.cpp b/src/cracklib.cpp
new file mode 100644
index 0000000..022aff0
--- /dev/null
+++ b/src/cracklib.cpp
@@ -0,0 +1,22 @@
+#include "cracklib.hpp"
+
+#include <cstdlib>
+
+#include "crack.h"
+
+PasswordCheck checkPassword( const std::string login, const std::string name, const std::string password )
+{
+ PasswordCheck c;
+ const char *m;
+
+ m = FascistCheckUser( password.c_str( ), NULL, login.c_str( ), name.c_str( ) );
+ if( m == NULL ) {
+ c.ok = true;
+ c.msg = "Password ok";
+ } else {
+ c.ok = false;
+ c.msg = std::string( m );
+ }
+
+ return c;
+}