Changeset 477

Show
Ignore:
Timestamp:
02/24/05 20:28:22 (4 years ago)
Author:
minaguib
Message:

* auth_server_request now returns AUTH_ERROR on error instead of AUTH_VALIDATION_FAILED
* centralserver.c: Fix typo (was =+, made it +=) that made the response from the auth server corrupted in memory if the entire response would not fit in 1 packet and retrieved with 1 read() call

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wifidog/ChangeLog

    r475 r477  
    11# $Header$ 
     2 
     32005-02-24 Mina Naguib <mina@ilesansfil.org> 
     4        * auth_server_request now returns AUTH_ERROR on error instead of AUTH_VALIDATION_FAILED 
     5        * centralserver.c: Fix typo (was =+, made it +=) that made the response 
     6        from the auth server corrupted in memory if the entire response would not 
     7        fit in 1 packet and retrieved with 1 read() call 
     8 
    292005-02-22 Philippe April <philippe@ilesansfil.org> 
    310        * Tagged v1_1_0_beta2 
  • trunk/wifidog/src/centralserver.c

    r471 r477  
    5959@param outgoing Current counter of the client's total outgoing traffic, in bytes  
    6060*/ 
    61 int 
     61t_authcode 
    6262auth_server_request(t_authresponse *authresponse, char *request_type, char *ip, char *mac, char *token, unsigned long long int incoming, unsigned long long int outgoing) 
    6363{ 
     
    6767        char *tmp; 
    6868 
    69         /* Blanket default is failed. */ 
    70         authresponse->authcode = AUTH_VALIDATION_FAILED
     69        /* Blanket default is error. */ 
     70        authresponse->authcode = AUTH_ERROR
    7171         
    7272        sockfd = connect_auth_server(); 
    7373        if (sockfd == -1) { 
    7474                /* Could not connect to any auth server */ 
    75                 return (-1); 
     75                return (AUTH_ERROR); 
    7676        } 
    7777 
     
    9494 
    9595        numbytes = totalbytes = 0; 
    96         while ((numbytes = read(sockfd, buf + totalbytes,  
    97                                 MAX_BUF - (totalbytes + 1))) > 0) 
    98                 totalbytes =+ numbytes; 
     96        while ((numbytes = read(sockfd, buf + totalbytes, MAX_BUF - (totalbytes + 1))) > 0) 
     97                totalbytes += numbytes; 
    9998         
    10099        if (numbytes == -1) { 
    101100                debug(LOG_ERR, "Error reading from auth server: %s", strerror(errno)); 
    102101                close(sockfd); 
    103                 return(-1); 
     102                return(AUTH_ERROR); 
    104103        } 
    105104        close(sockfd); 
     
    116115                        return(AUTH_ERROR); 
    117116                } 
    118         } else { 
     117        } 
     118        else { 
    119119                return(AUTH_ERROR); 
    120120        } 
  • trunk/wifidog/src/centralserver.h

    r471 r477  
    3636 
    3737/** @brief Initiates a transaction with the auth server */ 
    38 int auth_server_request(t_authresponse *authresponse, char *request_type, char *ip, char *mac, char *token, unsigned long long int incoming, unsigned long long int outgoing); 
     38t_authcode auth_server_request(t_authresponse *authresponse, char *request_type, char *ip, char *mac, char *token, unsigned long long int incoming, unsigned long long int outgoing); 
    3939 
    4040/** @brief Tries really hard to connect to an auth server.  Returns a connected file descriptor or -1 on error */