1 /* cc -dynamiclib -o plugin.so ~/plugin.c -lcrack */
12 extern char * FascistCheck(char *passwd,char *dictpath) ;
18 int pwcheck_init(void **context, const char *dict_file)
20 static char p[PATH_MAX];
21 static struct stat st;
23 strncpy(p, dict_file, PATH_MAX-5);
24 strncat(p, ".pwd", PATH_MAX);
25 p[PATH_MAX - 1] = '\0';
27 if (lstat(p, &st) < 0)
30 *context = &l_context;
32 l_context.dict_file = strdup(dict_file);
37 int pwcheck_check(void *context, const char *password, const char
38 *princ, char *msg, int msglen)
42 if (msg2 = FascistCheck((char *)password, ((struct lctx *)context)->dict_file))
44 strncpy(msg, msg2, msglen);
45 msg[msglen - 1] = '\0';
49 if (strcasecmp(password, princ) == 0) {
50 snprintf(msg, msglen, "You can't use \"%s\" as a password!",
52 msg[msglen - 1] = '\0';
59 void pwcheck_close(void *context)
61 if (l_context.dict_file) free(l_context.dict_file);
62 l_context.dict_file = NULL;