Changeset 1195


Ignore:
Timestamp:
15/06/06 15:51:43 (13 years ago)
Author:
spascoe
Message:

Defined constants used by bbftp in delivery.server.

Location:
TI05-delivery/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • TI05-delivery/trunk/lib/python/delivery/server.py

    r1187 r1195  
    1111 
    1212import bbftpd 
     13 
     14class TROPT: 
     15    """Static class containing constants used by bbftp in the transferoption parameter. 
     16 
     17    TROPT.X always corresponds to TROPT_X as defined in bbftpd/structures.h. 
     18    Options that aren't likely to be used for the delivery service are not 
     19    included (e.g. TROPT_RFIO). 
     20 
     21    @cvar TMP always use temporary name. 
     22    @cvar ACC keep access and modification time. 
     23    @cvar MODE keep mode. 
     24    @cvar DIR create all dirs in path. 
     25    """ 
     26    TMP = bbftpd.TROPT_TMP 
     27    ACC = bbftpd.TROPT_ACC 
     28    MODE = bbftpd.TROPT_MODE 
     29    DIR = bbftpd.TROPT_DIR 
     30 
     31class MSG: 
     32    """Static class containing message codes used by bbftp. 
     33 
     34    MSG.X corresponds to MSG_X or MSG_X_V2 as defined in bbftpd/structures.h. 
     35    Message codes not returned by the auth/authz interface are not included. 
     36 
     37    @cvar CHDIR a chdir request. 
     38    @cvar LIST a ls/dir request. 
     39    @cvar MKDIR a mkdir request. 
     40    @cvar RM a rm request. 
     41    @cvar STAT a stat request. 
     42    @cvar DF a statfs request. 
     43    """ 
     44    CHDIR = bbftpd.MSG_CHDIR_V2 
     45    LIST = bbftpd.MSG_LIST_V2 
     46    MKDIR = bbftpd.MSG_MKDIR_V2 
     47    RM = bbftpd.MSG_RM 
     48    STAT = bbftpd.MSG_STAT 
     49    DF = bbftpd.MSG_DF 
     50     
     51 
     52#-------------------------------------------------------------------------------------------------------------- 
    1353 
    1454def start(authHandler, args): 
  • TI05-delivery/trunk/src/bbftp-server-3.2.0/includes/ndg.h

    r1141 r1195  
    1010 */ 
    1111 
     12#include <bbftpd.h> 
     13#include <netinet/in.h> 
     14#include <structures.h> 
    1215 
    1316/* The logmessage size limit is hard coded into the bbFTP source.  I define a macro here to avoid 
  • TI05-delivery/trunk/src/python_ext/bbftpd.c

    r1187 r1195  
    99 * 
    1010 */ 
     11 
    1112 
    1213#include <Python.h> 
    1314#include <ndg.h> 
     15 
    1416 
    1517extern char **environ; 
     
    377379}; 
    378380 
     381 
     382#define ADDCONST(m,x) PyModule_AddIntConstant(m, #x, x) 
     383 
    379384PyMODINIT_FUNC initbbftpd(void) { 
    380   (void) Py_InitModule("bbftpd", BbftpdMethods); 
    381 } 
    382  
     385  PyObject *mod; 
     386 
     387  mod = Py_InitModule("bbftpd", BbftpdMethods); 
     388 
     389  ADDCONST(mod, MSG_CHDIR_V2); 
     390  ADDCONST(mod, MSG_CHDIR_V2); 
     391  ADDCONST(mod, MSG_LIST_V2); 
     392  ADDCONST(mod, MSG_MKDIR_V2); 
     393  ADDCONST(mod, MSG_RM); 
     394  ADDCONST(mod, MSG_STAT); 
     395  ADDCONST(mod, MSG_DF); 
     396   
     397  ADDCONST(mod, TROPT_TMP); 
     398  ADDCONST(mod, TROPT_ACC); 
     399  ADDCONST(mod, TROPT_MODE); 
     400  ADDCONST(mod, TROPT_DIR); 
     401  ADDCONST(mod, TROPT_GZIP); 
     402  ADDCONST(mod, TROPT_RFIO); 
     403  ADDCONST(mod, TROPT_RFIO_O); 
     404  ADDCONST(mod, TROPT_QBSS); 
     405   
     406} 
     407 
  • TI05-delivery/trunk/test/test_embedded.py

    r1187 r1195  
    7171 
    7272    def authzControl(self, msgcode, transferopt, path): 
    73         # Ignore what is being authorised for now, just authorise if read allowed 
     73        syslog.syslog(syslog.LOG_DEBUG, 'TestPermAuthzHandler.authzControl: msgcode = %s' % hex(msgcode)) 
    7474        return self.authzPath(path) 
    7575 
     
    318318 
    319319        self.assertLines(['Connection and authentication correct', 'stat /.*/foo OK'], output) 
    320         self.assertLines(['.*Authz: MSG_STAT .*/foo', '.*TestPermAuthzHandler OK'], lines) 
     320        self.assertLines(['.*Authz: MSG_STAT .*/foo', '.*TestPermAuthzHandler OK', 
     321                          '.*TestPermAuthzHandler.*msgcode = %s.*' % hex(server.MSG.STAT)], lines) 
    321322 
    322323    def testFail(self): 
Note: See TracChangeset for help on using the changeset viewer.