Changeset 987


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.

Location:
TI05-delivery/trunk/src/bbftp-server-3.2.0
Files:
8 edited

Legend:

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

    r983 r987  
    9696 
    9797#ifdef NDG_AUTH 
    98     if (bbftpd_private_authz(MSG_CHDIR_V2, (void *)msg_dir, logmessage) != 0) { 
     98    if (bbftpd_private_authz_control(MSG_CHDIR_V2, msg_dir->transferoption, msg_dir->dirname, 
     99                                     logmessage) != 0) { 
    99100      syslog(BBFTPD_ERR, logmessage); 
    100101      reply(MSG_BAD, logmessage); 
  • TI05-delivery/trunk/src/bbftp-server-3.2.0/bbftpd/bbftpd_mkdir.c

    r983 r987  
    8686    msg_dir = (struct mess_dir *) buffer ; 
    8787#ifdef NDG_AUTH 
    88     if (bbftpd_private_authz(MSG_MKDIR_V2, (void *)msg_dir, logmessage) != 0) { 
     88    if (bbftpd_private_authz_control(MSG_MKDIR_V2, msg_dir->transferoption, msg_dir->dirname, 
     89                                     logmessage) != 0) { 
    8990      syslog(BBFTPD_ERR, logmessage); 
    9091      reply(MSG_BAD, logmessage); 
  • 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 
  • TI05-delivery/trunk/src/bbftp-server-3.2.0/bbftpd/bbftpd_readcontrol.c

    r983 r987  
    177177                    } 
    178178                    msg_integer = (struct  mess_integer *) receive_buffer ; 
    179 #ifdef NDG_AUTH 
    180                     if (bbftpd_private_authz(msgcode, (void *)msg_integer, logmessage) != 0) { 
    181                       syslog(BBFTPD_ERR, logmessage); 
    182                       reply(MSG_BAD, logmessage); 
    183                       FREE(receive_buffer); 
    184                       return 0; 
    185                     } 
    186 #endif // NDG_AUTH 
    187  
    188179#ifndef WORDS_BIGENDIAN 
    189180                    myumask = ntohl(msg_integer->myint) ; 
     
    234225                   msg_dir = (struct mess_dir *) receive_buffer ; 
    235226#ifdef NDG_AUTH 
    236                     if (bbftpd_private_authz(msgcode, (void *)msg_dir, logmessage) != 0) { 
     227                    if (bbftpd_private_authz_control(msgcode, msg_dir->transferoption, msg_dir->dirname, 
     228                                                     logmessage) != 0) { 
    237229                      syslog(BBFTPD_ERR, logmessage); 
    238230                      reply(MSG_BAD, logmessage); 
     
    284276                    } 
    285277                    msg_store_v2 = (struct  mess_store_v2 *) receive_buffer ; 
    286 #ifdef NDG_AUTH 
    287                     if (bbftpd_private_authz(msgcode, (void *)msg_store_v2, logmessage) != 0) { 
    288                       syslog(BBFTPD_ERR, logmessage); 
    289                       reply(MSG_BAD, logmessage); 
    290                       FREE(receive_buffer); 
    291                       return 0; 
    292                     } 
    293 #endif // NDG_AUTH 
    294278 
    295279                    /* 
     
    332316                    } 
    333317                    msg_store_v2 = (struct  mess_store_v2 *) receive_buffer ; 
    334 #ifdef NDG_AUTH 
    335                     if (bbftpd_private_authz(msgcode, (void *)msg_store_v2, logmessage) != 0) { 
    336                       syslog(BBFTPD_ERR, logmessage); 
    337                       reply(MSG_BAD, logmessage); 
    338                       FREE(receive_buffer); 
    339                       return 0; 
    340                     } 
    341 #endif // NDG_AUTH 
    342318 
    343319                    /* 
  • TI05-delivery/trunk/src/bbftp-server-3.2.0/bbftpd/bbftpd_rm.c

    r983 r987  
    8080    msg_file = (struct mess_dir *) buffer ; 
    8181#ifdef NDG_AUTH 
    82     if (bbftpd_private_authz(MSG_RM, (void *)msg_file, logmessage) != 0) { 
     82    if (bbftpd_private_authz_control(MSG_RM, msg_file->transferoption, msg_file->dirname, 
     83                                     logmessage) != 0) { 
    8384      syslog(BBFTPD_ERR, logmessage); 
    8485      reply(MSG_BAD, logmessage); 
  • TI05-delivery/trunk/src/bbftp-server-3.2.0/bbftpd/bbftpd_stat.c

    r983 r987  
    104104    msg_file = (struct mess_dir *) buffer ; 
    105105#ifdef NDG_AUTH 
    106     if (bbftpd_private_authz(MSG_STAT, (void *)msg_file, logmessage) != 0) { 
     106    if (bbftpd_private_authz_control(MSG_STAT, msg_file->transferoption, msg_file->dirname, 
     107                                     logmessage) != 0) { 
    107108      syslog(BBFTPD_ERR, logmessage); 
    108109      reply(MSG_BAD, logmessage); 
  • TI05-delivery/trunk/src/bbftp-server-3.2.0/bbftpd/bbftpd_statfs.c

    r983 r987  
    107107    msg_file = (struct mess_dir *) buffer ; 
    108108#ifdef NDG_AUTH 
    109     if (bbftpd_private_authz(MSG_DF, (void *)msg_file, logmessage) != 0) { 
     109    if (bbftpd_private_authz_control(MSG_DF, msg_file->transferoption, msg_file->dirname, 
     110                                     logmessage) != 0) { 
    110111      syslog(BBFTPD_ERR, logmessage); 
    111112      reply(MSG_BAD, logmessage); 
  • TI05-delivery/trunk/src/bbftp-server-3.2.0/includes/daemon_proto.h

    r983 r987  
    7676void bbftpd_private_finalise(void); 
    7777void bbftpd_private_auth_finalise(void); 
    78 int bbftpd_private_authz(int msgcode, void *msgstruct, char *logmessage); 
     78int bbftpd_private_authz_control(int msgcode, int transferoption, char *path, char *logmessage); 
    7979#endif // NDG_AUTH 
    8080/* 
Note: See TracChangeset for help on using the changeset viewer.