summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/c/urweb.c13
-rw-r--r--src/compiler.sml2
-rw-r--r--tests/crypt.ur7
-rw-r--r--tests/crypt.urs1
4 files changed, 12 insertions, 11 deletions
diff --git a/src/c/urweb.c b/src/c/urweb.c
index 38733cc4..9f5c009a 100644
--- a/src/c/urweb.c
+++ b/src/c/urweb.c
@@ -13,7 +13,7 @@
#include <stdint.h>
#include <sys/types.h>
#include <sys/socket.h>
-#include <crypt.h>
+#include <openssl/des.h>
#include <time.h>
#include <pthread.h>
@@ -3697,15 +3697,8 @@ failure_kind uw_runCallback(uw_context ctx, void (*callback)(uw_context)) {
}
uw_Basis_string uw_Basis_crypt(uw_context ctx, uw_Basis_string key, uw_Basis_string salt) {
- struct crypt_data *data;
-
- if ((data = uw_get_global(ctx, "crypt")) == NULL) {
- data = malloc(sizeof(struct crypt_data));
- data->initialized = 0;
- uw_set_global(ctx, "crypt", data, free);
- }
-
- return uw_strdup(ctx, crypt_r(key, salt, data));
+ char buf[14];
+ return uw_strdup(ctx, DES_fcrypt(key, salt, buf));
}
uw_Basis_bool uw_Basis_eq_time(uw_context ctx, uw_Basis_time t1, uw_Basis_time t2) {
diff --git a/src/compiler.sml b/src/compiler.sml
index db500b6b..e13042af 100644
--- a/src/compiler.sml
+++ b/src/compiler.sml
@@ -1295,7 +1295,7 @@ fun compileC {cname, oname, ename, libs, profile, debug, link = link'} =
^ " " ^ #compile proto
^ " -c " ^ cname ^ " -o " ^ oname
- val link = "gcc -Werror -O3 -lm -lcrypt -pthread " ^ Config.gccArgs ^ " " ^ libs ^ " " ^ lib ^ " " ^ Config.openssl ^ " " ^ oname
+ val link = "gcc -Werror -O3 -lm -pthread " ^ Config.gccArgs ^ " " ^ libs ^ " " ^ lib ^ " " ^ Config.openssl ^ " " ^ oname
^ " -o " ^ ename
val (compile, link) =
diff --git a/tests/crypt.ur b/tests/crypt.ur
new file mode 100644
index 00000000..e1f48c65
--- /dev/null
+++ b/tests/crypt.ur
@@ -0,0 +1,7 @@
+fun cryptIt r = return <xml><body>
+ {[crypt r.Pass "AB"]}
+</body></xml>
+
+fun main () = return <xml><body>
+ <form><textbox{#Pass}/> <submit action={cryptIt}/></form>
+</body></xml>
diff --git a/tests/crypt.urs b/tests/crypt.urs
new file mode 100644
index 00000000..6ac44e0b
--- /dev/null
+++ b/tests/crypt.urs
@@ -0,0 +1 @@
+val main : unit -> transaction page