summaryrefslogtreecommitdiff
path: root/lib/openldap.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2011-03-14 22:22:22 +0100
committerDaniel Stenberg <daniel@haxx.se>2011-03-14 22:22:22 +0100
commit8831000bc07de463d277975a3ddfb6a31dcf14b4 (patch)
tree0313bc919a3ee27021c352e9efad38ad8c62407e /lib/openldap.c
parented8749e308a9ed0da49ad46b8b2ba5e8aae80244 (diff)
downloadcurl-8831000bc07de463d277975a3ddfb6a31dcf14b4.tar.gz
protocol handler: added flags field
The protocol handler struct got a 'flags' field for special information and characteristics of the given protocol. This now enables us to move away central protocol information such as CLOSEACTION and DUALCHANNEL from single defines in a central place, out to each protocol's definition. It also made us stop abusing the protocol field for other info than the protocol, and we could start cleaning up other protocol-specific things by adding flags bits to set in the handler struct. The "protocol" field connectdata struct was removed as well and the code now refers directly to the conn->handler->protocol field instead. To make things work properly, the code now always store a conn->given pointer that points out the original handler struct so that the code can learn details from the original protocol even if conn->handler is modified along the way - for example when switching to go over a HTTP proxy.
Diffstat (limited to 'lib/openldap.c')
-rw-r--r--lib/openldap.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/openldap.c b/lib/openldap.c
index 7010da6c2..386f796e5 100644
--- a/lib/openldap.c
+++ b/lib/openldap.c
@@ -83,7 +83,8 @@ const struct Curl_handler Curl_handler_ldap = {
ZERO_NULL, /* perform_getsock */
ldap_disconnect, /* disconnect */
PORT_LDAP, /* defport */
- PROT_LDAP /* protocol */
+ PROT_LDAP, /* protocol */
+ PROTOPT_NONE /* flags */
};
#ifdef USE_SSL
@@ -105,7 +106,8 @@ const struct Curl_handler Curl_handler_ldaps = {
ZERO_NULL, /* perform_getsock */
ldap_disconnect, /* disconnect */
PORT_LDAPS, /* defport */
- PROT_LDAP | PROT_SSL /* protocol */
+ PROT_LDAP, /* protocol */
+ PROTOPT_SSL /* flags */
};
#endif
@@ -185,7 +187,7 @@ static CURLcode ldap_connect(struct connectdata *conn, bool *done)
strcpy(hosturl, "ldap");
ptr = hosturl+4;
- if (conn->protocol & PROT_SSL)
+ if (conn->handler->flags & PROTOPT_SSL)
*ptr++ = 's';
snprintf(ptr, sizeof(hosturl)-(ptr-hosturl), "://%s:%d",
conn->host.name, conn->remote_port);
@@ -229,7 +231,7 @@ static CURLcode ldap_connect(struct connectdata *conn, bool *done)
#endif /* !CURL_DISABLE_HTTP && !CURL_DISABLE_PROXY */
#ifdef USE_SSL
- if (conn->protocol & PROT_SSL) {
+ if (conn->handler->flags & PROTOPT_SSL) {
CURLcode res;
if (data->state.used_interface == Curl_if_easy) {
res = Curl_ssl_connect(conn, FIRSTSOCKET);
@@ -260,7 +262,7 @@ static CURLcode ldap_connecting(struct connectdata *conn, bool *done)
char *info = NULL;
#ifdef USE_SSL
- if (conn->protocol & PROT_SSL) {
+ if (conn->handler->flags & PROTOPT_SSL) {
/* Is the SSL handshake complete yet? */
if (!li->ssldone) {
CURLcode res = Curl_ssl_connect_nonblocking(conn, FIRSTSOCKET, &li->ssldone);