Package: cpu / 1.4.3-12

10_support-inetOrgPerson-Schema.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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;