Changeset 12f279ef4f9d


Ignore:
Timestamp:
09/06/11 16:22:42 (8 months ago)
Author:
Mahlon E. Smith <mahlon@…>
Branch:
default
Tags:
0.5
Message:

Backout the additional objectClasses patch for mkdir: same behavior can
be acheived with 'touch', less complex to leave it as is.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • shelldap

    r37 r38  
    312312=item B<mkdir> 
    313313 
    314 Creates a new entry. The type of object created depends on 
    315 the naming attribute given, and defaults to 'organizationalUnit' 
    316 if none is given. 
    317 Supported naming attributes and corresponding object classes are: 
    318     c   - country 
    319     o   - organization 
    320     ou  - organizationalUnit 
    321  
    322     mkdir myNewOrgUnit 
    323     mkdir o=myNewOrg 
     314Creates a new 'organizationalUnit' entry. 
     315 
     316    mkdir containername 
     317    mkdir ou=whatever 
    324318 
    325319=item B<move> 
     
    15771571    my $self = shift; 
    15781572    my $dir  = join ' ', @_; 
    1579     my %ClassMap = ( c => 'country', 
    1580              o => 'organization', 
    1581              ou => 'organizationalUnit' ); 
    1582     my %class; 
    15831573 
    15841574    unless ( $dir ) { 
     
    15871577    } 
    15881578 
    1589     # convert given path to DN 
     1579    # normalize name, if it is not yet a legal DN 
     1580    $dir = 'ou=' . $dir unless canonical_dn( $dir ); 
     1581 
     1582    # convert given path to full DN 
    15901583    $dir = $self->path_to_dn( $dir ); 
    15911584 
    1592     # normalize name, if it is not yet a legal DN 
    1593     $dir = 'ou='.$dir  if (!canonical_dn($dir)); 
    1594  
    15951585    # get RDN: naming attributes (lower-case) and their values 
    1596         my %rdn = %{ shift(@{ ldap_explode_dn($dir, casefold => 'lower') }) }; 
    1597  
    1598     # without RDN, return error 
    1599     unless ( %rdn ) { 
    1600         print "Illegal DN: $dir\n"; 
    1601         return; 
    1602     } 
    1603  
    1604     # get objectclass from naming attributes 
    1605     foreach my $attr (keys(%rdn)) { 
    1606         map { $class{$ClassMap{$_}} = 1  if ($attr =~ /^\Q$_\E$/); } 
    1607             keys(%ClassMap); 
    1608     } 
    1609  
    1610     # fail if we did not get a unique objectclass 
    1611     unless (scalar(keys(%class)) == 1) { 
    1612         print "Unsupported DN: $dir\n"; 
    1613         return; 
    1614     } 
    1615  
    1616     # create the new object 
    1617     my $r = $self->ldap()->add($dir, 
    1618                    attr => [ objectClass => [ 'top', keys(%class) ], 
    1619                          %rdn ]); 
     1586    my %rdn = %{ shift(@{ ldap_explode_dn($dir, casefold => 'lower') }) }; 
     1587 
     1588    # add 
     1589    my $r = $self->ldap()->add( $dir, attr => [ 
     1590        objectClass => [ 'top', 'organizationalUnit' ], %rdn 
     1591    ]); 
    16201592 
    16211593    print $r->error(), "\n"; 
Note: See TracChangeset for help on using the changeset viewer.