diff options
-rw-r--r-- | server/proxy_ui_server.workspace | 12 | ||||
-rw-r--r-- | server/server/config.cpp | 15 | ||||
-rw-r--r-- | server/server/headers.h | 1 |
3 files changed, 15 insertions, 13 deletions
diff --git a/server/proxy_ui_server.workspace b/server/proxy_ui_server.workspace index fef20c5..6c4621d 100644 --- a/server/proxy_ui_server.workspace +++ b/server/proxy_ui_server.workspace @@ -10,16 +10,6 @@ </WorkspaceConfiguration> </BuildMatrix> <Environment> - <![CDATA[ - - - - - - - - - - ]]> + <![CDATA[]]> </Environment> </CodeLite_Workspace> diff --git a/server/server/config.cpp b/server/server/config.cpp index 60b7946..5fcdfc4 100644 --- a/server/server/config.cpp +++ b/server/server/config.cpp @@ -83,14 +83,25 @@ void config::load_upload_list(char *pth) p1 = p2+l; std::string::size_type lp1 = 0, lp2 = 0; std::string source, destination, hash; - byte *hash_buf = NULL; lp1++; lp2 = line.find('"', lp1); source = line.substr(lp1, lp2-lp1); lp1 = lp2+3; lp2 = line.find('"', lp1); destination = line.substr(lp1, lp2-lp1); - //TODO calc hash + std::ifstream file; + MD5_CTX c = {0}; + MD5_Init(&c); + file.open(source.c_str()); + if(file.is_open()) + { + char hash_buf[1024]; + while(!file.eof()) + MD5_Update(&c, hash_buf, file.readsome(hash_buf, 1024)); + unsigned char result[MD5_DIGEST_LENGTH]; + MD5_Final(result, &c); + hash = (char*)result; + } upload_list.push_back(upload_entry(source, destination, hash)); p2 = cfg_str.find(';', p1); } diff --git a/server/server/headers.h b/server/server/headers.h index 3d12023..5fe3726 100644 --- a/server/server/headers.h +++ b/server/server/headers.h @@ -20,6 +20,7 @@ #include <boost/thread/thread.hpp> #include <boost/date_time.hpp> #include <boost/filesystem.hpp> +#include <openssl/md5.h> #include "utilities.h" #include "main.h" |