summaryrefslogtreecommitdiff
path: root/lib/openldap.c
Commit message (Collapse)AuthorAgeFilesLines
* checksrc: find bad indentation in conditions without open braceDaniel Stenberg2023-04-281-1/+1
| | | | | | | | | | | If the previous line starts with if/while/for AND ends with a closed parenthesis and there's an equal number of open and closed parentheses on that line, verify that this line is indented $indent more steps, if not a cpp line. Also adjust the fall-out from this fix. Closes #11054
* copyright: update all copyright lines and remove year rangesDaniel Stenberg2023-01-031-2/+2
| | | | | | | | | | | | - they are mostly pointless in all major jurisdictions - many big corporations and projects already don't use them - saves us from pointless churn - git keeps history for us - the year range is kept in COPYING checksrc is updated to allow non-year using copyright statements Closes #10205
* vtls: localization of state data in filtersStefan Eissing2022-11-221-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - almost all backend calls pass the Curl_cfilter intance instead of connectdata+sockindex - ssl_connect_data is remove from struct connectdata and made internal to vtls - ssl_connect_data is allocated in the added filter, kept at cf->ctx - added function to let a ssl filter access its ssl_primary_config and ssl_config_data this selects the propert subfields in conn and data, for filters added as plain or proxy - adjusted all backends to use the changed api - adjusted all backends to access config data via the exposed functions, no longer using conn or data directly cfilter renames for clear purpose: - methods `Curl_conn_*(data, conn, sockindex)` work on the complete filter chain at `sockindex` and connection `conn`. - methods `Curl_cf_*(cf, ...)` work on a specific Curl_cfilter instance. - methods `Curl_conn_cf()` work on/with filter instances at a connection. - rebased and resolved some naming conflicts - hostname validation (und session lookup) on SECONDARY use the same name as on FIRST (again). new debug macros and removing connectdata from function signatures where not needed. adapting schannel for new Curl_read_plain paramter. Closes #9919
* lib: connection filters (cfilter) addition to curl:Stefan Eissing2022-11-111-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | - general construct/destroy in connectdata - default implementations of callback functions - connect: cfilters for connect and accept - socks: cfilter for socks proxying - http_proxy: cfilter for http proxy tunneling - vtls: cfilters for primary and proxy ssl - change in general handling of data/conn - Curl_cfilter_setup() sets up filter chain based on data settings, if none are installed by the protocol handler setup - Curl_cfilter_connect() boot straps filters into `connected` status, used by handlers and multi to reach further stages - Curl_cfilter_is_connected() to check if a conn is connected, e.g. all filters have done their work - Curl_cfilter_get_select_socks() gets the sockets and READ/WRITE indicators for multi select to work - Curl_cfilter_data_pending() asks filters if the have incoming data pending for recv - Curl_cfilter_recv()/Curl_cfilter_send are the general callbacks installed in conn->recv/conn->send for io handling - Curl_cfilter_attach_data()/Curl_cfilter_detach_data() inform filters and addition/removal of a `data` from their connection - adding vtl functions to prevent use of Curl_ssl globals directly in other parts of the code. Reviewed-by: Daniel Stenberg Closes #9855
* misc: ISSPACE() => ISBLANK()Daniel Stenberg2022-09-061-2/+2
| | | | | | | | | | | Instances of ISSPACE() use that should rather use ISBLANK(). I think somewhat carelessly used because it sounds as if it checks for space or whitespace, but also includes %0a to %0d. For parsing purposes, we should only accept what we must and not be overly liberal. It leads to surprises and surprises lead to bad things. Closes #9432
* copyright: make repository REUSE compliantmax.mehl2022-06-131-0/+2
| | | | | | | | | | | Add licensing and copyright information for all files in this repository. This either happens in the file itself as a comment header or in the file `.reuse/dep5`. This commit also adds a Github workflow to check pull requests and adapts copyright.pl to the changes. Closes #8869
* urldata: remove conn->bits.user_passwdDaniel Stenberg2022-02-161-4/+4
| | | | | | | | | The authentication status should be told by the transfer and not the connection. Reported-by: John H. Ayad Fixes #8449 Closes #8451
* openldap: pass string length arguments to client_write()Patrick Monnerat2022-02-091-19/+23
| | | | | | | This uses the new STRCONST() macro and saves 2 strlen() calls on short string constants per LDIF output line. Closes #8404
* lib: remove support for CURL_DOES_CONVERSIONSDaniel Stenberg2022-02-041-1/+1
| | | | | | TPF was the only user and support for that was dropped. Closes #8378
* openldap: fix compiler warning when built without SSL supportDaniel Stenberg2022-02-011-0/+3
| | | | | | openldap.c:841:52: error: unused parameter ‘data’ [-Werror=unused-parameter] Closes #8367
* openldap: implement SASL authenticationPatrick Monnerat2022-01-111-13/+309
| | | | | | | | | | | As credentials can be quite different depending on the mechanism used, there are no default mechanisms for LDAP and simple bind with a DN is then used. The caller has to provide mechanism(s) using CURLOPT_LOGIN_OPTIONS to enable SASL authentication and disable simple bind. Closes #8152
* openldap: several minor improvementsPatrick Monnerat2021-12-151-79/+100
| | | | | | | | | | | | - Early check proper LDAP URL syntax. Reject URLs with a userinfo part. - Use dynamic memory for ldap_init_fd() URL rather than a stack-allocated buffer. - Never chase referrals: supporting it would require additional parallel connections and alternate authentication credentials. - Do not wait 1 microsecond while polling/reading query response data. - Store last received server code for retrieval with CURLINFO_RESPONSE_CODE. Closes #8140
* openldap: simplify ldif generation codePatrick Monnerat2021-12-131-62/+47
| | | | | | | and take care of zero-length values, avoiding conversion to base64 and/or trailing spaces. Closes #8136
* openldap: process search query response messages one by onePatrick Monnerat2021-12-111-157/+114
| | | | | | | | Upon receiving large result sets, this reduces memory consumption and allows starting to output results while the transfer is still in progress. Closes #8101
* openldap: implement STARTTLSPatrick Monnerat2021-12-061-6/+62
| | | | | | | As this introduces use of CURLOPT_USE_SSL option for LDAP, also check this option in ldap.c as it is not supported by this backend. Closes #8065
* openldap: handle connect phase with a state machinePatrick Monnerat2021-11-261-111/+213
| | | | Closes #8054
* infof: remove newline from format strings, always append itDaniel Stenberg2021-07-071-2/+2
| | | | | | | | | | | | | | | | - the data needs to be "line-based" anyway since it's also passed to the debug callback/application - it makes infof() work like failf() and consistency is good - there's an assert that triggers on newlines in the format string - Also removes a few instances of "..." - Removes the code that would append "..." to the end of the data *iff* it was truncated in infof() Closes #7357
* vtls: only store TIMER_APPCONNECT for non-proxy connectDaniel Stenberg2021-06-191-2/+3
| | | | | | | | | Introducing a 'isproxy' argument to the connect function so that it knows wether to store the time stamp or not. Reported-by: Yongkang Huang Fixes #7274 Closes #7274
* conn: add 'attach' to protocol handler, make libssh2 use itDaniel Stenberg2021-05-171-0/+2
| | | | | | | | | | | The libssh2 backend has SSH session associated with the connection but the callback context is the easy handle, so when a connection gets attached to a transfer, the protocol handler now allows for a custom function to get used to set things up correctly. Reported-by: Michael O'Farrell Fixes #6898 Closes #7078
* openldap: replace ldap_ prefix on private functionsDaniel Stenberg2021-05-051-33/+34
| | | | | | | | | | | | Since openldap itself uses that prefix and with OpenĹDAP 2.5.4 (at least) there's a symbol collision because of that. The private functions now use the 'oldap_' prefix where it previously used 'ldap_'. Reported-by: 3eka on github Fixes #7004 Closes #7005
* lib: remove strlen call from Curl_client_writeJacob Hoffman-Andrews2021-04-291-3/+3
| | | | | | | At all call sites with an explicit 0 len, pass an appropriate nonzero len. Closes #6954
* tidy-up: make conditional checks more consistentDaniel Stenberg2021-04-221-2/+2
| | | | | | ... remove '== NULL' and '!= 0' Closes #6912
* openldap: protect SSL-specific code with proper #ifdefDaniel Stenberg2021-04-151-0/+2
| | | | Closes #6901
* ldap: only set the callback ptr for TLS context when TLS is usedPatrick Monnerat2021-03-281-4/+5
| | | | | | Follow-up to a5eee22e594c2460f Fixes #6804 Closes #6805
* urldata: merge "struct DynamicStatic" into "struct UrlState"Daniel Stenberg2021-03-261-3/+3
| | | | | | | | Both were used for the same purposes and there was no logical separation between them. Combined, this also saves 16 bytes in less holes in my test build. Closes #6798
* openldap: disconnect betterDaniel Stenberg2021-03-241-1/+1
| | | | | | | | | Instead of clearing the callback argument in disconnect, set it to the (new) transfer to make sure the correct data is passed to the callbacks. Follow-up to e467ea3bd937f38 Assisted-by: Patrick Monnerat Closes #6787
* openldap: avoid NULL pointer dereferencesDaniel Stenberg2021-03-231-15/+25
| | | | | | | Follow-up to a59c33ceffb8f78 Reported-by: Patrick Monnerat Fixes #6676 Closes #6780
* openldap: pass 'data' to the callbacks instead of 'conn'Daniel Stenberg2021-02-161-7/+9
|
* hostip/proxy: remove conn->data useDaniel Stenberg2021-01-261-3/+3
| | | | Closes #6513
* vtls: reduce conn->data usePatrick Monnerat2021-01-191-2/+3
| | | | Closes #6474
* lib: pass in 'struct Curl_easy *' to most functionsDaniel Stenberg2021-01-171-38/+43
| | | | | | | | | | | | | | | | | | | | | ... in most cases instead of 'struct connectdata *' but in some cases in addition to. - We mostly operate on transfers and not connections. - We need the transfer handle to log, store data and more. Everything in libcurl is driven by a transfer (the CURL * in the public API). - This work clarifies and separates the transfers from the connections better. - We should avoid "conn->data". Since individual connections can be used by many transfers when multiplexing, making sure that conn->data points to the current and correct transfer at all times is difficult and has been notoriously error-prone over the years. The goal is to ultimately remove the conn->data pointer for this reason. Closes #6425
* urldata: remove 'void *protop' and create the union 'p'Daniel Stenberg2020-11-231-4/+4
| | | | | | | ... to avoid the use of 'void *' for the protocol specific structs done per transfer. Closes #6238
* curl.se: new homeDaniel Stenberg2020-11-041-1/+1
| | | | Closes #6172
* Curl_handler: add 'family' to each protocolDaniel Stenberg2020-09-211-1/+3
| | | | | | | Makes get_protocol_family() faster and it moves the knowledge about the "families" to each protocol handler, where it belongs. Closes #5986
* source cleanup: remove all custom typedef structsDaniel Stenberg2020-05-151-7/+7
| | | | | | | | | | | - Stick to a single unified way to use structs - Make checksrc complain on 'typedef struct {' - Allow them in tests, public headers and examples - Let MD4_CTX, MD5_CTX, and SHA256_CTX typedefs remain as they actually typedef different types/structs depending on build conditions. Closes #5338
* urldata: avoid 'generic', use dedicated pointersDaniel Stenberg2019-09-031-14/+14
| | | | | | For the 'proto' union within the connectdata struct. Closes #4290
* cleanup: remove FIXME and TODO commentsDaniel Stenberg2019-05-161-5/+0
| | | | | | | | | They serve very little purpose and mostly just add noise. Most of them have been around for a very long time. I read them all before removing or rephrasing them. Ref: #3876 Closes #3883
* urldata: simplify bytecountersDaniel Stenberg2019-03-011-2/+2
| | | | | | | | | | | | | - no need to have them protocol specific - no need to set pointers to them with the Curl_setup_transfer() call - make Curl_setup_transfer() operate on a transfer pointer, not connection - switch some counters from long to the more proper curl_off_t type Closes #3627
* snprintf: renamed and we now only use msnprintf()Daniel Stenberg2018-11-231-2/+2
| | | | | | | | | | | The function does not return the same value as snprintf() normally does, so readers may be mislead into thinking the code works differently than it actually does. A different function name makes this easier to detect. Reported-by: Tomas Hoger Assisted-by: Daniel Gustafsson Fixes #3296 Closes #3297
* openldap: fix for NULL return from ldap_get_attribute_ber()Howard Chu2018-03-231-1/+22
| | | | Closes #2399
* openldap: white space changes, fixed up the copyright yearsDaniel Stenberg2018-03-121-18/+19
|
* openldap: check ldap_get_attribute_ber() results for NULL before usingDaniel Stenberg2018-03-121-4/+4
| | | | | | CVE-2018-1000121 Reported-by: Dario Weisser Bug: https://curl.haxx.se/docs/adv_2018-97a2.html
* openldap: fix checksrc nitsDaniel Stenberg2017-12-061-5/+5
|
* openldap: add commented out debug possibilitiesStepan Broz2017-12-061-0/+28
| | | | | | ... to aid debugging openldap library using its built-in debug messages. Closes #2159
* memdebug: trace send, recv and socketDaniel Stenberg2017-10-141-2/+2
| | | | | | ... to allow them to be included in torture tests too. closes #1980
* code style: use spaces around plusesDaniel Stenberg2017-09-111-1/+1
|
* code style: use spaces around equals signsDaniel Stenberg2017-09-111-5/+5
|
* handler: refactor connection checkingMax Dymond2017-06-301-0/+2
| | | | | | Add a new type of callback to Curl_handler which performs checks on the connection. Alter RTSP so that it uses this callback to do its own check on connection health.
* internals: rename the SessionHandle struct to Curl_easyDaniel Stenberg2016-06-221-5/+5
|
* lib: include curl_printf.h as one of the last headersDaniel Stenberg2016-04-291-3/+2
| | | | | | | | | | | | | | | | | | | | curl_printf.h defines printf to curl_mprintf, etc. This can cause problems with external headers which may use __attribute__((format(printf, ...))) markers etc. To avoid that they cause problems with system includes, we include curl_printf.h after any system headers. That makes the three last headers to always be, and we keep them in this order: curl_printf.h curl_memory.h memdebug.h None of them include system headers, they all do funny #defines. Reported-by: David Benjamin Fixes #743