From: Micke Nordin Date: Wed, 20 Jan 2010 20:48:53 +0000 (+0100) Subject: Starting move to lib X-Git-Url: http://git.maemo.org/git/?p=mnenc;a=commitdiff_plain;h=42d9e6a363448d98546dbbaa1bdf91fa9a742841 Starting move to lib --- diff --git a/libmnenc/.libs/libmnenc.a b/libmnenc/.libs/libmnenc.a new file mode 100644 index 0000000..b527e89 Binary files /dev/null and b/libmnenc/.libs/libmnenc.a differ diff --git a/libmnenc/.libs/libmnenc.la b/libmnenc/.libs/libmnenc.la new file mode 120000 index 0000000..b2d5f14 --- /dev/null +++ b/libmnenc/.libs/libmnenc.la @@ -0,0 +1 @@ +../libmnenc.la \ No newline at end of file diff --git a/libmnenc/.libs/mnenc.o b/libmnenc/.libs/mnenc.o new file mode 100644 index 0000000..e9bdd2b Binary files /dev/null and b/libmnenc/.libs/mnenc.o differ diff --git a/libmnenc/libmnenc.a b/libmnenc/libmnenc.a new file mode 100644 index 0000000..ea555e4 Binary files /dev/null and b/libmnenc/libmnenc.a differ diff --git a/libmnenc/libmnenc.la b/libmnenc/libmnenc.la new file mode 100644 index 0000000..20d0435 --- /dev/null +++ b/libmnenc/libmnenc.la @@ -0,0 +1,41 @@ +# libmnenc.la - a libtool library file +# Generated by ltmain.sh (GNU libtool) 2.2.6 Debian-2.2.6a-4 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='' + +# Names of this library. +library_names='' + +# The name of the static archive. +old_library='libmnenc.a' + +# Linker flags that can not go in dependency_libs. +inherited_linker_flags='' + +# Libraries that this one depends upon. +dependency_libs='' + +# Names of additional weak libraries provided by this library +weak_library_names='' + +# Version information for libmnenc. +current= +age= +revision= + +# Is this an already installed library? +installed=no + +# Should we warn about portability when linking against -modules? +shouldnotlink=no + +# Files to dlopen/dlpreopen +dlopen='' +dlpreopen='' + +# Directory that this library needs to be installed in: +libdir='' diff --git a/libmnenc/libmnenc.so.0.0.0 b/libmnenc/libmnenc.so.0.0.0 new file mode 100755 index 0000000..26a42fd Binary files /dev/null and b/libmnenc/libmnenc.so.0.0.0 differ diff --git a/libmnenc/mnenc.lo b/libmnenc/mnenc.lo new file mode 100644 index 0000000..7a36d1e --- /dev/null +++ b/libmnenc/mnenc.lo @@ -0,0 +1,12 @@ +# mnenc.lo - a libtool object file +# Generated by ltmain.sh (GNU libtool) 2.2.6 Debian-2.2.6a-4 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object='.libs/mnenc.o' + +# Name of the non-PIC object +non_pic_object='mnenc.o' + diff --git a/libmnenc/mnenc.o b/libmnenc/mnenc.o new file mode 100644 index 0000000..5439228 Binary files /dev/null and b/libmnenc/mnenc.o differ diff --git a/mnenc.o b/mnenc.o new file mode 100644 index 0000000..0003d75 Binary files /dev/null and b/mnenc.o differ diff --git a/mnencd.cpp b/mnencd.cpp index ddc89e2..25be4b2 100644 --- a/mnencd.cpp +++ b/mnencd.cpp @@ -38,8 +38,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include -#include "mnenc.hpp" -#include "password.hpp" +#include #include "mnencd.hpp" int main(int argc, char** argv) { diff --git a/mnencd.hpp b/mnencd.hpp index ba7e6a8..1dba0e7 100644 --- a/mnencd.hpp +++ b/mnencd.hpp @@ -49,43 +49,41 @@ std::string make_filename(std::string user, std::string app) { name = getenv("USER"); return "/home/" + name + "/.mnenc/" + remove_chars(app + user); } -std::string get_password(std::string masterpasswd, std::string user, std::string app) { - mnenc menc = mnenc(); - menc.genkey(masterpasswd); - std::string key = menc.get_key(); - std::string enc, dec; - password pw = password("", "", key); - if(pw.from_file(make_filename(user, app))) { - enc = pw.get_enc(); - dec = menc.decrypt(key, enc); +std::string get_password(std::string user, std::string app) { + mnenc menc; + std::string dec; + if(menc.from_file(make_filename(user, app))) { + dec = menc.get_dec(); } else { dec = "failure"; } return dec; } -void put_password(std::string masterpasswd, std::string passwd, std::string user, std::string app) { - mnenc menc = mnenc(); - menc.genkey(masterpasswd); - std::string key = menc.get_key(); - password pw = password(menc.encrypt(key, passwd ), "", key); - pw.to_file(make_filename(user, app)); +void put_password(std::string passwd, std::string user, std::string app) { + mnenc micke; //Declare a encryptor/decryptor + micke.encrypt(passwd); //Encrypt the password Blahonga + micke.to_file(make_filename(user, app)); //Save to file + +} + +std::string open_connection(std::string str) { + return "mhejj"; } + + std::string do_something(std::string str) { //Handle requests for secure pipe pid_t proc = fork(); std::string reply = ""; if( proc == 0 ) { // child reply = open_connection( str ); - } else if( p > 0 ) { // parent - // Store p somewhere + } else if( proc > 0 ) { // parent } else { // fork failed } return reply; } -std::string open_connection(std::string str) { -} std::string do_something_else(std::string str) { //Handle requests std::vector request; //Incomming message stored here @@ -106,7 +104,7 @@ std::string do_something_else(std::string str) { //Handle requests if(masterpasswd == "") { //If master password is not yet set return "412_Precondition_Failed\n"; } else { //If we have a master password to encrypt with - put_password(masterpasswd, request[3], request[2], request[1]); + put_password(request[3], request[2], request[1]); return "201_Created\n"; } @@ -114,7 +112,7 @@ std::string do_something_else(std::string str) { //Handle requests if(masterpasswd == "") { //If master password is not yet set return "412_Precondition_Failed\n"; } else { //If we have a master password to encrypt with - std::string pw = get_password(masterpasswd, request[2], request[1]); + std::string pw = get_password(request[2], request[1]); std::string message; if(pw == "") { message = "500_Internal_Server_Error\n"; diff --git a/mnencd.o b/mnencd.o new file mode 100644 index 0000000..598a3ac Binary files /dev/null and b/mnencd.o differ diff --git a/password.o b/password.o new file mode 100644 index 0000000..9285972 Binary files /dev/null and b/password.o differ diff --git a/php.o b/php.o new file mode 100644 index 0000000..a8c6cb1 Binary files /dev/null and b/php.o differ