"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "lib/openldap.c" between
curl-7.65.3.tar.xz and curl-7.66.0.tar.xz

About: cURL is a powerful commandline tool to transfer data from or to a server, using one of the supported protocols HTTP(S), FTP(S), SCP, SFTP, TFTP, DICT, TELNET, LDAP(S) or FILE.

openldap.c  (curl-7.65.3.tar.xz):openldap.c  (curl-7.66.0.tar.xz)
skipping to change at line 154 skipping to change at line 154
"unrecognized scheme", "unrecognized scheme",
"unbalanced delimiter", "unbalanced delimiter",
"bad URL", "bad URL",
"bad host or port", "bad host or port",
"bad or missing attributes", "bad or missing attributes",
"bad or missing scope", "bad or missing scope",
"bad or missing filter", "bad or missing filter",
"bad or missing extensions" "bad or missing extensions"
}; };
typedef struct ldapconninfo { struct ldapconninfo {
LDAP *ld; LDAP *ld;
Curl_recv *recv; /* for stacking SSL handler */ Curl_recv *recv; /* for stacking SSL handler */
Curl_send *send; Curl_send *send;
int proto; int proto;
int msgid; int msgid;
bool ssldone; bool ssldone;
bool sslinst; bool sslinst;
bool didbind; bool didbind;
} ldapconninfo; };
typedef struct ldapreqinfo { typedef struct ldapreqinfo {
int msgid; int msgid;
int nument; int nument;
} ldapreqinfo; } ldapreqinfo;
static CURLcode ldap_setup_connection(struct connectdata *conn) static CURLcode ldap_setup_connection(struct connectdata *conn)
{ {
ldapconninfo *li; struct ldapconninfo *li;
LDAPURLDesc *lud; LDAPURLDesc *lud;
struct Curl_easy *data = conn->data; struct Curl_easy *data = conn->data;
int rc, proto; int rc, proto;
CURLcode status; CURLcode status;
rc = ldap_url_parse(data->change.url, &lud); rc = ldap_url_parse(data->change.url, &lud);
if(rc != LDAP_URL_SUCCESS) { if(rc != LDAP_URL_SUCCESS) {
const char *msg = "url parsing problem"; const char *msg = "url parsing problem";
status = CURLE_URL_MALFORMAT; status = CURLE_URL_MALFORMAT;
if(rc > LDAP_URL_SUCCESS && rc <= LDAP_URL_ERR_BADEXTS) { if(rc > LDAP_URL_SUCCESS && rc <= LDAP_URL_ERR_BADEXTS) {
if(rc == LDAP_URL_ERR_MEM) if(rc == LDAP_URL_ERR_MEM)
status = CURLE_OUT_OF_MEMORY; status = CURLE_OUT_OF_MEMORY;
msg = url_errs[rc]; msg = url_errs[rc];
} }
failf(conn->data, "LDAP local: %s", msg); failf(conn->data, "LDAP local: %s", msg);
return status; return status;
} }
proto = ldap_pvt_url_scheme2proto(lud->lud_scheme); proto = ldap_pvt_url_scheme2proto(lud->lud_scheme);
ldap_free_urldesc(lud); ldap_free_urldesc(lud);
li = calloc(1, sizeof(ldapconninfo)); li = calloc(1, sizeof(struct ldapconninfo));
if(!li) if(!li)
return CURLE_OUT_OF_MEMORY; return CURLE_OUT_OF_MEMORY;
li->proto = proto; li->proto = proto;
conn->proto.generic = li; conn->proto.ldapc = li;
connkeep(conn, "OpenLDAP default"); connkeep(conn, "OpenLDAP default");
return CURLE_OK; return CURLE_OK;
} }
#ifdef USE_SSL #ifdef USE_SSL
static Sockbuf_IO ldapsb_tls; static Sockbuf_IO ldapsb_tls;
#endif #endif
static CURLcode ldap_connect(struct connectdata *conn, bool *done) 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; struct Curl_easy *data = conn->data;
int rc, proto = LDAP_VERSION3; int rc, proto = LDAP_VERSION3;
char hosturl[1024]; char hosturl[1024];
char *ptr; char *ptr;
(void)done; (void)done;
strcpy(hosturl, "ldap"); strcpy(hosturl, "ldap");
ptr = hosturl + 4; ptr = hosturl + 4;
if(conn->handler->flags & PROTOPT_SSL) if(conn->handler->flags & PROTOPT_SSL)
skipping to change at line 255 skipping to change at line 255
if(result) if(result)
return result; return result;
} }
#endif #endif
return CURLE_OK; return CURLE_OK;
} }
static CURLcode ldap_connecting(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; struct Curl_easy *data = conn->data;
LDAPMessage *msg = NULL; LDAPMessage *msg = NULL;
struct timeval tv = {0, 1}, *tvp; struct timeval tv = {0, 1}, *tvp;
int rc, err; int rc, err;
char *info = NULL; char *info = NULL;
#ifdef USE_SSL #ifdef USE_SSL
if(conn->handler->flags & PROTOPT_SSL) { if(conn->handler->flags & PROTOPT_SSL) {
/* Is the SSL handshake complete yet? */ /* Is the SSL handshake complete yet? */
if(!li->ssldone) { if(!li->ssldone) {
skipping to change at line 360 skipping to change at line 360
if(info) if(info)
ldap_memfree(info); ldap_memfree(info);
conn->recv[FIRSTSOCKET] = ldap_recv; conn->recv[FIRSTSOCKET] = ldap_recv;
*done = TRUE; *done = TRUE;
return CURLE_OK; return CURLE_OK;
} }
static CURLcode ldap_disconnect(struct connectdata *conn, bool dead_connection) static CURLcode ldap_disconnect(struct connectdata *conn, bool dead_connection)
{ {
ldapconninfo *li = conn->proto.generic; struct ldapconninfo *li = conn->proto.ldapc;
(void) dead_connection; (void) dead_connection;
if(li) { if(li) {
if(li->ld) { if(li->ld) {
ldap_unbind_ext(li->ld, NULL, NULL); ldap_unbind_ext(li->ld, NULL, NULL);
li->ld = NULL; li->ld = NULL;
} }
conn->proto.generic = NULL; conn->proto.ldapc = NULL;
free(li); free(li);
} }
return CURLE_OK; return CURLE_OK;
} }
static CURLcode ldap_do(struct connectdata *conn, bool *done) static CURLcode ldap_do(struct connectdata *conn, bool *done)
{ {
ldapconninfo *li = conn->proto.generic; struct ldapconninfo *li = conn->proto.ldapc;
ldapreqinfo *lr; ldapreqinfo *lr;
CURLcode status = CURLE_OK; CURLcode status = CURLE_OK;
int rc = 0; int rc = 0;
LDAPURLDesc *ludp = NULL; LDAPURLDesc *ludp = NULL;
int msgid; int msgid;
struct Curl_easy *data = conn->data; struct Curl_easy *data = conn->data;
connkeep(conn, "OpenLDAP do"); connkeep(conn, "OpenLDAP do");
infof(data, "LDAP local: %s\n", data->change.url); infof(data, "LDAP local: %s\n", data->change.url);
skipping to change at line 430 skipping to change at line 430
bool premature) bool premature)
{ {
ldapreqinfo *lr = conn->data->req.protop; ldapreqinfo *lr = conn->data->req.protop;
(void)res; (void)res;
(void)premature; (void)premature;
if(lr) { if(lr) {
/* if there was a search in progress, abandon it */ /* if there was a search in progress, abandon it */
if(lr->msgid) { if(lr->msgid) {
ldapconninfo *li = conn->proto.generic; struct ldapconninfo *li = conn->proto.ldapc;
ldap_abandon_ext(li->ld, lr->msgid, NULL, NULL); ldap_abandon_ext(li->ld, lr->msgid, NULL, NULL);
lr->msgid = 0; lr->msgid = 0;
} }
conn->data->req.protop = NULL; conn->data->req.protop = NULL;
free(lr); free(lr);
} }
return CURLE_OK; return CURLE_OK;
} }
static ssize_t ldap_recv(struct connectdata *conn, int sockindex, char *buf, static ssize_t ldap_recv(struct connectdata *conn, int sockindex, char *buf,
size_t len, CURLcode *err) size_t len, CURLcode *err)
{ {
ldapconninfo *li = conn->proto.generic; struct ldapconninfo *li = conn->proto.ldapc;
struct Curl_easy *data = conn->data; struct Curl_easy *data = conn->data;
ldapreqinfo *lr = data->req.protop; ldapreqinfo *lr = data->req.protop;
int rc, ret; int rc, ret;
LDAPMessage *msg = NULL; LDAPMessage *msg = NULL;
LDAPMessage *ent; LDAPMessage *ent;
BerElement *ber = NULL; BerElement *ber = NULL;
struct timeval tv = {0, 1}; struct timeval tv = {0, 1};
(void)len; (void)len;
(void)buf; (void)buf;
skipping to change at line 721 skipping to change at line 721
struct connectdata *conn = sbiod->sbiod_pvt; struct connectdata *conn = sbiod->sbiod_pvt;
return Curl_ssl_data_pending(conn, FIRSTSOCKET); return Curl_ssl_data_pending(conn, FIRSTSOCKET);
} }
return 0; return 0;
} }
static ber_slen_t static ber_slen_t
ldapsb_tls_read(Sockbuf_IO_Desc *sbiod, void *buf, ber_len_t len) ldapsb_tls_read(Sockbuf_IO_Desc *sbiod, void *buf, ber_len_t len)
{ {
struct connectdata *conn = sbiod->sbiod_pvt; struct connectdata *conn = sbiod->sbiod_pvt;
ldapconninfo *li = conn->proto.generic; struct ldapconninfo *li = conn->proto.ldapc;
ber_slen_t ret; ber_slen_t ret;
CURLcode err = CURLE_RECV_ERROR; CURLcode err = CURLE_RECV_ERROR;
ret = (li->recv)(conn, FIRSTSOCKET, buf, len, &err); ret = (li->recv)(conn, FIRSTSOCKET, buf, len, &err);
if(ret < 0 && err == CURLE_AGAIN) { if(ret < 0 && err == CURLE_AGAIN) {
SET_SOCKERRNO(EWOULDBLOCK); SET_SOCKERRNO(EWOULDBLOCK);
} }
return ret; return ret;
} }
static ber_slen_t static ber_slen_t
ldapsb_tls_write(Sockbuf_IO_Desc *sbiod, void *buf, ber_len_t len) ldapsb_tls_write(Sockbuf_IO_Desc *sbiod, void *buf, ber_len_t len)
{ {
struct connectdata *conn = sbiod->sbiod_pvt; struct connectdata *conn = sbiod->sbiod_pvt;
ldapconninfo *li = conn->proto.generic; struct ldapconninfo *li = conn->proto.ldapc;
ber_slen_t ret; ber_slen_t ret;
CURLcode err = CURLE_SEND_ERROR; CURLcode err = CURLE_SEND_ERROR;
ret = (li->send)(conn, FIRSTSOCKET, buf, len, &err); ret = (li->send)(conn, FIRSTSOCKET, buf, len, &err);
if(ret < 0 && err == CURLE_AGAIN) { if(ret < 0 && err == CURLE_AGAIN) {
SET_SOCKERRNO(EWOULDBLOCK); SET_SOCKERRNO(EWOULDBLOCK);
} }
return ret; return ret;
} }
 End of changes. 14 change blocks. 
14 lines changed or deleted 14 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)