Starting move to lib
authorMicke Nordin <mickewiki@gmail.com>
Wed, 20 Jan 2010 20:48:53 +0000 (21:48 +0100)
committerMicke Nordin <mickewiki@gmail.com>
Wed, 20 Jan 2010 20:48:53 +0000 (21:48 +0100)
14 files changed:
libmnenc/.libs/libmnenc.a [new file with mode: 0644]
libmnenc/.libs/libmnenc.la [new symlink]
libmnenc/.libs/mnenc.o [new file with mode: 0644]
libmnenc/libmnenc.a [new file with mode: 0644]
libmnenc/libmnenc.la [new file with mode: 0644]
libmnenc/libmnenc.so.0.0.0 [new file with mode: 0755]
libmnenc/mnenc.lo [new file with mode: 0644]
libmnenc/mnenc.o [new file with mode: 0644]
mnenc.o [new file with mode: 0644]
mnencd.cpp
mnencd.hpp
mnencd.o [new file with mode: 0644]
password.o [new file with mode: 0644]
php.o [new file with mode: 0644]

diff --git a/libmnenc/.libs/libmnenc.a b/libmnenc/.libs/libmnenc.a
new file mode 100644 (file)
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 (symlink)
index 0000000..b2d5f14
--- /dev/null
@@ -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 (file)
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 (file)
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 (file)
index 0000000..20d0435
--- /dev/null
@@ -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 (executable)
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 (file)
index 0000000..7a36d1e
--- /dev/null
@@ -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 (file)
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 (file)
index 0000000..0003d75
Binary files /dev/null and b/mnenc.o differ
index ddc89e2..25be4b2 100644 (file)
@@ -38,8 +38,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include <cerrno>
 #include <fstream>
 #include <iostream>
 #include <cerrno>
 #include <fstream>
 #include <iostream>
-#include "mnenc.hpp"
-#include "password.hpp"
+#include <mnenc.hpp>
 #include "mnencd.hpp"
 
 int main(int argc, char** argv) {
 #include "mnencd.hpp"
 
 int main(int argc, char** argv) {
index ba7e6a8..1dba0e7 100644 (file)
@@ -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);
 }
        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;
 }
 
        } 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 );
 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;
 }
     } else { // fork failed
     }
     
     return reply;
 }
-std::string open_connection(std::string str) {
 
 
-}
 std::string do_something_else(std::string str) { //Handle requests
 
        std::vector<std::string> request; //Incomming message stored here
 std::string do_something_else(std::string str) { //Handle requests
 
        std::vector<std::string> 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
                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";
                }
                
                        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
                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";
                        std::string message;
                        if(pw == "") {
                                message = "500_Internal_Server_Error\n";
diff --git a/mnencd.o b/mnencd.o
new file mode 100644 (file)
index 0000000..598a3ac
Binary files /dev/null and b/mnencd.o differ
diff --git a/password.o b/password.o
new file mode 100644 (file)
index 0000000..9285972
Binary files /dev/null and b/password.o differ
diff --git a/php.o b/php.o
new file mode 100644 (file)
index 0000000..a8c6cb1
Binary files /dev/null and b/php.o differ