source: branches/samba-3.3.x/examples/auth/crackcheck/packer.h

Last change on this file was 374, checked in by Herwig Bauernfeind, 16 years ago

Update Samba 3.3 to 3.3.10 (new files)

File size: 1.9 KB
Line 
1/*
2 * This program is copyright Alec Muffett 1993, portions copyright other authors.
3 * The authors disclaim all responsibility or liability with respect to it's usage
4 * or its effect upon hardware or computer systems.
5 */
6
7#ifndef CRACKLIB_PACKER_H
8#define CRACKLIB_PACKER_H
9
10/* Moved here cause needed by mod_php */
11#define STRINGSIZE 1024
12#define TRUNCSTRINGSIZE (STRINGSIZE/4)
13
14#ifndef NUMWORDS
15#define NUMWORDS 16
16#endif
17#define MAXWORDLEN 32
18#define MAXBLOCKLEN (MAXWORDLEN * NUMWORDS)
19
20#ifdef IN_CRACKLIB
21
22#include <stdio.h>
23#include <ctype.h>
24#include <crack.h>
25
26#if defined(ENABLE_NLS)
27#include <libintl.h>
28#define _(String) dgettext("cracklib", String)
29#else
30#define _(String) (String)
31#endif
32
33#if defined(HAVE_INTTYPES_H)
34#include <inttypes.h>
35#else
36#if defined(HAVE_STDINT_H)
37#include <stdint.h>
38#else
39typedef unsigned int uint32_t;
40typedef unsigned short uint16_t;
41#endif
42#endif
43
44
45struct pi_header
46{
47 uint32_t pih_magic;
48 uint32_t pih_numwords;
49 uint16_t pih_blocklen;
50 uint16_t pih_pad;
51};
52
53typedef struct
54{
55 FILE *ifp;
56 FILE *dfp;
57 FILE *wfp;
58
59 uint32_t flags;
60#define PFOR_WRITE 0x0001
61#define PFOR_FLUSH 0x0002
62#define PFOR_USEHWMS 0x0004
63#define PFOR_USEZLIB 0x0008
64
65 uint32_t hwms[256];
66
67 struct pi_header header;
68
69 int count;
70 char data[NUMWORDS][MAXWORDLEN];
71} PWDICT;
72
73#define PW_WORDS(x) ((x)->header.pih_numwords)
74#define PIH_MAGIC 0x70775631
75
76/* Internal routines */
77extern char *GetPW(PWDICT *pwp, uint32_t number);
78
79#else
80
81/* Dummy structure, this is an internal only opaque data type */
82typedef struct {
83 int dummy;
84} PWDICT;
85
86#endif
87
88extern PWDICT *PWOpen(const char *prefix, char *mode);
89extern int PWClose(PWDICT *pwp);
90extern unsigned int FindPW(PWDICT *pwp, char *string);
91extern int PutPW(PWDICT *pwp, char *string);
92extern int PMatch(char *control, char *string);
93extern char *Mangle(char *input, char *control);
94extern char Chop(char *string);
95extern char *Trim(char *string);
96
97#endif
Note: See TracBrowser for help on using the repository browser.