1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-19 03:52:17 +00:00
freebsd-ports/devel/tcl-neo/files/patch-md5
Mikhail Teterin 8335f34f0f The first part of the NeoWebScript port I'm working on (hard).
The beast comes as part of one GIANT tarball including the
entire NeoWebScript as well as outdated Apache, gd, Tcl, itcl,
TclX, db-2 (no kidding!), etc.

This part is a set of general purpose commands and procedures,
which can be used (and appreciated) by regular TCL scripting --
not just web-oriented inside NWS.

This port is built without the available LDAP support -- our
openldap2 port used db3, but the db-support in NeoTcl only
works with db2. If some db-expert can send me a patch for the
neoXdb.c, the humanity will remember him/her forev^H^H a while.
2001-08-17 05:07:16 +00:00

28 lines
950 B
Plaintext

Everybody and their cat try to ship their own implementation of md5
functions. Force FreeBSD's -lmd here. Also, when creating the resulting
string-object, use our advanced knowledge, that all md5 digests are 32
characters long.
--- neoXgeneral.c Thu Apr 20 09:16:01 2000
+++ neoXgeneral.c Thu Aug 16 20:46:02 2001
@@ -10,1 +10,2 @@
-#include "util_md5.h"
+#include <sys/types.h>
+#include <md5.h>
@@ -94,11 +95,13 @@
{
char *digest;
+ int length;
if (objc != 2) {
- Tcl_SetResult(interp, "usage: md5 string", TCL_STATIC);
+ Tcl_WrongNumArgs(interp, 1, objv, "<string>");
return TCL_ERROR;
}
- digest = md5(Tcl_GetStringFromObj(objv[1], (int*)NULL));
- Tcl_SetObjResult(interp, Tcl_NewStringObj(digest, -1));
+ digest = Tcl_GetStringFromObj(objv[1], &length);
+ digest = MD5Data(digest, length, NULL);
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(digest, 32));
return TCL_OK;
}