diff options
Diffstat (limited to 'mactelnetd.c')
-rw-r--r-- | mactelnetd.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/mactelnetd.c b/mactelnetd.c index cdb2727..b90ce2f 100644 --- a/mactelnetd.c +++ b/mactelnetd.c @@ -45,6 +45,7 @@ #include <sys/ioctl.h> #include <sys/stat.h> #include <sys/sysinfo.h> +#include <sys/mman.h> #include <pwd.h> #include <utmp.h> #include <syslog.h> @@ -385,6 +386,14 @@ static void user_login(struct mt_connection *curconn, struct mt_mactelnet_hdr *p if ((user = find_user(curconn->username)) != NULL) { md5_state_t state; +#ifdef _POSIX_MEMLOCK_RANGE + mlock(md5data, sizeof(md5data)); + mlock(md5sum, sizeof(md5sum)); + if (user->password != NULL) { + mlock(user->password, strlen(user->password)); + } +#endif + /* Concat string of 0 + password + encryptionkey */ md5data[0] = 0; strncpy(md5data + 1, user->password, 82); @@ -589,6 +598,9 @@ static void handle_data_packet(struct mt_connection *curconn, struct mt_mactelne } else if (cpkt.cptype == MT_CPTYPE_PASSWORD) { +#ifdef _POSIX_MEMLOCK_RANGE + mlock(curconn->trypassword, 17); +#endif memcpy(curconn->trypassword, cpkt.data, 17); got_pass_packet = 1; |