The unified diff between revisions [826db75f..] and [a4cab2b4..] is displayed below. It can also be downloaded as a raw diff.
#
#
# add_file "account.c"
# content [fb4a3d799f80de884ba1f6c703b6532900c192ef]
#
# add_file "account.h"
# content [2868cecce2e6b4ad1a78026da20de1f6d8371cb5]
#
# patch "Makefile.in"
# from [112e899589f2fd132a159e6dcf148b544ff8ae91]
# to [18432081a78218026941c91a605bf3101dda141a]
#
# patch "common-session.c"
# from [2469aa8351074283ffeaaf89f3c56a87f15cc0ed]
# to [1264a49e05001b96e621efa4abf6f9e77402ed71]
#
# patch "debian/README.Debian"
# from [4837372aa9257e0f2b111507c45ee9b415f91bb6]
# to [2683df43210a4d566034f1d09ece581f1b337dbe]
#
# patch "debian/changelog"
# from [0b48636591f4a2c83a575882f346ddc5b3d8bf06]
# to [24a7644afdd8af3aae19d513bf105eca67db29e0]
#
# patch "debian/control"
# from [fe09be771f90bdad78dc5a9a2bfc32bc0d360c41]
# to [d8fc53738944f7433a83c506ceb0e0946056f8bb]
#
# patch "debian/dropbear.conffiles"
# from [113171be673739ad226f8eb9445540221090069a]
# to [0439782cc45249e65c2e450209200dcaef339710]
#
# patch "debian/dropbear.init"
# from [1639105b9863144cc4aea7991903b1a8d1810b1d]
# to [8a1d7d2adb4d35a13b594a0bfe8faf0f6c38a0cf]
#
# patch "debian/dropbear.postinst"
# from [f1a7b7e6b65e9a3883b2adee3127f9a573886a38]
# to [85bdd4d6328165d534bd5739cd5da7a27636db07]
#
# patch "debian/dropbear.postrm"
# from [3068545aa53768bd2a64353635d535609123ea6a]
# to [ed40c011e1127b5751fd799c89b5143120f8fa62]
#
# patch "debian/dropbear.prerm"
# from [9ddba283f9d790a33074a0b5e6d51e3c7e098741]
# to [c3c2968d21e5e7824f20c1b5c41cabf9d6dda076]
#
# patch "debian/rules"
# from [58521b19dfa543e95e1c580e894b09df24cc514b]
# to [53602f3c8cbda45fb8a451da2d3949ea5043f352]
#
# patch "options.h"
# from [4b11e0cc8a977bdeb9c380ad273ac07a53f8f38a]
# to [562d600e35b6a1ef1ab8d8df1dd61654056bd697]
#
# patch "packet.c"
# from [6ec289d04a1bb71593461e80acce2d37fa1eb536]
# to [01803cc5860fe470ae70a883d807579b3bd0fc68]
#
# patch "svr-auth.c"
# from [fab10976a9ca57a482a384cedd794de7f0247e40]
# to [97bfdca33556c1e1910c6c95561428cf1a26d898]
#
============================================================
--- account.c fb4a3d799f80de884ba1f6c703b6532900c192ef
+++ account.c fb4a3d799f80de884ba1f6c703b6532900c192ef
@@ -0,0 +1,102 @@
+/*
+ * account.c:
+ * Accounting for sshd.
+ *
+ * Based on code (c) 2001 Chris Lightfoot.
+ * Modified 2001 by Matt Johnston for use with dispense
+ *
+ */
+
+#include <sys/types.h>
+#include <stdlib.h>
+
+#include <ucc.h>
+
+#include "dbutil.h"
+
+size_t total_read, total_written;
+char *acct_user = 0;
+int isctrl = 0;
+
+/*
+ * Validates the user, checking for sufficient coke credit etc.
+ * Assuming that the username is the same as the coke account (pretty
+ * sure this is valid, what would dispense client for drinks do???)
+ * If it isn't valid, sent DROPBEAR_FAILURE, else DROPBEAR_SUCCESS
+ */
+int check_coke_user(char *name) {
+
+ SetCokebankToSocks();
+ if (!name) {
+ cokebank_close();
+ dropbear_exit("cokebank eek!");
+ }
+
+ isctrl = InCokeControl(name);
+ if(!cokebank_open() || cokebank_get(name)-(isctrl?COKE_CONTROLLERS_MIN:0)<CONNECT_MIN) {
+ cokebank_close();
+ return DROPBEAR_FAILURE;
+ }
+ cokebank_close();
+
+ /* name is valid */
+ if (acct_user)
+ m_free(acct_user);
+ acct_user = strdup(name);
+ if (!acct_user) {
+ dropbear_exit("strdup failed for accounting");
+ }
+
+ return DROPBEAR_SUCCESS;
+}
+
+void acct_reset() {
+ if (acct_user)
+ m_free(acct_user);
+ total_read = total_written = 0;
+}
+
+void acct_add(size_t r, size_t w) {
+
+ total_read += r;
+ total_written += w;
+
+ SetCokebankToSocks();
+
+ if (total_read > CUNIT)
+ {
+ if(!cokebank_open() || (cokebank_add_bytes(acct_user, total_read, "Incoming SSH traffic", "-server-", "sshd")))
+ {
+ cokebank_close();
+ dropbear_exit("UCC Incoming Connection Server -- INFO: Error adjusting coke balance.");
+ }
+ else if(cokebank_get(acct_user)-(isctrl?COKE_CONTROLLERS_MIN:0)<CONNECT_MIN) {
+ cokebank_close();
+ dropbear_exit("UCC Incoming Connection Server -- INFO: Coke balance bad, low or missing.");
+ }
+ cokebank_close();
+ total_read = total_written = 0;
+ }
+}
+
+/* Called on connection close etc, or any other time */
+void acct_report() {
+
+ if (total_read)
+ {
+ if (acct_user)
+ {
+ SetCokebankToSocks();
+ if(!cokebank_open() || cokebank_add_bytes(acct_user, total_read,"Incoming SSH traffic","-server-","sshd"))
+ {
+ cokebank_close();
+ dropbear_exit("UCC Incoming Connection Server -- INFO: Error adjusting coke balance.");
+ }
+ else
+ {
+ cokebank_close();
+ total_read = total_written = 0;
+ }
+ }
+ }
+}
============================================================
--- account.h 2868cecce2e6b4ad1a78026da20de1f6d8371cb5
+++ account.h 2868cecce2e6b4ad1a78026da20de1f6d8371cb5
@@ -0,0 +1,9 @@
+#ifndef ACCOUNT_H
+#define ACCOUNT_H
+
+int check_coke_user(char *name);
+void acct_reset();
+void acct_add(size_t r, size_t w);
+void acct_report();
+
+#endif /* ACCOUNT_H */
============================================================
--- Makefile.in 112e899589f2fd132a159e6dcf148b544ff8ae91
+++ Makefile.in 18432081a78218026941c91a605bf3101dda141a
@@ -10,7 +10,7 @@ ifndef PROGRAMS
# Hopefully that seems intuitive.
ifndef PROGRAMS
- PROGRAMS=dropbear dbclient dropbearkey dropbearconvert
+ PROGRAMS=cokedropbear
endif
LTC=libtomcrypt/libtomcrypt.a
@@ -25,7 +25,7 @@ SVROBJS=svr-kex.o svr-algo.o svr-auth.o
SVROBJS=svr-kex.o svr-algo.o svr-auth.o sshpty.o \
svr-authpasswd.o svr-authpubkey.o svr-session.o svr-service.o \
svr-chansession.o svr-runopts.o svr-agentfwd.o svr-main.o svr-x11fwd.o\
- svr-tcpfwd.o svr-authpam.o
+ svr-tcpfwd.o svr-authpam.o account.o
CLIOBJS=cli-algo.o cli-main.o cli-auth.o cli-authpasswd.o cli-kex.o \
cli-session.o cli-service.o cli-runopts.o cli-chansession.o \
@@ -47,9 +47,9 @@ HEADERS=options.h dbutil.h session.h pac
debug.h channel.h chansession.h config.h queue.h sshpty.h \
termcodes.h gendss.h genrsa.h runopts.h includes.h \
loginrec.h atomicio.h x11fwd.h agentfwd.h tcpfwd.h compat.h \
- listener.h fake-rfc2553.h
+ listener.h fake-rfc2553.h account.h
-dropbearobjs=$(COMMONOBJS) $(CLISVROBJS) $(SVROBJS)
+cokedropbearobjs=$(COMMONOBJS) $(CLISVROBJS) $(SVROBJS)
dbclientobjs=$(COMMONOBJS) $(CLISVROBJS) $(CLIOBJS)
dropbearkeyobjs=$(COMMONOBJS) $(KEYOBJS)
dropbearconvertobjs=$(COMMONOBJS) $(CONVERTOBJS)
@@ -70,7 +70,7 @@ CFLAGS=-I. -I$(srcdir)/libtomcrypt/src/h
STRIP=@STRIP@
INSTALL=@INSTALL@
CFLAGS=-I. -I$(srcdir)/libtomcrypt/src/headers/ @CFLAGS@
-LIBS=$(LTC) $(LTM) @LIBS@
+LIBS=$(LTC) $(LTM) @LIBS@ -lucc
LDFLAGS=@LDFLAGS@
EXEEXT=@EXEEXT@
@@ -78,7 +78,7 @@ space:= $(empty) $(empty)
# whether we're building client, server, or both for the common objects.
# evilness so we detect 'dropbear' by itself as a word
space:= $(empty) $(empty)
-ifneq (,$(strip $(foreach prog, $(PROGRAMS), $(findstring ZdropbearZ, Z$(prog)Z))))
+ifneq (,$(strip $(foreach prog, $(PROGRAMS), $(findstring ZcokedropbearZ, Z$(prog)Z))))
CFLAGS+= -DDROPBEAR_SERVER
endif
ifneq (,$(strip $(foreach prog, $(PROGRAMS), $(findstring ZdbclientZ, Z$(prog)Z))))
@@ -133,12 +133,12 @@ insmulti%: dropbearmulti
-rm -f $(DESTDIR)$(bindir)/$*$(EXEEXT)
-ln -s $(DESTDIR)$(bindir)/dropbearmulti$(EXEEXT) $(DESTDIR)$(bindir)/$*$(EXEEXT)
-# dropbear should go in sbin, so it needs a seperate rule
-inst_dropbear: dropbear
+# cokedropbear should go in sbin, so it needs a seperate rule
+inst_cokedropbear: cokedropbear
$(INSTALL) -d -m 755 $(DESTDIR)$(sbindir)
- $(INSTALL) -m 755 dropbear$(EXEEXT) $(DESTDIR)$(sbindir)
- -chown root $(DESTDIR)$(sbindir)/dropbear$(EXEEXT)
- -chgrp 0 $(DESTDIR)$(sbindir)/dropbear$(EXEEXT)
+ $(INSTALL) -m 755 cokedropbear$(EXEEXT) $(DESTDIR)$(sbindir)
+ -chown root $(DESTDIR)$(sbindir)/cokedropbear$(EXEEXT)
+ -chgrp 0 $(DESTDIR)$(sbindir)/cokedropbear$(EXEEXT)
inst_%: $*
$(INSTALL) -d -m 755 $(DESTDIR)$(bindir)
@@ -148,12 +148,12 @@ inst_%: $*
# for some reason the rule further down doesn't like $($@objs) as a prereq.
-dropbear: $(dropbearobjs)
+cokedropbear: $(cokedropbearobjs)
dbclient: $(dbclientobjs)
dropbearkey: $(dropbearkeyobjs)
dropbearconvert: $(dropbearconvertobjs)
-dropbear dbclient dropbearkey dropbearconvert: $(HEADERS) $(LTC) $(LTM) \
+cokedropbear dbclient dropbearkey dropbearconvert: $(HEADERS) $(LTC) $(LTM) \
Makefile
$(LD) $(LDFLAGS) -o $@$(EXEEXT) $($@objs) $(LIBS)
@@ -198,7 +198,7 @@ thisclean:
clean: ltc-clean ltm-clean thisclean
thisclean:
- -rm -f dropbear dbclient dropbearkey dropbearconvert scp scp-progress \
+ -rm -f cokedropbear dbclient dropbearkey dropbearconvert scp scp-progress \
dropbearmulti *.o *.da *.bb *.bbg *.prof
distclean: clean tidy
============================================================
--- common-session.c 2469aa8351074283ffeaaf89f3c56a87f15cc0ed
+++ common-session.c 1264a49e05001b96e621efa4abf6f9e77402ed71
@@ -34,6 +34,7 @@
#include "kex.h"
#include "channel.h"
#include "atomicio.h"
+#include "account.h"
static void checktimeouts();
static int ident_readln(int fd, char* buf, int count);
@@ -108,7 +109,11 @@ void common_session_init(int sock, char*
ses.allowprivport = 0;
+ if (IS_DROPBEAR_SERVER) {
+ acct_reset();
+ }
+
TRACE(("leave session_init"))
}
@@ -207,6 +212,10 @@ void common_session_cleanup() {
TRACE(("leave session_cleanup: !sessinitdone"))
return;
}
+
+ if (IS_DROPBEAR_SERVER) {
+ acct_report();
+ }
m_free(ses.session_id);
m_burn(ses.keys, sizeof(struct key_context));
============================================================
--- debian/README.Debian 4837372aa9257e0f2b111507c45ee9b415f91bb6
+++ debian/README.Debian 2683df43210a4d566034f1d09ece581f1b337dbe
@@ -1,3 +1,5 @@
+This is the modified UCC dispense-linked SSH server.
+
Dropbear for Debian
-------------------
============================================================
--- debian/changelog 0b48636591f4a2c83a575882f346ddc5b3d8bf06
+++ debian/changelog 24a7644afdd8af3aae19d513bf105eca67db29e0
@@ -1,3 +1,9 @@
+cokedropbear (0.46-0.1-dispense) unstable; urgency=medium
+
+ * With dispense stuff.
+
+ -- Matt Johnston <matt@ucc.asn.au> Fri, 29 July 2005 13:32:55 +0800
+
dropbear (0.46-0.1) unstable; urgency=medium
* New upstream release, various fixes.
============================================================
--- debian/control fe09be771f90bdad78dc5a9a2bfc32bc0d360c41
+++ debian/control d8fc53738944f7433a83c506ceb0e0946056f8bb
@@ -1,20 +1,17 @@
-Source: dropbear
+Source: cokedropbear
Section: net
Priority: optional
-Maintainer: Gerrit Pape <pape@smarden.org>
+Maintainer: Matt Johnston <matt@ucc.asn.au>
Build-Depends: libz-dev
Standards-Version: 3.6.1.0
-Package: dropbear
+Package: cokedropbear
Architecture: any
Depends: ${shlibs:Depends}
Suggests: ssh, runit
-Description: lightweight SSH2 server
- dropbear is a SSH 2 server designed to be small enough to be used in small
- memory environments, while still being functional and secure enough for
- general use.
+Description: lightweight SSH2 server, modified for UCC dispense
+ This is modified for UCC's dispense.
.
- It implements most required features of the SSH 2 protocol, and other
- features such as X11 and authentication agent forwarding.
+ Dropbear is a SSH 2 server.
.
See http://matt.ucc.asn.au/dropbear/dropbear.html
============================================================
--- debian/dropbear.conffiles 113171be673739ad226f8eb9445540221090069a
+++ debian/dropbear.conffiles 0439782cc45249e65c2e450209200dcaef339710
@@ -1,3 +1 @@
-/etc/init.d/dropbear
-/etc/dropbear/run
-/etc/dropbear/log/run
+/etc/init.d/cokedropbear
============================================================
--- debian/dropbear.init 1639105b9863144cc4aea7991903b1a8d1810b1d
+++ debian/dropbear.init 8a1d7d2adb4d35a13b594a0bfe8faf0f6c38a0cf
@@ -1,25 +1,22 @@
#!/bin/sh
#
-# Do not configure this file. Edit /etc/default/dropbear instead!
+# Do not configure this file. Edit /etc/default/cokedropbear instead!
#
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
-DAEMON=/usr/sbin/dropbear
-NAME=dropbear
-DESC="Dropbear SSH server"
+DAEMON=/usr/sbin/cokedropbear
+NAME=cokedropbear
+DESC="UCC Dispense Dropbear SSH server"
-DROPBEAR_PORT=22
+DROPBEAR_PORT=376
DROPBEAR_EXTRA_ARGS=
NO_START=0
set -e
-cancel() { echo "$1" >&2; exit 0; };
-test ! -r /etc/default/dropbear || . /etc/default/dropbear
-test "$NO_START" = "0" || cancel 'NO_START is not set to zero.'
-test -x "$DAEMON" || cancel "$DAEMON does not exist or is not executable."
-test ! -h /var/service/dropbear || \
- cancel '/var/service/dropbear exists, service is controlled through runit.'
+test ! -r /etc/default/cokedropbear || . /etc/default/cokedropbear
+test "$NO_START" = "0" || exit 0
+test -x "$DAEMON" || exit 0
test -z "$DROPBEAR_BANNER" || \
DROPBEAR_EXTRA_ARGS="$DROPBEAR_EXTRA_ARGS -b $DROPBEAR_BANNER"
============================================================
--- debian/dropbear.postinst f1a7b7e6b65e9a3883b2adee3127f9a573886a38
+++ debian/dropbear.postinst 85bdd4d6328165d534bd5739cd5da7a27636db07
@@ -3,44 +3,12 @@ test "$1" = 'configure' || exit 0
test "$1" = 'configure' || exit 0
-if test ! -e /etc/dropbear/dropbear_rsa_host_key; then
- if test -f /etc/ssh/ssh_host_rsa_key; then
- echo "Converting existing OpenSSH RSA host key to Dropbear format."
- /usr/lib/dropbear/dropbearconvert openssh dropbear \
- /etc/ssh/ssh_host_rsa_key /etc/dropbear/dropbear_rsa_host_key
- else
- echo "Generating Dropbear RSA key. Please wait."
- dropbearkey -t rsa -f /etc/dropbear/dropbear_rsa_host_key
- fi
-fi
-if test ! -e /etc/dropbear/dropbear_dss_host_key; then
- if test -f /etc/ssh/ssh_host_dsa_key; then
- echo "Converting existing OpenSSH RSA host key to Dropbear format."
- /usr/lib/dropbear/dropbearconvert openssh dropbear \
- /etc/ssh/ssh_host_dsa_key /etc/dropbear/dropbear_dss_host_key
- else
- echo "Generating Dropbear DSS key. Please wait."
- dropbearkey -t dss -f /etc/dropbear/dropbear_dss_host_key
- fi
-fi
-if test ! -s /etc/default/dropbear; then
- # check whether OpenSSH seems to be installed.
- if test -x /usr/sbin/sshd; then
- cat <<EOT
-OpenSSH appears to be installed. Setting /etc/default/dropbear so that
-Dropbear will not start by default. Edit this file to change this behaviour.
+echo "You must manually convert your OpenSSH host keys if required."
-EOT
- cat >>/etc/default/dropbear <<EOT
-# disabled because OpenSSH is installed
-# change to NO_START=0 to enable Dropbear
-NO_START=1
-
-EOT
- fi
- cat >>/etc/default/dropbear <<EOT
+if test ! -s /etc/default/cokedropbear; then
+ cat >>/etc/default/cokedropbear <<EOT
# the TCP port that Dropbear listens on
-DROPBEAR_PORT=22
+DROPBEAR_PORT=376
# any additional arguments for Dropbear
DROPBEAR_EXTRA_ARGS=
@@ -57,11 +25,11 @@ fi
EOT
fi
-if test -x /etc/init.d/dropbear; then
- update-rc.d dropbear defaults >/dev/null
+if test -x /etc/init.d/cokedropbear; then
+ update-rc.d cokedropbear defaults >/dev/null
if test -x /usr/sbin/invoke-rc.d; then
- invoke-rc.d dropbear restart
+ invoke-rc.d cokedropbear start
else
- /etc/init.d/dropbear restart
+ /etc/init.d/cokedropbear start
fi
fi
============================================================
--- debian/dropbear.postrm 3068545aa53768bd2a64353635d535609123ea6a
+++ debian/dropbear.postrm ed40c011e1127b5751fd799c89b5143120f8fa62
@@ -2,11 +2,4 @@ test "$1" = 'purge' || exit 0
set -e
test "$1" = 'purge' || exit 0
+update-rc.d cokedropbear remove >/dev/null
-if test -e /etc/dropbear; then
- rm -f /etc/dropbear/dropbear_rsa_host_key
- rm -f /etc/dropbear/dropbear_dss_host_key
- rmdir --ignore-fail-on-non-empty /etc/dropbear
-fi
-update-rc.d dropbear remove >/dev/null
-rm -f /etc/default/dropbear
-rm -rf /etc/dropbear/supervise /etc/dropbear/log/supervise
============================================================
--- debian/dropbear.prerm 9ddba283f9d790a33074a0b5e6d51e3c7e098741
+++ debian/dropbear.prerm c3c2968d21e5e7824f20c1b5c41cabf9d6dda076
@@ -2,10 +2,10 @@ test "$1" = 'remove' || test "$1" = 'dec
set -e
test "$1" = 'remove' || test "$1" = 'deconfigure' || exit 0
-if test -x /etc/init.d/dropbear; then
+if test -x /etc/init.d/cokedropbear; then
if test -x /usr/sbin/invoke-rc.d; then
- invoke-rc.d dropbear stop
+ invoke-rc.d cokedropbear stop
else
- /etc/init.d/dropbear stop
+ /etc/init.d/cokedropbear stop
fi
fi
============================================================
--- debian/rules 58521b19dfa543e95e1c580e894b09df24cc514b
+++ debian/rules 53602f3c8cbda45fb8a451da2d3949ea5043f352
@@ -23,7 +23,7 @@ endif
CC =diet -v -Os gcc -nostdinc
endif
-DIR =$(shell pwd)/debian/dropbear
+DIR =$(shell pwd)/debian/cokedropbear
patch: deb-checkdir patch-stamp
patch-stamp:
@@ -35,7 +35,7 @@ config.status: patch-stamp configure
config.status: patch-stamp configure
CC='$(CC)' \
CFLAGS='$(CFLAGS)'' -DSFTPSERVER_PATH="\"/usr/lib/sftp-server\""' \
- ./configure --host='$(DEB_HOST_GNU_TYPE)' \
+ ./configure --host='$(DEB_HOST_GNU_TYPE)' --enable-pam\
--build='$(DEB_BUILD_GNU_TYPE)' --prefix=/usr \
--mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info \
$(CONFFLAGS)
@@ -60,44 +60,21 @@ install: deb-checkdir deb-checkuid build
install -d -m0755 '$(DIR)'/etc/dropbear
# programs
install -d -m0755 '$(DIR)'/usr/sbin
- install -m0755 dropbear '$(DIR)'/usr/sbin/dropbear
- install -d -m0755 '$(DIR)'/usr/bin
- install -m0755 dbclient '$(DIR)'/usr/bin/dbclient
- install -m0755 dropbearkey '$(DIR)'/usr/bin/dropbearkey
- install -d -m0755 '$(DIR)'/usr/lib/dropbear
- install -m0755 dropbearconvert \
- '$(DIR)'/usr/lib/dropbear/dropbearconvert
- $(STRIP) -R .comment -R .note '$(DIR)'/usr/sbin/* \
- '$(DIR)'/usr/bin/* '$(DIR)'/usr/lib/dropbear/*
+ install -m0755 cokedropbear '$(DIR)'/usr/sbin/cokedropbear
+ $(STRIP) -R .comment -R .note '$(DIR)'/usr/sbin/*
# init and run scripts
install -d -m0755 '$(DIR)'/etc/init.d
- install -m0755 debian/dropbear.init '$(DIR)'/etc/init.d/dropbear
- install -m0755 debian/service/run '$(DIR)'/etc/dropbear/run
- install -d -m0755 '$(DIR)'/etc/dropbear/log
- install -m0755 debian/service/log '$(DIR)'/etc/dropbear/log/run
- ln -s /var/log/dropbear '$(DIR)'/etc/dropbear/log/main
- ln -s /var/run/dropbear '$(DIR)'/etc/dropbear/supervise
- ln -s /var/run/dropbear.log '$(DIR)'/etc/dropbear/log/supervise
- # man pages
- install -d -m0755 '$(DIR)'/usr/share/man/man8
- for i in dropbear.8 dropbearkey.8; do \
- install -m644 $$i '$(DIR)'/usr/share/man/man8/ || exit 1; \
- done
- gzip -9 '$(DIR)'/usr/share/man/man8/*.8
- install -d -m0755 '$(DIR)'/usr/share/man/man1
- install -m644 dbclient.1 '$(DIR)'/usr/share/man/man1/
- gzip -9 '$(DIR)'/usr/share/man/man1/*.1
+ install -m0755 debian/dropbear.init '$(DIR)'/etc/init.d/cokedropbear
# copyright, changelog
cat debian/copyright.in LICENSE >debian/copyright
test -r changelog || ln -s CHANGES changelog
binary-indep:
-binary-arch: install dropbear.deb
+binary-arch: install cokedropbear.deb
test '$(CC)' != 'gcc' || \
- dpkg-shlibdeps '$(DIR)'/usr/sbin/* '$(DIR)'/usr/bin/* \
- '$(DIR)'/usr/lib/dropbear/*
- dpkg-gencontrol -isp -pdropbear -P'$(DIR)'
+ dpkg-shlibdeps '$(DIR)'/usr/sbin/*
+ dpkg-gencontrol -isp -pcokedropbear -P'$(DIR)'
dpkg -b '$(DIR)' ..
binary: binary-arch binary-indep
============================================================
--- options.h 4b11e0cc8a977bdeb9c380ad273ac07a53f8f38a
+++ options.h 562d600e35b6a1ef1ab8d8df1dd61654056bd697
@@ -127,8 +127,8 @@ etc) slower (perhaps by 50%). Recommende
* but there's an interface via a PAM module - don't bother using it otherwise.
* You can't enable both PASSWORD and PAM. */
-#define ENABLE_SVR_PASSWORD_AUTH
-/*#define ENABLE_SVR_PAM_AUTH*/
+/*#define ENABLE_SVR_PASSWORD_AUTH*/
+#define ENABLE_SVR_PAM_AUTH
#define ENABLE_SVR_PUBKEY_AUTH
#define ENABLE_CLI_PASSWORD_AUTH
@@ -172,7 +172,7 @@ etc) slower (perhaps by 50%). Recommende
/* The file to store the daemon's process ID, for shutdown scripts etc */
#ifndef DROPBEAR_PIDFILE
-#define DROPBEAR_PIDFILE "/var/run/dropbear.pid"
+#define DROPBEAR_PIDFILE "/var/run/cokedropbear.pid"
#endif
/* The command to invoke for xauth when using X11 forwarding.
@@ -200,7 +200,7 @@ etc) slower (perhaps by 50%). Recommende
*******************************************************************/
#ifndef DROPBEAR_VERSION
-#define DROPBEAR_VERSION "0.46"
+#define DROPBEAR_VERSION "0.46-dispense"
#endif
#define LOCAL_IDENT "SSH-2.0-dropbear_" DROPBEAR_VERSION
============================================================
--- packet.c 6ec289d04a1bb71593461e80acce2d37fa1eb536
+++ packet.c 01803cc5860fe470ae70a883d807579b3bd0fc68
@@ -34,6 +34,7 @@
#include "service.h"
#include "auth.h"
#include "channel.h"
+#include "account.h"
static void read_packet_init();
static void writemac(buffer * outputbuffer, buffer * clearwritebuf);
@@ -139,6 +140,10 @@ void read_packet() {
if ((unsigned int)len == maxlen) {
/* The whole packet has been read */
+ if (IS_DROPBEAR_SERVER) {
+ /* coke charging */
+ acct_add(ses.readbuf->len, 0);
+ }
decrypt_packet();
/* The main select() loop process_packet() to
* handle the packet contents... */
============================================================
--- svr-auth.c fab10976a9ca57a482a384cedd794de7f0247e40
+++ svr-auth.c 97bfdca33556c1e1910c6c95561428cf1a26d898
@@ -33,6 +33,7 @@
#include "packet.h"
#include "auth.h"
#include "runopts.h"
+#include "account.h"
static void authclear();
static int checkusername(unsigned char *username, unsigned int userlen);
@@ -277,6 +278,15 @@ goodshell:
endusershell();
TRACE(("matching shell"))
+ /* check for coke balance good */
+ if (check_coke_user(username) == DROPBEAR_FAILURE) {
+ dropbear_log(LOG_WARNING,
+ "disallowing login for '%s' cokebank balance low, bad, etc",
+ username);
+ send_msg_userauth_failure(0, 1);
+ return DROPBEAR_FAILURE;
+ }
+
TRACE(("uid = %d", ses.authstate.pw->pw_uid))
TRACE(("leave checkusername"))
return DROPBEAR_SUCCESS;