Changeset 1074


Ignore:
Timestamp:
31/05/06 15:57:25 (13 years ago)
Author:
spascoe
Message:

Implemented setting the username from python during authentication.

Location:
TI05-delivery/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • TI05-delivery/trunk/src/bbftp-server-3.2.0/bbftpd/bbftpd_private_user.c

    r1073 r1074  
    9797int bbftpd_private_auth(char *logmessage) 
    9898{ 
     99  char *username; 
     100 
    99101  char msg[NDG_MESSAGE_LEN]; 
    100102  /* Send version verification message.  */ 
     
    107109 
    108110#ifdef NDG_PYTHON_EMBED 
    109   return bbftpd_private_auth_callback(logmessage); 
    110 #else 
     111  if (bbftpd_private_auth_callback(logmessage) == -1) { 
     112    return -1; 
     113  } 
     114  if ((username = bbftpd_private_auth_getusername(logmessage)) == NULL) { 
     115    return -1; 
     116  } 
     117    
     118  sprintf(currentusername, "%.*s", MAXLEN, username); 
     119#endif 
     120 
    111121  return 0 ; 
    112 #endif 
    113122} 
    114123 
  • TI05-delivery/trunk/test/test_embedded.py

    r1073 r1074  
    2222    def authorise(self): 
    2323        # Return a dummy authzContext 
    24         return "authorised :-)" 
     24        return AuthzContext("JoeBloggs") 
     25 
     26class AuthzContext(object): 
     27    def __init__(self, username): 
     28        self.username = username 
    2529 
    2630class EmbeddedServerTestCase(unittest.TestCase): 
     
    6064                                      '.*Received auth message: NDG-bbFTP.*', 
    6165                                      r'.*Authz: MSG_LIST_V2 .*/test/data/\*.*', 
    62                                       r'.*User disconnected.*'], lines)) 
     66                                      r'.*User JoeBloggs disconnected.*'], lines)) 
    6367 
    6468 
     
    8084        # Check syslog 
    8185        lines = self._readSyslog() 
    82         self.assert_(self._findLines(['.*Authz: RETR .*/foo', '.*GET .*/foo.*'], lines)) 
     86        self.assert_(self._findLines(['.*Authz: RETR .*/foo', '.*GET JoeBloggs .*/foo.*'], lines)) 
    8387 
    8488    def testStore(self): 
     
    103107        # Check syslog 
    104108        lines = self._readSyslog() 
    105         self.assert_(self._findLines(['.*Authz: STORE .*/new_bar', '.*PUT .*/new_bar.*'], lines)) 
     109        self.assert_(self._findLines(['.*Authz: STORE .*/new_bar', '.*PUT JoeBloggs .*/new_bar.*'], lines)) 
    106110 
    107111 
Note: See TracChangeset for help on using the changeset viewer.