Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
OpenLDAP
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue 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
James Lowden
OpenLDAP
Commits
cde66129
Commit
cde66129
authored
16 years ago
by
Quanah Gibson-Mount
Browse files
Options
Downloads
Patches
Plain Diff
- remove unneeded Copy-Constructor
- allow to create Controls with no value
parent
c3d50a82
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/LDAPControl.cpp
+14
-11
14 additions, 11 deletions
contrib/ldapc++/src/LDAPControl.cpp
contrib/ldapc++/src/LDAPControl.h
+11
-9
11 additions, 9 deletions
contrib/ldapc++/src/LDAPControl.h
with
25 additions
and
20 deletions
contrib/ldapc++/src/LDAPControl.cpp
+
14
−
11
View file @
cde66129
...
...
@@ -10,13 +10,6 @@
using
namespace
std
;
LDAPCtrl
::
LDAPCtrl
(
const
LDAPCtrl
&
c
){
DEBUG
(
LDAP_DEBUG_CONSTRUCT
,
"LDAPCtrl::LDAPCtrl(&)"
<<
endl
);
m_oid
=
c
.
m_oid
;
m_data
=
c
.
m_data
;
m_isCritical
=
c
.
m_isCritical
;
}
LDAPCtrl
::
LDAPCtrl
(
const
char
*
oid
,
bool
critical
,
const
char
*
data
,
int
length
){
DEBUG
(
LDAP_DEBUG_CONSTRUCT
,
"LDAPCtrl::LDAPCtrl()"
<<
endl
);
...
...
@@ -28,10 +21,10 @@ LDAPCtrl::LDAPCtrl(const char *oid, bool critical, const char* data,
m_data
.
assign
(
data
,
length
);
}
else
{
m_data
=
string
();
m_noData
=
true
;
}
}
LDAPCtrl
::
LDAPCtrl
(
const
string
&
oid
,
bool
critical
,
const
string
&
data
){
DEBUG
(
LDAP_DEBUG_CONSTRUCT
,
"LDAPCtrl::LDAPCtrl()"
<<
endl
);
DEBUG
(
LDAP_DEBUG_CONSTRUCT
|
LDAP_DEBUG_PARAMETER
,
...
...
@@ -39,6 +32,7 @@ LDAPCtrl::LDAPCtrl(const string& oid, bool critical, const string& data){
m_oid
=
oid
;
m_isCritical
=
critical
;
m_data
=
data
;
m_noData
=
false
;
}
LDAPCtrl
::
LDAPCtrl
(
const
LDAPControl
*
ctrl
){
...
...
@@ -62,6 +56,10 @@ bool LDAPCtrl::isCritical()const {
return
m_isCritical
;
}
bool
LDAPCtrl
::
hasData
()
const
{
return
!
m_noData
;
}
string
LDAPCtrl
::
getData
()
const
{
DEBUG
(
LDAP_DEBUG_TRACE
,
"LDAPCtrl::getData()"
<<
endl
);
return
m_data
;
...
...
@@ -73,9 +71,14 @@ LDAPControl* LDAPCtrl::getControlStruct() const {
ret
->
ldctl_oid
=
new
char
[
m_oid
.
size
()
+
1
];
m_oid
.
copy
(
ret
->
ldctl_oid
,
string
::
npos
);
ret
->
ldctl_oid
[
m_oid
.
size
()]
=
0
;
ret
->
ldctl_value
.
bv_len
=
m_data
.
size
();
ret
->
ldctl_value
.
bv_val
=
new
char
[
m_data
.
size
()];
m_data
.
copy
(
ret
->
ldctl_value
.
bv_val
,
string
::
npos
);
if
(
m_noData
)
{
ret
->
ldctl_value
.
bv_len
=
0
;
ret
->
ldctl_value
.
bv_val
=
NULL
;
}
else
{
ret
->
ldctl_value
.
bv_len
=
m_data
.
size
();
ret
->
ldctl_value
.
bv_val
=
new
char
[
m_data
.
size
()];
m_data
.
copy
(
ret
->
ldctl_value
.
bv_val
,
string
::
npos
);
}
ret
->
ldctl_iscritical
=
(
m_isCritical
?
1
:
0
);
return
ret
;
}
...
...
This diff is collapsed.
Click to expand it.
contrib/ldapc++/src/LDAPControl.h
+
11
−
9
View file @
cde66129
...
...
@@ -16,11 +16,6 @@
*/
class
LDAPCtrl
{
public
:
/**
* Copy-constructor
*/
LDAPCtrl
(
const
LDAPCtrl
&
c
);
/**
* Constructor.
* @param oid: The Object Identifier of the Control
...
...
@@ -29,7 +24,7 @@ class LDAPCtrl{
* @param data: If there is data for the control, put it here.
* @param length: The length of the data field
*/
LDAPCtrl
(
const
char
*
oid
,
bool
critical
,
const
char
*
data
=
0
,
LDAPCtrl
(
const
char
*
oid
,
bool
critical
=
false
,
const
char
*
data
=
0
,
int
length
=
0
);
/**
...
...
@@ -39,8 +34,8 @@ class LDAPCtrl{
* critical by the server.
* @param data: If there is data for the control, put it here.
*/
LDAPCtrl
(
const
std
::
string
&
oid
,
bool
critical
=
false
,
const
std
::
string
&
data
=
std
::
string
()
);
LDAPCtrl
(
const
std
::
string
&
oid
,
bool
critical
,
const
std
::
string
&
data
);
/**
* Creates a copy of the Control that "ctrl is pointing to
...
...
@@ -58,7 +53,13 @@ class LDAPCtrl{
std
::
string
getOID
()
const
;
/**
* @return The Data of the control as a std::string-Objekt
* @return true if there is no "Control Value" (there is a
* difference between no and an empty control value)
*/
bool
hasData
()
const
;
/**
* @return The Data of the control as a std::string-Object
*/
std
::
string
getData
()
const
;
...
...
@@ -80,6 +81,7 @@ class LDAPCtrl{
std
::
string
m_oid
;
std
::
string
m_data
;
bool
m_isCritical
;
bool
m_noData
;
};
#endif //LDAP_CONTROL_H
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