The unified diff between revisions [5cb8d5a7..] and [f792a539..] 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 [20073ce1c29bdfdf4a1c9a19b27cd3cf1ac01751]
#    to [de2f6d0faf104619691b538174047350fe8dccfa]
#
# patch "common-session.c"
#  from [08f75d08c5618f1c23377436c6cbee3a6f9359d7]
#    to [a11a4b382ef50264a4f6d4262de9b1ac049a064c]
#
# patch "debian/README.Debian"
#  from [4837372aa9257e0f2b111507c45ee9b415f91bb6]
#    to [2683df43210a4d566034f1d09ece581f1b337dbe]
#
# patch "debian/changelog"
#  from [83250653adb870ad412b46c8f8d63f5fa5acbcea]
#    to [d60ac3bcda310652c1f3fbf7525dcce07600804a]
#
# patch "debian/control"
#  from [fe09be771f90bdad78dc5a9a2bfc32bc0d360c41]
#    to [d8fc53738944f7433a83c506ceb0e0946056f8bb]
#
# patch "debian/dropbear.conffiles"
#  from [113171be673739ad226f8eb9445540221090069a]
#    to [0439782cc45249e65c2e450209200dcaef339710]
#
# patch "debian/dropbear.init"
#  from [edbfabaa3a4b33bdddbc2d9603345db2349a2708]
#    to [8a1d7d2adb4d35a13b594a0bfe8faf0f6c38a0cf]
#
# patch "debian/dropbear.postinst"
#  from [c1d443d9a4b3d18024f79ed28da4f2cda89c5981]
#    to [85bdd4d6328165d534bd5739cd5da7a27636db07]
#
# patch "debian/dropbear.postrm"
#  from [3068545aa53768bd2a64353635d535609123ea6a]
#    to [ed40c011e1127b5751fd799c89b5143120f8fa62]
#
# patch "debian/dropbear.prerm"
#  from [29a798b9b9c0883f37e59cd4f93f282c0f26f994]
#    to [53ede32224237c8417c6b756c8fb308140d668b0]
#
# patch "debian/rules"
#  from [aae3ee6d5edbc1865dafbdf08953c04adc86e0b9]
#    to [8866091b695e7c70282625a8240cb02296cde4e4]
#
# patch "options.h"
#  from [4bfe6850de1ff24e37f06c6acb7800a72e2ce0b5]
#    to [918550e301b2b551088b78a713cf45d97c62d361]
#
# patch "packet.c"
#  from [a23ba4bf643006ed480a7dc3f5db0643e77bcc17]
#    to [2c66fd1450ac8a5e63adf49b8f9a9928b23b5699]
#
# patch "svr-auth.c"
#  from [aa0862ce0910cee5bfb9c0f57d1c482c9370c225]
#    to [c5c8b31319fa963acf444a61da0471dfa434bf8a]
#
============================================================
--- 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	20073ce1c29bdfdf4a1c9a19b27cd3cf1ac01751
+++ Makefile.in	de2f6d0faf104619691b538174047350fe8dccfa
@@ -9,7 +9,7 @@ ifndef PROGRAMS
 # Hopefully that seems intuitive.

 ifndef PROGRAMS
-	PROGRAMS=dropbear dbclient dropbearkey dropbearconvert
+	PROGRAMS=cokedropbear
 endif

 LTC=libtomcrypt/libtomcrypt.a
@@ -24,7 +24,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 \
@@ -46,9 +46,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)
@@ -66,7 +66,7 @@ CFLAGS=-Ilibtomcrypt @CFLAGS@
 STRIP=@STRIP@
 INSTALL=@INSTALL@
 CFLAGS=-Ilibtomcrypt @CFLAGS@
-LIBS=$(LTC) $(LTM) @LIBS@
+LIBS=$(LTC) $(LTM) @LIBS@ -lucc
 LDFLAGS=@LDFLAGS@

 EXEEXT=@EXEEXT@
@@ -74,7 +74,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))))
@@ -132,12 +132,12 @@ insmulti%: dropbearmulti
 	-rm -f $(DESTDIR)$(bindir)/$(SPREFIX)$*$(EXEEXT)
 	-ln -s $(DESTDIR)$(bindir)/$(SPREFIX)dropbearmulti$(EXEEXT) $(DESTDIR)$(bindir)/$(SPREFIX)$*$(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 $(SPREFIX)dropbear$(EXEEXT) $(DESTDIR)$(sbindir)
-	-chown root $(DESTDIR)$(sbindir)/$(SPREFIX)dropbear$(EXEEXT)
-	-chgrp 0 $(DESTDIR)$(sbindir)/$(SPREFIX)dropbear$(EXEEXT)
+	$(INSTALL) -m 755 $(SPREFIX)cokedropbear$(EXEEXT) $(DESTDIR)$(sbindir)
+	-chown root $(DESTDIR)$(sbindir)/$(SPREFIX)cokedropbear$(EXEEXT)
+	-chgrp 0 $(DESTDIR)$(sbindir)/$(SPREFIX)cokedropbear$(EXEEXT)

 inst_%: $*
 	$(INSTALL) -d -m 755 $(DESTDIR)$(bindir)
@@ -147,12 +147,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 $(SPREFIX)$@$(EXEEXT) $($@objs) $(LIBS)

@@ -197,7 +197,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
 	-rm -f staticdropbear staticdropbearkey staticdropbearconvert staticscp
 	-rm -f dropbearmulti staticdropbearmulti
 	-rm -f *.o *.da *.bb *.bbg *.prof
============================================================
--- common-session.c	08f75d08c5618f1c23377436c6cbee3a6f9359d7
+++ common-session.c	a11a4b382ef50264a4f6d4262de9b1ac049a064c
@@ -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);
@@ -107,7 +108,11 @@ void common_session_init(int sock, char*

 	ses.allowprivport = 0;

+	if (IS_DROPBEAR_SERVER) {
+		acct_reset();
+	}

+
 	TRACE(("leave session_init"));
 }

@@ -206,6 +211,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	83250653adb870ad412b46c8f8d63f5fa5acbcea
+++ debian/changelog	d60ac3bcda310652c1f3fbf7525dcce07600804a
@@ -1,3 +1,9 @@
+dropbear (0.44dispensable1-1) unstable; urgency=medium
+
+  * An update for the UCC dispense server.
+
+ -- Matt Johnston <matt@ucc.asn.au>  Thur, 4 November 2004 21:20:00 +0800
+
 dropbear (0.44test4-1) unstable; urgency=medium

   * New upstream beta, various useful 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	edbfabaa3a4b33bdddbc2d9603345db2349a2708
+++ debian/dropbear.init	8a1d7d2adb4d35a13b594a0bfe8faf0f6c38a0cf
@@ -1,23 +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

-test ! -r /etc/default/dropbear || . /etc/default/dropbear
+test ! -r /etc/default/cokedropbear || . /etc/default/cokedropbear
 test "$NO_START" = "0" || exit 0
 test -x "$DAEMON" || exit 0
-test ! -h /var/service/dropbear || exit 0

 test -z "$DROPBEAR_BANNER" || \
   DROPBEAR_EXTRA_ARGS="$DROPBEAR_EXTRA_ARGS -b $DROPBEAR_BANNER"
============================================================
--- debian/dropbear.postinst	c1d443d9a4b3d18024f79ed28da4f2cda89c5981
+++ debian/dropbear.postinst	85bdd4d6328165d534bd5739cd5da7a27636db07
@@ -2,46 +2,13 @@ test "$1" = 'configure' || exit 0
 set -e

 test "$1" = 'configure' || exit 0
-test -n "$2" || chown log /etc/dropbear/log/main || true

-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=
@@ -58,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 start
+    invoke-rc.d cokedropbear start
   else
-    /etc/init.d/dropbear start
+    /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	29a798b9b9c0883f37e59cd4f93f282c0f26f994
+++ debian/dropbear.prerm	53ede32224237c8417c6b756c8fb308140d668b0
@@ -2,10 +2,10 @@ test "$1" = 'remove' || test "$1" = 'dec
 set -u

 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	aae3ee6d5edbc1865dafbdf08953c04adc86e0b9
+++ debian/rules	8866091b695e7c70282625a8240cb02296cde4e4
@@ -21,7 +21,7 @@ endif
   CC =diet -v -Os gcc
 endif

-DIR=`pwd`/debian/dropbear
+DIR=`pwd`/debian/cokedropbear

 patch: deb-checkdir patch-stamp
 patch-stamp:
@@ -53,41 +53,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 -m0755 debian/cokedropbear.init "$(DIR)"/etc/init.d/cokedropbear
 	# copyright, changelog
 	cat debian/copyright.in LICENSE >debian/copyright
 	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	4bfe6850de1ff24e37f06c6acb7800a72e2ce0b5
+++ options.h	918550e301b2b551088b78a713cf45d97c62d361
@@ -155,7 +155,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.
@@ -168,7 +168,7 @@ etc) slower (perhaps by 50%). Recommende
  * OpenSSH), set the path below. If the path isn't defined, sftp will not
  * be enabled */
 #ifndef SFTPSERVER_PATH
-#define SFTPSERVER_PATH "/usr/libexec/sftp-server"
+#define SFTPSERVER_PATH "/usr/lib/sftp-server"
 #endif

 /* This is used by the scp binary when used as a client binary. If you're
@@ -183,7 +183,7 @@ etc) slower (perhaps by 50%). Recommende
  *******************************************************************/

 #ifndef DROPBEAR_VERSION
-#define DROPBEAR_VERSION "0.44test4"
+#define DROPBEAR_VERSION "0.44-dispensable1"
 #endif

 #define LOCAL_IDENT "SSH-2.0-dropbear_" DROPBEAR_VERSION
============================================================
--- packet.c	a23ba4bf643006ed480a7dc3f5db0643e77bcc17
+++ packet.c	2c66fd1450ac8a5e63adf49b8f9a9928b23b5699
@@ -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	aa0862ce0910cee5bfb9c0f57d1c482c9370c225
+++ svr-auth.c	c5c8b31319fa963acf444a61da0471dfa434bf8a
@@ -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);
@@ -275,6 +276,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;