Changeset 165

Show
Ignore:
Timestamp:
09/04/07 16:53:53 (20 months ago)
Author:
smoku
Message:

Integrated LDAP append-realm patch by Andrew Klang. Closes #60

Location:
trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/c2s/authreg_ldap.c

    r164 r165  
    4242#define AR_LDAP_FLAGS_RECONNECT (0x8) 
    4343#define AR_LDAP_FLAGS_DISABLE_REFERRALS (0x10) 
     44#define AR_LDAP_FLAGS_APPEND_REALM (0x20) 
    4445 
    4546/** internal structure, holds our data */ 
     
    199200    } 
    200201 
    201     snprintf(filter, 1024, "(%s=%s)", data->uidattr, username); 
     202    if (data->flags & AR_LDAP_FLAGS_APPEND_REALM) { 
     203        snprintf(filter, 1024, "(%s=%s@%s)", data->uidattr, username, realm); 
     204    } else { 
     205        snprintf(filter, 1024, "(%s=%s)", data->uidattr, username); 
     206    } 
    202207 
    203208    if(ldap_set_rebind_proc(data->ld, &rebindProc, data)) { 
     
    402407    if(config_get(ar->c2s->config, ldap_entry) != NULL) 
    403408      data->flags |= AR_LDAP_FLAGS_V3; 
     409 
    404410    if (l>0) 
    405411        snprintf(ldap_entry,sizeof(ldap_entry), "authreg.ldap%d.startls", l ); 
     
    408414    if(config_get(ar->c2s->config, ldap_entry) != NULL) 
    409415      data->flags |= AR_LDAP_FLAGS_STARTTLS; 
     416 
    410417    if (l>0) 
    411418        snprintf(ldap_entry,sizeof(ldap_entry), "authreg.ldap%d.ssl", l ); 
     
    414421    if(config_get(ar->c2s->config, ldap_entry) != NULL) 
    415422      data->flags |= AR_LDAP_FLAGS_SSL; 
     423 
    416424    if (l>0) 
    417425        snprintf(ldap_entry,sizeof(ldap_entry), "authreg.ldap%d.disablereferrals", l ); 
     
    420428    if(config_get(ar->c2s->config, ldap_entry) != NULL) 
    421429      data->flags |= AR_LDAP_FLAGS_DISABLE_REFERRALS; 
     430 
     431    if (l>0) 
     432        snprintf(ldap_entry,sizeof(ldap_entry), "authreg.ldap%d.append-realm", l ); 
     433    else 
     434        snprintf(ldap_entry, sizeof(ldap_entry), "authreg.ldap.append-realm"); 
     435    if(config_get(ar->c2s->config, ldap_entry) != NULL) 
     436      data->flags |= AR_LDAP_FLAGS_APPEND_REALM; 
    422437 
    423438    if((data->flags & AR_LDAP_FLAGS_STARTTLS) && (data->flags & AR_LDAP_FLAGS_SSL)) { 
  • trunk/etc/c2s.xml.dist.in

    r162 r165  
    380380      <uidattr>uid</uidattr> 
    381381 
     382      <!-- Enable the append-realm element if you want to append 
     383           realm value (usernam@realm) to the uidattr value 
     384      <append-realm/> 
     385      --> 
     386 
    382387      <!-- base DN of the tree. You should specify a DN for each 
    383388           authentication realm declared in the <local/> section above,