mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-05-28 04:35:57 -04:00
ITS#10501 slapadd: Skip dynamic attributes
This commit is contained in:
parent
50183a199f
commit
be3bde6a45
4 changed files with 19 additions and 8 deletions
|
|
@ -97,13 +97,13 @@ entry_init(void)
|
|||
Entry *
|
||||
str2entry( char *s )
|
||||
{
|
||||
return str2entry2( s, 1 );
|
||||
return str2entry2( s, SLAP_ENTRY_SCHEMA_CHECK );
|
||||
}
|
||||
|
||||
#define bvcasematch(bv1, bv2) (ber_bvstrcasecmp(bv1, bv2) == 0)
|
||||
|
||||
Entry *
|
||||
str2entry2( char *s, int checkvals )
|
||||
str2entry2( char *s, int flags )
|
||||
{
|
||||
int rc;
|
||||
Entry *e;
|
||||
|
|
@ -212,7 +212,7 @@ str2entry2( char *s, int checkvals )
|
|||
}
|
||||
|
||||
/* Make sure all attributes with multiple values are contiguous */
|
||||
if ( checkvals ) {
|
||||
if ( flags & SLAP_ENTRY_SCHEMA_CHECK ) {
|
||||
int j, k;
|
||||
struct berval bv;
|
||||
int fv;
|
||||
|
|
@ -273,6 +273,11 @@ str2entry2( char *s, int checkvals )
|
|||
ad->ad_type->sat_syntax->ssyn_oid );
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if ( (flags & SLAP_ENTRY_SKIP_DYNAMIC) && \
|
||||
(ad->ad_type->sat_flags & SLAP_AT_DYNAMIC) ) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (( ad_prev && ad != ad_prev ) || ( i == lines )) {
|
||||
|
|
@ -289,7 +294,8 @@ str2entry2( char *s, int checkvals )
|
|||
a->a_nvals = NULL;
|
||||
} else {
|
||||
/* Duplicate attribute detected */
|
||||
if ( checkvals && is_at_single_value( ad->ad_type ) ) {
|
||||
if ( (flags & SLAP_ENTRY_SCHEMA_CHECK) && \
|
||||
is_at_single_value( ad->ad_type ) ) {
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"str2entry: single-value attributeType %s "
|
||||
"presented under multiple names\n",
|
||||
|
|
|
|||
|
|
@ -1012,7 +1012,7 @@ LDAP_SLAPD_F (int) entry_init LDAP_P((void));
|
|||
LDAP_SLAPD_F (int) entry_destroy LDAP_P((void));
|
||||
|
||||
LDAP_SLAPD_F (Entry *) str2entry LDAP_P(( char *s ));
|
||||
LDAP_SLAPD_F (Entry *) str2entry2 LDAP_P(( char *s, int checkvals ));
|
||||
LDAP_SLAPD_F (Entry *) str2entry2 LDAP_P(( char *s, int flags ));
|
||||
LDAP_SLAPD_F (char *) entry2str LDAP_P(( Entry *e, int *len ));
|
||||
LDAP_SLAPD_F (char *) entry2str_wrap LDAP_P(( Entry *e, int *len, ber_len_t wrap ));
|
||||
|
||||
|
|
|
|||
|
|
@ -1219,6 +1219,8 @@ struct Entry {
|
|||
/* for use by the backend for any purpose */
|
||||
void* e_private;
|
||||
};
|
||||
#define SLAP_ENTRY_SCHEMA_CHECK 0x0001
|
||||
#define SLAP_ENTRY_SKIP_DYNAMIC 0x0002
|
||||
|
||||
/*
|
||||
* A list of LDAPMods
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ typedef struct Trec {
|
|||
|
||||
static Trec trec;
|
||||
static unsigned long sid = SLAP_SYNC_SID_MAX + 1;
|
||||
static int checkvals;
|
||||
static int flags;
|
||||
static int enable_meter;
|
||||
static lutil_meter_t meter;
|
||||
static const char *progname = "slapadd";
|
||||
|
|
@ -121,7 +121,7 @@ again:
|
|||
prev_DN_strict = slap_DN_strict;
|
||||
slap_DN_strict = 0;
|
||||
}
|
||||
e = str2entry2( buf, checkvals );
|
||||
e = str2entry2( buf, flags );
|
||||
if ( !dbnum ) {
|
||||
slap_DN_strict = prev_DN_strict;
|
||||
}
|
||||
|
|
@ -386,7 +386,10 @@ slapadd( int argc, char **argv )
|
|||
}
|
||||
}
|
||||
|
||||
checkvals = (slapMode & SLAP_TOOL_QUICK) ? 0 : 1;
|
||||
flags = SLAP_ENTRY_SKIP_DYNAMIC;
|
||||
if ( !(slapMode & SLAP_TOOL_QUICK) ) {
|
||||
flags |= SLAP_ENTRY_SCHEMA_CHECK;
|
||||
}
|
||||
|
||||
/* do not check values in quick mode */
|
||||
if ( slapMode & SLAP_TOOL_QUICK ) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue