72 lines
2.3 KiB
Diff
72 lines
2.3 KiB
Diff
Description: Enhancement to support inetOrgPerson Schema
|
|
Author: Bas van der Vlies <basv@sara.nl>
|
|
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=397882
|
|
|
|
--- a/src/include/plugins/ldap/ldap.h
|
|
+++ b/src/include/plugins/ldap/ldap.h
|
|
@@ -90,6 +90,7 @@
|
|
char * group_base;
|
|
char * dn;
|
|
char * cn;
|
|
+ char * cn_value;
|
|
char * gid;
|
|
char * exec; /* post {un}install exec script */
|
|
bool make_home_directory;
|
|
--- a/src/plugins/ldap/commandline.c
|
|
+++ b/src/plugins/ldap/commandline.c
|
|
@@ -41,6 +41,7 @@
|
|
{"2", 1, 0, '2'},
|
|
{"addfile", 1, 0, 'a'},
|
|
{"cn", 1, 0, 'A'},
|
|
+ {"cn_value", 1, 0, 'C'},
|
|
{"userbase", 1, 0, 'b'},
|
|
{"groupbase", 1, 0, 'B'},
|
|
{"gecos", 1, 0, 'c'},
|
|
@@ -327,6 +328,8 @@
|
|
return 1;
|
|
break;
|
|
case 'C':
|
|
+ globalLdap->cn_value = strdup (optarg);
|
|
+ break;
|
|
case 'M':
|
|
default:
|
|
break;
|
|
@@ -767,8 +770,10 @@
|
|
globalLdap->cn = cfg_get_str ("LDAP", "GROUP_CN_STRING");
|
|
}
|
|
if (operation != CAT)
|
|
- globalLdap->dn = buildDn ((operation > 2) ? GROUPADD : USERADD,
|
|
- globalLdap->passent->pw_name);
|
|
+ {
|
|
+ globalLdap->dn = buildDn ((operation > 2) ? GROUPADD : USERADD,
|
|
+ ldapGetCn());
|
|
+ }
|
|
|
|
if (globalLdap->add_file != NULL)
|
|
{
|
|
@@ -884,7 +889,8 @@
|
|
"LDAP Specific Options\n\n"
|
|
"\t-2, -2 : If specified, use LDAPv2\n"
|
|
"\t-a addfile, --addfile=file : File to use for additional attrs\n"
|
|
- "\t-A cn, --cn=cn : Comman Name Prefix\n"
|
|
+ "\t-A cn, --cn=cn : Common Name Prefix (cn)\n"
|
|
+ "\t-C <cn_value>, --cn_value=value : Use this value in LDAP query cn=value\n"
|
|
"\t-b base, --userbase=base : Base DN for users\n"
|
|
"\t-B group_base, --groupbase=base : Base DN for groups\n"
|
|
"\t-D bind_dn, --binddn=bind_dn : Bind DN\n"
|
|
--- a/src/plugins/ldap/ld.c
|
|
+++ b/src/plugins/ldap/ld.c
|
|
@@ -437,7 +437,11 @@
|
|
size_t slen = 0;
|
|
char *temp;
|
|
|
|
- if (globalLdap->first_name && globalLdap->last_name)
|
|
+ if (globalLdap->cn_value)
|
|
+ {
|
|
+ temp = globalLdap->cn_value;
|
|
+ }
|
|
+ else if (globalLdap->first_name && globalLdap->last_name)
|
|
{
|
|
slen =
|
|
strlen (globalLdap->first_name) + strlen (globalLdap->last_name) + 2;
|