|
|
d0db73 |
NOTE: The patch has been adjusted to match the base code before backporting.
|
|
|
d0db73 |
|
|
|
d0db73 |
From 8a259e3df16def3f05828f355e98a5089cd6e6d0 Mon Sep 17 00:00:00 2001
|
|
|
d0db73 |
From: =?UTF-8?q?Ond=C5=99ej=20Kuzn=C3=ADk?= <ondra@openldap.org>
|
|
|
d0db73 |
Date: Thu, 14 Jun 2018 16:14:15 +0100
|
|
|
d0db73 |
Subject: [PATCH] ITS#8573 allow all libldap options in tools -o option
|
|
|
d0db73 |
|
|
|
d0db73 |
---
|
|
|
d0db73 |
clients/tools/common.c | 15 ++-
|
|
|
d0db73 |
doc/devel/args | 2 +-
|
|
|
d0db73 |
doc/man/man1/ldapcompare.1 | 9 +-
|
|
|
d0db73 |
doc/man/man1/ldapdelete.1 | 9 +-
|
|
|
d0db73 |
doc/man/man1/ldapexop.1 | 9 +-
|
|
|
d0db73 |
doc/man/man1/ldapmodify.1 | 9 +-
|
|
|
d0db73 |
doc/man/man1/ldapmodrdn.1 | 9 +-
|
|
|
d0db73 |
doc/man/man1/ldappasswd.1 | 9 +-
|
|
|
d0db73 |
doc/man/man1/ldapsearch.1 | 9 +-
|
|
|
d0db73 |
doc/man/man1/ldapwhoami.1 | 13 ++-
|
|
|
d0db73 |
doc/man/man8/slapcat.8 | 2 +-
|
|
|
d0db73 |
include/ldap_pvt.h | 5 +
|
|
|
d0db73 |
libraries/libldap/init.c | 231 ++++++++++++++++++++++---------------
|
|
|
d0db73 |
servers/slapd/slapcommon.c | 5 +-
|
|
|
d0db73 |
14 files changed, 200 insertions(+), 136 deletions(-)
|
|
|
d0db73 |
|
|
|
d0db73 |
diff --git a/clients/tools/common.c b/clients/tools/common.c
|
|
|
d0db73 |
index 39db70b93..d5c3491fc 100644
|
|
|
d0db73 |
--- a/clients/tools/common.c
|
|
|
d0db73 |
+++ b/clients/tools/common.c
|
|
|
d0db73 |
@@ -351,9 +351,9 @@ N_(" -I use SASL Interactive mode\n"),
|
|
|
d0db73 |
N_(" -n show what would be done but don't actually do it\n"),
|
|
|
d0db73 |
N_(" -N do not use reverse DNS to canonicalize SASL host name\n"),
|
|
|
d0db73 |
N_(" -O props SASL security properties\n"),
|
|
|
d0db73 |
-N_(" -o <opt>[=<optparam>] general options\n"),
|
|
|
d0db73 |
+N_(" -o <opt>[=<optparam>] any libldap ldap.conf options, plus\n"),
|
|
|
d0db73 |
+N_(" ldif_wrap=<width> (in columns, or \"no\" for no wrapping)\n"),
|
|
|
d0db73 |
N_(" nettimeout=<timeout> (in seconds, or \"none\" or \"max\")\n"),
|
|
|
d0db73 |
-N_(" ldif-wrap=<width> (in columns, or \"no\" for no wrapping)\n"),
|
|
|
d0db73 |
N_(" -p port port on LDAP server\n"),
|
|
|
d0db73 |
N_(" -Q use SASL Quiet mode\n"),
|
|
|
d0db73 |
N_(" -R realm SASL realm\n"),
|
|
|
d0db73 |
@@ -785,6 +785,11 @@ tool_args( int argc, char **argv )
|
|
|
d0db73 |
if ( (cvalue = strchr( control, '=' )) != NULL ) {
|
|
|
d0db73 |
*cvalue++ = '\0';
|
|
|
d0db73 |
}
|
|
|
d0db73 |
+ for ( next=control; *next; next++ ) {
|
|
|
d0db73 |
+ if ( *next == '-' ) {
|
|
|
d0db73 |
+ *next = '_';
|
|
|
d0db73 |
+ }
|
|
|
d0db73 |
+ }
|
|
|
d0db73 |
|
|
|
d0db73 |
if ( strcasecmp( control, "nettimeout" ) == 0 ) {
|
|
|
d0db73 |
if( nettimeout.tv_sec != -1 ) {
|
|
|
d0db73 |
@@ -814,7 +819,7 @@ tool_args( int argc, char **argv )
|
|
|
d0db73 |
exit( EXIT_FAILURE );
|
|
|
d0db73 |
}
|
|
|
d0db73 |
|
|
|
d0db73 |
- } else if ( strcasecmp( control, "ldif-wrap" ) == 0 ) {
|
|
|
d0db73 |
+ } else if ( strcasecmp( control, "ldif_wrap" ) == 0 ) {
|
|
|
d0db73 |
if ( cvalue == 0 ) {
|
|
|
d0db73 |
ldif_wrap = LDIF_LINE_WIDTH;
|
|
|
d0db73 |
|
|
|
d0db73 |
@@ -825,13 +830,13 @@ tool_args( int argc, char **argv )
|
|
|
d0db73 |
unsigned int u;
|
|
|
d0db73 |
if ( lutil_atou( &u, cvalue ) ) {
|
|
|
d0db73 |
fprintf( stderr,
|
|
|
d0db73 |
- _("Unable to parse ldif-wrap=\"%s\"\n"), cvalue );
|
|
|
d0db73 |
+ _("Unable to parse ldif_wrap=\"%s\"\n"), cvalue );
|
|
|
d0db73 |
exit( EXIT_FAILURE );
|
|
|
d0db73 |
}
|
|
|
d0db73 |
ldif_wrap = (ber_len_t)u;
|
|
|
d0db73 |
}
|
|
|
d0db73 |
|
|
|
d0db73 |
- } else {
|
|
|
d0db73 |
+ } else if ( ldap_pvt_conf_option( control, cvalue, 1 ) ) {
|
|
|
d0db73 |
fprintf( stderr, "Invalid general option name: %s\n",
|
|
|
d0db73 |
control );
|
|
|
d0db73 |
usage();
|
|
|
d0db73 |
diff --git a/doc/devel/args b/doc/devel/args
|
|
|
d0db73 |
index 7805eff1c..31c22f948 100644
|
|
|
d0db73 |
--- a/doc/devel/args
|
|
|
d0db73 |
+++ b/doc/devel/args
|
|
|
d0db73 |
@@ -27,7 +27,7 @@ ldapwhoami * DE**HI** NO QR UVWXYZ def*h*** *nop* vwxy
|
|
|
d0db73 |
-h host
|
|
|
d0db73 |
-n no-op
|
|
|
d0db73 |
-N no (SASLprep) normalization of simple bind password
|
|
|
d0db73 |
- -o general options (currently nettimeout and ldif-wrap only)
|
|
|
d0db73 |
+ -o general libldap options (plus ldif_wrap and nettimeout for backwards comp.)
|
|
|
d0db73 |
-p port
|
|
|
d0db73 |
-v verbose
|
|
|
d0db73 |
-V version
|
|
|
d0db73 |
diff --git a/doc/man/man1/ldapcompare.1 b/doc/man/man1/ldapcompare.1
|
|
|
d0db73 |
index 667815a26..de90498db 100644
|
|
|
d0db73 |
--- a/doc/man/man1/ldapcompare.1
|
|
|
d0db73 |
+++ b/doc/man/man1/ldapcompare.1
|
|
|
d0db73 |
@@ -186,13 +186,14 @@ Compare extensions:
|
|
|
d0db73 |
.TP
|
|
|
d0db73 |
.BI \-o \ opt \fR[= optparam \fR]
|
|
|
d0db73 |
|
|
|
d0db73 |
-Specify general options.
|
|
|
d0db73 |
-
|
|
|
d0db73 |
-General options:
|
|
|
d0db73 |
+Specify any
|
|
|
d0db73 |
+.BR ldap.conf (5)
|
|
|
d0db73 |
+option or one of the following:
|
|
|
d0db73 |
.nf
|
|
|
d0db73 |
nettimeout=<timeout> (in seconds, or "none" or "max")
|
|
|
d0db73 |
- ldif-wrap=<width> (in columns, or "no" for no wrapping)
|
|
|
d0db73 |
+ ldif_wrap=<width> (in columns, or "no" for no wrapping)
|
|
|
d0db73 |
.fi
|
|
|
d0db73 |
+
|
|
|
d0db73 |
.TP
|
|
|
d0db73 |
.BI \-O \ security-properties
|
|
|
d0db73 |
Specify SASL security properties.
|
|
|
d0db73 |
diff --git a/doc/man/man1/ldapdelete.1 b/doc/man/man1/ldapdelete.1
|
|
|
d0db73 |
index 9e7036230..872424a65 100644
|
|
|
d0db73 |
--- a/doc/man/man1/ldapdelete.1
|
|
|
d0db73 |
+++ b/doc/man/man1/ldapdelete.1
|
|
|
d0db73 |
@@ -192,13 +192,14 @@ Delete extensions:
|
|
|
d0db73 |
.TP
|
|
|
d0db73 |
.BI \-o \ opt \fR[= optparam \fR]
|
|
|
d0db73 |
|
|
|
d0db73 |
-Specify general options.
|
|
|
d0db73 |
-
|
|
|
d0db73 |
-General options:
|
|
|
d0db73 |
+Specify any
|
|
|
d0db73 |
+.BR ldap.conf (5)
|
|
|
d0db73 |
+option or one of the following:
|
|
|
d0db73 |
.nf
|
|
|
d0db73 |
nettimeout=<timeout> (in seconds, or "none" or "max")
|
|
|
d0db73 |
- ldif-wrap=<width> (in columns, or "no" for no wrapping)
|
|
|
d0db73 |
+ ldif_wrap=<width> (in columns, or "no" for no wrapping)
|
|
|
d0db73 |
.fi
|
|
|
d0db73 |
+
|
|
|
d0db73 |
.TP
|
|
|
d0db73 |
.BI \-O \ security-properties
|
|
|
d0db73 |
Specify SASL security properties.
|
|
|
d0db73 |
diff --git a/doc/man/man1/ldapexop.1 b/doc/man/man1/ldapexop.1
|
|
|
d0db73 |
index 5f5ae7aae..96a7c514e 100644
|
|
|
d0db73 |
--- a/doc/man/man1/ldapexop.1
|
|
|
d0db73 |
+++ b/doc/man/man1/ldapexop.1
|
|
|
d0db73 |
@@ -189,13 +189,14 @@ Specify general extensions. \'!\' indicates criticality.
|
|
|
d0db73 |
.TP
|
|
|
d0db73 |
.BI \-o \ opt \fR[= optparam \fR]
|
|
|
d0db73 |
|
|
|
d0db73 |
-Specify general options.
|
|
|
d0db73 |
-
|
|
|
d0db73 |
-General options:
|
|
|
d0db73 |
+Specify any
|
|
|
d0db73 |
+.BR ldap.conf (5)
|
|
|
d0db73 |
+option or one of the following:
|
|
|
d0db73 |
.nf
|
|
|
d0db73 |
nettimeout=<timeout> (in seconds, or "none" or "max")
|
|
|
d0db73 |
- ldif-wrap=<width> (in columns, or "no" for no wrapping)
|
|
|
d0db73 |
+ ldif_wrap=<width> (in columns, or "no" for no wrapping)
|
|
|
d0db73 |
.fi
|
|
|
d0db73 |
+
|
|
|
d0db73 |
.TP
|
|
|
d0db73 |
.BI \-O \ security-properties
|
|
|
d0db73 |
Specify SASL security properties.
|
|
|
d0db73 |
diff --git a/doc/man/man1/ldapmodify.1 b/doc/man/man1/ldapmodify.1
|
|
|
d0db73 |
index f884c5bfb..90f813506 100644
|
|
|
d0db73 |
--- a/doc/man/man1/ldapmodify.1
|
|
|
d0db73 |
+++ b/doc/man/man1/ldapmodify.1
|
|
|
d0db73 |
@@ -255,13 +255,14 @@ Modify extensions:
|
|
|
d0db73 |
.TP
|
|
|
d0db73 |
.BI \-o \ opt \fR[= optparam \fR]]
|
|
|
d0db73 |
|
|
|
d0db73 |
-Specify general options.
|
|
|
d0db73 |
-
|
|
|
d0db73 |
-General options:
|
|
|
d0db73 |
+Specify any
|
|
|
d0db73 |
+.BR ldap.conf (5)
|
|
|
d0db73 |
+option or one of the following:
|
|
|
d0db73 |
.nf
|
|
|
d0db73 |
nettimeout=<timeout> (in seconds, or "none" or "max")
|
|
|
d0db73 |
- ldif-wrap=<width> (in columns, or "no" for no wrapping)
|
|
|
d0db73 |
+ ldif_wrap=<width> (in columns, or "no" for no wrapping)
|
|
|
d0db73 |
.fi
|
|
|
d0db73 |
+
|
|
|
d0db73 |
.TP
|
|
|
d0db73 |
.BI \-O \ security-properties
|
|
|
d0db73 |
Specify SASL security properties.
|
|
|
d0db73 |
diff --git a/doc/man/man1/ldapmodrdn.1 b/doc/man/man1/ldapmodrdn.1
|
|
|
d0db73 |
index fa9eac627..900ba7e0e 100644
|
|
|
d0db73 |
--- a/doc/man/man1/ldapmodrdn.1
|
|
|
d0db73 |
+++ b/doc/man/man1/ldapmodrdn.1
|
|
|
d0db73 |
@@ -186,13 +186,14 @@ Modrdn extensions:
|
|
|
d0db73 |
.TP
|
|
|
d0db73 |
.BI \-o \ opt \fR[= optparam \fR]
|
|
|
d0db73 |
|
|
|
d0db73 |
-Specify general options.
|
|
|
d0db73 |
-
|
|
|
d0db73 |
-General options:
|
|
|
d0db73 |
+Specify any
|
|
|
d0db73 |
+.BR ldap.conf (5)
|
|
|
d0db73 |
+option or one of the following:
|
|
|
d0db73 |
.nf
|
|
|
d0db73 |
nettimeout=<timeout> (in seconds, or "none" or "max")
|
|
|
d0db73 |
- ldif-wrap=<width> (in columns, or "no" for no wrapping)
|
|
|
d0db73 |
+ ldif_wrap=<width> (in columns, or "no" for no wrapping)
|
|
|
d0db73 |
.fi
|
|
|
d0db73 |
+
|
|
|
d0db73 |
.TP
|
|
|
d0db73 |
.BI \-O \ security-properties
|
|
|
d0db73 |
Specify SASL security properties.
|
|
|
d0db73 |
diff --git a/doc/man/man1/ldappasswd.1 b/doc/man/man1/ldappasswd.1
|
|
|
d0db73 |
index d3f45b082..bf273fb25 100644
|
|
|
d0db73 |
--- a/doc/man/man1/ldappasswd.1
|
|
|
d0db73 |
+++ b/doc/man/man1/ldappasswd.1
|
|
|
d0db73 |
@@ -188,13 +188,14 @@ Passwd Modify extensions:
|
|
|
d0db73 |
.TP
|
|
|
d0db73 |
.BI \-o \ opt \fR[= optparam \fR]]
|
|
|
d0db73 |
|
|
|
d0db73 |
-Specify general options.
|
|
|
d0db73 |
-
|
|
|
d0db73 |
-General options:
|
|
|
d0db73 |
+Specify any
|
|
|
d0db73 |
+.BR ldap.conf (5)
|
|
|
d0db73 |
+option or one of the following:
|
|
|
d0db73 |
.nf
|
|
|
d0db73 |
nettimeout=<timeout> (in seconds, or "none" or "max")
|
|
|
d0db73 |
- ldif-wrap=<width> (in columns, or "no" for no wrapping)
|
|
|
d0db73 |
+ ldif_wrap=<width> (in columns, or "no" for no wrapping)
|
|
|
d0db73 |
.fi
|
|
|
d0db73 |
+
|
|
|
d0db73 |
.TP
|
|
|
d0db73 |
.BI \-O \ security-properties
|
|
|
d0db73 |
Specify SASL security properties.
|
|
|
d0db73 |
diff --git a/doc/man/man1/ldapsearch.1 b/doc/man/man1/ldapsearch.1
|
|
|
d0db73 |
index 196179232..901e56043 100644
|
|
|
d0db73 |
--- a/doc/man/man1/ldapsearch.1
|
|
|
d0db73 |
+++ b/doc/man/man1/ldapsearch.1
|
|
|
d0db73 |
@@ -332,13 +332,14 @@ Search extensions:
|
|
|
d0db73 |
.TP
|
|
|
d0db73 |
.BI \-o \ opt \fR[= optparam \fR]
|
|
|
d0db73 |
|
|
|
d0db73 |
-Specify general options.
|
|
|
d0db73 |
-
|
|
|
d0db73 |
-General options:
|
|
|
d0db73 |
+Specify any
|
|
|
d0db73 |
+.BR ldap.conf (5)
|
|
|
d0db73 |
+option or one of the following:
|
|
|
d0db73 |
.nf
|
|
|
d0db73 |
nettimeout=<timeout> (in seconds, or "none" or "max")
|
|
|
d0db73 |
- ldif-wrap=<width> (in columns, or "no" for no wrapping)
|
|
|
d0db73 |
+ ldif_wrap=<width> (in columns, or "no" for no wrapping)
|
|
|
d0db73 |
.fi
|
|
|
d0db73 |
+
|
|
|
d0db73 |
.TP
|
|
|
d0db73 |
.BI \-O \ security-properties
|
|
|
d0db73 |
Specify SASL security properties.
|
|
|
d0db73 |
diff --git a/doc/man/man1/ldapwhoami.1 b/doc/man/man1/ldapwhoami.1
|
|
|
d0db73 |
index b684de54a..79864c729 100644
|
|
|
d0db73 |
--- a/doc/man/man1/ldapwhoami.1
|
|
|
d0db73 |
+++ b/doc/man/man1/ldapwhoami.1
|
|
|
d0db73 |
@@ -143,13 +143,18 @@ WhoAmI extensions:
|
|
|
d0db73 |
.TP
|
|
|
d0db73 |
.BI \-o \ opt \fR[= optparam \fR]
|
|
|
d0db73 |
|
|
|
d0db73 |
-Specify general options.
|
|
|
d0db73 |
-
|
|
|
d0db73 |
-General options:
|
|
|
d0db73 |
+Specify any
|
|
|
d0db73 |
+.BR ldap.conf (5)
|
|
|
d0db73 |
+option or one of the following:
|
|
|
d0db73 |
.nf
|
|
|
d0db73 |
nettimeout=<timeout> (in seconds, or "none" or "max")
|
|
|
d0db73 |
- ldif-wrap=<width> (in columns, or "no" for no wrapping)
|
|
|
d0db73 |
+ ldif_wrap=<width> (in columns, or "no" for no wrapping)
|
|
|
d0db73 |
.fi
|
|
|
d0db73 |
+
|
|
|
d0db73 |
+.B -o
|
|
|
d0db73 |
+option that can be passed here, check
|
|
|
d0db73 |
+.BR ldap.conf (5)
|
|
|
d0db73 |
+for details.
|
|
|
d0db73 |
.TP
|
|
|
d0db73 |
.BI \-O \ security-properties
|
|
|
d0db73 |
Specify SASL security properties.
|
|
|
d0db73 |
diff --git a/doc/man/man8/slapcat.8 b/doc/man/man8/slapcat.8
|
|
|
d0db73 |
index d05cfa643..24c8f03ea 100644
|
|
|
d0db73 |
--- a/doc/man/man8/slapcat.8
|
|
|
d0db73 |
+++ b/doc/man/man8/slapcat.8
|
|
|
d0db73 |
@@ -149,7 +149,7 @@ Possible generic options/values are:
|
|
|
d0db73 |
syslog\-level=<level> (see `\-S' in slapd(8))
|
|
|
d0db73 |
syslog\-user=<user> (see `\-l' in slapd(8))
|
|
|
d0db73 |
|
|
|
d0db73 |
- ldif-wrap={no|<n>}
|
|
|
d0db73 |
+ ldif_wrap={no|<n>}
|
|
|
d0db73 |
|
|
|
d0db73 |
.in
|
|
|
d0db73 |
\fIn\fP is the number of columns allowed for the LDIF output
|
|
|
d0db73 |
diff --git a/include/ldap_pvt.h b/include/ldap_pvt.h
|
|
|
d0db73 |
index 61c620785..c586a95b5 100644
|
|
|
d0db73 |
--- a/include/ldap_pvt.h
|
|
|
d0db73 |
+++ b/include/ldap_pvt.h
|
|
|
d0db73 |
@@ -321,6 +321,11 @@ struct ldapmsg;
|
|
|
d0db73 |
LDAP_F ( int ) ldap_pvt_discard LDAP_P((
|
|
|
d0db73 |
struct ldap *ld, ber_int_t msgid ));
|
|
|
d0db73 |
|
|
|
d0db73 |
+/* init.c */
|
|
|
d0db73 |
+LDAP_F( int )
|
|
|
d0db73 |
+ldap_pvt_conf_option LDAP_P((
|
|
|
d0db73 |
+ char *cmd, char *opt, int userconf ));
|
|
|
d0db73 |
+
|
|
|
d0db73 |
/* messages.c */
|
|
|
d0db73 |
LDAP_F( BerElement * )
|
|
|
d0db73 |
ldap_get_message_ber LDAP_P((
|
|
|
d0db73 |
diff --git a/libraries/libldap/init.c b/libraries/libldap/init.c
|
|
|
d0db73 |
index 182ef7d7e..746824fbd 100644
|
|
|
d0db73 |
--- a/libraries/libldap/init.c
|
|
|
d0db73 |
+++ b/libraries/libldap/init.c
|
|
|
d0db73 |
@@ -148,6 +148,141 @@ static const struct ol_attribute {
|
|
|
d0db73 |
#define MAX_LDAP_ATTR_LEN sizeof("GSSAPI_ALLOW_REMOTE_PRINCIPAL")
|
|
|
d0db73 |
#define MAX_LDAP_ENV_PREFIX_LEN 8
|
|
|
d0db73 |
|
|
|
d0db73 |
+static int
|
|
|
d0db73 |
+ldap_int_conf_option(
|
|
|
d0db73 |
+ struct ldapoptions *gopts,
|
|
|
d0db73 |
+ char *cmd, char *opt, int userconf )
|
|
|
d0db73 |
+{
|
|
|
d0db73 |
+ int i;
|
|
|
d0db73 |
+
|
|
|
d0db73 |
+ for(i=0; attrs[i].type != ATTR_NONE; i++) {
|
|
|
d0db73 |
+ void *p;
|
|
|
d0db73 |
+
|
|
|
d0db73 |
+ if( !userconf && attrs[i].useronly ) {
|
|
|
d0db73 |
+ continue;
|
|
|
d0db73 |
+ }
|
|
|
d0db73 |
+
|
|
|
d0db73 |
+ if(strcasecmp(cmd, attrs[i].name) != 0) {
|
|
|
d0db73 |
+ continue;
|
|
|
d0db73 |
+ }
|
|
|
d0db73 |
+
|
|
|
d0db73 |
+ switch(attrs[i].type) {
|
|
|
d0db73 |
+ case ATTR_BOOL:
|
|
|
d0db73 |
+ if((strcasecmp(opt, "on") == 0)
|
|
|
d0db73 |
+ || (strcasecmp(opt, "yes") == 0)
|
|
|
d0db73 |
+ || (strcasecmp(opt, "true") == 0))
|
|
|
d0db73 |
+ {
|
|
|
d0db73 |
+ LDAP_BOOL_SET(gopts, attrs[i].offset);
|
|
|
d0db73 |
+
|
|
|
d0db73 |
+ } else {
|
|
|
d0db73 |
+ LDAP_BOOL_CLR(gopts, attrs[i].offset);
|
|
|
d0db73 |
+ }
|
|
|
d0db73 |
+
|
|
|
d0db73 |
+ break;
|
|
|
d0db73 |
+
|
|
|
d0db73 |
+ case ATTR_INT: {
|
|
|
d0db73 |
+ char *next;
|
|
|
d0db73 |
+ long l;
|
|
|
d0db73 |
+ p = &((char *) gopts)[attrs[i].offset];
|
|
|
d0db73 |
+ l = strtol( opt, &next, 10 );
|
|
|
d0db73 |
+ if ( next != opt && next[ 0 ] == '\0' ) {
|
|
|
d0db73 |
+ * (int*) p = l;
|
|
|
d0db73 |
+ }
|
|
|
d0db73 |
+ } break;
|
|
|
d0db73 |
+
|
|
|
d0db73 |
+ case ATTR_KV: {
|
|
|
d0db73 |
+ const struct ol_keyvalue *kv;
|
|
|
d0db73 |
+
|
|
|
d0db73 |
+ for(kv = attrs[i].data;
|
|
|
d0db73 |
+ kv->key != NULL;
|
|
|
d0db73 |
+ kv++) {
|
|
|
d0db73 |
+
|
|
|
d0db73 |
+ if(strcasecmp(opt, kv->key) == 0) {
|
|
|
d0db73 |
+ p = &((char *) gopts)[attrs[i].offset];
|
|
|
d0db73 |
+ * (int*) p = kv->value;
|
|
|
d0db73 |
+ break;
|
|
|
d0db73 |
+ }
|
|
|
d0db73 |
+ }
|
|
|
d0db73 |
+ } break;
|
|
|
d0db73 |
+
|
|
|
d0db73 |
+ case ATTR_STRING:
|
|
|
d0db73 |
+ p = &((char *) gopts)[attrs[i].offset];
|
|
|
d0db73 |
+ if (* (char**) p != NULL) LDAP_FREE(* (char**) p);
|
|
|
d0db73 |
+ * (char**) p = LDAP_STRDUP(opt);
|
|
|
d0db73 |
+ break;
|
|
|
d0db73 |
+ case ATTR_OPTION:
|
|
|
d0db73 |
+ ldap_set_option( NULL, attrs[i].offset, opt );
|
|
|
d0db73 |
+ break;
|
|
|
d0db73 |
+ case ATTR_SASL:
|
|
|
d0db73 |
+#ifdef HAVE_CYRUS_SASL
|
|
|
d0db73 |
+ ldap_int_sasl_config( gopts, attrs[i].offset, opt );
|
|
|
d0db73 |
+#endif
|
|
|
d0db73 |
+ break;
|
|
|
d0db73 |
+ case ATTR_GSSAPI:
|
|
|
d0db73 |
+#ifdef HAVE_GSSAPI
|
|
|
d0db73 |
+ ldap_int_gssapi_config( gopts, attrs[i].offset, opt );
|
|
|
d0db73 |
+#endif
|
|
|
d0db73 |
+ break;
|
|
|
d0db73 |
+ case ATTR_TLS:
|
|
|
d0db73 |
+#ifdef HAVE_TLS
|
|
|
d0db73 |
+ ldap_int_tls_config( NULL, attrs[i].offset, opt );
|
|
|
d0db73 |
+#endif
|
|
|
d0db73 |
+ break;
|
|
|
d0db73 |
+ case ATTR_OPT_TV: {
|
|
|
d0db73 |
+ struct timeval tv;
|
|
|
d0db73 |
+ char *next;
|
|
|
d0db73 |
+ tv.tv_usec = 0;
|
|
|
d0db73 |
+ tv.tv_sec = strtol( opt, &next, 10 );
|
|
|
d0db73 |
+ if ( next != opt && next[ 0 ] == '\0' && tv.tv_sec > 0 ) {
|
|
|
d0db73 |
+ (void)ldap_set_option( NULL, attrs[i].offset, (const void *)&tv );
|
|
|
d0db73 |
+ }
|
|
|
d0db73 |
+ } break;
|
|
|
d0db73 |
+ case ATTR_OPT_INT: {
|
|
|
d0db73 |
+ long l;
|
|
|
d0db73 |
+ char *next;
|
|
|
d0db73 |
+ l = strtol( opt, &next, 10 );
|
|
|
d0db73 |
+ if ( next != opt && next[ 0 ] == '\0' && l > 0 && (long)((int)l) == l ) {
|
|
|
d0db73 |
+ int v = (int)l;
|
|
|
d0db73 |
+ (void)ldap_set_option( NULL, attrs[i].offset, (const void *)&v );
|
|
|
d0db73 |
+ }
|
|
|
d0db73 |
+ } break;
|
|
|
d0db73 |
+ }
|
|
|
d0db73 |
+
|
|
|
d0db73 |
+ break;
|
|
|
d0db73 |
+ }
|
|
|
d0db73 |
+
|
|
|
d0db73 |
+ if ( attrs[i].type == ATTR_NONE ) {
|
|
|
d0db73 |
+ Debug( LDAP_DEBUG_TRACE, "ldap_int_tls_config: "
|
|
|
d0db73 |
+ "unknown option '%s'",
|
|
|
d0db73 |
+ cmd, 0, 0 );
|
|
|
d0db73 |
+ return 1;
|
|
|
d0db73 |
+ }
|
|
|
d0db73 |
+
|
|
|
d0db73 |
+ return 0;
|
|
|
d0db73 |
+}
|
|
|
d0db73 |
+
|
|
|
d0db73 |
+int
|
|
|
d0db73 |
+ldap_pvt_conf_option(
|
|
|
d0db73 |
+ char *cmd, char *opt, int userconf )
|
|
|
d0db73 |
+{
|
|
|
d0db73 |
+ struct ldapoptions *gopts;
|
|
|
d0db73 |
+ int rc = LDAP_OPT_ERROR;
|
|
|
d0db73 |
+
|
|
|
d0db73 |
+ /* Get pointer to global option structure */
|
|
|
d0db73 |
+ gopts = LDAP_INT_GLOBAL_OPT();
|
|
|
d0db73 |
+ if (NULL == gopts) {
|
|
|
d0db73 |
+ return LDAP_NO_MEMORY;
|
|
|
d0db73 |
+ }
|
|
|
d0db73 |
+
|
|
|
d0db73 |
+ if ( gopts->ldo_valid != LDAP_INITIALIZED ) {
|
|
|
d0db73 |
+ ldap_int_initialize(gopts, NULL);
|
|
|
d0db73 |
+ if ( gopts->ldo_valid != LDAP_INITIALIZED )
|
|
|
d0db73 |
+ return LDAP_LOCAL_ERROR;
|
|
|
d0db73 |
+ }
|
|
|
d0db73 |
+
|
|
|
d0db73 |
+ return ldap_int_conf_option( gopts, cmd, opt, userconf );
|
|
|
d0db73 |
+}
|
|
|
d0db73 |
+
|
|
|
d0db73 |
static void openldap_ldap_init_w_conf(
|
|
|
d0db73 |
const char *file, int userconf )
|
|
|
d0db73 |
{
|
|
|
d0db73 |
@@ -213,101 +348,7 @@ static void openldap_ldap_init_w_conf(
|
|
|
d0db73 |
while(isspace((unsigned char)*start)) start++;
|
|
|
d0db73 |
opt = start;
|
|
|
d0db73 |
|
|
|
d0db73 |
- for(i=0; attrs[i].type != ATTR_NONE; i++) {
|
|
|
d0db73 |
- void *p;
|
|
|
d0db73 |
-
|
|
|
d0db73 |
- if( !userconf && attrs[i].useronly ) {
|
|
|
d0db73 |
- continue;
|
|
|
d0db73 |
- }
|
|
|
d0db73 |
-
|
|
|
d0db73 |
- if(strcasecmp(cmd, attrs[i].name) != 0) {
|
|
|
d0db73 |
- continue;
|
|
|
d0db73 |
- }
|
|
|
d0db73 |
-
|
|
|
d0db73 |
- switch(attrs[i].type) {
|
|
|
d0db73 |
- case ATTR_BOOL:
|
|
|
d0db73 |
- if((strcasecmp(opt, "on") == 0)
|
|
|
d0db73 |
- || (strcasecmp(opt, "yes") == 0)
|
|
|
d0db73 |
- || (strcasecmp(opt, "true") == 0))
|
|
|
d0db73 |
- {
|
|
|
d0db73 |
- LDAP_BOOL_SET(gopts, attrs[i].offset);
|
|
|
d0db73 |
-
|
|
|
d0db73 |
- } else {
|
|
|
d0db73 |
- LDAP_BOOL_CLR(gopts, attrs[i].offset);
|
|
|
d0db73 |
- }
|
|
|
d0db73 |
-
|
|
|
d0db73 |
- break;
|
|
|
d0db73 |
-
|
|
|
d0db73 |
- case ATTR_INT: {
|
|
|
d0db73 |
- char *next;
|
|
|
d0db73 |
- long l;
|
|
|
d0db73 |
- p = &((char *) gopts)[attrs[i].offset];
|
|
|
d0db73 |
- l = strtol( opt, &next, 10 );
|
|
|
d0db73 |
- if ( next != opt && next[ 0 ] == '\0' ) {
|
|
|
d0db73 |
- * (int*) p = l;
|
|
|
d0db73 |
- }
|
|
|
d0db73 |
- } break;
|
|
|
d0db73 |
-
|
|
|
d0db73 |
- case ATTR_KV: {
|
|
|
d0db73 |
- const struct ol_keyvalue *kv;
|
|
|
d0db73 |
-
|
|
|
d0db73 |
- for(kv = attrs[i].data;
|
|
|
d0db73 |
- kv->key != NULL;
|
|
|
d0db73 |
- kv++) {
|
|
|
d0db73 |
-
|
|
|
d0db73 |
- if(strcasecmp(opt, kv->key) == 0) {
|
|
|
d0db73 |
- p = &((char *) gopts)[attrs[i].offset];
|
|
|
d0db73 |
- * (int*) p = kv->value;
|
|
|
d0db73 |
- break;
|
|
|
d0db73 |
- }
|
|
|
d0db73 |
- }
|
|
|
d0db73 |
- } break;
|
|
|
d0db73 |
-
|
|
|
d0db73 |
- case ATTR_STRING:
|
|
|
d0db73 |
- p = &((char *) gopts)[attrs[i].offset];
|
|
|
d0db73 |
- if (* (char**) p != NULL) LDAP_FREE(* (char**) p);
|
|
|
d0db73 |
- * (char**) p = LDAP_STRDUP(opt);
|
|
|
d0db73 |
- break;
|
|
|
d0db73 |
- case ATTR_OPTION:
|
|
|
d0db73 |
- ldap_set_option( NULL, attrs[i].offset, opt );
|
|
|
d0db73 |
- break;
|
|
|
d0db73 |
- case ATTR_SASL:
|
|
|
d0db73 |
-#ifdef HAVE_CYRUS_SASL
|
|
|
d0db73 |
- ldap_int_sasl_config( gopts, attrs[i].offset, opt );
|
|
|
d0db73 |
-#endif
|
|
|
d0db73 |
- break;
|
|
|
d0db73 |
- case ATTR_GSSAPI:
|
|
|
d0db73 |
-#ifdef HAVE_GSSAPI
|
|
|
d0db73 |
- ldap_int_gssapi_config( gopts, attrs[i].offset, opt );
|
|
|
d0db73 |
-#endif
|
|
|
d0db73 |
- break;
|
|
|
d0db73 |
- case ATTR_TLS:
|
|
|
d0db73 |
-#ifdef HAVE_TLS
|
|
|
d0db73 |
- ldap_int_tls_config( NULL, attrs[i].offset, opt );
|
|
|
d0db73 |
-#endif
|
|
|
d0db73 |
- break;
|
|
|
d0db73 |
- case ATTR_OPT_TV: {
|
|
|
d0db73 |
- struct timeval tv;
|
|
|
d0db73 |
- char *next;
|
|
|
d0db73 |
- tv.tv_usec = 0;
|
|
|
d0db73 |
- tv.tv_sec = strtol( opt, &next, 10 );
|
|
|
d0db73 |
- if ( next != opt && next[ 0 ] == '\0' && tv.tv_sec > 0 ) {
|
|
|
d0db73 |
- (void)ldap_set_option( NULL, attrs[i].offset, (const void *)&tv );
|
|
|
d0db73 |
- }
|
|
|
d0db73 |
- } break;
|
|
|
d0db73 |
- case ATTR_OPT_INT: {
|
|
|
d0db73 |
- long l;
|
|
|
d0db73 |
- char *next;
|
|
|
d0db73 |
- l = strtol( opt, &next, 10 );
|
|
|
d0db73 |
- if ( next != opt && next[ 0 ] == '\0' && l > 0 && (long)((int)l) == l ) {
|
|
|
d0db73 |
- int v = (int)l;
|
|
|
d0db73 |
- (void)ldap_set_option( NULL, attrs[i].offset, (const void *)&v );
|
|
|
d0db73 |
- }
|
|
|
d0db73 |
- } break;
|
|
|
d0db73 |
- }
|
|
|
d0db73 |
-
|
|
|
d0db73 |
- break;
|
|
|
d0db73 |
- }
|
|
|
d0db73 |
+ ldap_int_conf_option( gopts, cmd, opt, userconf );
|
|
|
d0db73 |
}
|
|
|
d0db73 |
|
|
|
d0db73 |
fclose(fp);
|
|
|
d0db73 |
diff --git a/servers/slapd/slapcommon.c b/servers/slapd/slapcommon.c
|
|
|
d0db73 |
index 01574af1e..a62c69581 100644
|
|
|
d0db73 |
--- a/servers/slapd/slapcommon.c
|
|
|
d0db73 |
+++ b/servers/slapd/slapcommon.c
|
|
|
d0db73 |
@@ -228,7 +228,8 @@ parse_slapopt( int tool, int *mode )
|
|
|
d0db73 |
break;
|
|
|
d0db73 |
}
|
|
|
d0db73 |
|
|
|
d0db73 |
- } else if ( strncasecmp( optarg, "ldif-wrap", len ) == 0 ) {
|
|
|
d0db73 |
+ } else if ( ( strncasecmp( optarg, "ldif_wrap", len ) == 0 ) ||
|
|
|
d0db73 |
+ ( strncasecmp( optarg, "ldif-wrap", len ) == 0 ) ) {
|
|
|
d0db73 |
switch ( tool ) {
|
|
|
d0db73 |
case SLAPCAT:
|
|
|
d0db73 |
if ( strcasecmp( p, "no" ) == 0 ) {
|
|
|
d0db73 |
@@ -237,7 +238,7 @@ parse_slapopt( int tool, int *mode )
|
|
|
d0db73 |
} else {
|
|
|
d0db73 |
unsigned int u;
|
|
|
d0db73 |
if ( lutil_atou( &u, p ) ) {
|
|
|
d0db73 |
- Debug( LDAP_DEBUG_ANY, "unable to parse ldif-wrap=\"%s\".\n", p, 0, 0 );
|
|
|
d0db73 |
+ Debug( LDAP_DEBUG_ANY, "unable to parse ldif_wrap=\"%s\".\n", p, 0, 0 );
|
|
|
d0db73 |
return -1;
|
|
|
d0db73 |
}
|
|
|
d0db73 |
ldif_wrap = (ber_len_t)u;
|
|
|
d0db73 |
--
|
|
|
d0db73 |
2.29.2
|
|
|
d0db73 |
|