Commit Graph

31 Commits

Author SHA1 Message Date
c6ee3d79ad Fix syntax-check 'sc_prohibit_have_config_h'
* cfg.mk: Remove sc_prohibit_have_config_h from local-checks-to-skip
* libwget/*.c: Include <config.h> unconditionally
* src/*.c: Likewise
* tests/*.c: Likewise
2017-04-30 22:01:34 +02:00
7171aff7e8 Use atoll() instead of atol() for time_t variables
* libwget/cookie.c: Use atoll() instead of atol()
* libwget/hsts.c: Likewise
* libwget/http.c: Likewise
* libwget/ocsp.c: Likewise
* libwget/tls_session.c: Likewise
* libwget/hpkp.c: Change type of maxage from long to time_t
2017-03-29 16:18:26 +02:00
706b19648f Read and write time_t as long long int
* libwget/cookie.c: Write time_t as long long int
* libwget/hsts.c:   Likewise
* libwget/ocsp.c:   Likewise
* libwget/tls_session.c: Likewise
* libwget/hpkp.c:   Read and write time_t as long long int

Reported-By: Tim Rühsen
2017-03-29 11:58:51 +05:30
582c27e1b0 * libwget/hpkp.c: Make code similar to hsts.c 2017-03-08 12:05:18 +01:00
1a56fadd98 * libwget/hpkp.c (wget_hpkp_db_add): NULLify freed pointer 2017-03-08 11:10:37 +01:00
79350f1dfd * libwget/hpkp.c (_hpkp_db_load): Fix parsing host entries 2017-03-05 21:47:48 +01:00
79667f113d Remove port from HPKP code
* include/wget/wget.h: Remove wget_hpkp_set_port()
* libwget/hpkp.c (struct _wget_hpkp_st): Remove 'port'
* src/wget.c (process_response_header): Do not call wget_hpkp_set_port()
2017-03-04 18:32:22 +01:00
ec396c577f Fix URLs to HTTPS where possible 2017-02-28 15:31:30 +01:00
6e31d53bef HPKP: Drop/reject expired entries on save/load
* libwget/hpkp.c: Check max_age on load/save.
2017-02-22 13:16:40 +01:00
364ebfd4b2 Remove HPKP entries with zero PINs
* libwget/hpkp.c (wget_hpkp_db_check_pubkey): Fix subdomain default,
  (wget_hpkp_db_add): Remove entry on zero PINs
* src/wget.c: Remove comment line
* tests/test.c (test_hpkp): Test this feature
2017-02-22 13:16:40 +01:00
2b448ffa92 Fix memleak in HPKP
* include/wget/wget.h: Changed declaration of wget_hpkp_free()
* libwget/hpkp.c: Use wget_hpkp_free() as destructor function
* libwget/http.c (wget_http_free_hpkp_entries): Amended
* tests/test.c: Fix typos
2017-02-22 13:16:40 +01:00
559ca85662 * libwget/hpkp.c (_wget_hpkp_compare_pins): Implement 'includeSubDomains' 2017-02-22 13:16:40 +01:00
79165a421d * libwget/hpkp.c (wget_hpkp_set_host): Free host before assignment 2017-02-22 13:16:40 +01:00
68b8f02fab Implement HPKP checking
* include/wget/wget.h: Add function wget_hpkp_db_check_pubkey(),
  add WGET_SSL_HPKP_CACHE
* libwget/hpkp.c: Implement wget_hpkp_db_check_pubkey()
* libwget/ssl_gnutls.c: Implement and use _cert_verify_hpkp()
* src/options.c (init): Set WGET_SSL_HPKP_CACHE
2017-02-22 13:16:40 +01:00
afc4d5a1af HPKP API redesign 2017-02-22 13:16:40 +01:00
6dc090900f * libwget/hpkp.c (wget_hpkp_db_load): Fix -Wformat= 2017-02-22 13:16:40 +01:00
dcdcbbfa16 libwget/hpkp.c (wget_hpkp_db_load): Fix -Wsign-compare 2017-02-22 13:16:39 +01:00
e46e2e5d76 * libwget/hpkp.c: Fix signed/unsigned format warnings 2017-02-22 13:16:39 +01:00
94b93dd1b5 * libwget/hpkp.c (wget_hpkp_new): Fix -Wold-style-definition 2017-02-22 13:16:39 +01:00
84a6e44932 HPKP: version the HPKP file, for the future
* libwget/hpkp.c (wget_hpkp_db_save): write the version number
    (wget_hpkp_db_load): check the version number == 1
2017-02-22 13:13:54 +01:00
5ff138f3bb HPKP: Check file is regular or symlink
* libwget/hpkp.c (wget_hpkp_db_save): check if file is regular or symlink. If symlink, resolve it since unlink(2) does not follow symlinks.
2017-02-22 13:13:54 +01:00
89fed7e4db HPKP: Fix memory leaks
* src/wget.c (main, process_response_header): add debug traces
 * libwget/http.c (wget_http_parse_public_key_pins): fix memory leaks
 * libwget/hpkp.c (__wget_hpkp_free, wget_hpkp_db_load): fix memory
   leaks
2017-02-22 13:13:54 +01:00
16037fe94d HPKP: inline docs 2017-02-22 13:13:54 +01:00
ce2b489a08 HPKP: return WGET_HPKP_ENTRY_EXISTS 2017-02-22 13:13:54 +01:00
86cb1180b6 HPKP: Define return values. 2017-02-22 13:13:54 +01:00
4d263eb628 HPKP: use vector rather than linked list for b64 pins 2017-02-22 13:13:54 +01:00
17e2d3d2f9 HPKP: add log traces + fix bugs 2017-02-22 13:13:54 +01:00
5a3a418705 HPKP: hpkp complete 2017-02-22 13:13:54 +01:00
33e01c5dfa HPKP: fix wget_hpkp_db_save()
* src/wget.c (main): call wget_hpkp_db_save() at the end (params
   inverted).
 * include/wget/wget.h: export wget_hpkp_db_save().
 * libwget/hpkp.c (__hashtable_browse_cb): fix fprintf format string.
   (wget_hpkp_db_save): check filename is not an empty string.
   (wget_hpkp_db_load): likewise.
2017-02-22 13:13:54 +01:00
501459c813 HPKP: functions to load & save the database file
* libwget/hpkp.c (__wget_hpkp_new): new function. NO-OP, NEEDS
   IMPLEMENTATION.
   (__vector_browse_cb): new callback function to browse the vector.
   (__hashtable_browse_cb): new callback function to browse the hash
   table.
   (wget_hpkp_db_save): new function.
   (__wget_hpkp_parse_host_line): new function.
   (__wget_hpkp_parse_pin_line): new function.
   (wget_hpkp_db_load): new function.
2017-02-22 12:46:01 +01:00
584b15e67e Prototype HPKP functions
* include/wget/wget.h: new public function wget_hpkp_db_init().
 * libwget/hpkp.c: new file.
2017-02-22 12:46:01 +01:00