PMDF System Manager's Guide


Previous Next Contents Index

37.9.2.3 Recipe Files

The attribute schema used by the sample example.com site is based upon LDAP attributes. The "canonical" LDIF attributes are:
Canonical LDIF  
attribute Description
DN Distinguished name: the attribute uniquely identifying this directory entry
cn Common name: the person's name
sn Surname: the person's family (last) name
uid User identifier/account name
mail E-mail address
description A comment field; it can contain important information for cc:Mail
These canonical attributes are the same as the correspondingly named IDDS LDAP attributes. For cc:Mail, the attribute mapping between native cc:Mail attributes and canonical LDIF attributes is as follows:
cc:Mail native attribute Cook Canonical LDIF attribute
function of name plus ou=cc,o=Example,c=NZ --> DN
function of name --> cn
function of name --> sn
cmts --> description
function of addr plus example.com --> mail
Canonical LDIF attribute Serve cc:Mail native attribute
function of cn --> name
function of mail --> addr
description --> cmts
For Lotus Notes, attribute mapping between native Lotus Notes attributes and canonical LDIF attibutes is approximately as follows:
Lotus Notes native attribute Cook Canonical LDIF attribute
function of FullName plus o=example,c=nz --> DN
substring of FullName --> cn
LastName --> sn
shortname --> uid
substring of FullName plus @example.com --> mail
description --> description
Canonical LDIF Serve Lotus Notes native
attribute   attribute
function of DN (effectively CN='cn'/O='ou') --> FullName
cn --> LastName
  --> Form always set to Person
  --> Type always set to Person
description --> description
mail --> MailAddress
  --> MailDomain always set to PMDF

When thinking about recipe files, for concreteness it can be helpful to see samples of actual LDIF files; see Section 37.9.2.4 below.

Sample recipe files for cooking and serving cc:Mail are shown in Example 37-38 and Example 37-39.

Example 37-38 Sample cook_cc.rcp File

cn1 = name[1]; #inputs are always lists 
comma = find(",", cn1); 
if (comma) 
{ 
 lastname = cn1[1, comma];  # up to but not incl. comma 
 cdn = cn1[comma+1, -1] + " " + lastname; 
 fcn = cdn;                 # from just after comma to end 
} 
else 
{ 
 cdn = cn1; 
 space = find(" ", cn1); 
 if (space) 
  lastname = cn1[space+1, -1]; 
 else 
  lastname = cn1; 
} 
dncomp = {"cn", cdn, "ou", "cc", "o", "Example", "c", "NZ"}' 
dn = makeDN(dncomp); 
 
mail1 = addr[1]; 
at = find("@", mail1); 
if (at) 
 user = mail1[1, at]; 
else 
 user = mail1; 
 
if (user[1] == "\"") 
 user = user[2, -2]; 
space = find(" ", user); 
if (space) 
{ 
 user = user[1,space] + "." + user[space+1, -1]; 
 space = find(" ", user); 
 if (space) 
 { 
  user = user[1,space] + "." + user[space+1, -1]; 
  space = find(" ", user); 
  if (space) 
   user = user[1,space] + "." + user[space+1, -1]; 
 } 
} 
percent = find("%", user); 
if (percent) 
{ 
 host = user[percent+1, -1]; 
 if (host == "pmdf") 
  domain = "@example.com"; 
 else 
 { 
  domain = host + "@example.com"; 
  authoritative = 1; 
 } 
 
} 
else 
{ 
 domain = "@example.com"; 
 authoritative = 1; 
} 
mail1 = user + "@" + domain; 
 
template 
DN: 'dn' 
cn: 'cdn' 
sn: 'lastname' 
mail: 'mail1' 
description: 'cmts' 
authoritative: 'authoritative' 
endtemplate 

Example 37-39 Sample serve_cc.rcp File

# 
# cn is first last  --  name should be last, first 
# 
name = cn[1]; 
tag = gettag(cn); 
tag = tag[2]; 
space = find(" ", name); 
if (space) 
 name = name[space+1, -1] + ", " + name[1, space]; 
settag(name, tag); 
# 
# don't accidentally generate attributes on a delete entry 
# 
if (tag == "!") 
template 
name: 'name' 
endtemplate 
else 
{ 
# 
# mail is user@example.com. (all mods are non cc users) 
# addr should be user%pmdf 
# 
addr = mail[1]; 
at = find("@", addr); 
if (at) 
 addr = addr[1, at]; 
addr = addr + "%pmdf"; 
 
template 
name: 'name' 
addr: 'addr' 
cmts: 'description' 
endtemplate 
} 

Sample recipe files for cooking and serving IDDS are shown in Example 37-40 and Example 37-41.

Example 37-40 Sample cook_idds.rcp File

dn_parts = explodedDN; 
if ((dn_parts[4] != "Notes") && (dn_parts[4] != "cc")) 
 authoritative = 1; 
template 
DN: 'dn' 
cn: 'cn' 
sn: 'sn' 
uid: 'uid' 
mail: 'mail' 
description: 'description' 
authoritative: 'authoritative' 
endtemplate 

Example 37-41 Sample serve_idds.rcp File

tag = gettag(DN); 
if (tag[2]=="!") 
{ 
template 
DN: 'DN' 
endif 
} 
else 
{ 
template 
DN: 'DN' 
objectClass: top 
objectClass: person 
objectClass: organizationalPerson 
objectClass: pilotObject 
objectClass: newPilotPerson 
objectClass: pmdfPerson 
objectClass: quipuObject 
cn: 'cn' 
sn: 'sn' 
telephoneNumber: 'telephoneNumber' 
facsimileTelephoneNumber: 'facsimileTelephoneNumber' 
seeAlso: 'seeAlso' 
userPassword: 'userPassword' 
uid: 'uid' 
mail: 'mail' 
description: 'description' 
userClass: X.500 
endtemplate 
} 

Sample recipe files for cooking and serving Lotus Notes are shown in Example 37-42 and Example 37-43.

Example 37-42 Sample cook_ln.rcp File

cn = FullName[1]; 
slash = find("/", cn); 
if (slash) 
{ 
 ou = cn[slash+1, -1]; 
 cn = cn[1, slash]; 
} 
else 
 ou = "example"; 
if (cn[3] == "CN=") 
 cn = cn[4, -1]; 
if (ou[2] == "O=") 
 ou = ou[3, -1]; 
 
if (maildomain != "PMDF") 
{ 
 mail = cn; 
 space = find(" ", mail); 
 if (space) 
 { 
  mail = mail[1, space] + "." + mail[space+1, -1]; 
  space = find(" ", mail); 
  if (space) 
  { 
   mail = mail[1, space] + "." + mail[space+1, -1]; 
   space = find(" ", mail); 
   if (space) 
    mail = mail[1, space] + "." + mail[space+1, -1]; 
  } 
 } 
 mail = mail + "@example.com"; 
 authoritative = 1 
} 
else 
 mail = mailaddress; 
 
dnlist = {"cn", cn, "ou", ou, "o", "example", "c", "nz"}; 
dn = makedn(dnlist); 
 
template 
DN: 'dn' 
cn: 'cn' 
sn: 'LastName' 
uid: 'shortname' 
mail: 'mail' 
description: 'description' 
authoritative: 'authoritative' 
endtemplate 

Example 37-43 Sample serve_ln.rcp File

tag = gettag(DN); 
tag = tag[2]; 
fullname = "CN=" + explodedDN[2] + "/O=" + explodedDN[4]; 
settag(fullname, tag); 
if (tag == "!") 
{ 
template 
FullName: 'fullname' 
endtemplate 
} 
else 
{ 
template 
FullName: 'fullname' 
LastName: 'cn' 
Form: Person 
Type: Person 
description: 'description' 
MailAddress: 'mailaddress' 
MailDomain: PMDF 
endtemplate 
} 


Previous Next Contents Index