summaryrefslogtreecommitdiffstats
path: root/pureftpd/Dockerfile
blob: d87bf692711050186210ad1008d83661f9e5cdf3 (plain)
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
FROM debian/eol:wheezy AS build-stage

RUN echo "deb http://archive.debian.org/debian/ wheezy-backports main contrib non-free" >> /etc/apt/sources.list
RUN echo "deb-src http://archive.debian.org/debian/ wheezy-backports main contrib non-free" >> /etc/apt/sources.list
RUN apt-get update \
  && apt-get install -y \
      software-properties-common
RUN apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 CBCB082A1BB943DB
RUN echo "deb http://mirror2.hs-esslingen.de/mariadb/repo/10.3/debian wheezy main" >> /etc/apt/sources.list
RUN echo "deb-src http://mirror2.hs-esslingen.de/mariadb/repo/10.3/debian wheezy main" >> /etc/apt/sources.list
RUN apt-get update \
  && apt-get install -y \
      build-essential \
      fakeroot \
      dpkg-dev \
      autoconf-archive \
      libcap2-dev \
#      libmysqlclient-dev \
      libmariadb-dev-compat \
      po-debconf \
      debhelper \
      wget \
      libpam-dev \
      libldap2-dev \
      libpq-dev \
      libssl-dev
RUN mkdir pure-ftp-1.0.36-1.1
RUN cd pure-ftp-1.0.36-1.1
RUN wget http://archive.debian.org/debian/pool/main/p/pure-ftpd/pure-ftpd_1.0.36-1.1.dsc
RUN wget http://archive.debian.org/debian/pool/main/p/pure-ftpd/pure-ftpd_1.0.36.orig.tar.gz
RUN wget http://archive.debian.org/debian/pool/main/p/pure-ftpd/pure-ftpd_1.0.36-1.1.diff.gz
RUN tar zxvf pure-ftpd_1.0.36.orig.tar.gz
RUN mv pure-ftpd-1.0.36.orig/ pure-ftpd-1.0.36
RUN mkdir pure-ftpd-1.0.36/debian
RUN gunzip pure-ftpd_1.0.36-1.1.diff.gz
RUN patch -p0 < pure-ftpd_1.0.36-1.1.diff
RUN echo "--- pure-ftpd-1.0.36.orig/src/log_mysql.c       2012-03-16 01:01:37.000000000 +0000" >> self_implemented_make_scrambled_password.diff \
  && echo "+++ pure-ftpd-1.0.36/src/log_mysql.c    2021-01-24 20:59:29.749460231 +0000" >> self_implemented_make_scrambled_password.diff \
  && echo "@@ -460,7 +460,25 @@ void pw_mysql_check(AuthResult * const r" >> self_implemented_make_scrambled_password.diff \
  && echo "         my_make_scrambled_password(scrambled_password, password," >> self_implemented_make_scrambled_password.diff \
  && echo "                                    strlen(password));" >> self_implemented_make_scrambled_password.diff \
  && echo " #  else" >> self_implemented_make_scrambled_password.diff \
  && echo "-        make_scrambled_password(scrambled_password, password);" >> self_implemented_make_scrambled_password.diff \
  && echo "+{" >> self_implemented_make_scrambled_password.diff \
  && echo "+  ulong hash_res[2];" >> self_implemented_make_scrambled_password.diff \
  && echo "+  size_t len = strlen(password);" >> self_implemented_make_scrambled_password.diff \
  && echo "+  ulong nr=1345345333L, add=7, nr2=0x12345671L;" >> self_implemented_make_scrambled_password.diff \
  && echo "+  ulong tmp;" >> self_implemented_make_scrambled_password.diff \
  && echo "+  const char *password_end= password + len;" >> self_implemented_make_scrambled_password.diff \
  && echo "+  for (; password < password_end; password++)" >> self_implemented_make_scrambled_password.diff \
  && echo "+  {" >> self_implemented_make_scrambled_password.diff \
  && echo "+    if (*password == ' ' || *password == '\t')" >> self_implemented_make_scrambled_password.diff \
  && echo "+      continue;                        /* skipp space in password */" >> self_implemented_make_scrambled_password.diff \
  && echo "+    tmp= (ulong) (unsigned char) *password;" >> self_implemented_make_scrambled_password.diff \
  && echo "+    nr^= (((nr & 63)+add)*tmp)+ (nr << 8);" >> self_implemented_make_scrambled_password.diff \
  && echo "+    nr2+=(nr2 << 8) ^ nr;" >> self_implemented_make_scrambled_password.diff \
  && echo "+    add+=tmp;" >> self_implemented_make_scrambled_password.diff \
  && echo "+  }" >> self_implemented_make_scrambled_password.diff \
  && echo "+  hash_res[0]=nr & (((ulong) 1L << 31) -1L); /* Don't use sign bit (str2int) */;" >> self_implemented_make_scrambled_password.diff \
  && echo "+  hash_res[1]=nr2 & (((ulong) 1L << 31) -1L);" >> self_implemented_make_scrambled_password.diff \
  && echo "+  sprintf(scrambled_password,\"%08lx%08lx\",hash_res[0],hash_res[1]);" >> self_implemented_make_scrambled_password.diff \
  && echo "+}" >> self_implemented_make_scrambled_password.diff \
  && echo " #  endif" >> self_implemented_make_scrambled_password.diff \
  && echo " # endif" >> self_implemented_make_scrambled_password.diff \
  && echo " #endif" >> self_implemented_make_scrambled_password.diff \
  && echo "" >> self_implemented_make_scrambled_password.diff
RUN patch -p0 < self_implemented_make_scrambled_password.diff
RUN chmod +x pure-ftpd-1.0.36/debian/rules
RUN cd pure-ftpd-1.0.36/ \
  && dpkg-buildpackage -uc -b

FROM scratch

COPY --from=build-stage /*.deb .