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
Christopher Ng
OpenLDAP
Commits
6847e329
Commit
6847e329
authored
25 years ago
by
Kurt Zeilenga
Browse files
Options
Downloads
Patches
Plain Diff
Fix new URL startup code.
parent
4fdd533a
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
servers/slapd/daemon.c
+35
-14
35 additions, 14 deletions
servers/slapd/daemon.c
servers/slapd/main.c
+5
-1
5 additions, 1 deletion
servers/slapd/main.c
with
40 additions
and
15 deletions
servers/slapd/daemon.c
+
35
−
14
View file @
6847e329
...
...
@@ -33,7 +33,7 @@ typedef struct slap_listener {
struct
sockaddr_in
sl_addr
;
}
Listener
;
Listener
**
slap_listeners
;
Listener
**
slap_listeners
=
NULL
;
#ifdef HAVE_WINSOCK2
/* in nt_main.c */
...
...
@@ -196,7 +196,7 @@ static void slapd_close(ber_socket_t s) {
Listener
*
open_listener
(
char
*
url
,
const
char
*
url
,
int
port
,
int
tls_port
)
{
...
...
@@ -228,6 +228,8 @@ open_listener(
}
#else
l
.
sl_is_tls
=
lud
->
lud_ldaps
;
if
(
!
lud
->
lud_port
)
{
lud
->
lud_port
=
lud
->
lud_ldaps
?
tls_port
:
port
;
}
...
...
@@ -298,7 +300,7 @@ open_listener(
WSAGetLastError
(),
WSAGetLastErrorString
(),
0
);
#endif
return
(
AC_SOCKET_INVALID
)
;
return
NULL
;
}
#ifndef HAVE_WINSOCK
...
...
@@ -307,7 +309,7 @@ open_listener(
"daemon: listener descriptor %ld is too great %ld
\n
"
,
(
long
)
l
.
sl_sd
,
(
long
)
dtblsize
,
0
);
tcp_close
(
l
.
sl_sd
);
return
(
AC_SOCKET_INVALID
)
;
return
NULL
;
}
#endif
...
...
@@ -345,7 +347,7 @@ open_listener(
err
>
-
1
&&
err
<
sys_nerr
?
sys_errlist
[
err
]
:
"unknown"
);
tcp_close
(
l
.
sl_sd
);
return
AC_SOCKET_INVALID
;
return
NULL
;
}
l
.
sl_url
=
ch_strdup
(
url
);
...
...
@@ -353,13 +355,16 @@ open_listener(
li
=
ch_malloc
(
sizeof
(
Listener
)
);
*
li
=
l
;
Debug
(
LDAP_DEBUG_TRACE
,
"daemon: initialized %s
\n
"
,
l
.
sl_url
,
0
,
0
);
return
li
;
}
static
int
sockinit
(
void
);
static
int
sockdestroy
(
void
);
slapd_daemon_init
(
char
*
urls
,
int
port
,
int
tls_port
)
int
slapd_daemon_init
(
char
*
urls
,
int
port
,
int
tls_port
)
{
int
i
,
rc
;
char
**
u
;
...
...
@@ -368,6 +373,9 @@ slapd_daemon_init(char *urls, int port, int tls_port )
assert
(
tls_port
==
0
);
#endif
Debug
(
LDAP_DEBUG_ARGS
,
"daemon_init: %s (%d/%d)
\n
"
,
urls
?
urls
:
"<null>"
,
port
,
tls_port
);
if
(
rc
=
sockinit
()
)
{
return
rc
;
}
...
...
@@ -390,22 +398,35 @@ slapd_daemon_init(char *urls, int port, int tls_port )
FD_ZERO
(
&
slap_daemon
.
sd_writers
);
if
(
urls
==
NULL
)
{
urls
=
ch_strdup
(
"ldap://"
)
;
urls
=
"ldap://
/
"
;
}
u
=
str2charray
(
urls
,
" "
);
if
(
u
==
NULL
)
{
if
(
u
==
NULL
||
u
[
0
]
==
NULL
)
{
Debug
(
LDAP_DEBUG_ANY
,
"daemon_init: no urls (%s) provided.
\n
"
,
urls
,
0
,
0
);
return
-
1
;
}
for
(
i
=
0
;
u
[
i
]
==
NULL
;
i
++
)
{
/* EMPTY */
;
for
(
i
=
0
;
u
[
i
]
!=
NULL
;
i
++
)
{
Debug
(
LDAP_DEBUG_TRACE
,
"daemon_init: listen on %s
\n
"
,
u
[
i
],
0
,
0
);
}
if
(
i
==
0
)
{
Debug
(
LDAP_DEBUG_ANY
,
"daemon_init: no listeners to open (%s)
\n
"
,
urls
,
0
,
0
);
return
-
1
;
}
Debug
(
LDAP_DEBUG_TRACE
,
"daemon_init: %d listeners to open...
\n
"
,
i
,
0
,
0
);
slap_listeners
=
ch_malloc
(
(
i
+
1
)
*
sizeof
(
Listener
*
)
);
for
(
i
=
0
;
u
[
i
]
=
=
NULL
;
i
++
)
{
for
(
i
=
0
;
u
[
i
]
!
=
NULL
;
i
++
)
{
slap_listeners
[
i
]
=
open_listener
(
u
[
i
],
port
,
tls_port
);
if
(
slap_listeners
[
i
]
==
NULL
)
{
...
...
@@ -414,12 +435,12 @@ slapd_daemon_init(char *urls, int port, int tls_port )
}
slap_listeners
[
i
]
=
NULL
;
Debug
(
LDAP_DEBUG_TRACE
,
"daemon_init: %d listeners opened.
\n
"
,
i
,
0
,
0
);
charray_free
(
u
);
ldap_pvt_thread_mutex_init
(
&
slap_daemon
.
sd_mutex
);
return
0
;
return
!
i
;
}
...
...
This diff is collapsed.
Click to expand it.
servers/slapd/main.c
+
5
−
1
View file @
6847e329
...
...
@@ -320,7 +320,11 @@ int main( int argc, char **argv )
openlog
(
serverName
,
OPENLOG_OPTIONS
);
#endif
slapd_daemon_init
(
urls
,
port
,
tls_port
);
if
(
slapd_daemon_init
(
urls
,
port
,
tls_port
)
!=
0
)
{
rc
=
1
;
SERVICE_EXIT
(
ERROR_SERVICE_SPECIFIC_ERROR
,
16
);
goto
stop
;
}
#if defined(HAVE_SETUID) && defined(HAVE_SETGID)
if
(
username
!=
NULL
||
groupname
!=
NULL
)
{
...
...
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