Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
OpenLDAP
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
François Kooman
OpenLDAP
Commits
7ebb050f
Commit
7ebb050f
authored
17 years ago
by
Quanah Gibson-Mount
Browse files
Options
Downloads
Patches
Plain Diff
use URIs instead of hostname/port
parent
c59e2a3b
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
contrib/ldapc++/src/LDAPAsynConnection.cpp
+18
-14
18 additions, 14 deletions
contrib/ldapc++/src/LDAPAsynConnection.cpp
contrib/ldapc++/src/LDAPAsynConnection.h
+11
-7
11 additions, 7 deletions
contrib/ldapc++/src/LDAPAsynConnection.h
with
29 additions
and
21 deletions
contrib/ldapc++/src/LDAPAsynConnection.cpp
+
18
−
14
View file @
7ebb050f
...
...
@@ -49,22 +49,26 @@ void LDAPAsynConnection::init(const string& hostname, int port){
" hostname:"
<<
hostname
<<
endl
<<
" port:"
<<
port
<<
endl
);
char
*
ldapuri
;
LDAPURLDesc
url
;
memset
(
&
url
,
0
,
sizeof
(
url
));
url
.
lud_scheme
=
strdup
(
"ldap"
);
url
.
lud_host
=
strdup
(
hostname
.
c_str
());
url
.
lud_port
=
port
;
url
.
lud_scope
=
LDAP_SCOPE_DEFAULT
;
ldapuri
=
ldap_url_desc2str
(
&
url
);
m_uri
.
setScheme
(
"ldap"
);
m_uri
.
setHost
(
hostname
);
m_uri
.
setPort
(
port
);
const
char
*
ldapuri
=
m_uri
.
getURLString
().
c_str
();
int
ret
=
ldap_initialize
(
&
cur_session
,
ldapuri
);
if
(
ret
!=
LDAP_SUCCESS
)
{
throw
LDAPException
(
ret
);
}
m_host
=
hostname
;
m_port
=
port
;
int
opt
=
3
;
ldap_set_option
(
cur_session
,
LDAP_OPT_REFERRALS
,
LDAP_OPT_OFF
);
ldap_set_option
(
cur_session
,
LDAP_OPT_PROTOCOL_VERSION
,
&
opt
);
}
void
LDAPAsynConnection
::
initialize
(
const
std
::
string
&
uri
){
m_uri
.
setURLString
(
uri
);
int
ret
=
ldap_initialize
(
&
cur_session
,
m_uri
.
getURLString
().
c_str
());
if
(
ret
!=
LDAP_SUCCESS
)
{
throw
LDAPException
(
ret
);
}
int
opt
=
3
;
ldap_set_option
(
cur_session
,
LDAP_OPT_REFERRALS
,
LDAP_OPT_OFF
);
ldap_set_option
(
cur_session
,
LDAP_OPT_PROTOCOL_VERSION
,
&
opt
);
...
...
@@ -250,12 +254,12 @@ LDAP* LDAPAsynConnection::getSessionHandle() const{
const
string
&
LDAPAsynConnection
::
getHost
()
const
{
DEBUG
(
LDAP_DEBUG_TRACE
,
"LDAPAsynConnection::setHost()"
<<
endl
);
return
m_
h
ost
;
return
m_
uri
.
getH
ost
()
;
}
int
LDAPAsynConnection
::
getPort
()
const
{
DEBUG
(
LDAP_DEBUG_TRACE
,
"LDAPAsynConnection::getPort()"
<<
endl
);
return
m_
p
ort
;
return
m_
uri
.
getP
ort
()
;
}
LDAPAsynConnection
*
LDAPAsynConnection
::
referralConnect
(
...
...
This diff is collapsed.
Click to expand it.
contrib/ldapc++/src/LDAPAsynConnection.h
+
11
−
7
View file @
7ebb050f
...
...
@@ -88,6 +88,15 @@ class LDAPAsynConnection{
*/
void
init
(
const
std
::
string
&
hostname
,
int
port
);
/**
* Initializes a connection to a server.
*
* There actually no communication to the server. Just the
* object is initialized
* @param uri The LDAP-Uri for the destination
*/
void
initialize
(
const
std
::
string
&
uri
);
/**
* Start TLS on this connection. This isn't in the constructor,
* because it could fail (i.e. server doesn't have SSL cert, client
...
...
@@ -306,14 +315,9 @@ class LDAPAsynConnection{
LDAPConstraints
*
m_constr
;
/**
* The name of the destination host
*/
std
::
string
m_host
;
/**
* The port the destination server is running on.
* The URI of this connection
*/
int
m_port
;
LDAPUrl
m_uri
;
protected
:
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment