Commit be22981d authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

Add nameAndOptionalUID pretty routine... improves uniqueMember handling

Should resolve ITS#2664.
parent 2ff82a82
......@@ -729,6 +729,87 @@ nameUIDValidate(
return rc;
}
int
nameUIDPretty(
Syntax *syntax,
struct berval *val,
struct berval *out,
void *ctx )
{
assert( val );
assert( out );
#ifdef NEW_LOGGING
LDAP_LOG( OPERATION, ARGS, ">>> nameUIDPretty: <%s>\n", val->bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, ">>> nameUIDPretty: <%s>\n", val->bv_val, 0, 0 );
#endif
if( val->bv_len == 0 ) {
ber_dupbv_x( out, val, ctx );
} else if ( val->bv_len > SLAP_LDAPDN_MAXLEN ) {
return LDAP_INVALID_SYNTAX;
} else {
int rc;
struct berval dnval = *val;
struct berval uidval = { 0, NULL };
if( val->bv_val[val->bv_len-1] == 'B'
&& val->bv_val[val->bv_len-2] == '\'' )
{
uidval.bv_val=strrchr( val->bv_val, '#' );
if( uidval.bv_val ) {
dnval.bv_len = uidval.bv_val - dnval.bv_val;
uidval.bv_len = val->bv_len - dnval.bv_len;
uidval.bv_len--;
uidval.bv_val++;
}
}
rc = dnPretty( syntax, &dnval, out, ctx );
if( rc != LDAP_SUCCESS ) return rc;
if( uidval.bv_val ) {
char *tmp = sl_realloc( out->bv_val, out->bv_len + uidval.bv_len + 2, ctx );
int i, c, got1;
if( tmp == NULL ) {
ber_memfree_x( out->bv_val, ctx );
return LDAP_OTHER;
}
out->bv_val[out->bv_len++] = '#';
got1 = uidval.bv_len < sizeof("'0'B");
for(i=0; i<uidval.bv_len; i++) {
c = uidval.bv_val[i];
switch(c) {
case '0':
if( got1 ) out->bv_val[out->bv_len++] = c;
break;
case '1':
got1 = 1;
default:
out->bv_val[out->bv_len++] = c;
}
}
out->bv_val[out->bv_len] = '\0';
}
}
#ifdef NEW_LOGGING
LDAP_LOG( OPERATION, ARGS, "<<< nameUIDPretty: <%s>\n", out->bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "<<< nameUIDPretty: <%s>\n", out->bv_val, 0, 0 );
#endif
return LDAP_SUCCESS;
}
static int
uniqueMemberNormalize(
slap_mask_t usage,
......@@ -2508,7 +2589,7 @@ static slap_syntax_defs_rec syntax_defs[] = {
{"( 1.3.6.1.4.1.1466.115.121.1.33 DESC 'MHS OR Address' )",
0, NULL, NULL},
{"( 1.3.6.1.4.1.1466.115.121.1.34 DESC 'Name And Optional UID' )",
0, nameUIDValidate, NULL},
0, nameUIDValidate, nameUIDPretty },
{"( 1.3.6.1.4.1.1466.115.121.1.35 DESC 'Name Form Description' )",
0, NULL, NULL},
{"( 1.3.6.1.4.1.1466.115.121.1.36 DESC 'Numeric String' )",
......
......@@ -119,17 +119,16 @@ dn: cn=ITD Staff,ou=Groups,o=University of Michigan,c=US
owner: cn=Manager,o=University of Michigan,c=US
description: All ITD Staff
cn: ITD Staff
objectclass: groupofnames
member: cn=Manager,o=University of Michigan,c=US
member: cn=Bjorn Jensen,ou=Information Technology Division,ou=People,o=Univers
ity of Michigan,c=US
member: cn=James A Jones 2,ou=Information Technology Division,ou=People,o=Univ
ersity of Michigan,c=US
member: cn=John Doe,ou=Information Technology Division,ou=People,o=University
objectclass: groupofuniquenames
uniquemember: cn=Manager,o=University of Michigan,c=US
uniquemember: cn=Bjorn Jensen,ou=Information Technology Division,ou=People,o=U
niversity of Michigan,c=US
uniquemember: cn=James A Jones 2,ou=Information Technology Division,ou=People,
o=University of Michigan,c=US
uniquemember: cn=John Doe,ou=Information Technology Division,ou=People,o=Unive
rsity of Michigan,c=US
uniquemember: cn=James A Jones 1,ou=Alumni Association,ou=People,o=University
of Michigan,c=US
member: cn=James A Jones 1,ou=Alumni Association,ou=People,o=University of Mic
higan,c=US
ou: Groups
dn: cn=James A Jones 2,ou=Information Technology Division,ou=People,o=Universi
ty of Michigan,c=US
......
......@@ -117,14 +117,14 @@ dn: cn=ITD Staff,ou=Groups,o=University of Michigan,c=US
owner: cn=Manager,o=University of Michigan,c=US
description: All ITD Staff
cn: ITD Staff
objectclass: groupofnames
member: cn=Manager,o=University of Michigan,c=US
member: cn=John Doe,ou=Information Technology Division,ou=People,o=University
objectclass: groupofuniquenames
uniquemember: cn=Manager,o=University of Michigan,c=US
uniquemember: cn=John Doe,ou=Information Technology Division,ou=People,o=Unive
rsity of Michigan,c=US
uniquemember: cn=Dorothy Stevens,ou=Alumni Association,ou=People,o=University
of Michigan,c=US
uniquemember: cn=James A Jones 1,ou=Alumni Association,ou=People,o=University
of Michigan,c=US
member: cn=Dorothy Stevens,ou=Alumni Association,ou=People,o=University of Mic
higan,c=US
member: cn=James A Jones 1,ou=Alumni Association,ou=People,o=University of Mic
higan,c=US
dn: cn=James A Jones 1,ou=Alumni Association,ou=People,o=University of Michiga
n,c=US
......
......@@ -120,14 +120,14 @@ dn: cn=ITD Staff,ou=Groups,o=University of Michigan,c=US
owner: cn=Manager,o=University of Michigan,c=US
description: All ITD Staff
cn: ITD Staff
objectclass: groupofnames
member: cn=Manager,o=University of Michigan,c=US
member: cn=Bjorn Jensen,ou=Information Technology Division,ou=People,o=Univers
ity of Michigan,c=US
member: cn=James A Jones 2,ou=Information Technology Division,ou=People,o=Univ
ersity of Michigan,c=US
member: cn=John Doe,ou=Information Technology Division,ou=People,o=University
of Michigan,c=US
objectclass: groupofuniquenames
uniquemember: cn=Manager,o=University of Michigan,c=US
uniquemember: cn=Bjorn Jensen,ou=Information Technology Division,ou=People,o=U
niversity of Michigan,c=US
uniquemember: cn=James A Jones 2,ou=Information Technology Division,ou=People,
o=University of Michigan,c=US
uniquemember: cn=John Doe,ou=Information Technology Division,ou=People,o=Unive
rsity of Michigan,c=US
dn: cn=James A Jones II,ou=Information Technology Division,ou=People,o=Univ
ersity of Michigan,c=US
......
......@@ -119,14 +119,14 @@ dn: cn=ITD Staff,ou=Groups,o=University of Michigan,c=US
owner: cn=Manager,o=University of Michigan,c=US
description: All ITD Staff
cn: ITD Staff
objectclass: groupofnames
member: cn=Manager,o=University of Michigan,c=US
member: cn=Bjorn Jensen,ou=Information Technology Division,ou=People,o=Univers
ity of Michigan,c=US
member: cn=James A Jones 2,ou=Information Technology Division,ou=People,o=Univ
ersity of Michigan,c=US
member: cn=John Doe,ou=Information Technology Division,ou=People,o=University
of Michigan,c=US
objectclass: groupofuniquenames
uniquemember: cn=Manager,o=University of Michigan,c=US
uniquemember: cn=Bjorn Jensen,ou=Information Technology Division,ou=People,o=U
niversity of Michigan,c=US
uniquemember: cn=James A Jones 2,ou=Information Technology Division,ou=People,
o=University of Michigan,c=US
uniquemember: cn=John Doe,ou=Information Technology Division,ou=People,o=Unive
rsity of Michigan,c=US
dn: cn=James A Jones II,ou=Information Technology Division,ou=People,o=Univers
ity of Michigan,c=US
......
......@@ -89,14 +89,14 @@ dn: cn=ITD Staff,ou=Groups,o=University of Michigan,c=US
owner: cn=Manager,o=University of Michigan,c=US
description: All ITD Staff
cn: ITD Staff
objectclass: groupofnames
member: cn=Manager,o=University of Michigan,c=US
member: cn=Bjorn Jensen,ou=Information Technology Division,ou=People,o=Univers
ity of Michigan,c=US
member: cn=James A Jones 2,ou=Information Technology Division,ou=People,o=Univ
ersity of Michigan,c=US
member: cn=John Doe,ou=Information Technology Division,ou=People,o=University
of Michigan,c=US
objectClass: groupOfUniqueNames
uniqueMember: cn=Manager,o=University of Michigan,c=US
uniqueMember: cn=Bjorn Jensen,OU=Information Technology Division,ou=PEOPLE,o=U
niversity of Michigan,c=US
uniqueMember: cn=James A Jones 2,ou=Information Technology Division,ou=PEOPLE,
o=University of Michigan,c=US
uniqueMember: cn=John Doe,ou=Information Technology Division,ou=People,o=Unive
rsity of Michigan,c=US
dn: cn=James A Jones 1,ou=Alumni Association,ou=People,o=University of Michiga
n,c=US
......@@ -226,14 +226,14 @@ dn: cn=ITD Staff,ou=Groups,o=University of Michigan,c=US
owner: cn=Manager,o=University of Michigan,c=US
description: All ITD Staff
cn: ITD Staff
objectclass: groupofnames
member: cn=Manager,o=University of Michigan,c=US
member: cn=Bjorn Jensen,ou=Information Technology Division,ou=People,o=Univers
ity of Michigan,c=US
member: cn=James A Jones 2,ou=Information Technology Division,ou=People,o=Univ
ersity of Michigan,c=US
member: cn=John Doe,ou=Information Technology Division,ou=People,o=University
of Michigan,c=US
objectclass: groupofuniquenames
uniquemember: cn=Manager,o=University of Michigan,c=US
uniquemember: cn=Bjorn Jensen,ou=Information Technology Division,ou=People,o=U
niversity of Michigan,c=US
uniquemember: cn=James A Jones 2,ou=Information Technology Division,ou=People,
o=University of Michigan,c=US
uniquemember: cn=John Doe,ou=Information Technology Division,ou=People,o=Unive
rsity of Michigan,c=US
dn: cn=Manager,o=University of Michigan,c=US
objectClass: person
......
......@@ -52,20 +52,21 @@ access to dn.children="ou=Alumni Association,ou=People,o=University of Michigan
by dn.subtree="o=University of Michigan,c=US" +rs continue
by * stop
access to attr=member
access to attr=member,uniquemember
by dnattr=member selfwrite
by dnattr=uniquemember selfwrite
by * read
access to attr=member filter=(mail=*edu)
access to attr=member,uniquemember filter=(mail=*edu)
by * read
access to filter="(objectclass=groupofnames)"
access to filter="(&(objectclass=groupofnames)(objectClass=groupofuniquenames))"
by dn.base="cn=Bjorn Jensen,ou=Information Technology Division,ou=People,o=University of Michigan,c=US" =sc continue
by dn.regex="^cn=Bjorn Jensen,ou=Information Technology Division,ou=People,o=University of Michigan,c=US$" +rw stop
by * break
access to dn.children="ou=Information Technology Division,ou=People,o=University of Michigan,c=US"
by group.exact="cn=ITD Staff,ou=Groups,o=University of Michigan,c=US" write
by group/groupOfUniqueNames/uniqueMember.exact="cn=ITD Staff,ou=Groups,o=University of Michigan,c=US" write
by * read
access to filter="(name=X*Y*Z)"
......
......@@ -278,12 +278,12 @@ dn: cn=ITD Staff,ou=Groups,o=University of Michigan,c=US
owner: cn=Manager,o=University of Michigan,c=US
description: All ITD Staff
cn: ITD Staff
objectClass: groupofnames
member: cn=Manager,o=University of Michigan,c=US
member: cn=Bjorn Jensen,ou=Information Technology Division,ou=People,o=Univers
ity of Michigan,c=US
member: cn=James A Jones 2,ou=Information Technology Division,ou=People,o=Univ
ersity of Michigan,c=US
member: cn=John Doe,ou=Information Technology Division,ou=People,o=University
of Michigan,c=US
objectclass: groupofuniquenames
uniquemember: cn=Manager,o=University of Michigan,c=US
uniquemember: cn=Bjorn Jensen,OU=Information Technology Division,ou=PEOPLE,o=U
niversity of Michigan,c=US
uniquemember: cn=James A Jones 2,ou=Information Technology Division,ou=PEOPLE,
o=University of Michigan,c=US
uniquemember: cn=John Doe,ou=Information Technology Division,ou=People,o=Unive
rsity of Michigan,c=US
......@@ -126,14 +126,14 @@ dn: cn=ITD Staff,ou=Groups,o=University of Michigan,c=US
owner: cn=Manager,o=University of Michigan,c=US
description: All ITD Staff
cn: ITD Staff
objectclass: groupofnames
member: cn=Manager,o=University of Michigan,c=US
member: cn=Bjorn Jensen,OU=Information Technology Division,ou=PEOPLE,o=Univers
ity of Michigan,c=US
member: cn=James A Jones 2,ou=Information Technology Division,ou=PEOPLE,o=Univ
ersity of Michigan,c=US
member: cn=John Doe,ou=Information Technology Division,ou=People,o=University
of Michigan,c=US
objectclass: groupofuniquenames
uniquemember: cn=Manager,o=University of Michigan,c=US
uniquemember: cn=Bjorn Jensen,OU=Information Technology Division,ou=PEOPLE,o=U
niversity of Michigan,c=US
uniquemember: cn=James A Jones 2,ou=Information Technology Division,ou=PEOPLE,
o=University of Michigan,c=US
uniquemember: cn=John Doe,ou=Information Technology Division,ou=People,o=Unive
rsity of Michigan,c=US
dn: cn=James A Jones 1,ou=Alumni Association,ou=People,o=University of Mich
igan,c=US
......
......@@ -145,14 +145,14 @@ dn: cn=ITD Staff,ou=Groups,o=University of Michigan,c=US
owner: cn=Manager,o=University of Michigan,c=US
description: All ITD Staff
cn: ITD Staff
objectclass: groupofnames
member: cn=Manager,o=University of Michigan,c=US
member: cn=Bjorn Jensen,OU=Information Technology Division,ou=PEOPLE,o=Univers
ity of Michigan,c=US
member: cn=James A Jones 2,ou=Information Technology Division,ou=PEOPLE,o=Univ
ersity of Michigan,c=US
member: cn=John Doe,ou=Information Technology Division,ou=People,o=University
of Michigan,c=US
objectclass: groupofuniquenames
uniquemember: cn=Manager,o=University of Michigan,c=US
uniquemember: cn=Bjorn Jensen,OU=Information Technology Division,ou=PEOPLE,o=U
niversity of Michigan,c=US
uniquemember: cn=James A Jones 2,ou=Information Technology Division,ou=PEOPLE,
o=University of Michigan,c=US
uniquemember: cn=John Doe,ou=Information Technology Division,ou=People,o=Unive
rsity of Michigan,c=US
dn: cn=James A Jones 1,ou=Alumni Association,ou=People,o=University of Mich
igan,c=US
......
......@@ -121,14 +121,14 @@ dn: cn=ITD Staff,ou=Groups,o=University of Michigan,c=US
owner: cn=Manager,o=University of Michigan,c=US
description: All ITD Staff
cn: ITD Staff
objectclass: groupofnames
member: cn=Manager,o=University of Michigan,c=US
member: cn=Bjorn Jensen,ou=Information Technology Division,ou=People,o=Univers
ity of Michigan,c=US
member: cn=James A Jones 2,ou=Information Technology Division,ou=People,o=Univ
ersity of Michigan,c=US
member: cn=John Doe,ou=Information Technology Division,ou=People,o=University
of Michigan,c=US
objectclass: groupofuniquenames
uniquemember: cn=Manager,o=University of Michigan,c=US
uniquemember: cn=Bjorn Jensen,ou=Information Technology Division,ou=People,o=U
niversity of Michigan,c=US
uniquemember: cn=James A Jones 2,ou=Information Technology Division,ou=People,
o=University of Michigan,c=US
uniquemember: cn=John Doe,ou=Information Technology Division,ou=People,o=Unive
rsity of Michigan,c=US
dn: cn=James A Jones 1,ou=Alumni Association,ou=People,o=University of Michiga
n,c=US
......
......@@ -73,7 +73,7 @@ fi
echo "Testing OR searching..."
$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT \
'(|(givenname=Xx*yY*Z)(cn=)(undef=*)(objectclass=groupofnames)(sn=jones)(member=cn=Manager,o=University of Michigan,c=US))' >> $SEARCHOUT 2>&1
'(|(givenname=Xx*yY*Z)(cn=)(undef=*)(objectclass=groupofnames)(sn=jones)(member=cn=Manager,o=University of Michigan,c=US)(uniqueMember=cn=Manager,o=University of Michigan,c=US))' >> $SEARCHOUT 2>&1
RC=$?
if test $RC != 0 ; then
echo "ldapsearch failed ($RC)!"
......
......@@ -91,13 +91,17 @@ drink: Mad Dog 20/20
dn: cn=ITD Staff,ou=Groups,o=University of Michigan,c=US
changetype: modify
delete: member
member: cn=James A Jones 2,ou=Information Technology Division,ou=People,o=University of Michigan,c=US
member: cn=Bjorn Jensen,ou=Information Technology Division,ou=People,o=University of Michigan,c=US
delete: uniquemember
uniquemember: cn=James A Jones 2,ou=Information Technology Division,
ou=People,o=University of Michigan,c=US
uniquemember: cn=Bjorn Jensen,ou=Information Technology Division,
ou=People,o=University of Michigan,c=US
-
add: member
member: cn=Dorothy Stevens,ou=Alumni Association,ou=People,o=University of Michigan,c=US
member: cn=James A Jones 1,ou=Alumni Association,ou=People,o=University of Michigan,c=US
add: uniquemember
uniquemember: cn=Dorothy Stevens,ou=Alumni Association,
ou=People,o=University of Michigan,c=US
uniquemember: cn=James A Jones 1,ou=Alumni Association,
ou=People,o=University of Michigan,c=US
dn: cn=All Staff,ou=Groups,o=University of Michigan,c=US
changetype: modify
......
......@@ -97,8 +97,8 @@ $LDAPMODIFY -D "$JAJDN" -h $LOCALHOST -p $PORT -w jaj > \
version: 1
dn: cn=ITD Staff, ou=Groups, o=University of Michigan, c=US
changetype: modify
add: member
member: cn=Barbara Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
add: uniquemember
uniquemember: cn=Barbara Jensen,ou=Information Technology Division,ou=People,o=University of Michigan,c=US
EOMODS1
......@@ -108,8 +108,8 @@ version: 1
dn: cn=ITD Staff, ou=Groups, o=University of Michigan, c=US
changetype: modify
add: member
member: cn=James A Jones 1, ou=Alumni Association, ou=People, o=University of Michigan, c=US
add: uniquemember
uniquemember: cn=James A Jones 1, ou=Alumni Association, ou=People, o=University of Michigan, c=US
EOMODS2
#
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment