|
5 | 5 | * | (__| |_| | _ <| |___
|
6 | 6 | * \___|\___/|_| \_\_____|
|
7 | 7 | *
|
8 |
| - * Copyright (C) 2017 - 2021, Max Dymond, <[email protected]>, et al. |
| 8 | + * Copyright (C) 2017 - 2022, Max Dymond, <[email protected]>, et al. |
9 | 9 | *
|
10 | 10 | * This software is licensed as described in the file COPYING, which
|
11 | 11 | * you should have received as part of this distribution. The terms
|
@@ -462,81 +462,78 @@ int fuzz_select(int nfds,
|
462 | 462 | }
|
463 | 463 |
|
464 | 464 | /**
|
465 |
| - * Set allowed protocols based on the compile options |
| 465 | + * Set allowed protocols based on the compile options. |
| 466 | + * |
| 467 | + * Note that it can only use ONE of the FUZZ_PROTOCOLS_* defines.a |
466 | 468 | */
|
467 | 469 | int fuzz_set_allowed_protocols(FUZZ_DATA *fuzz)
|
468 | 470 | {
|
469 | 471 | int rc = 0;
|
470 |
| - unsigned long allowed_protocols = 0; |
| 472 | + const char *allowed_protocols = ""; |
471 | 473 |
|
472 | 474 | #ifdef FUZZ_PROTOCOLS_ALL
|
473 | 475 | /* Do not allow telnet currently as it accepts input from stdin. */
|
474 |
| - allowed_protocols |= CURLPROTO_ALL & ~CURLPROTO_TELNET; |
| 476 | + allowed_protocols = |
| 477 | + "dict,file,ftp,ftps,gopher,gophers,http,https,imap,imaps," |
| 478 | + "ldap,ldaps,mqtt,pop3,pop3s,rtmp,rtmpe,rtmps,rtmpt,rtmpte,rtmpts," |
| 479 | + "rtsp,scp,sftp,smb,smbs,smtp,smtps,tftp"; |
475 | 480 | #endif
|
476 | 481 | #ifdef FUZZ_PROTOCOLS_DICT
|
477 |
| - allowed_protocols |= CURLPROTO_DICT; |
| 482 | + allowed_protocols = "dict"; |
478 | 483 | #endif
|
479 | 484 | #ifdef FUZZ_PROTOCOLS_FILE
|
480 |
| - allowed_protocols |= CURLPROTO_FILE; |
| 485 | + allowed_protocols = "file"; |
481 | 486 | #endif
|
482 | 487 | #ifdef FUZZ_PROTOCOLS_FTP
|
483 |
| - allowed_protocols |= CURLPROTO_FTP; |
484 |
| - allowed_protocols |= CURLPROTO_FTPS; |
| 488 | + allowed_protocols = "ftp,ftps"; |
485 | 489 | #endif
|
486 | 490 | #ifdef FUZZ_PROTOCOLS_GOPHER
|
487 |
| - allowed_protocols |= CURLPROTO_GOPHER; |
| 491 | + allowed_protocols = "gopher,gophers"; |
488 | 492 | #endif
|
489 | 493 | #ifdef FUZZ_PROTOCOLS_HTTP
|
490 |
| - allowed_protocols |= CURLPROTO_HTTP; |
| 494 | + allowed_protocols = "http"; |
491 | 495 | #endif
|
492 | 496 | #ifdef FUZZ_PROTOCOLS_HTTPS
|
493 |
| - allowed_protocols |= CURLPROTO_HTTPS; |
| 497 | + allowed_protocols = "https"; |
494 | 498 | #endif
|
495 | 499 | #ifdef FUZZ_PROTOCOLS_IMAP
|
496 |
| - allowed_protocols |= CURLPROTO_IMAP; |
497 |
| - allowed_protocols |= CURLPROTO_IMAPS; |
| 500 | + allowed_protocols = "imap,imaps"; |
498 | 501 | #endif
|
499 | 502 | #ifdef FUZZ_PROTOCOLS_LDAP
|
500 |
| - allowed_protocols |= CURLPROTO_LDAP; |
501 |
| - allowed_protocols |= CURLPROTO_LDAPS; |
| 503 | + allowed_protocols = "ldap,ldaps"; |
502 | 504 | #endif
|
503 | 505 | #ifdef FUZZ_PROTOCOLS_MQTT
|
504 |
| - allowed_protocols |= CURLPROTO_MQTT; |
| 506 | + allowed_protocols = "mqtt"; |
505 | 507 | #endif
|
506 | 508 | #ifdef FUZZ_PROTOCOLS_POP3
|
507 |
| - allowed_protocols |= CURLPROTO_POP3; |
508 |
| - allowed_protocols |= CURLPROTO_POP3S; |
| 509 | + allowed_protocols = "pop3,pop3s"; |
509 | 510 | #endif
|
510 | 511 | #ifdef FUZZ_PROTOCOLS_RTMP
|
511 |
| - allowed_protocols |= CURLPROTO_RTMP; |
512 |
| - allowed_protocols |= CURLPROTO_RTMPE; |
513 |
| - allowed_protocols |= CURLPROTO_RTMPS; |
514 |
| - allowed_protocols |= CURLPROTO_RTMPT; |
515 |
| - allowed_protocols |= CURLPROTO_RTMPTE; |
516 |
| - allowed_protocols |= CURLPROTO_RTMPTS; |
| 512 | + allowed_protocols = "rtmp,rtmpe,rtmps,rtmpt,rtmpte,rtmpts"; |
517 | 513 | #endif
|
518 | 514 | #ifdef FUZZ_PROTOCOLS_RTSP
|
519 |
| - allowed_protocols |= CURLPROTO_RTSP; |
| 515 | + allowed_protocols = "rtsp"; |
520 | 516 | #endif
|
521 | 517 | #ifdef FUZZ_PROTOCOLS_SCP
|
522 |
| - allowed_protocols |= CURLPROTO_SCP; |
| 518 | + allowed_protocols = "scp"; |
523 | 519 | #endif
|
524 | 520 | #ifdef FUZZ_PROTOCOLS_SFTP
|
525 |
| - allowed_protocols |= CURLPROTO_SFTP; |
| 521 | + allowed_protocols = "sftp"; |
526 | 522 | #endif
|
527 | 523 | #ifdef FUZZ_PROTOCOLS_SMB
|
528 |
| - allowed_protocols |= CURLPROTO_SMB; |
529 |
| - allowed_protocols |= CURLPROTO_SMBS; |
| 524 | + allowed_protocols = "smb,smbs"; |
530 | 525 | #endif
|
531 | 526 | #ifdef FUZZ_PROTOCOLS_SMTP
|
532 |
| - allowed_protocols |= CURLPROTO_SMTP; |
533 |
| - allowed_protocols |= CURLPROTO_SMTPS; |
| 527 | + allowed_protocols = "smtp,smtps"; |
534 | 528 | #endif
|
535 | 529 | #ifdef FUZZ_PROTOCOLS_TFTP
|
536 |
| - allowed_protocols |= CURLPROTO_TFTP; |
| 530 | + allowed_protocols = "tftp"; |
| 531 | +#endif |
| 532 | +#ifdef FUZZ_PROTOCOLS_WS |
| 533 | + allowed_protocols = "ws,wss"; |
537 | 534 | #endif
|
538 | 535 |
|
539 |
| - FTRY(curl_easy_setopt(fuzz->easy, CURLOPT_PROTOCOLS, allowed_protocols)); |
| 536 | + FTRY(curl_easy_setopt(fuzz->easy, CURLOPT_PROTOCOLS_STR, allowed_protocols)); |
540 | 537 |
|
541 | 538 | EXIT_LABEL:
|
542 | 539 |
|
|
0 commit comments