diff options
-rw-r--r-- | sesman/env.c | 17 | ||||
-rw-r--r-- | sesman/sesman.h | 2 |
2 files changed, 9 insertions, 10 deletions
diff --git a/sesman/env.c b/sesman/env.c index 227f6bbf..863ada8f 100644 --- a/sesman/env.c +++ b/sesman/env.c @@ -25,11 +25,9 @@ */ #include "list.h" - #include "sesman.h" - -#include "sys/types.h" #include "grp.h" +#include "ssl_calls.h" extern unsigned char g_fixedkey[8]; /* in sesman.c */ extern struct config_sesman *g_cfg; /* in sesman.c */ @@ -39,14 +37,18 @@ int DEFAULT_CC env_check_password_file(char *filename, char *password) { char encryptedPasswd[16]; + char key[24]; int fd; + void* des; - g_memset(encryptedPasswd, 0, 16); + g_memset(encryptedPasswd, 0, sizeof(encryptedPasswd)); g_strncpy(encryptedPasswd, password, 8); - rfbDesKey(g_fixedkey, 0); - rfbDes((unsigned char *)encryptedPasswd, (unsigned char *)encryptedPasswd); + g_memset(key, 0, sizeof(key)); + g_mirror_memcpy(key, g_fixedkey, 8); + des = ssl_des3_encrypt_info_create(key, 0); + ssl_des3_encrypt(des, 8, encryptedPasswd, encryptedPasswd); + ssl_des3_info_delete(des); fd = g_file_open(filename); - if (fd == -1) { log_message(LOG_LEVEL_WARNING, @@ -54,7 +56,6 @@ env_check_password_file(char *filename, char *password) filename); return 1; } - g_file_write(fd, encryptedPasswd, 8); g_file_close(fd); return 0; diff --git a/sesman/sesman.h b/sesman/sesman.h index 71688987..e80f85d1 100644 --- a/sesman/sesman.h +++ b/sesman/sesman.h @@ -30,7 +30,6 @@ #if defined(HAVE_CONFIG_H) #include "config_ac.h" #endif -#include "d3des.h" #include "arch.h" #include "parse.h" #include "os_calls.h" @@ -39,7 +38,6 @@ #include "env.h" #include "auth.h" #include "config.h" -//#include "tcp.h" #include "sig.h" #include "session.h" #include "access.h" |