Changeset 159 for trunk/instant_messenger/socket/server.c
- Timestamp:
- 01/21/08 08:37:07 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/instant_messenger/socket/server.c
r151 r159 280 280 struct cat * info; 281 281 pthread_t cat_thread; 282 283 FILE *file; 284 char line[80]; 285 char *ips[20]; 286 int cont; 287 int j; 282 288 283 289 unsigned int addr = 0; … … 289 295 printf("New connection: %s\n\n", buf); 290 296 291 if ( strcmp(buf, "10.15.20.42") == 0 || strcmp(buf, "10.15.20.202") == 0 ) 297 if(!(file = fopen("/etc/socket_im/hosts","r"))) 298 { 299 printf("ImpossÃvel abrir o arquivo hosts \n"); 300 exit(1); 301 } 302 303 fgets(line, 80, file); 304 while(!feof(file)) 305 { 306 ips[cont] = malloc(sizeof(char)*17); 307 line[strlen(line) - 1 ] = '\0'; 308 strcpy(ips[cont], line); 309 fgets(line, 80, file); 310 cont++; 311 } 312 313 fclose(file); 314 315 for( j = 0; j < cont; j++) 316 { 317 if( strcmp( buf, ips[j] ) == 0) 318 { 319 user = Handshake(client->newfd); 320 jabber_fd = user->jabber_fd; 321 break; 322 } 323 } 324 325 /*if ( strcmp(buf, "10.15.20.42") == 0 || strcmp(buf, "10.15.20.202") == 0 || strcmp(buf, "10.15.20.145") == 0 ) 292 326 { 293 327 user = Handshake(client->newfd); 294 328 jabber_fd = user->jabber_fd; 295 } 329 }*/ 296 330 297 331 if ( jabber_fd == (int)NULL )
Note: See TracChangeset
for help on using the changeset viewer.