Menu

#9 Mix and Match LDAP support?

open
nobody
None
5
2008-06-10
2008-06-10
Anonymous
No

One of my systems has a few dozen local accounts AND LDAP authentication. The LDAP setting is for all or nothing. It would be nice to configure it to fall back to the default behavior on users who not available in LDAP.

The below is an example patch of what I mean.

--- /tmp/quota-3.15/warnquota.c 2008-06-10 13:06:54.000000000 -0500
+++ warnquota_alter.c 2008-06-10 13:17:45.000000000 -0500
@@ -119,6 +119,7 @@
char ldap_search_attr[CNF_BUFFER];
char ldap_mail_attr[CNF_BUFFER];
char default_domain[CNF_BUFFER];
+ int ldap_guess_email; /* 0 */
#endif /* USE_LDAP_MAIL_LOOKUP */
};

@@ -442,6 +443,12 @@
offender->offender_name, cnt);
return 0;
} else if(cnt == 0) {
+ if (config->ldap_guess_email == 1) {
+ to = malloc(strlen(offender->offender_name)+
+ strlen(config->default_domain)+1);
+ sprintf(to, "%s@%s", offender->offender_name,
+ config->default_domain);
+ } else
errstr(_("Entry not found for client %s, %d not sending mail.\n"),
offender->offender_name, cnt);
return 0;
@@ -832,6 +839,8 @@
sstrncpy(config->ldap_mail_attr, value, CNF_BUFFER);
else if(!strcmp(var, "LDAP_DEFAULT_MAIL_DOMAIN"))
sstrncpy(config->default_domain, value, CNF_BUFFER);
+ else if (!strcmp(var, "LDAP_GUESS_ON_NOT_FOUND"))
+ config->ldap_guess_email = (int)strtol(value, NULL, 10);
#endif
else /* not matched at all */
errstr(_("Error in config file (line %d), ignoring\n"), line);

Discussion

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.