summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorParag Mehta <pm@gentoo.org>2001-07-26 01:09:54 +0000
committerParag Mehta <pm@gentoo.org>2001-07-26 01:09:54 +0000
commitd29019dcd1ce06680a921a26dd80a2920dc38ca4 (patch)
tree5b5ba393c283b72d92c59332da0b60f8db241afe /net-ftp
parentmodified directory structure as per ebuild names and as sugested by drobbins ... (diff)
downloadgentoo-2-d29019dcd1ce06680a921a26dd80a2920dc38ca4.tar.gz
gentoo-2-d29019dcd1ce06680a921a26dd80a2920dc38ca4.tar.bz2
gentoo-2-d29019dcd1ce06680a921a26dd80a2920dc38ca4.zip
new bug release recommended for production machines.removed earlier version.
Diffstat (limited to 'net-ftp')
-rw-r--r--net-ftp/pure-ftpd/files/digest-pure-ftpd-0.98.7-r21
-rw-r--r--net-ftp/pure-ftpd/files/digest-pure-ftpd-0.991
-rw-r--r--net-ftp/pure-ftpd/files/ftpusers24
-rw-r--r--net-ftp/pure-ftpd/files/pure-ftp_xml_python.py41
-rw-r--r--net-ftp/pure-ftpd/files/pure-ftpwho_html.py213
-rw-r--r--net-ftp/pure-ftpd/pure-ftpd-0.98.7-r2.ebuild44
-rw-r--r--net-ftp/pure-ftpd/pure-ftpd-0.99.ebuild54
7 files changed, 333 insertions, 45 deletions
diff --git a/net-ftp/pure-ftpd/files/digest-pure-ftpd-0.98.7-r2 b/net-ftp/pure-ftpd/files/digest-pure-ftpd-0.98.7-r2
deleted file mode 100644
index f6c4a53075df..000000000000
--- a/net-ftp/pure-ftpd/files/digest-pure-ftpd-0.98.7-r2
+++ /dev/null
@@ -1 +0,0 @@
-MD5 381169cc31fdebfa2d414cd264d8485b pure-ftpd-0.98.7.tar.gz
diff --git a/net-ftp/pure-ftpd/files/digest-pure-ftpd-0.99 b/net-ftp/pure-ftpd/files/digest-pure-ftpd-0.99
new file mode 100644
index 000000000000..6101d513d14c
--- /dev/null
+++ b/net-ftp/pure-ftpd/files/digest-pure-ftpd-0.99
@@ -0,0 +1 @@
+MD5 5653e4ee557621069cb25d54c8477d71 pure-ftpd-0.99.tar.gz
diff --git a/net-ftp/pure-ftpd/files/ftpusers b/net-ftp/pure-ftpd/files/ftpusers
new file mode 100644
index 000000000000..df1b69c0b0ad
--- /dev/null
+++ b/net-ftp/pure-ftpd/files/ftpusers
@@ -0,0 +1,24 @@
+# /etc/ftpusers: list of users disallowed FTP access.
+#
+
+daemon
+bin
+sys
+sync
+games
+man
+lp
+mail
+news
+uucp
+proxy
+majordom
+postgres
+www-data
+backup
+msql
+operator
+list
+irc
+nobody
+
diff --git a/net-ftp/pure-ftpd/files/pure-ftp_xml_python.py b/net-ftp/pure-ftpd/files/pure-ftp_xml_python.py
new file mode 100644
index 000000000000..8c7ff809f214
--- /dev/null
+++ b/net-ftp/pure-ftpd/files/pure-ftp_xml_python.py
@@ -0,0 +1,41 @@
+#! /usr/bin/python2
+#Script by j@falooley.org (Jason Lunz) in the contrib section of pure-ftp
+
+ import os
+ from xml.sax import handler, make_parser
+
+ class ftpwho_handler(handler.ContentHandler):
+ def __init__(self):
+ handler.ContentHandler.__init__(self)
+ self.clear()
+
+ def startElement(self, name, attrs):
+ if name != 'client': return
+ d = {}
+ for (k, v) in attrs.items():
+ d[k] = v
+ self.clients.append(d)
+
+ def clear(self):
+ self.clients = []
+
+ parser = make_parser()
+ fh = ftpwho_handler()
+ parser.setContentHandler(fh)
+
+ def numberize(dicts):
+ for c in dicts:
+ for k in ('pid', 'time', 'localport', 'percentage', 'bandwidth'):
+ if c.has_key(k):
+ c[k] = int(c[k])
+ for k in ('current_size', 'resume', 'total_size'):
+ if c.has_key(k):
+ c[k] = long(c[k])
+ return dicts
+
+ def clients():
+ fh.clear()
+ parser.parse(os.popen('pure-ftpwho -x'))
+ return numberize(fh.clients)
+
+
diff --git a/net-ftp/pure-ftpd/files/pure-ftpwho_html.py b/net-ftp/pure-ftpd/files/pure-ftpwho_html.py
new file mode 100644
index 000000000000..6e425da17b91
--- /dev/null
+++ b/net-ftp/pure-ftpd/files/pure-ftpwho_html.py
@@ -0,0 +1,213 @@
+#! /usr/bin/python2
+# vim: sw=4
+#Script by j@falooley.org (Jason Lunz) in the contrib section of pure-ftp
+
+ import getopt
+ import pure_ftpwho
+ import sys
+ from string import capitalize, lower
+
+ def range_idx(list, first = 1, cmp_func = cmp):
+ for i in range(first+1, len(list)):
+ if cmp_func(list[first], list[i]):
+ return i
+ return len(list)
+
+ def dcmp(a, b, key):
+ if a.has_key(key):
+ if b.has_key(key):
+ return cmp(a[key], b[key])
+ else:
+ return 1
+ else:
+ if b.has_key(key):
+ return -1
+ else:
+ return 0
+
+ def multisort(dicts, keys):
+ if not keys:
+ return dicts
+ dicts.sort(lambda x, y, key=keys[0]: dcmp(x, y, key))
+ ret = []
+ first = last = 0
+ while last < len(dicts):
+ last = range_idx(dicts, first, lambda x, y, k=keys[0]: dcmp(x, y, k))
+ add = multisort(dicts[first:last], keys[1:])
+ if(add):
+ ret.extend(add)
+ first = last
+ return ret
+
+ def col_heading(key):
+ headings = {'pid' : 'PID'}
+ if headings.has_key(key):
+ return headings[key]
+ else:
+ return capitalize(lower(key))
+
+ def size_abbrev(num, order=-1):
+ abbr = ['b', 'K', 'M', 'G', 'T']
+ if order == -1:
+ q = 1
+ for i in range(len(abbr)):
+ p = pow(1024, i+1)
+ if num < p:
+ return (float(num)/q, abbr[i], i)
+ q = p
+ else:
+ return (float(num)/pow(1024, order), abbr[order], order)
+
+ def celltext(dict, type):
+ sizes = ['current_size', 'total_size', 'percentage', 'bandwidth']
+ align = ''
+ ret = ''
+ if type == 'stats':
+ align = ' align="right"'
+ if filter(lambda k, d=dict: d.has_key(k), sizes):
+ bw, abbr, order = size_abbrev(dict['bandwidth'])
+ if order == 0:
+ format = '%d'
+ else:
+ format = '%.1f'
+ sf = format + '/' + format
+ sf += '&nbsp;%s&nbsp;(%d%%&nbsp;-&nbsp;' + format
+ sf += '&nbsp;%s/s)'
+ ret = sf % (size_abbrev(dict['current_size'], order)[0],
+ size_abbrev(dict['total_size'], order)[0],
+ abbr, dict['percentage'], bw, abbr)
+ elif not dict.has_key(type):
+ ret = '&nbsp;'
+ elif type in sizes:
+ ret = size_abbrev(dict[type])
+ elif type == 'time':
+ align = ' align="right"'
+ str = ''
+ minutes, seconds = divmod(dict[type], 60)
+ hours, minutes = divmod(minutes, 60)
+ days, hours = divmod(hours, 24)
+ if(days):
+ str += '%dd' % days
+ if(hours):
+ str += '%02d:' % hours
+ ret = str + '%02d:%02d' % (minutes, seconds)
+ else:
+ ret = dict[type]
+ return '<td%s>%s</td>' % (align, ret)
+
+ def html(dicts, order, headings, stream, totals):
+ sorted = multisort(dicts, order)
+ stream.write('''<!DOCTYPE html PUBLIC "-//W3C/DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
+ <html>
+ <title>Pure-FTPd server status</title>
+ <body bgcolor="#ffffff" text="#000000">
+ ''')
+ if(totals):
+ stream.write('<table cellspacing="4" border="2" cellpadding="4">')
+ stream.write('<tr><th>Account</th><th>Total Bandwidth</th></tr>')
+ for k in totals.keys():
+ stream.write('<tr><td>%s</td>' % k)
+ stream.write('<td>%d&nbsp;%s/s</td></tr>\n' % size_abbrev(totals[k])[:2])
+ stream.write('</table><BR>\n')
+ stream.write('<div align="center">')
+ stream.write('<table width="100%" cellspacing="4" border="2" cellpadding="4">')
+ for k in headings:
+ stream.write('<th>%s</th>' % col_heading(k))
+ stream.write('\n')
+ for d in sorted:
+ stream.write('<tr valign="middle">\n')
+ for k in headings:
+ stream.write('%s' % celltext(d, k))
+ stream.write('\n</tr>\n')
+ stream.write('</table></div></body></html>\n')
+
+ def arg_expand(list, opts):
+ optmap = {
+ 'A':'account',
+ 'B':'bandwidth',
+ 'C':'current_size',
+ 'F':'file',
+ 'H':'host',
+ 'L':'localhost',
+ 'O':'localport',
+ 'P':'percentage',
+ 'D':'pid',
+ 'R':'resume',
+ 'S':'state',
+ 'T':'time',
+ 'X':'stats',
+ 'Z':'total_size' }
+ for l in opts:
+ if optmap.has_key(l):
+ list.append(optmap[l])
+ else:
+ print 'unrecognized column %s' % l
+ sys.exit(1)
+
+ def usage():
+ print '''usage: html_ftpwho.py [options]
+ -c <orderstr> columns to output (default "AXTSHF")
+ -o <orderstr> sort order (default "SABT")
+ -t show totals per account
+
+ <orderstr> is a string of letters, each representing a client attribute:
+ A - account
+ B - bandwidth
+ C - current_size
+ F - file
+ H - host
+ L - localhost
+ O - localport
+ P - percentage
+ D - pid
+ R - resume
+ S - state
+ T - time
+ X - stats
+ Z - total_size
+ '''
+ sys.exit(1)
+
+ try:
+ optlist, args = getopt.getopt(sys.argv[1:], 'hc:o:t')
+ except getopt.error, msg:
+ print msg
+ usage()
+
+ ord_arg = ''
+ col_arg = ''
+ show_totals = 0
+ for opt in optlist:
+ if '-c' == opt[0]:
+ col_arg += opt[1]
+ elif '-h' == opt[0]:
+ usage()
+ elif '-o' == opt[0]:
+ ord_arg += opt[1]
+ elif '-t' == opt[0]:
+ show_totals = 1
+ else:
+ print 'unrecognized option "%s"' % opt[0]
+ usage()
+
+ if not ord_arg:
+ ord_arg = 'SABT'
+ if not col_arg:
+ col_arg = 'AXTSHF'
+ order = []
+ columns = []
+ arg_expand(order, ord_arg)
+ arg_expand(columns, col_arg)
+
+ cl = pure_ftpwho.clients()
+ totals = {}
+ if show_totals:
+ for c in cl:
+ if c.has_key('bandwidth'):
+ try:
+ totals[c['account']] += c['bandwidth']
+ except KeyError:
+ totals[c['account']] = c['bandwidth']
+
+ html(cl, order, columns, sys.stdout, totals)
+
diff --git a/net-ftp/pure-ftpd/pure-ftpd-0.98.7-r2.ebuild b/net-ftp/pure-ftpd/pure-ftpd-0.98.7-r2.ebuild
deleted file mode 100644
index 3e396e852864..000000000000
--- a/net-ftp/pure-ftpd/pure-ftpd-0.98.7-r2.ebuild
+++ /dev/null
@@ -1,44 +0,0 @@
-# Copyright 1999-2000 Gentoo Technologies, Inc.
-# Distributed under the terms of the GNU General Public License, v2 or later
-# Author Prakash Shetty (Crux) <ps@gnuos.org>
-
-A=${P}.tar.gz
-S=${WORKDIR}/${P}
-DESCRIPTION="A Fast Production Quality FTP Server"
-SRC_URI="http://prdownloads.sourceforge.net/pureftpd/${A}"
-HOMEPAGE="http://pureftpd.sourceforge.net"
-
-DEPEND=">=sys-libs/glibc-2.1.3
- >=sys-libs/pam-0.75"
-
-src_compile() {
-
- cd ${S}
- try ./configure --prefix=/usr --with-throttling --with-virtualhosts\
- --with-ratios --with-largefile
- try make
-
-}
-
-src_install () {
-
- cd ${S}
- try make DESTDIR=${D} install
- dodoc COPYING ChangeLog README README.Configuration-File
- dodoc README.Contrib README.LDAP README.Netfilter
- dodir /etc/pure-ftpd
-}
-
-pkg_config() {
- echo "This config script will add pftpd lines to your /etc/xinetd.conf."
- echo "Press control-C to abort, hit Enter to continue."
- echo
- read
- cat ${FILESDIR}/pftpd.inetd >> ${ROOT}etc/inetd.conf
- ln -s /dev/null /etc/pure-ftpd/127.0.0.1
- /etc/rc.d/init.d/svc-xinetd restart
- echo "Modifications applied."
-}
-
-
-
diff --git a/net-ftp/pure-ftpd/pure-ftpd-0.99.ebuild b/net-ftp/pure-ftpd/pure-ftpd-0.99.ebuild
new file mode 100644
index 000000000000..da528e5c89af
--- /dev/null
+++ b/net-ftp/pure-ftpd/pure-ftpd-0.99.ebuild
@@ -0,0 +1,54 @@
+# Copyright 1999-2000 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License, v2 or later
+# Author Parag Mehta <pm@gentoo.org>
+
+A=${P}.tar.gz
+S=${WORKDIR}/${P}
+DESCRIPTION="A Fast Production Quality FTP Server - Bug fixes backported from 0.99 . No new feature. Use this version on production servers."
+SRC_URI="http://prdownloads.sourceforge.net/pureftpd/${A}"
+HOMEPAGE="http://pureftpd.sourceforge.net"
+
+DEPEND=">=sys-libs/glibc-2.1.3
+ >=sys-libs/pam-0.75"
+
+src_compile() {
+
+ cd ${S}
+ try ./configure --prefix=/usr --with-throttling --with-virtualhosts \
+ --with-ratios --with-largefile --with-cookie --with-welcomemsg \
+ --with-altlog --with-ftpwho
+ try make
+
+}
+
+src_install () {
+
+ cd ${S}
+ try make DESTDIR=${D} install
+ dodoc COPYING ChangeLog README README.Configuration-File
+ dodoc README.Contrib README.LDAP README.Netfilter
+ dodir /etc/pure-ftpd
+ cp $S/configuration-file/*.pl ${D}/usr/sbin/
+ cp $S/configuration-file/*.py ${D}/usr/sbin/
+ cp $S/configuration-file/pure-ftpd.conf ${D}/etc/pure-ftpd/pure-ftpd.conf
+ cp ${FILESDIR}/ftpusers ${D}/etc
+ cp ${FILESDIR}/pure-ftpwho_html.py ${D}/usr/sbin/
+ cp ${FILESDIR}/pure-ftp_xml_python.py ${D}/usr/sbin/
+ echo -e "\033[1;42m\033[1;33m Please do no forget to run, the following syntax : \033[0m"
+ echo -e "\033[1;42m\033[1;33m ebuild pure-ftpd-0.99.ebuild config \033[0m"
+ echo -e "\033[1;42m\033[1;33m This will add the necessary post install config to your system. \033[0m"
+}
+
+pkg_config() {
+ echo "This config script will add pftpd lines to your /etc/xinetd.conf."
+ echo "Press control-C to abort now OR hit Enter to continue."
+ echo
+ read
+ cat ${FILESDIR}/pftpd.inetd >> ${ROOT}etc/inetd.conf
+ ln -s /dev/null /etc/pure-ftpd/127.0.0.1
+ /etc/rc.d/init.d/svc-xinetd restart
+ echo "Modifications applied."
+}
+
+
+