mirror of
https://github.com/curl/curl.git
synced 2026-08-26 21:44:10 +03:00
urldata: avoid 'generic', use dedicated pointers
For the 'proto' union within the connectdata struct. Closes #4290
This commit is contained in:
parent
5050edb124
commit
4ac2884003
3 changed files with 25 additions and 22 deletions
|
|
@ -151,7 +151,7 @@ static const char *url_errs[] = {
|
|||
"bad or missing extensions"
|
||||
};
|
||||
|
||||
typedef struct ldapconninfo {
|
||||
struct ldapconninfo {
|
||||
LDAP *ld;
|
||||
Curl_recv *recv; /* for stacking SSL handler */
|
||||
Curl_send *send;
|
||||
|
|
@ -160,7 +160,7 @@ typedef struct ldapconninfo {
|
|||
bool ssldone;
|
||||
bool sslinst;
|
||||
bool didbind;
|
||||
} ldapconninfo;
|
||||
};
|
||||
|
||||
typedef struct ldapreqinfo {
|
||||
int msgid;
|
||||
|
|
@ -169,7 +169,7 @@ typedef struct ldapreqinfo {
|
|||
|
||||
static CURLcode ldap_setup_connection(struct connectdata *conn)
|
||||
{
|
||||
ldapconninfo *li;
|
||||
struct ldapconninfo *li;
|
||||
LDAPURLDesc *lud;
|
||||
struct Curl_easy *data = conn->data;
|
||||
int rc, proto;
|
||||
|
|
@ -190,11 +190,11 @@ static CURLcode ldap_setup_connection(struct connectdata *conn)
|
|||
proto = ldap_pvt_url_scheme2proto(lud->lud_scheme);
|
||||
ldap_free_urldesc(lud);
|
||||
|
||||
li = calloc(1, sizeof(ldapconninfo));
|
||||
li = calloc(1, sizeof(struct ldapconninfo));
|
||||
if(!li)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
li->proto = proto;
|
||||
conn->proto.generic = li;
|
||||
conn->proto.ldapc = li;
|
||||
connkeep(conn, "OpenLDAP default");
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
|
@ -205,7 +205,7 @@ static Sockbuf_IO ldapsb_tls;
|
|||
|
||||
static CURLcode ldap_connect(struct connectdata *conn, bool *done)
|
||||
{
|
||||
ldapconninfo *li = conn->proto.generic;
|
||||
struct ldapconninfo *li = conn->proto.ldapc;
|
||||
struct Curl_easy *data = conn->data;
|
||||
int rc, proto = LDAP_VERSION3;
|
||||
char hosturl[1024];
|
||||
|
|
@ -252,7 +252,7 @@ static CURLcode ldap_connect(struct connectdata *conn, bool *done)
|
|||
|
||||
static CURLcode ldap_connecting(struct connectdata *conn, bool *done)
|
||||
{
|
||||
ldapconninfo *li = conn->proto.generic;
|
||||
struct ldapconninfo *li = conn->proto.ldapc;
|
||||
struct Curl_easy *data = conn->data;
|
||||
LDAPMessage *msg = NULL;
|
||||
struct timeval tv = {0, 1}, *tvp;
|
||||
|
|
@ -357,7 +357,7 @@ static CURLcode ldap_connecting(struct connectdata *conn, bool *done)
|
|||
|
||||
static CURLcode ldap_disconnect(struct connectdata *conn, bool dead_connection)
|
||||
{
|
||||
ldapconninfo *li = conn->proto.generic;
|
||||
struct ldapconninfo *li = conn->proto.ldapc;
|
||||
(void) dead_connection;
|
||||
|
||||
if(li) {
|
||||
|
|
@ -365,7 +365,7 @@ static CURLcode ldap_disconnect(struct connectdata *conn, bool dead_connection)
|
|||
ldap_unbind_ext(li->ld, NULL, NULL);
|
||||
li->ld = NULL;
|
||||
}
|
||||
conn->proto.generic = NULL;
|
||||
conn->proto.ldapc = NULL;
|
||||
free(li);
|
||||
}
|
||||
return CURLE_OK;
|
||||
|
|
@ -373,7 +373,7 @@ static CURLcode ldap_disconnect(struct connectdata *conn, bool dead_connection)
|
|||
|
||||
static CURLcode ldap_do(struct connectdata *conn, bool *done)
|
||||
{
|
||||
ldapconninfo *li = conn->proto.generic;
|
||||
struct ldapconninfo *li = conn->proto.ldapc;
|
||||
ldapreqinfo *lr;
|
||||
CURLcode status = CURLE_OK;
|
||||
int rc = 0;
|
||||
|
|
@ -427,7 +427,7 @@ static CURLcode ldap_done(struct connectdata *conn, CURLcode res,
|
|||
if(lr) {
|
||||
/* if there was a search in progress, abandon it */
|
||||
if(lr->msgid) {
|
||||
ldapconninfo *li = conn->proto.generic;
|
||||
struct ldapconninfo *li = conn->proto.ldapc;
|
||||
ldap_abandon_ext(li->ld, lr->msgid, NULL, NULL);
|
||||
lr->msgid = 0;
|
||||
}
|
||||
|
|
@ -441,7 +441,7 @@ static CURLcode ldap_done(struct connectdata *conn, CURLcode res,
|
|||
static ssize_t ldap_recv(struct connectdata *conn, int sockindex, char *buf,
|
||||
size_t len, CURLcode *err)
|
||||
{
|
||||
ldapconninfo *li = conn->proto.generic;
|
||||
struct ldapconninfo *li = conn->proto.ldapc;
|
||||
struct Curl_easy *data = conn->data;
|
||||
ldapreqinfo *lr = data->req.protop;
|
||||
int rc, ret;
|
||||
|
|
@ -718,7 +718,7 @@ static ber_slen_t
|
|||
ldapsb_tls_read(Sockbuf_IO_Desc *sbiod, void *buf, ber_len_t len)
|
||||
{
|
||||
struct connectdata *conn = sbiod->sbiod_pvt;
|
||||
ldapconninfo *li = conn->proto.generic;
|
||||
struct ldapconninfo *li = conn->proto.ldapc;
|
||||
ber_slen_t ret;
|
||||
CURLcode err = CURLE_RECV_ERROR;
|
||||
|
||||
|
|
@ -733,7 +733,7 @@ static ber_slen_t
|
|||
ldapsb_tls_write(Sockbuf_IO_Desc *sbiod, void *buf, ber_len_t len)
|
||||
{
|
||||
struct connectdata *conn = sbiod->sbiod_pvt;
|
||||
ldapconninfo *li = conn->proto.generic;
|
||||
struct ldapconninfo *li = conn->proto.ldapc;
|
||||
ber_slen_t ret;
|
||||
CURLcode err = CURLE_SEND_ERROR;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue