Changeset 973 for TI05-delivery/trunk


Ignore:
Timestamp:
22/05/06 12:23:42 (13 years ago)
Author:
spascoe
Message:

Added the private authentication API extensions needed to implement
NDG security. This API is connected to empty stub functions, no useful
functionality yet. Authorisation will require a further extension later.

The code compiles. Execution yet to be tested.

Location:
TI05-delivery/trunk/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • TI05-delivery/trunk/src/Makefile

    r806 r973  
    33 
    44PREFIX=$(HOME)/opt/bbftp 
    5 CONFIG_OPTS=--prefix=$(PREFIX) --without-gzip --without-rfio --enable-authentication=private 
     5CONFIG_OPTS=--prefix=$(PREFIX) --without-gzip --without-rfio --enable-authentication=private CPPFLAGS="-DNDG_AUTH" 
    66 
    77BBFTPD=bbftp-server-3.2.0/bbftpd 
  • TI05-delivery/trunk/src/bbftp-server-3.2.0/bbftpd/bbftpd.c

    r773 r973  
    377377#endif 
    378378 
     379 
    379380/* 
    380381 * Stats 
     
    789790    } 
    790791#endif 
    791  
     792#ifdef NDG_AUTH 
     793    if ( bbftpd_private_initialise(logmessage) == -1) {       
     794      syslog(BBFTPD_ERR, "bbftpd_private_init failure: %s", logmessage); 
     795      //!TODO: Should I write to stderr in all daemon modes (be_daemon)? 
     796      fprintf(stderr, "bbftpd_private_init failure: %s", logmessage); 
     797      exit(1); 
     798    } 
     799#endif // NDG_AUTH 
    792800    if ( be_daemon == 2 ) { 
    793801        /* 
  • TI05-delivery/trunk/src/bbftp-server-3.2.0/bbftpd/bbftpd_private.c

    r773 r973  
    6161extern  RSA     *myrsa ; 
    6262 
     63 
    6364/******************************************************************************* 
    6465** bbftpd_private_receive_connection :                                         * 
     
    179180        return -1 ; 
    180181    } 
     182#ifdef NDG_AUTH 
     183    ndg_atexit_status = NDG_INCHILD; 
     184#endif // NDG_AUTH 
     185 
    181186    return 0 ; 
    182187} 
     
    342347    return totallendecrypted ; 
    343348} 
     349 
     350 
     351#ifdef NDG_AUTH 
     352/* 
     353** bbftpd_private_initialise : 
     354** 
     355**      Routine to initialise the private authentication infrastructure. 
     356**      This function is mainly a wrapper around bbftpd_private_init(), 
     357**      except that it also sets up an atexit function. 
     358*/ 
     359int bbftpd_private_initialise(char *logmessage) { 
     360 
     361    if (atexit(bbftpd_private_atexit) != 0) { 
     362      sprintf(logmessage, "atexit failure"); 
     363      return -1; 
     364    } 
     365    ndg_atexit_status = NDG_INFATHER; 
     366    return bbftpd_private_init(logmessage); 
     367} 
     368 
     369/* 
     370** bbftpd_private_atexit : 
     371** 
     372**      Routine to be registered with atexit() for cleaning up the private authentication 
     373**      infrastructure.  This function must know whether the server is in a connected or 
     374**      unconnected state, therefore the global variable ndg_atexit_status is used. 
     375*/ 
     376void bbftpd_private_atexit(void) 
     377{ 
     378  if (ndg_atexit_status == NDG_INFATHER) { 
     379    bbftpd_private_finalise(); 
     380  } 
     381  else if (ndg_atexit_status == NDG_INCHILD) { 
     382    bbftpd_private_auth_finalise(); 
     383  } 
     384  else { 
     385    syslog(BBFTPD_ERR, "ndg_atexit_status unrecognised: %d", ndg_atexit_status); 
     386    fprintf(stderr, "ndg_atexit_status unrecognised: %d", ndg_atexit_status); 
     387  } 
     388} 
     389#endif // NDG_AUTH 
  • TI05-delivery/trunk/src/bbftp-server-3.2.0/bbftpd/bbftpd_private_user.c

    r806 r973  
    105105  return 0 ;  
    106106} 
     107 
     108 
     109#ifdef NDG_AUTH 
     110 
     111/* 
     112 * bbftpd_private_init : 
     113 * 
     114 *     Routine to initialise private authentication.  This function will be 
     115 *     called before bbftpd begins listening for connections and therefore 
     116 *     before the fork() that occurs when a client connects. 
     117 * 
     118 *     OUTPUT variable : 
     119 *          logmessage :  to write the error message in case of error 
     120 * 
     121 *     RETURN: 
     122 *         -1  Unrecoverable error 
     123 *          0  OK 
     124 * 
     125 */ 
     126 
     127int bbftpd_private_init(char *logmessage) 
     128{ 
     129  syslog(LOG_INFO, "initialising private authentication"); 
     130  return 0; 
     131} 
     132 
     133/* 
     134 * bbftpd_private_finalise : 
     135 * 
     136 *     Routine to clean up the private authentication infrastructure when the  
     137 *     daemon exits.  This function is the counterpart of bbftpd_private_init and  
     138 *     will be called from the daemon process during exit.  NOTE: it will not  
     139 *     be aware of any actions of child processes. 
     140 * 
     141 */ 
     142 
     143void bbftpd_private_finalise(void) 
     144{ 
     145  syslog(LOG_INFO, "finalising private authentication in server"); 
     146  return; 
     147} 
     148 
     149/* 
     150 * bbftpd_private_auth_finalise : 
     151 * 
     152 *     Routine to clean up the private authentication infrastructure for each child. 
     153 *     This function is the counterpart of bbftpd_private_auth and will be called from 
     154 *     each child of the daemon during exit. 
     155 * 
     156 */ 
     157 
     158void bbftpd_private_auth_finalise(void) 
     159{ 
     160  syslog(LOG_INFO, "finalising private authentication in connection"); 
     161  return; 
     162} 
     163 
     164#endif // NDG_AUTH 
  • TI05-delivery/trunk/src/bbftp-server-3.2.0/includes/bbftpd_private.h

    r773 r973  
    4040*/ 
    4141RSA     *hisrsa ; 
     42 
     43#ifdef NDG_AUTH 
     44/* 
     45** NDG authentication global variables. 
     46*/ 
     47#define NDG_INFATHER 1 
     48#define NDG_INCHILD 2 
     49int ndg_atexit_status ; 
     50#endif // NDG_AUTH 
  • TI05-delivery/trunk/src/bbftp-server-3.2.0/includes/daemon_proto.h

    r773 r973  
    6363int bbftpd_private_send(char *buffertosend, int buffertosendlength, char *logmessage) ; 
    6464int bbftpd_private_recv(char *buffertorecv, int lengthtorecv, char *logmessage) ; 
     65#ifdef NDG_AUTH 
     66int bbftpd_private_initialise(char *logmessage); 
     67void bbftpd_private_atexit(void); 
     68#endif // NDG_AUTH 
    6569/* 
    6670** Prototype for user private authentication routines 
    6771*/ 
    6872int bbftpd_private_auth(char *logmessage) ; 
     73#ifdef NDG_AUTH 
     74int bbftpd_private_init(char *logmessage); 
     75void bbftpd_private_finalise(void); 
     76void bbftpd_private_auth_finalise(void); 
     77#endif // NDG_AUTH 
    6978/* 
    7079** Prototype for retr routines 
Note: See TracChangeset for help on using the changeset viewer.