File: modifysrc

package info (click to toggle)
cracklib2 2.7-8
  • links: PTS
  • area: main
  • in suites: potato
  • size: 424 kB
  • ctags: 113
  • sloc: ansic: 1,914; sh: 1,084; makefile: 166; perl: 63
file content (262 lines) | stat: -rw-r--r-- 7,099 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
#!/bin/sh
#
# source:
#   /var/cvs/projects/debian/cracklib/debian/dpkg.scripts/modifysrc,v
#
# revision:
#   @(#) modifysrc,v 1.8 1999/04/02 14:48:30 jplejacq Exp
#
# copyright:
#   Copyright (C) 1998, 1999 Jean Pierre LeJacq <jplejacq@quoininc.com>
#
#   Distributed under the GNU GENERAL PUBLIC LICENSE.
#
# synopsis:
#   . modifysrc
#
# description:
#   Modification function for package pristine source
#
#   The changes made to the pristine source for this debian package
#   have been parameterized to support relocation of the files.  All
#   installed file and directory locations are specified in
#   debian/dpkg.scripts/substfiles.  This program reads that file and
#   takes each file in debian/src and makes the required
#   modifications.
#
#   This function is package dependent.



modify_src_override()
# postconditions:
#   Return 0 if successful, exits with non-zero otherwise.
#
# description:
#   Modify package pristine source.
{
  modify_src


  echo "${0}: configuring for selected package..."
    if   [ "${pkg}" = "${DH_DOPACKAGES}" ]
    then
      rules_srcdir="${pkg}.src"
      rules_cflags="-O2 -g -Wall -D_REENTRANT -fPIC"
      rules_ldflags="-L../../${pkg}.src/cracklib"
      rules_ldflags_lib="-shared -Wl,-soname=libcrack.so.2 -nodefaultlibs -lc"
      rules_lib="libcrack.so.${ver}"
      rules_libs="-lcrack"
    elif [ "${pkgbase}-runtime" = "${DH_DOPACKAGES}" ]
    then
      rules_srcdir="${pkgbase}-runtime.src"
      rules_cflags="-O2 -g -Wall -D_REENTRANT -fPIC"
      rules_ldflags="-L../../${pkg}.src/cracklib"
      rules_ldflags_lib="-shared -Wl,-soname=libcrack.so.2 -nodefaultlibs -lc"
      rules_lib="libcrack.so.${ver}"
      rules_libs="-lcrack"
    elif [ "${pkg}-dev" = "${DH_DOPACKAGES}" ]
    then
      rules_srcdir="${pkgdev}.src"
      rules_cflags="-O2 -g -Wall -D_REENTRANT"
      rules_ldflags="-L../../${pkg}.src/cracklib"
      rules_ldflags_lib=""
      rules_lib="libcrack.a"
      rules_libs="-lcrack"
    else
      echo "${0}: unknown package..."
      exit 1
    fi


  echo "${0}: modifying source..."
    if [ ! -f "${rules_srcdir}/Makefile.in" ]
    then
      mv ${rules_srcdir}/Makefile ${rules_srcdir}/Makefile.in
    fi

      sed -e "\
        s^cd cracklib \&\& make^cd cracklib \&\& make ${rules_lib}^;\
        s^DICTPATH=\$(DICTPATH)^^;\
      "\
      ${rules_srcdir}/Makefile.in > ${rules_srcdir}/Makefile


    if [ ! -f ${rules_srcdir}/cracklib/crack.h ]
    then
      cp -f\
        debian/dpkg.src/cracklib2-dev.crack.h\
        ${rules_srcdir}/cracklib/crack.h
    fi


    if [ ! -f "${rules_srcdir}/cracklib/Makefile.in" ]
    then
      mv ${rules_srcdir}/cracklib/Makefile ${rules_srcdir}/cracklib/Makefile.in
    fi

      sed -e "\
          s^ -O^${rules_cflags}^;\
        12i\\
LDFLAGS=${rules_ldflags_lib}\\
CC=gcc\\
\\
all: libcrack.a libcrack.so.${ver}\\
\\
libcrack.so.${ver}: \$(OBJ)\\
	\$(CC) \$(CFLAGS) \$(LDFLAGS) -o \$(@) \$(OBJ)\\
	ln -f -s \$(@) libcrack.so

      "\
      ${rules_srcdir}/cracklib/Makefile.in > ${rules_srcdir}/cracklib/Makefile


    if [ ! -f "${rules_srcdir}/cracklib/genrules.pl.in" ]
    then
      mv ${rules_srcdir}/cracklib/genrules.pl ${rules_srcdir}/cracklib/genrules.pl.in
    fi

      sed -e "\
        s^/usr/local/bin/perl^${f_host_perl}^;\
      "\
      ${rules_srcdir}/cracklib/genrules.pl.in > ${rules_srcdir}/cracklib/genrules.pl


    if [ ! -f "${rules_srcdir}/cracklib/packer.h.in" ]
    then
      mv ${rules_srcdir}/cracklib/packer.h ${rules_srcdir}/cracklib/packer.h.in
    fi

      sed -e "\
          s^typedef unsigned char int8^typedef u_int8_t int8^;\
          s^typedef unsigned short int int16^typedef u_int16_t int16^;\
          s^typedef unsigned long int int32^typedef u_int32_t int32^;\
          s^PWDICT \*PWOpen()^PWDICT \* PWOpen(char const prefix[], char const mode[])^;\
        56d;\
        10i\\
#include <sys/types.h>

        53i\\
extern int32 FindPW(PWDICT * pwp, char * string);\\
extern int PWClose(PWDICT * pwp);\\
extern char * Trim(char * string);\\
extern int PMatch(register char *control, register char *string);\\

      "\
      ${rules_srcdir}/cracklib/packer.h.in > ${rules_srcdir}/cracklib/packer.h


    if [ ! -f "${rules_srcdir}/cracklib/packlib.c.in" ]
    then
      mv ${rules_srcdir}/cracklib/packlib.c ${rules_srcdir}/cracklib/packlib.c.in
    fi

      sed -e "\
             s^PWOpen(prefix, mode)^PWOpen(char const prefix[], char const mode[])^;\
        15,16d;\
      "\
      ${rules_srcdir}/cracklib/packlib.c.in > ${rules_srcdir}/cracklib/packlib.c


    if [ ! -f "${rules_srcdir}/cracklib/fascist.c.in" ]
    then
      mv ${rules_srcdir}/cracklib/fascist.c ${rules_srcdir}/cracklib/fascist.c.in
    fi

      sed -e "\
               s^FascistCheck(password, path)^char const \* FascistCheck(char const password[], char const path[])^;\
            747d;\
        749,750d;\
             11i\\
#include \"crack.h\"

             15i\\
#include <string.h>\\
#include <unistd.h>\\

      "\
      ${rules_srcdir}/cracklib/fascist.c.in > ${rules_srcdir}/cracklib/fascist.c


    if [ ! -f "${rules_srcdir}/util/Makefile.in" ]
    then
      mv ${rules_srcdir}/util/Makefile ${rules_srcdir}/util/Makefile.in
    fi

      sed -e "\
          s^cc \$(CFLAGS)^\$(CC) \$(CFLAGS) \$(LDFLAGS)^;\
          s^LIBS=	../cracklib/libcrack.a^LIBS=${rules_libs}^;\
          s^packer: packer.o \$(LIBS)^packer: packer.o^;\
          s^unpacker: unpacker.o \$(LIBS)^unpacker: unpacker.o^;\
          s^testnum: testnum.o \$(LIBS)^testnum: testnum.o^;\
          s^teststr: teststr.o \$(LIBS)^teststr: teststr.o^;\
          s^testlib: testlib.o \$(LIBS)^testlib: testlib.o^;\
        17d;\
        18i\\
CC=gcc\\
CFLAGS=${rules_cflags} -L../cracklib -I../cracklib -I../../dpkg.src\\
LDFLAGS=${rules_ldflags}

      "\
      ${rules_srcdir}/util/Makefile.in > ${rules_srcdir}/util/Makefile



    #
    # Modify mkdict.
    #
    # This allows word list files to be compressed or uncompressed.
    #
    if [ ! -f "${rules_srcdir}/util/mkdict.in" ]
    then
      mv ${rules_srcdir}/util/mkdict ${rules_srcdir}/util/mkdict.in
    fi

      sed -e "\
        s^cat^zcat -f^;\
      "\
      ${rules_srcdir}/util/mkdict.in > ${rules_srcdir}/util/mkdict



    if [ ! -f "${rules_srcdir}/util/testnum.c.in" ]
    then
      mv ${rules_srcdir}/util/testnum.c ${rules_srcdir}/util/testnum.c.in
    fi

      sed -e "\
        9i\\
#include \"crack.h\"

      "\
      ${rules_srcdir}/util/testnum.c.in > ${rules_srcdir}/util/testnum.c


    if [ ! -f ${rules_srcdir}/util/teststr.c.in ]
    then
      mv ${rules_srcdir}/util/teststr.c ${rules_srcdir}/util/teststr.c.in
    fi

      sed -e "\
        9i\\
#include \"crack.h\"

      "\
      ${rules_srcdir}/util/teststr.c.in > ${rules_srcdir}/util/teststr.c


    if [ ! -f "${rules_srcdir}/util/testlib.c.in" ]
    then
      mv ${rules_srcdir}/util/testlib.c ${rules_srcdir}/util/testlib.c.in
    fi

      sed -e "\
        9i\\
#include \"crack.h\"

      "\
      ${rules_srcdir}/util/testlib.c.in > ${rules_srcdir}/util/testlib.c


  return 0
}