Changeset 1077 for TI05-delivery
- Timestamp:
- 01/06/06 15:18:02 (15 years ago)
- Location:
- TI05-delivery/trunk
- Files:
-
- 1 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
TI05-delivery/trunk/setup.py
r1067 r1077 5 5 6 6 bbftpd_home = './src/bbftp-server-3.2.0' 7 # Get the version from ./VERSION 8 version = open('./VERSION').read() 9 7 10 8 11 # Not all *.c files are compiled into *.o files in bbftpd … … 43 46 define_macros = [('NDG_AUTH', 1), ('LOCAL_SYSLOG_FACILITY', 1), 44 47 ('_LARGEFILE64_SOURCE', 1), 45 ('NDG_PYTHON_EMBED', 1)], 48 ('NDG_PYTHON_EMBED', 1), 49 ('NDG_DELIVERY_VERSION', '"%s"' % version)], 46 50 include_dirs = [bbftpd_home+'/includes', bbftpd_home+'/bbftpd'], 47 51 libraries = ['crypt', 'crypto'], … … 49 53 50 54 setup(name = 'bbftp-python', 51 version = '0.1',55 version = version, 52 56 description = 'Embedded bbftp server', 53 57 author = 'Stephen Pascoe', -
TI05-delivery/trunk/src/Makefile
r1065 r1077 1 1 # 2 # Top level makefile for the DeliveryService source code. 2 # Makefile for building bbftp client & server stand alone (without Python API) 3 # 3 4 4 5 PREFIX=$(HOME)/opt/bbftp 6 # Grab the DeliveryService version from the parent directory. 7 VERSION:=$(shell cat ../VERSION) 8 9 DEFS="-DNDG_AUTH -DLOCAL_SYSLOG_FACILITY -DNDG_DELIVERY_VERSION=$(VERSION)" 5 10 CONFIG_OPTS=--prefix=$(PREFIX) --without-gzip --without-rfio --enable-authentication=private \ 6 C PPFLAGS="-DNDG_AUTH -DLOCAL_SYSLOG_FACILITY"11 CFLAGS=$(DEFS) 7 12 8 13 BBFTPD=bbftp-server-3.2.0/bbftpd -
TI05-delivery/trunk/src/bbftp-client-3.2.0/bbftpc/bbftp_private_user.c
r802 r1077 30 30 31 31 #include <bbftp_private_user.h> 32 #include <client.h> 32 33 33 34 /* … … 39 40 */ 40 41 extern char *privatestr ; 42 43 extern int debug; 44 45 /* From bbftp_util.c */ 46 void printmessage(FILE *strm , int flag, int errcode, int tok, char *fmt, ...); 47 41 48 42 49 /******************************************************************************* … … 118 125 int bbftp_private_auth(char *logmessage) 119 126 { 127 char msg[NDG_MESSAGE_LEN]; 128 120 129 /* Send version verification message. */ 121 if (bbftp_private_send(NDG_FTP_PROTOCOL, NDG_MESSAGE_LEN, logmessage) == -1) { 130 sprintf(msg, "%.*s", NDG_MESSAGE_LEN - 1, NDG_HANDSHAKE); 131 if (bbftp_private_send(msg, NDG_MESSAGE_LEN, logmessage) == -1) { 122 132 return -1; 133 } 134 135 /* Receive response */ 136 if (bbftp_private_recv(msg, NDG_MESSAGE_LEN, logmessage) == -1) { 137 return -1; 138 } 139 140 if (debug) { 141 printmessage(stdout,CASE_NORMAL,0,0,"Received Auth handshake: %s\n", msg) ; 123 142 } 124 143 -
TI05-delivery/trunk/src/bbftp-client-3.2.0/includes/bbftp_private_user.h
r806 r1077 43 43 */ 44 44 45 #define NDG_FTP_VERSION "v0.0.1" 46 #define NDG_FTP_PROTOCOL ("NDG-bbFTP" NDG_FTP_VERSION) 45 // Define this in the makefile 46 // #define NDG_DELIVERY_VERSION "v0.0.1" 47 #define NDG_STR(s) #s 48 #define NDG_XSTR(s) NDG_STR(s) 49 #define NDG_HANDSHAKE ("NDG-Delivery-client " NDG_XSTR(NDG_DELIVERY_VERSION)) 47 50 48 51 #define NDG_MESSAGE_LEN 256 … … 52 55 */ 53 56 #define NDG_MAX_LOGMESSAGE 1024 57 -
TI05-delivery/trunk/src/bbftp-server-3.2.0/bbftpd/bbftpd_private_user.c
r1075 r1077 37 37 #include <bbftpd_private_user.h> 38 38 39 #ifdef NDG_PYTHON_EMBED 40 #include <Python.h> 41 #endif 42 39 43 extern char currentusername[MAXLEN] ; 40 44 … … 112 116 113 117 char msg[NDG_MESSAGE_LEN]; 114 /* Sendversion verification message. */118 /* Receive version verification message. */ 115 119 if (bbftpd_private_recv(msg, NDG_MESSAGE_LEN, logmessage) == -1) { 116 120 return -1; … … 118 122 else { 119 123 syslog(LOG_DEBUG, "Received auth message: %s", msg); 124 } 125 126 /* Send response */ 127 sprintf(msg, "%.*s", NDG_MESSAGE_LEN - 1, NDG_HANDSHAKE); 128 if (bbftpd_private_send(msg, NDG_MESSAGE_LEN, logmessage) == -1) { 129 return -1; 120 130 } 121 131 -
TI05-delivery/trunk/src/bbftp-server-3.2.0/includes/bbftp_private_user.h
r773 r1077 38 38 39 39 **/ 40 41 #ifdef NDG_AUTH 42 #define NDG_STR(s) #s 43 #define NDG_XSTR(s) NDG_STR(s) 44 #define NDG_HANDSHAKE ("NDG-Delivery-server " NDG_XSTR(NDG_DELIVERY_VERSION)) 45 #endif -
TI05-delivery/trunk/src/bbftp-server-3.2.0/includes/bbftpd_private_user.h
r1064 r1077 28 28 *****************************************************************************/ 29 29 30 #include <Python.h>31 32 30 /* 33 31 ** This include must contain all global variable to be used for private … … 49 47 #define NDG_MAX_LOGMESSAGE 1024 50 48 #define NDG_MESSAGE_LEN 256 49 50 #define NDG_STR(s) #s 51 #define NDG_XSTR(s) NDG_STR(s) 52 #define NDG_HANDSHAKE ("NDG-Delivery-server " NDG_XSTR(NDG_DELIVERY_VERSION)) -
TI05-delivery/trunk/test/test_bbftpd.py
r1064 r1077 11 11 from glob import glob 12 12 import re, tempfile 13 14 13 15 14 16 class ExtendedAPITestCase(unittest.TestCase): … … 57 59 self.assert_(self._findLines(['.*Starting bbftpd in background mode'], lines)) 58 60 61 def testHandshake(self): 62 """Connect with client in verbose mode and test Auth handhsake is received. 63 """ 64 65 self._startServer() 66 pid = self._getServerPid() 67 68 fh = self._runClient('dir .', debug=True) 69 output = fh.read() 70 71 self._stopServer(pid) 72 73 self.assert_(self._findLines(['Received Auth handshake: NDG-Delivery-server %s' % self.VERSION], output)) 74 75 lines = self._readSyslog() 76 self.assert_(self._findLines(['.*Received auth message: NDG-Delivery-client %s.*' % self.VERSION], lines)) 77 78 59 79 def testDir(self): 60 80 """Try connecting the client and listing a directory. … … 64 84 pid = self._getServerPid() 65 85 66 fh = self._runClient(' -e "dir %s"' % self.DATADIR)86 fh = self._runClient('dir %s' % self.DATADIR) 67 87 output = fh.read() 68 88 … … 74 94 lines = self._readSyslog() 75 95 self.assert_(self._findLines(['.*Getting new bbftp connexion.*', 76 '.*Received auth message: NDG-bbFTP.*',77 96 r'.*Authz: MSG_LIST_V2 .*/test/data/\*.*', 78 97 r'.*User disconnected.*'], lines)) … … 86 105 87 106 tmp = tempfile.mktemp('test_bbftpd') 88 fh = self._runClient(' -e "get %s/foo %s"' % (self.DATADIR, tmp))107 fh = self._runClient('get %s/foo %s' % (self.DATADIR, tmp)) 89 108 90 109 # Check the client output … … 112 131 dest = '%s/new_bar' % (self.DATADIR) 113 132 os.system('cp %s %s' % (src, dest)) 114 fh = self._runClient(' -e "put %s %s"' % (src, dest))133 fh = self._runClient('put %s %s' % (src, dest)) 115 134 116 135 # Check the client output … … 147 166 else: 148 167 raise RuntimeError, 'Cannot find test data directory' 168 self.VERSION = open('%s/VERSION' % self.HOME).read() 169 149 170 150 171 def _startServer(self): … … 192 213 return ''.join(filtered_log) 193 214 194 def _runClient(self, *args): 195 """Run the client with th -m option and return a file handle of the output. 196 """ 197 fh = os.popen('%s -m -u testcase %s localhost' % (self.BBFTP, ' '.join(args))) 215 def _runClient(self, cmd, debug=False, user="testcase"): 216 """Run the client. 217 """ 218 219 if debug: 220 f = "-d" 221 else: 222 f = "-m" 223 224 fh = os.popen('%s %s -u %s -e %s localhost' % (self.BBFTP, f, user, repr(cmd))) 198 225 return fh 199 226 -
TI05-delivery/trunk/test/test_embedded.py
r1075 r1077 16 16 BBFTP = glob('%s/src/bbftp-client*/bbftpc/bbftp' % HOME)[0] 17 17 DATADIR = '%s/test/data' % HOME 18 VERSION = open('%s/VERSION' % HOME).read() 18 19 NDG_MESSAGE_LEN = 256 20 21 NDG_HANDSHAKE = "NDG-Delivery-server %s" % VERSION 19 22 20 23 sys.path.append(BUILDDIR) … … 36 39 37 40 syslog.syslog(syslog.LOG_DEBUG, 'AuthContext received Auth message: %s' % msg) 38 41 42 # Send the response 43 msg = NDG_HANDSHAKE + '\0' * (NDG_MESSAGE_LEN - len(NDG_HANDSHAKE)) 44 bbftpd.send(msg) 45 39 46 return AuthzContext(msg, "TestCaseUser") 40 47 … … 64 71 65 72 66 fh = self._runClient( '-e "dir %s"'% DATADIR)73 fh = self._runClient("dir %s" % DATADIR) 67 74 output = fh.read() 68 75 … … 73 80 lines = self._readSyslog() 74 81 self.assert_(self._findLines(['.*Getting new bbftp connexion.*', 75 '.*AuthContext received Auth message: NDG- bbFTP.*',82 '.*AuthContext received Auth message: NDG-Delivery-client %s' % VERSION, 76 83 r'.*Authz: MSG_LIST_V2 .*/test/data/\*.*', 77 84 r'.*User TestCaseUser disconnected.*'], lines)) … … 83 90 84 91 tmp = tempfile.mktemp('test_bbftpd') 85 fh = self._runClient( '-e "get %s/foo %s"'% (DATADIR, tmp))92 fh = self._runClient("get %s/foo %s" % (DATADIR, tmp)) 86 93 87 94 # Check the client output … … 105 112 dest = '%s/new_bar' % (DATADIR) 106 113 os.system('cp %s %s' % (src, dest)) 107 fh = self._runClient( '-e "put %s %s"'% (src, dest))114 fh = self._runClient("put %s %s" % (src, dest)) 108 115 109 116 # Check the client output … … 134 141 syslog.syslog(syslog.LOG_DEBUG, 'Stopping server') 135 142 136 def _runClient(self, *args): 137 """Run the client with th -m option and return a file handle of the output. 143 144 def _runClient(self, cmd, debug=False, user="testcase"): 145 """Run the client. 138 146 """ 139 fh = os.popen('%s -m -u testcase %s localhost' % (BBFTP, ' '.join(args))) 147 148 if debug: 149 f = "-d" 150 else: 151 f = "-m" 152 153 fh = os.popen('%s %s -u %s -e %s localhost' % (BBFTP, f, user, repr(cmd))) 140 154 return fh 155 141 156 142 157 def _readSyslog(self, logfile="/var/log/bbftpd/bbftpd.log"):
Note: See TracChangeset
for help on using the changeset viewer.