source:
freewrt/package/atftp/patches/110-services.patch@
621d5d2
| Last change on this file since 621d5d2 was 475ad56, checked in by , 20 years ago | |
|---|---|
|
|
| File size: 2.4 KB | |
-
tftp.c
diff -urN atftp.old/tftp.c atftp.dev/tftp.c
old new 409 409 int set_peer(int argc, char **argv) 410 410 { 411 411 struct hostent *host; /* for host name lookup */ 412 struct servent *sp; /* server entry for tftp service */412 int port = htons(69); 413 413 414 414 /* sanity check */ 415 415 if ((argc < 2) || (argc > 3)) … … 418 418 return ERR; 419 419 } 420 420 421 /* get the server entry */422 sp = getservbyname("tftp", "udp");423 if (sp == 0) {424 fprintf(stderr, "tftp: udp/tftp, unknown service.\n");425 return ERR;426 }427 428 421 /* look up the host */ 429 422 host = gethostbyname(argv[1]); 430 423 /* if valid, update s_inn structure */ … … 437 430 Strncpy(data.hostname, host->h_name, 438 431 sizeof(data.hostname)); 439 432 data.hostname[sizeof(data.hostname)-1] = 0; 440 data.sa_peer.sin_port = sp->s_port;433 data.sa_peer.sin_port = port; 441 434 } 442 435 else 443 436 { … … 448 441 /* get the server port */ 449 442 if (argc == 3) 450 443 { 451 sp->s_port = htons(atoi(argv[2]));452 if ( sp->s_port < 0)444 port = htons(atoi(argv[2])); 445 if (port < 0) 453 446 { 454 447 fprintf(stderr, "%s: bad port number.\n", argv[2]); 455 448 data.connected = 0; 456 449 return ERR; 457 450 } 458 data.sa_peer.sin_port = sp->s_port;451 data.sa_peer.sin_port = port; 459 452 } 460 453 /* copy port number to data structure */ 461 data.port = ntohs( sp->s_port);454 data.port = ntohs(port); 462 455 463 456 data.connected = 1; 464 457 return OK; -
tftpd.c
diff -urN atftp.old/tftpd.c atftp.dev/tftpd.c
old new 230 230 231 231 /* find the port */ 232 232 if (tftpd_port == 0) 233 { 234 if ((serv = getservbyname("tftp", "udp")) == NULL) 235 { 236 logger(LOG_ERR, "atftpd: udp/tftp, unknown service"); 237 exit(1); 238 } 239 tftpd_port = ntohs(serv->s_port); 240 } 233 tftpd_port = htons(69); 234 241 235 /* initialise sockaddr_in structure */ 242 236 memset(&sa, 0, sizeof(sa)); 243 237 sa.sin_family = AF_INET;
Note:
See TracBrowser
for help on using the repository browser.
