Ticket #60: jabberd-ldap-append-realm-2.diff
| File jabberd-ldap-append-realm-2.diff, 1.2 KB (added by smoku, 20 months ago) |
|---|
-
c2s/authreg_ldap.c
old new 39 39 #define AR_LDAP_FLAGS_STARTTLS (0x1) 40 40 #define AR_LDAP_FLAGS_SSL (0x2) 41 41 #define AR_LDAP_FLAGS_V3 (0x4) 42 #define AR_LDAP_FLAGS_APPEND_REALM (0x8) 42 43 43 44 /** internal structure, holds our data */ 44 45 typedef struct moddata_st … … 138 139 return NULL; 139 140 } 140 141 141 snprintf(filter, 1024, "(%s=%s)", data->uidattr, username); 142 if (data->flags & AR_LDAP_FLAGS_APPEND_REALM) { 143 snprintf(filter, 1024, "(%s=%s@%s)", data->uidattr, username, realm); 144 } else { 145 snprintf(filter, 1024, "(%s=%s)", data->uidattr, username); 146 } 142 147 143 148 if(ldap_search_s(data->ld, basedn, LDAP_SCOPE_SUBTREE, filter, no_attrs, 0, &result)) 144 149 { … … 283 288 if(config_get(ar->c2s->config, "authreg.ldap.ssl") != NULL) 284 289 data->flags |= AR_LDAP_FLAGS_SSL; 285 290 291 if(config_get(ar->c2s->config, "authreg.ldap.append-realm") != NULL) 292 data->flags |= AR_LDAP_FLAGS_APPEND_REALM; 293 286 294 if((data->flags & AR_LDAP_FLAGS_STARTTLS) && (data->flags & AR_LDAP_FLAGS_SSL)) { 287 295 log_write(ar->c2s->log, LOG_ERR, "ldap: not possible to use both SSL and starttls"); 288 296 return 1;
