Ignore:
Timestamp:
23/05/06 16:25:39 (13 years ago)
Author:
spascoe
Message:

Closer inspection of the bbftp code reveals I'll need to refactor the
authz interface slightly. bbftpd_private_authz has been renamed
bbftpd_private_authz_control with a slightly different prototype.
This function now doesn't authorise store/retrieve requests.

File:
1 edited

Legend:

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

    r983 r987  
    162162 
    163163/* 
    164 ** bbftpd_private_authz : 
    165 ** 
    166 **    Routine to authorise individual bbftp commands.  The function must return 
    167 **    OK for the command to proceed. 
     164** bbftpd_private_authz_control : 
     165** 
     166**    Routine to authorise bbftp control commands.   
    168167** 
    169168**    INPUT variables: 
    170169**        msgcode : The message code from struct message 
    171 **        msgstruct : A pointer to a bbftpd structure dependent on the message type (see below) 
     170**        transferoptions : TROPT_* options 
     171**        path : path to apply command to 
    172172** 
    173173**    OUTPUT variables: 
     
    178178**        0  OK 
    179179** 
    180 **  msgstruct should be cast to the appropriate structure from structures.h 
    181 **  acording to msgcode: 
    182 ** 
    183 **    MSG_CHDIR_V2  : struct mess_dir 
    184 **    MSG_CHUMASK   : struct mess_int 
    185 **    MSG_MKLIST_V2 : struct mess_dir 
    186 **    MSG_MKDIR_V2  : struct mess_dir 
    187 **    MSG_RM        : struct mess_dir 
    188 **    MSG_STAT      : struct mess_dir 
    189 **    MSG_DF        : struct mess_dir 
    190 **    MSG_RETR_V2   : struct mess_store_v2 
    191 **    MSG_STORE_V2  : struct mess_store_v2 
    192180** 
    193181*/ 
    194 int bbftpd_private_authz(int msgcode, void *msgstruct, char *logmessage) 
    195 { 
    196  
    197   // For test purposes just log the authorisation request 
    198   syslog(LOG_INFO, "Authorisation request: %d", msgcode); 
     182int bbftpd_private_authz_control(int msgcode, int transferoption, char *path, char *logmessage) 
     183{ 
     184 
     185  switch (msgcode) { 
     186  case MSG_CHDIR_V2: 
     187    syslog(LOG_INFO, "Authz: MSG_DIR 0x%x %s", transferoption, path); 
     188    break; 
     189  case MSG_LIST_V2: 
     190    syslog(LOG_INFO, "Authz: MSG_LIST_V2 0x%x %s", transferoption, path); 
     191    break; 
     192  case MSG_MKDIR_V2: 
     193    syslog(LOG_INFO, "Authz: MSG_MKDIR_V2 0x%x %s", transferoption, path); 
     194    break; 
     195  case MSG_RM: 
     196    syslog(LOG_INFO, "Authz: MSG_RM 0x%x %s", transferoption, path); 
     197    break; 
     198  case MSG_STAT: 
     199    syslog(LOG_INFO, "Authz: MSG_STAT 0x%x %s", transferoption, path); 
     200    break; 
     201  case MSG_DF: 
     202    syslog(LOG_INFO, "Authz: MSG_DF 0x%x %s", transferoption, path); 
     203    break; 
     204  default: 
     205    sprintf(logmessage, "Unrecognised message to authorise %d", msgcode); 
     206    return -1; 
     207  } 
     208 
    199209  return 0; 
    200  
    201210} 
    202211 
Note: See TracChangeset for help on using the changeset viewer.