Changeset 477
- Timestamp:
- 02/24/05 20:28:22 (4 years ago)
- Files:
-
- trunk/wifidog/ChangeLog (modified) (1 diff)
- trunk/wifidog/src/centralserver.c (modified) (4 diffs)
- trunk/wifidog/src/centralserver.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/wifidog/ChangeLog
r475 r477 1 1 # $Header$ 2 3 2005-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 2 9 2005-02-22 Philippe April <philippe@ilesansfil.org> 3 10 * Tagged v1_1_0_beta2 trunk/wifidog/src/centralserver.c
r471 r477 59 59 @param outgoing Current counter of the client's total outgoing traffic, in bytes 60 60 */ 61 int 61 t_authcode 62 62 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) 63 63 { … … 67 67 char *tmp; 68 68 69 /* Blanket default is failed. */70 authresponse->authcode = AUTH_ VALIDATION_FAILED;69 /* Blanket default is error. */ 70 authresponse->authcode = AUTH_ERROR; 71 71 72 72 sockfd = connect_auth_server(); 73 73 if (sockfd == -1) { 74 74 /* Could not connect to any auth server */ 75 return ( -1);75 return (AUTH_ERROR); 76 76 } 77 77 … … 94 94 95 95 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; 99 98 100 99 if (numbytes == -1) { 101 100 debug(LOG_ERR, "Error reading from auth server: %s", strerror(errno)); 102 101 close(sockfd); 103 return( -1);102 return(AUTH_ERROR); 104 103 } 105 104 close(sockfd); … … 116 115 return(AUTH_ERROR); 117 116 } 118 } else { 117 } 118 else { 119 119 return(AUTH_ERROR); 120 120 } trunk/wifidog/src/centralserver.h
r471 r477 36 36 37 37 /** @brief Initiates a transaction with the auth server */ 38 intauth_server_request(t_authresponse *authresponse, char *request_type, char *ip, char *mac, char *token, unsigned long long int incoming, unsigned long long int outgoing);38 t_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); 39 39 40 40 /** @brief Tries really hard to connect to an auth server. Returns a connected file descriptor or -1 on error */
