From 3610971d0b35d87b581c046e21b284ebe45f13ba Mon Sep 17 00:00:00 2001
From: jl777 <jameslee777@yahoo.com>
Date: Tue, 20 Feb 2018 18:49:51 +0200
Subject: [PATCH] Allow sha256(passphrase) to be used as userpass

---
 iguana/exchanges/LP_commands.c | 3 ++-
 iguana/exchanges/mm.c          | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c
index 125549074..eb4dc1456 100644
--- a/iguana/exchanges/LP_commands.c
+++ b/iguana/exchanges/LP_commands.c
@@ -199,7 +199,8 @@ jpg(srcfile, destfile, power2=7, password, data="", required, ind=0)\n\
                 authenticated = 1;
             else printf("passhash %s != G %s\n",bits256_str(str,passhash),bits256_str(str2,G.LP_passhash));
         }
-        if ( authenticated == 0 && ((userpass= jstr(argjson,"userpass")) == 0 || strcmp(userpass,G.USERPASS) != 0) )
+        char passhashstr[65]; bits256_str(passhashstr,G.LP_passhash);
+        if ( authenticated == 0 && ((userpass= jstr(argjson,"userpass")) == 0 || (strcmp(userpass,G.USERPASS) != 0 && strcmp(userpass,passhashstr) != 0)) )
             return(clonestr("{\"error\":\"authentication error you need to make sure userpass is set\"}"));
         if ( jobj(argjson,"userpass") != 0 )
             jdelete(argjson,"userpass");
diff --git a/iguana/exchanges/mm.c b/iguana/exchanges/mm.c
index a9050a0eb..167a111a4 100644
--- a/iguana/exchanges/mm.c
+++ b/iguana/exchanges/mm.c
@@ -156,7 +156,7 @@ int32_t ensure_writable(char *dirname)
 
 int main(int argc, const char * argv[])
 {
-    char dirname[512],*passphrase; double incr; cJSON *retjson;
+    char dirname[512]; double incr; cJSON *retjson;
     OS_init();
     if ( strstr(argv[0],"btc2kmd") != 0 && argv[1] != 0 )
     {