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
David Barchiesi
OpenLDAP
Commits
a572f4b9
Commit
a572f4b9
authored
12 years ago
by
Jani Salonen
Committed by
Howard Chu
12 years ago
Browse files
Options
Downloads
Patches
Plain Diff
ITS#7305 add slapi_[get|free]_client_ip()
parent
450d2242
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/slapi-plugin.h
+2
-0
2 additions, 0 deletions
include/slapi-plugin.h
servers/slapd/slapi/slapi_utils.c
+37
-0
37 additions, 0 deletions
servers/slapd/slapi/slapi_utils.c
with
39 additions
and
0 deletions
include/slapi-plugin.h
+
2
−
0
View file @
a572f4b9
...
...
@@ -399,6 +399,8 @@ void slapi_seq_internal_set_pb( Slapi_PBlock *pb, char *ibase, int type,
/* connection related routines */
int
slapi_is_connection_ssl
(
Slapi_PBlock
*
pPB
,
int
*
isSSL
);
int
slapi_get_client_port
(
Slapi_PBlock
*
pPB
,
int
*
fromPort
);
int
slapi_get_client_ip
(
Slapi_PBlock
*
pb
,
char
**
clientIP
);
void
slapi_free_client_ip
(
char
**
clientIP
);
/* computed attributes */
typedef
struct
_computed_attr_context
computed_attr_context
;
...
...
This diff is collapsed.
Click to expand it.
servers/slapd/slapi/slapi_utils.c
+
37
−
0
View file @
a572f4b9
...
...
@@ -1843,6 +1843,43 @@ slapi_pw_find(
return
1
;
}
// Get connected client IP address.
//
// The user must free the returned client IP after its use.
// Compatible with IBM Tivoli call.
//
// Errors:
// * LDAP_PARAM_ERROR - If the pb parameter is null.
// * LDAP_OPERATIONS_ERROR - If the API encounters error processing the request.
// * LDAP_NO_MEMORY - Failed to allocate required memory.
int
slapi_get_client_ip
(
Slapi_PBlock
*
pb
,
char
**
clientIP
)
{
char
*
s
=
NULL
;
if
(
pb
==
NULL
||
pb
->
pb_conn
==
NULL
)
return
(
LDAP_PARAM_ERROR
);
if
((
s
=
(
char
*
)
slapi_ch_malloc
(
pb
->
pb_conn
->
c_peer_name
.
bv_len
+
1
))
==
NULL
)
{
return
(
LDAP_NO_MEMORY
);
}
memcpy
(
s
,
pb
->
pb_conn
->
c_peer_name
.
bv_val
,
pb
->
pb_conn
->
c_peer_name
.
bv_len
);
s
[
pb
->
pb_conn
->
c_peer_name
.
bv_len
]
=
0
;
*
clientIP
=
s
;
return
(
LDAP_SUCCESS
);
}
// Free previously allocated client IP address.
void
slapi_free_client_ip
(
char
**
clientIP
)
{
slapi_ch_free
((
void
**
)
clientIP
);
}
#define MAX_HOSTNAME 512
char
*
...
...
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