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
Dimitar Stoychev
OpenLDAP
Commits
cab43a68
Commit
cab43a68
authored
20 years ago
by
Pierangelo Masarati
Browse files
Options
Downloads
Patches
Plain Diff
infrastructure for '-o <option>[=<value>]' args
parent
7488f557
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
servers/slapd/main.c
+69
-2
69 additions, 2 deletions
servers/slapd/main.c
with
69 additions
and
2 deletions
servers/slapd/main.c
+
69
−
2
View file @
cab43a68
...
...
@@ -134,6 +134,41 @@ static int version = 0;
void
*
slap_tls_ctx
;
static
int
slapd_opt_slp
(
const
char
*
val
,
void
*
arg
)
{
#ifdef HAVE_SLP
/* NULL is default */
if
(
val
==
NULL
||
strcasecmp
(
val
,
"on"
)
==
0
)
{
slapd_register_slp
=
1
;
}
else
if
(
strcasecmp
(
val
,
"off"
)
==
0
)
{
slapd_register_slp
=
0
;
/* NOTE: add support for URL specification? */
}
else
{
fprintf
(
stderr
,
"unrecognized value
\"
%s
\"
for SLP option
\n
"
,
val
);
return
-
1
;
}
return
0
;
#else
fputs
(
"slapd: SLP support is not available
\n
"
,
stderr
);
return
0
;
#endif
}
struct
option_helper
{
struct
berval
oh_name
;
int
(
*
oh_fnc
)(
const
char
*
val
,
void
*
arg
);
void
*
oh_arg
;
}
option_helpers
[]
=
{
{
BER_BVC
(
"slp"
),
slapd_opt_slp
,
NULL
},
{
BER_BVNULL
}
};
static
void
usage
(
char
*
name
)
{
...
...
@@ -155,6 +190,8 @@ usage( char *name )
"
\t
-l facility
\t
Syslog facility (default: LOCAL4)
\n
"
#endif
"
\t
-n serverName
\t
Service name
\n
"
"
\t
-o <option>[=value]
\n
"
"
\t\t\t
Generic means to specify options; see slapd(8) for details
\n
"
#ifdef HAVE_CHROOT
"
\t
-r directory
\t
Sandbox directory to chroot to
\n
"
#endif
...
...
@@ -164,8 +201,8 @@ usage( char *name )
#endif
#if defined(HAVE_SETUID) && defined(HAVE_SETGID)
"
\t
-u user
\t\t
User (id or name) to run as
\n
"
"
\t
-V
\t\t
print version info (-VV only)
\n
"
#endif
"
\t
-V
\t\t
print version info (-VV only)
\n
"
);
}
...
...
@@ -282,7 +319,7 @@ int main( int argc, char **argv )
#endif
while
(
(
i
=
getopt
(
argc
,
argv
,
"c:d:f:h:
s:n
:StT:V"
"c:d:f:h:
n:o:s
:StT:V"
#if LDAP_PF_INET6
"46"
#endif
...
...
@@ -351,6 +388,35 @@ int main( int argc, char **argv )
configfile
=
ch_strdup
(
optarg
);
break
;
case
'o'
:
{
char
*
val
=
strchr
(
optarg
,
'='
);
struct
berval
opt
;
int
i
;
opt
.
bv_val
=
optarg
;
if
(
val
)
{
opt
.
bv_len
=
(
val
-
optarg
);
val
++
;
}
else
{
opt
.
bv_len
=
strlen
(
optarg
);
}
for
(
i
=
0
;
!
BER_BVISNULL
(
&
option_helpers
[
i
].
oh_name
);
i
++
)
{
if
(
ber_bvstrcasecmp
(
&
option_helpers
[
i
].
oh_name
,
&
opt
)
==
0
)
{
if
(
option_helpers
[
i
].
oh_fnc
(
val
,
option_helpers
[
i
].
oh_arg
)
==
-
1
)
{
goto
destroy
;
}
}
}
if
(
BER_BVISNULL
(
&
option_helpers
[
i
].
oh_name
)
)
{
goto
unhandled_option
;
}
break
;
}
case
's'
:
/* set syslog level */
ldap_syslog
=
atoi
(
optarg
);
break
;
...
...
@@ -429,6 +495,7 @@ int main( int argc, char **argv )
"aborting...
\n
"
,
serverNamePrefix
,
serverName
);
/* FALLTHRU */
default:
unhandled_option:
;
usage
(
argv
[
0
]
);
rc
=
1
;
SERVICE_EXIT
(
ERROR_SERVICE_SPECIFIC_ERROR
,
15
);
...
...
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