patching GOsa for seamless eGroupWare integration

"-------- Original-Nachricht --------"
Betreff: Re: [GOsa] gosa+samba3.schema conflicts with evolutionPerson.schema
Datum: Tue, 5 Jun 2007 15:23:31 +0200
Von: Cajus Pollmeier <pollmeier@gonicus.de>
An: GONICUS site administration project <gosa@oss.gonicus.de>

These are from two different RFCs, I guess. Bad luck. GOsa uses dateOfBirth 
internally. So, the simpliest way would be to remove the definition from the 
gosa+samba3.schema and add the alias 'dateOfBirth' to the 
evolutionPerson.schema's definition. I can't tell you if they store it in the 
suggested way. They use a maximum size of 128, strange. Just try it.

Am Dienstag 05 Juni 2007 15:05:35 schrieb Christoph Haas:
> the gosa+samba3.schema conflicts with the evolutionPerson.schema, which
> I need also quite urgently in the attributetype 'dob'.
>
> gosa+samba3.schema
> --- snip ---
> attributetype ( 1.3.6.1.4.1.15305.2.2 NAME ( 'dateOfBirth' 'dob' )
>         DESC    'Date of birth in ISO 8601 format'
>         EQUALITY caseIgnoreMatch
>         SYNTAX  1.3.6.1.4.1.1466.115.121.1.15{10}
>         SINGLE-VALUE )
> --- snap ---
>
> evolutionPerson.schema:
> --- snip ---
> attributetype ( 1.3.6.1.4.1.8506.1.2.11
> 	NAME ( 'birthDate' 'dob' )
> 	EQUALITY caseIgnoreMatch
> 	SUBSTR caseIgnoreSubstringsMatch
> 	SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{128} )
> --- snap ---
>
> is there a way for me to modify the objectclass 'gosaAccount', so that
> it utilizes in the MAY-section the birthDate from the
> evolutionPerson.schema instead?
>
> --- snip ---
> objectclass ( 1.3.6.1.4.1.10098.1.2.1.19.6 NAME 'gosaAccount' SUP top
> AUXILIARY
>         DESC 'Objectclass for GOsa Accounts (v2.4)'
> 	MUST ( uid )
>         MAY ( sambaLMPassword $ sambaNTPassword $ sambaPwdLastSet $
>               gosaDefaultPrinter $gosaDefaultLanguage $ academicTitle $
>               personalTitle $ gosaHostACL $ dateOfBirth $
> 	      sambaBadPasswordCount $ sambaBadPasswordTime $ gender ))
> --- snip ---
>
> Thanks and cheers
> Christoph.
-- 
* Dipl.-Ing. Cajus Pollmeier <pollmeier@GONICUS.de>
* GONICUS GmbH * Stahlgruberring 54 * D-81829 München
* Tel.:+49(0)89 / 12 02 12 79 - 0 * Fax.:+49 (0)29 32 /9 16-223
* http://www.GONICUS.de
*
* Sitz der Gesellschaft: Moehnestrasse 11-17 * D-59755 Arnsberg
* Geschaeftsfuehrer: Rainer Luelsdorf, Alfred Schroeder
* Vorsitzender des Beirats: Juergen Michels
* Amtsgericht Arnsberg * HRB 1968

So I ended up in patching GOsa, since I didn't know whether eGroupWare also uses birthDate internally in the MySQL-database …
Basically it's just replacing in GOsa and it's corresponding ldap-schemas „dateOfBirth“ with „birthDate“. The patches below were generated from GOsa 2.5.11a. Be careful, if newer GOsa-versions need to be patched on other places too!
gosa-ldapschema2egw_addressbook.patch:

--- /etc/openldap/schema/gosa/gosa.schema.org	2007-03-23 14:00:00.000000000 +0100
+++ /etc/openldap/schema/gosa/gosa.schema	2007-06-05 17:15:00.000000000 +0200
@@ -234,11 +234,11 @@ attributetype ( 1.3.6.1.4.1.15305.2.1 NA
 	SYNTAX  1.3.6.1.4.1.1466.115.121.1.26{1}
 	SINGLE-VALUE )
 
-attributetype ( 1.3.6.1.4.1.15305.2.2 NAME ( 'dateOfBirth' 'dob' )
-	DESC	'Date of birth in ISO 8601 format'
-	EQUALITY caseIgnoreMatch
-	SYNTAX	1.3.6.1.4.1.1466.115.121.1.15{10}
-	SINGLE-VALUE )
+#attributetype ( 1.3.6.1.4.1.15305.2.2 NAME ( 'dateOfBirth' 'dob' )
+#	DESC	'Date of birth in ISO 8601 format'
+#	EQUALITY caseIgnoreMatch
+#	SYNTAX	1.3.6.1.4.1.1466.115.121.1.15{10}
+#	SINGLE-VALUE )
 
 # cyrus imapd access control list
 # acls work with users and groups
@@ -277,7 +277,7 @@ objectclass ( 1.3.6.1.4.1.10098.1.2.1.19
           DESC 'Objectclass for GOsa Accounts (v2.4)'
 	MUST ( uid )
         MAY ( lmPassword $ ntPassword $ pwdLastSet $ gosaDefaultPrinter $ gosaDefaultLanguage $
-              academicTitle $ personalTitle $ gosaHostACL $ dateOfBirth $ gender ))
+              academicTitle $ personalTitle $ gosaHostACL $ birthDate $ gender ))
 
 objectclass ( 1.3.6.1.4.1.10098.1.2.1.19.7 NAME 'gosaHost' SUP top AUXILIARY
         DESC 'Objectclass for GOsa Hosts (v2.4)'
--- /etc/openldap/schema/gosa/gosa+samba3.schema.org	2007-03-23 14:00:00.000000000 +0100
+++ /etc/openldap/schema/gosa/gosa+samba3.schema	2007-06-05 17:16:00.000000000 +0200
@@ -236,11 +236,11 @@ attributetype ( 1.3.6.1.4.1.15305.2.1 NA
         SYNTAX  1.3.6.1.4.1.1466.115.121.1.26{1}
         SINGLE-VALUE )
 
-attributetype ( 1.3.6.1.4.1.15305.2.2 NAME ( 'dateOfBirth' 'dob' )
-        DESC    'Date of birth in ISO 8601 format'
-        EQUALITY caseIgnoreMatch
-        SYNTAX  1.3.6.1.4.1.1466.115.121.1.15{10}
-        SINGLE-VALUE )
+#attributetype ( 1.3.6.1.4.1.15305.2.2 NAME ( 'dateOfBirth' 'dob' )
+#        DESC    'Date of birth in ISO 8601 format'
+#        EQUALITY caseIgnoreMatch
+#        SYNTAX  1.3.6.1.4.1.1466.115.121.1.15{10}
+#        SINGLE-VALUE )
 
 # cyrus imapd access control list
 # acls work with users and groups
@@ -279,7 +279,7 @@ objectclass ( 1.3.6.1.4.1.10098.1.2.1.19
         DESC 'Objectclass for GOsa Accounts (v2.4)'
 	MUST ( uid )
         MAY ( sambaLMPassword $ sambaNTPassword $ sambaPwdLastSet $ gosaDefaultPrinter $
-	      gosaDefaultLanguage $ academicTitle $ personalTitle $ gosaHostACL $ dateOfBirth $
+	      gosaDefaultLanguage $ academicTitle $ personalTitle $ gosaHostACL $ birthDate $
 		  sambaBadPasswordCount $ sambaBadPasswordTime $ gender ))
 
objectclass ( 1.3.6.1.4.1.10098.1.2.1.19.7 NAME 'gosaHost' SUP top AUXILIARY


gosa2egw_addressbook.patch:

--- gosa/html/getxls.php.org	2006-09-08 10:10:05.000000000 +0200
+++ gosa/html/getxls.php	2007-06-05 17:20:56.000000000 +0200
@@ -61,7 +61,7 @@ function dump_ldap ($mode= 0)
 
     switch ($d){
       case "ou=people," : 
-        $user= 				   $ldap->gen_xls($dn,"(objectClass=*)",array("uid","dateOfBirth","gender","givenName","preferredLanguage"));
+        $user= 				   $ldap->gen_xls($dn,"(objectClass=*)",array("uid","birthDate","gender","givenName","preferredLanguage"));
       $intitul=array(_("Birthday").":", _("Sex").":", _("Surname")."/"._("Given name").":",_("Language").":");
 
       //name of the xls file
@@ -220,7 +220,7 @@ function dump_ldap ($mode= 0)
     $dn =  base64_decode($_GET['dn']);
 
     //data about users
-    $user= $ldap->gen_xls("ou=people,".$dn,"(objectClass=*)",array("uid","dateOfBirth","gender","givenName","preferredLanguage"));
+    $user= $ldap->gen_xls("ou=people,".$dn,"(objectClass=*)",array("uid","birthDate","gender","givenName","preferredLanguage"));
   $user_intitul=array(_("Day of birth").":",_("Sex").":",_("Surname")."/"._("Given name").":",_("Language").":");
     //data about groups
     $groups= $ldap->gen_xls("ou=groups,".$dn,"(objectClass=*)",array("cn","memberUid"),TRUE,1);
--- gosa/plugins/personal/generic/generic.tpl.org	2006-08-11 12:43:05.000000000 +0200
+++ gosa/plugins/personal/generic/generic.tpl	2007-06-05 17:09:00.000000000 +0200
@@ -85,19 +85,19 @@
      <td>
       <div style="height:10px;"></div>
       {if $use_dob eq 1}
-      <select id="day" name=day onChange="createResult(this.form,this.form.dateOfBirth);" {$dateOfBirthACL}>
+      <select id="day" name=day onChange="createResult(this.form,this.form.birthDate);" {$birthDateACL}>
        {html_options values=$days output=$days selected=$day}
       </select>
-      <select name=month onChange="populate(this.form,this.form.dateOfBirth);" {$dateOfBirthACL}>
+      <select name=month onChange="populate(this.form,this.form.birthDate);" {$birthDateACL}>
        {html_options options=$months selected=$month}
       </select>
-      <select name=year onChange="populate(this.form,this.form.dateOfBirth);" {$dateOfBirthACL}>
+      <select name=year onChange="populate(this.form,this.form.birthDate);" {$birthDateACL}>
        {html_options values=$years output=$years selected=$year}
       </select>
-      <input type="hidden" name="dateOfBirth" value="{$dateOfBirth}">
-      <input type="submit" name="set_dob" value="-" {$dateOfBirthACL}>
+      <input type="hidden" name="birthDate" value="{$birthDate}">
+      <input type="submit" name="set_dob" value="-" {$birthDateACL}>
       {else}
-      <input type="submit" name="set_dob" value="{t}Set{/t}" {$dateOfBirthACL}>
+      <input type="submit" name="set_dob" value="{t}Set{/t}" {$birthDateACL}>
       {/if}
      </td>
     </tr>
@@ -434,7 +434,7 @@
   <!-- // First input field on page
   document.mainform.sn.focus();
   	if (document.mainform.yearSel != "")
-				populate(document.mainform,document.mainform.dateOfBirth);
+				populate(document.mainform,document.mainform.birthDate);
   -->
 </script>
 
--- gosa/plugins/personal/mail/class_mailAccount.inc.org	2007-05-04 13:30:35.000000000 +0200
+++ gosa/plugins/personal/mail/class_mailAccount.inc	2007-06-05 17:09:44.000000000 +0200
@@ -441,9 +441,9 @@ class mailAccount extends plugin
       $attrs= $this->parent->by_object['user']->attributes;
       foreach ($attrs as $val){
         
-        if(preg_match("/dateOfBirth/",$val)){
+        if(preg_match("/birthDate/",$val)){
           if($this->parent->by_object['user']->use_dob){
-            $contents= preg_replace("/%$val/",date("Y-d-m",$this->parent->by_object['user']->dateOfBirth),$contents);
+            $contents= preg_replace("/%$val/",date("Y-d-m",$this->parent->by_object['user']->birthDate),$contents);
           }
         }else {
           $contents= preg_replace("/%$val/",
--- gosa/plugins/personal/connectivity/class_opengwAccount.inc.org	2007-01-29 14:59:42.000000000 +0100
+++ gosa/plugins/personal/connectivity/class_opengwAccount.inc	2007-06-05 17:07:44.000000000 +0200
@@ -18,7 +18,7 @@ class opengwAccount extends plugin
 			"firstname"   =>"givenName",
 			"login"       =>"uid",
 			"degree"      =>"academicTitle",
-			"birthday"    =>"dateOfBirth",
+			"birthday"    =>"birthDate",
 			"sex"         =>"gender",
 			"street"      =>"street",
 			"zip"         =>"postalCode",
--- gosa/plugins/personal/generic/class_user.inc.org	2007-06-04 07:07:44.000000000 +0200
+++ gosa/plugins/personal/generic/class_user.inc	2007-06-05 17:08:19.000000000 +0200
@@ -39,7 +39,7 @@ class user extends plugin
   var $l= "";
   var $st= "";
   var $postalAddress= "";
-  var $dateOfBirth;
+  var $birthDate;
   var $use_dob= "0";
   var $gender="0";
   var $preferredLanguage="0";
@@ -82,7 +82,7 @@ class user extends plugin
 
   /* attribute list for save action */
   var $attributes= array("sn", "givenName", "uid", "personalTitle", "academicTitle",
-      "homePostalAddress", "homePhone", "labeledURI", "ou", "o", "dateOfBirth", "gender","preferredLanguage",
+      "homePostalAddress", "homePhone", "labeledURI", "ou", "o", "birthDate", "gender","preferredLanguage",
       "departmentNumber", "employeeNumber", "employeeType", "l", "st","jpegPhoto",
       "roomNumber", "telephoneNumber", "mobile", "pager", "cn", "userPKCS12",
       "postalAddress", "facsimileTelephoneNumber", "userSMIMECertificate");
@@ -184,12 +184,12 @@ class user extends plugin
       $this->last_pw_storage= $this->pw_storage;
     }
 
-    /* Generate dateOfBirth entry */
-    if (isset ($this->attrs['dateOfBirth'])){
+    /* Generate birthDate entry */
+    if (isset ($this->attrs['birthDate'])){
       /* This entry is ISO 8601 conform */
-      list($year, $month, $day)= split("-", $this->attrs['dateOfBirth'][0], 3);
+      list($year, $month, $day)= split("-", $this->attrs['birthDate'][0], 3);
     
-      $this->dateOfBirth=array( 'mon'=> $month,"mday"=> $day,"year"=> $year);
+      $this->birthDate=array( 'mon'=> $month,"mday"=> $day,"year"=> $year);
       $this->use_dob= "1";
     } else {
       $this->use_dob= "0";
@@ -213,18 +213,18 @@ class user extends plugin
     $smarty= get_smarty();
 
     /* Fill calendar */
-    if ($this->dateOfBirth == "0"){
+    if ($this->birthDate == "0"){
       $date= getdate();
     } else {
-      if(is_array($this->dateOfBirth)){
-        $date = $this->dateOfBirth;
+      if(is_array($this->birthDate)){
+        $date = $this->birthDate;
   
         // Trigger on dates like 1985-04-01, getdate only understands timestamps
-      } else if (!empty($this->dateOfBirth) && !is_numeric($this->dateOfBirth)){
-        $date= getdate(strtotime($this->dateOfBirth));
+      } else if (!empty($this->birthDate) && !is_numeric($this->birthDate)){
+        $date= getdate(strtotime($this->birthDate));
 
       } else {
-        $date = getdate($this->dateOfBirth);
+        $date = getdate($this->birthDate);
       } 
     }
 
@@ -355,7 +355,7 @@ class user extends plugin
       $this->dialog= FALSE;
     }
 
-    /* Toggle dateOfBirth information */
+    /* Toggle birthDate information */
     if (isset($_POST['set_dob'])){
       $this->use_dob= ($this->use_dob == "0")?"1":"0";
     }
@@ -697,8 +697,8 @@ class user extends plugin
 
     if ($this->use_dob == "1"){
       /* If it is an array, the generic page has never been loaded - so there's no difference. Using an array would cause an error btw. */
-      if(!is_array($this->attrs['dateOfBirth'])) {
-        $this->attrs['dateOfBirth']= date("Y-m-d", $this->attrs['dateOfBirth']);
+      if(!is_array($this->attrs['birthDate'])) {
+        $this->attrs['birthDate']= date("Y-m-d", $this->attrs['birthDate']);
       }
     }
     /* Remove additional objectClasses */
@@ -759,12 +759,12 @@ class user extends plugin
       $remove_userCertificate= true;
     }
 
-    /* Special handling for dateOfBirth value */
+    /* Special handling for birthDate value */
     if ($this->use_dob != "1"){
       if ($this->new) {
-        unset($this->attrs["dateOfBirth"]);
+        unset($this->attrs["birthDate"]);
       } else {
-        $this->attrs["dateOfBirth"]= array();
+        $this->attrs["birthDate"]= array();
       }
     }
     if (!$this->gender){

You can either patch GOsa before you build your RPM-file in patching the spec-file:

# patch -p0 < gosa.spec.patch

gosa.spec.patch:

--- gosa.spec	2007-07-18 09:22:00.000000000 +0200
+++ gosa.spec.egw	2007-07-18 09:22:16.000000000 +0200
@@ -15,6 +15,8 @@
   Release:		1
   License: 		GPL
   Source: 		ftp://oss.GONICUS.de/pub/gosa/%{sourcename}.tar.bz2
+  Patch0:               gosa-ldapschema2egw_addressbook.patch
+  Patch1:               gosa2egw_addressbook.patch
   URL: 			http://www.gosa-project.org
   Group: 			System/Administration
   Vendor:			GONICUS GmbH
@@ -101,6 +103,8 @@
   %prep
   %setup -q -n %{sourcename}
   find . -depth -name CVS -type d | xargs rm -rf
+  %patch0 -p 0
+  %patch1 -p 0
   
   %build


or after installation:

patch -p0 < gosa2egw_addressbook.patch
patch -p0 < gosa-ldap2egw_addressbook.patch



index