diff -u -p -N -X src/diff_exclude.dat src-orig/Makefile src/Makefile
--- src-orig/Makefile	Tue Sep 13 06:58:24 2011
+++ src/Makefile	Sat Sep 17 14:20:06 2011
@@ -71,6 +71,7 @@ JOHN_OBJS = \
 	rar_fmt.o rar2john.o \
 	zip_fmt.o zip2john.o gladman_hmac.o gladman_pwd2key.o \
 	$(PLUGFORMATS_OBJS) \
+	plugin.o \
 	dummy.o \
 	batch.o bench.o charset.o common.o compiler.o config.o cracker.o \
 	crc32.o external.o formats.o getopt.o idle.o inc.o john.o list.o \
@@ -327,7 +328,7 @@ linux-x86-mmx:
 	$(MAKE) $(PROJ) \
 		JOHN_OBJS="$(JOHN_OBJS) c3_fmt.o x86.o x86-mmx.o sha1-mmx.o md5-mmx.o" \
 		CFLAGS="$(CFLAGS) -DHAVE_CRYPT" \
-		LDFLAGS="$(LDFLAGS) -lcrypt"
+		LDFLAGS="$(LDFLAGS) -ldl -lcrypt"
 
 linux-x86-any:
 	$(LN) x86-any.h arch.h
@@ -335,7 +336,7 @@ linux-x86-any:
 	$(MAKE) $(PROJ) \
 		JOHN_OBJS="$(JOHN_OBJS) c3_fmt.o x86.o" \
 		CFLAGS="$(CFLAGS) -DHAVE_CRYPT" \
-		LDFLAGS="$(LDFLAGS) -lcrypt"
+		LDFLAGS="$(LDFLAGS) -ldl -lcrypt"
 
 linux-x86-avx:
 	$(LN) x86-sse.h arch.h
diff -u -p -N -X src/diff_exclude.dat src-orig/formats.h src/formats.h
--- src-orig/formats.h	Wed Aug  3 12:19:13 2011
+++ src/formats.h	Wed Sep 14 03:32:17 2011
@@ -186,6 +186,7 @@ struct fmt_private {
 /*
  * A structure to keep a list of supported ciphertext formats.
  */
+#define FMT_MAIN_VERSION 9		/* change if structure changes */
 struct fmt_main {
 	struct fmt_params params;
 	struct fmt_methods methods;
diff -u -p -N -X src/diff_exclude.dat src-orig/gladman_hmac.c src/gladman_hmac.c
--- src-orig/gladman_hmac.c	Sat Jul  2 17:40:59 2011
+++ src/gladman_hmac.c	Wed Sep 14 05:39:54 2011
@@ -33,6 +33,7 @@
  This is an implementation of HMAC, the FIPS standard keyed hash function
 */
 
+#include <string.h>		/* for mem*() prototypes */
 #include "gladman_hmac.h"
 
 #if defined(__cplusplus)
diff -u -p -N -X src/diff_exclude.dat src-orig/gladman_pwd2key.c src/gladman_pwd2key.c
--- src-orig/gladman_pwd2key.c	Thu Jun 16 19:30:00 2011
+++ src/gladman_pwd2key.c	Wed Sep 14 05:41:06 2011
@@ -34,6 +34,7 @@
  a password and a salt value.
 */
 
+#include <string.h>
 #include <memory.h>
 #include "gladman_hmac.h"
 
diff -u -p -N -X src/diff_exclude.dat src-orig/john.c src/john.c
--- src-orig/john.c	Tue Sep 13 06:58:24 2011
+++ src/john.c	Wed Sep 14 02:30:10 2011
@@ -50,6 +50,7 @@
 #endif /* HAVE_MPI */
 #include <openssl/opensslv.h>
 #include "unicode.h"
+#include "plugin.h"
 
 #if CPU_DETECT
 extern int CPU_detect(void);
@@ -158,6 +159,10 @@ static void john_register_all(void)
 
 
 	john_register_one(&fmt_dummy);
+	register_dlls ( options.fmt_dlls,
+		cfg_get_param(SECTION_OPTIONS, NULL, "plugin"),
+		john_register_one );
+
 
 	if (!fmt_list) {
 #ifdef HAVE_MPI
diff -u -p -N -X src/diff_exclude.dat src-orig/openvms_fmt_plug.x src/openvms_fmt_plug.x
--- src-orig/openvms_fmt_plug.x	Wed Dec 31 19:00:00 1969
+++ src/openvms_fmt_plug.x	Sat Sep 17 11:36:26 2011
@@ -0,0 +1,81 @@
+/*
+ * This file is part of John the Ripper password cracker,
+ * Copyright (c) 1996-2001 by Solar Designer
+ *
+ * 'Plugin' module for 1.7.8 jumbo patch, rename from .x to .c to have the
+ * make file build a complie-time plugin from source files in the vms
+ * sub-directory.
+ *
+ * The use of pthreads in vms_std-mp.c is inhibited unless compiled with
+ * HAVE_PTHREAD defined.
+ *
+ * Date:    15-SEP-2011
+ *
+ * Copyright (c) 2011 by David L. Jones <jonesd/at/columbus.rr.com>, and
+ * is hereby released to the general public under the following terms:
+ *    Redistribution and use in source and binary forms, with or without
+ *    modifications, are permitted.
+ */
+#ifndef HAVE_PTHREAD
+#define NOPTHREAD
+#endif
+
+#include "vms/vms_fmt.c"
+
+#include "vms/vms_std-mp.c"
+
+#include "vms/uaf_encode.c"
+/*
+ * This file is part of John the Ripper password cracker,
+ * Copyright (c) 1996-2001 by Solar Designer
+ *
+ * 'Plugin' module for 1.7.8 jumbo patch, rename from .x to .c to have the
+ * make file build a complie-time plugin from source files in the vms
+ * sub-directory.
+ *
+ * The use of pthreads in vms_std-mp.c is inhibited unless compiled with
+ * HAVE_PTHREAD defined.
+ *
+ * Date:    15-SEP-2011
+ *
+ * Copyright (c) 2011 by David L. Jones <jonesd/at/columbus.rr.com>, and
+ * is hereby released to the general public under the following terms:
+ *    Redistribution and use in source and binary forms, with or without
+ *    modifications, are permitted.
+ */
+#ifndef HAVE_PTHREAD
+#define NOPTHREAD
+#endif
+
+#include "vms/vms_fmt.c"
+
+#include "vms/vms_std-mp.c"
+
+#include "vms/uaf_encode.c"
+/*
+ * This file is part of John the Ripper password cracker,
+ * Copyright (c) 1996-2001 by Solar Designer
+ *
+ * 'Plugin' module for 1.7.8 jumbo patch, rename from .x to .c to have the
+ * make file build a complie-time plugin from source files in the vms
+ * sub-directory.
+ *
+ * The use of pthreads in vms_std-mp.c is inhibited unless compiled with
+ * HAVE_PTHREAD defined.
+ *
+ * Date:    15-SEP-2011
+ *
+ * Copyright (c) 2011 by David L. Jones <jonesd/at/columbus.rr.com>, and
+ * is hereby released to the general public under the following terms:
+ *    Redistribution and use in source and binary forms, with or without
+ *    modifications, are permitted.
+ */
+#ifndef HAVE_PTHREAD
+#define NOPTHREAD
+#endif
+
+#include "vms/vms_fmt.c"
+
+#include "vms/vms_std-mp.c"
+
+#include "vms/uaf_encode.c"
diff -u -p -N -X src/diff_exclude.dat src-orig/options.c src/options.c
--- src-orig/options.c	Tue Sep 13 06:58:25 2011
+++ src/options.c	Sat Sep 17 11:36:26 2011
@@ -78,7 +78,7 @@ static struct opt_entry opt_list[] = {
 		FLG_CRACKING_SUP, OPT_REQ_PARAM,
 		OPT_FMT_STR_ALLOC, &options.session},
 	{"status", FLG_STATUS_SET, FLG_STATUS_CHK,
-		0, ~FLG_STATUS_SET & ~OPT_REQ_PARAM,
+		0, ~FLG_STATUS_SET & ~OPT_REQ_PARAM & ~FLG_DYNFMT,
 		OPT_FMT_STR_ALLOC, &options.session},
 	{"make-charset", FLG_MAKECHR_SET, FLG_MAKECHR_CHK,
 		0, FLG_CRACKING_CHK | FLG_SESSION | OPT_REQ_PARAM,
@@ -87,7 +87,7 @@ static struct opt_entry opt_list[] = {
 		0, FLG_CRACKING_SUP | FLG_MAKECHR_CHK,
 		OPT_FMT_STR_ALLOC, &options.showuncracked_str},
 	{"test", FLG_TEST_SET, FLG_TEST_CHK,
-		0, ~FLG_TEST_SET & ~FLG_FORMAT & ~FLG_SAVEMEM & ~FLG_CONFIG_CLI &
+		0, ~FLG_TEST_SET & ~FLG_FORMAT & ~FLG_SAVEMEM & ~FLG_CONFIG_CLI & ~FLG_DYNFMT &
 		~OPT_REQ_PARAM & ~FLG_NOLOG & ~FLG_INP_ENCODING, "%u", &benchmark_time},
 	{"users", FLG_NONE, 0, FLG_PASSWD, OPT_REQ_PARAM,
 		OPT_FMT_ADD_LIST_MULTI, &options.loader.users},
@@ -107,6 +107,8 @@ static struct opt_entry opt_list[] = {
 		OPT_FMT_STR_ALLOC, &options.subformat},
 	{"save-memory", FLG_SAVEMEM, FLG_SAVEMEM, 0, OPT_REQ_PARAM,
 		"%u", &mem_saving_level},
+	{"plugin", FLG_DYNFMT, 0, 0, OPT_REQ_PARAM, 
+		OPT_FMT_ADD_LIST_MULTI,	&options.fmt_dlls},
 	{"mem-file-size", FLG_NONE, FLG_NONE, 0, OPT_REQ_PARAM,
 		"%u", &options.loader.max_wordfile_memory},
 	{"fix-state-delay", FLG_NONE, FLG_NONE, 0, OPT_REQ_PARAM,
@@ -231,6 +233,7 @@ void opt_init(char *name, int argc, char
 	list_init(&options.loader.users);
 	list_init(&options.loader.groups);
 	list_init(&options.loader.shells);
+	list_init(&options.fmt_dlls);
 
 	options.length = -1;
 
diff -u -p -N -X src/diff_exclude.dat src-orig/options.h src/options.h
--- src-orig/options.h	Tue Sep 13 06:58:25 2011
+++ src/options.h	Wed Sep 14 02:43:05 2011
@@ -88,6 +88,8 @@
 #define FLG_FORMAT			0x02000000
 /* Memory saving enabled */
 #define FLG_SAVEMEM			0x04000000
+/* Dynamic load of foreign format module */
+#define FLG_DYNFMT			0x08000000
 /* Command-line config file */
 #define FLG_CONFIG_CLI      0x10000000
 /* Turn off logging */
@@ -174,6 +176,9 @@ struct options_main {
 
 /* Write cracked passwords to log (default is just username) */
 	int log_passwords;
+
+/* List of dll files to load for additional formats */
+	struct list_main *fmt_dlls;
 };
 
 extern struct options_main options;
diff -u -p -N -X src/diff_exclude.dat src-orig/plugin.c src/plugin.c
--- src-orig/plugin.c	Wed Dec 31 19:00:00 1969
+++ src/plugin.c	Sat Sep 17 11:19:25 2011
@@ -0,0 +1,131 @@
+/*
+ * This file is part of John the Ripper password cracker,
+ *
+ * Plugin module support.
+ *
+ * Author:  David Jones
+ * Date:     5-SEP-2011
+ *
+ * Copyright (c) 2011 by David L. Jones <jonesd/at/columbus.rr.com>, and
+ * is hereby released to the general public under the following terms:
+ *    Redistribution and use in source and binary forms, with or without
+ *    modifications, are permitted.
+ */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+#include <stdlib.h>
+#include <sys/stat.h>
+#include <dlfcn.h>
+#ifndef RTLD_LOCAL
+#define RTLD_LOCAL 0
+#endif
+
+#include "plugin.h"
+/*
+ * Scan fmt_list and look for duplicate format name, which confuses --test.
+ * Return 1 if duplicate.
+ */
+static int duplicate_format_name(struct fmt_main * candidate)
+{
+	struct fmt_main *fmt;
+	for (fmt = fmt_list; fmt; fmt = fmt->next) {
+		if (strcmp(fmt->params.label, candidate->params.label) == 0) {
+			fprintf(stderr, "Duplicate instance of %s format!\n",
+				candidate->params.label);
+			return 1;	/* IS a duplicate */
+		}
+	}
+	return 0;
+}
+/*
+ * Keep a list of the handles returned by our dlopen() calls in case we
+ * have need to do cleanup in the future.
+ */
+static void   **dll_handle;
+
+/*
+ * Load format modules from DLLs specified by using  the --plugin=dllfile
+ * command line option or Dynamic-fmt config file option.  The DLL must
+ * define a function FMT_LOADER with the prototype:
+ *    struct fmt_main *FMT_LOADER ( int fmt_version );
+ *
+ * fmt_version is the version number of the fmt_main structure.  It must be
+ * changed whenever the fmt_main layout or semantics change.  The FMT_LOADER
+ * function returns the address of a fmt_main structure or NULL if a version
+ * mismatch or other error occurs.
+ */
+void register_dlls(
+	struct list_main * dll_list,
+	char *config_param,
+	format_register register_one)
+{
+	struct list_entry *le;
+	struct fmt_main *(*loader) (int fmt_version);
+	struct fmt_main *fmt;
+	struct list_main *cfg_list;
+	int             ndx;
+	char           *dll_name, *cfg_names;
+	/*
+         * Convert config_param string into list structure and chain it
+         * and dll_list together temporarily.  Set le to the list head.
+         */
+	list_init(&cfg_list);
+	if (config_param) {
+		cfg_names = strdup(config_param);	/* so strtok can modify */
+		for (dll_name = strtok(strdup(cfg_names), ","); dll_name;
+			dll_name = strtok(0, ",")) {
+			dll_name += strspn(dll_name, " \t");	/* skip whitespace */
+			if (*dll_name)
+				list_add(cfg_list, dll_name);
+		}
+	}
+	le = NULL;
+	if (cfg_list->count > 0) {
+		le = cfg_list->head;	/* Start with config_param files */
+		if (!dll_list)
+			printf("Missing options.fmt_dlls!\n");
+		else if (dll_list->count > 0)
+			cfg_list->tail->next = dll_list->head;
+	} else if (!dll_list) {
+		printf("/bugcheck/ options.fmt_dlls did not intialize\n");
+	} else if (dll_list->count > 0) {
+		le = dll_list->head;	/* config_param empty, start with
+					 * dll_list */
+	} else {
+		return;		/* both lists empty, bail out */
+	}
+	/*
+         * Step through combined list and load files named.
+         */
+	dll_handle = malloc(sizeof(void *) * (cfg_list->count + dll_list->count));
+	ndx = 0;
+	for (; le; le = le->next) {
+
+		dll_name = le->data;
+		dll_handle[ndx] = dlopen(dll_name, RTLD_NOW | RTLD_LOCAL);
+		if (dll_handle[ndx]) {
+			loader = dlsym(dll_handle[ndx], "FMT_LOADER");
+			if (loader) {
+				fmt = loader(FMT_MAIN_VERSION);
+				if (duplicate_format_name(fmt)) {
+					fprintf(stderr, "Plugin %s not registered.\n",
+						fmt->params.format_name);
+				} else if (fmt)
+					register_one(fmt);
+				else {
+					fprintf(stderr, "Unsupported version for DLL FMT\n");
+				}
+			} else {
+				fprintf(stderr, "Failed to load symbol '%s'\n", "FMT_LOADER");
+				fprintf(stderr, "%s\n", dlerror());
+			}
+		} else {
+			fprintf(stderr, "Failed to open DLL '%s'\n", dll_name);
+			fprintf(stderr, "%s\n", dlerror());
+		}
+	}
+	if (cfg_list->count > 0)
+		cfg_list->tail->next = 0;
+}
diff -u -p -N -X src/diff_exclude.dat src-orig/plugin.h src/plugin.h
--- src-orig/plugin.h	Wed Dec 31 19:00:00 1969
+++ src/plugin.h	Sat Sep 17 23:13:42 2011
@@ -0,0 +1,19 @@
+/*
+ * This file is part of John the Ripper password cracker,
+ * Copyright (c) 1996-2004,2006,2009-2011 by Solar Designer
+ *
+ * Plugin module support.
+ */
+#ifndef _JOHN_PLUGIN_H
+#define _JOHN_PLUGIN_H
+
+#include "list.h"
+#include "formats.h"
+
+typedef void    (*format_register) (struct fmt_main * format);
+void 
+register_dlls(
+	struct list_main * dll_list,
+	char *config_param,
+	format_register register_one);
+#endif
Common subdirectories: src-orig/unused and src/unused
Common subdirectories: src-orig/vms and src/vms
