(install-ldif): New target to install cygwin.ldif. * cygheap.h (class cygheap_pwdgrp): Rename pfx_t to nss_pfx_t. Add PFX to enum value. Add nss_scheme_method enum and nss_scheme_t structure. Add home_scheme, shell_scheme and gecos_scheme members. (NSS_SCHEME_MAX): Define. (cygheap_pwdgrp::get_home): Declare. (cygheap_pwdgrp::get_shell): Declare. (cygheap_pwdgrp::get_gecos): Declare. * cygwin.ldif: New file. * ldap.cc (std_user_attr): New array, just defining the standard attributes. (group_attr): Add cygwinUnixGid. (user_attr): Convert to macro pointing to cygheap->pg.ldap_user_attr. (cygheap_pwdgrp::init_ldap_user_attr): New method. (cyg_ldap::fetch_ad_account): Call cygheap_pwdgrp::init_ldap_user_attr if user_attr initialization is required. Fix comment. (cyg_ldap::get_string_attribute): Implement taking attribute name as argument. * ldap.h: Drop unused macros. (cyg_ldap::get_gecos): Remove. (cyg_ldap::get_home): Remove. (cyg_ldap::get_shell): Remove. (cyg_ldap::get_string_attribute): Declare name argument variant public. * uinfo.cc (cygheap_user::ontherange): Fix indentation. (cygheap_pwdgrp::init): Initialize new home_scheme, shell_scheme and gecos_scheme members. Align comment. (NSS_NCMP): Define comparison macro. (NSS_CMP): Ditto. (cygheap_pwdgrp::nss_init_line): Use aforementioned macros throughout. Fix comment handling. Add db_home, db_shell and db_gecos handling. (fetch_from_description): New function to fetch XML-style attributes from (description) string. (fetch_from_path): New function to evaluate path string with wildcards. (cygheap_pwdgrp::get_home): New methods to fetch pw_dir value. (cygheap_pwdgrp::get_shell): Ditto for pw_shell. (cygheap_pwdgrp::get_gecos): Ditto for pw_gecos. (colon_to_semicolon): Move up. (pwdgrp::fetch_account_from_windows): Convert home, shell, gecos variables to char*. Drop statement breaking extended group info. Fetch home, shell and gecos values using new methods. Use fetch_from_description calls to fetch UNIX id and primary groups from SAM comment field. Accommodate uxid being a char* now. Accommodate the fact that extended info is malloc'ed, rather then alloca'ed. Create linebuf content as multibyte string. Create line buffer by just calling cstrdup.
		
			
				
	
	
		
			254 lines
		
	
	
		
			6.0 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			254 lines
		
	
	
		
			6.0 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
# =========================================================================
 | 
						|
#
 | 
						|
# Schema Extension for Cygwin User and Group auxiliary classes
 | 
						|
#
 | 
						|
# Extend your Active Directory using
 | 
						|
#
 | 
						|
# ldifde -i -f <path>\<this>.ldif -b <username> <domain> <password> \
 | 
						|
#   -k -c "CN=schema,CN=Configuration,DC=X" #schemaNamingContext
 | 
						|
#
 | 
						|
# Remember:
 | 
						|
# - you have to be schema admin for your active directory
 | 
						|
# - you have to run the above command directly from your schema master
 | 
						|
#
 | 
						|
# For further information read
 | 
						|
#   http://technet.microsoft.com/en-us/magazine/2008.05.schema.aspx
 | 
						|
#
 | 
						|
# ----------------------------------------------------------------------
 | 
						|
#
 | 
						|
# Explanation for the OIDs:
 | 
						|
#
 | 
						|
#  Value           Meaning  Description
 | 
						|
#      1               ISO  Identifies the root authority.
 | 
						|
#      3              IANA  Group designation assigned by ISO.
 | 
						|
#  6.1.4.1.2312    Red Hat  Organization assigned by IANA.
 | 
						|
#     15            Cygwin  Assigned by Organization.
 | 
						|
#      Y       Object Type  Number defining the different object type
 | 
						|
#                             (category) such as classSchema or
 | 
						|
#                             attributeSchema. For example, 5 defines
 | 
						|
#                             object class.
 | 
						|
#      Z            Object  Number identifying a particular object
 | 
						|
#                             within the category. For example, the user
 | 
						|
#                             class has the number 9 assigned to it.
 | 
						|
# 
 | 
						|
# ----------------------------------------------------------------------
 | 
						|
 | 
						|
# Attribute definition for cygwinHome
 | 
						|
 | 
						|
dn: CN=cygwin-Home,CN=Schema,CN=Configuration,DC=X
 | 
						|
changetype: ntdsschemaadd
 | 
						|
objectClass: top
 | 
						|
objectClass: attributeSchema
 | 
						|
cn: cygwin-Home
 | 
						|
attributeID: 1.3.6.1.4.1.2312.15.2.1
 | 
						|
# attributeSyntax 2.5.5.12 is String(Unicode) with oMSyntax == 64
 | 
						|
# see http://technet.microsoft.com/en-us/library/cc961740.aspx
 | 
						|
attributeSyntax: 2.5.5.12
 | 
						|
isSingleValued: TRUE
 | 
						|
adminDisplayName: cygwin-Home
 | 
						|
adminDescription: cygwin-Home
 | 
						|
oMSyntax: 64
 | 
						|
searchFlags: 1
 | 
						|
lDAPDisplayName: cygwinHome
 | 
						|
systemOnly: FALSE
 | 
						|
 | 
						|
dn:
 | 
						|
changetype: modify
 | 
						|
add: schemaUpdateNow
 | 
						|
schemaUpdateNow: 1
 | 
						|
-
 | 
						|
 | 
						|
# Attribute definition for cygwinShell
 | 
						|
 | 
						|
dn: CN=cygwin-Shell,CN=Schema,CN=Configuration,DC=X
 | 
						|
changetype: ntdsschemaadd
 | 
						|
objectClass: top
 | 
						|
objectClass: attributeSchema
 | 
						|
cn: cygwin-Shell
 | 
						|
attributeID: 1.3.6.1.4.1.2312.15.2.2
 | 
						|
attributeSyntax: 2.5.5.12
 | 
						|
isSingleValued: TRUE
 | 
						|
adminDisplayName: cygwin-Shell
 | 
						|
adminDescription: cygwin-Shell
 | 
						|
oMSyntax: 64
 | 
						|
searchFlags: 1
 | 
						|
lDAPDisplayName: cygwinShell
 | 
						|
systemOnly: FALSE
 | 
						|
 | 
						|
dn:
 | 
						|
changetype: modify
 | 
						|
add: schemaUpdateNow
 | 
						|
schemaUpdateNow: 1
 | 
						|
-
 | 
						|
 | 
						|
# Attribute definition for cygwinGecos
 | 
						|
 | 
						|
dn: CN=cygwin-Gecos,CN=Schema,CN=Configuration,DC=X
 | 
						|
changetype: ntdsschemaadd
 | 
						|
objectClass: top
 | 
						|
objectClass: attributeSchema
 | 
						|
cn: cygwin-Gecos
 | 
						|
attributeID: 1.3.6.1.4.1.2312.15.2.3
 | 
						|
attributeSyntax: 2.5.5.12
 | 
						|
isSingleValued: TRUE
 | 
						|
adminDisplayName: cygwin-Gecos
 | 
						|
adminDescription: cygwin-Gecos
 | 
						|
oMSyntax: 64
 | 
						|
searchFlags: 1
 | 
						|
lDAPDisplayName: cygwinGecos
 | 
						|
systemOnly: FALSE
 | 
						|
 | 
						|
dn:
 | 
						|
changetype: modify
 | 
						|
add: schemaUpdateNow
 | 
						|
schemaUpdateNow: 1
 | 
						|
-
 | 
						|
 | 
						|
# Attribute definition for cygwinFstab
 | 
						|
 | 
						|
dn: CN=cygwin-Fstab,CN=Schema,CN=Configuration,DC=X
 | 
						|
changetype: ntdsschemaadd
 | 
						|
objectClass: top
 | 
						|
objectClass: attributeSchema
 | 
						|
cn: cygwin-Fstab
 | 
						|
attributeID: 1.3.6.1.4.1.2312.15.2.4
 | 
						|
attributeSyntax: 2.5.5.12
 | 
						|
isSingleValued: FALSE
 | 
						|
adminDisplayName: cygwin-Fstab
 | 
						|
adminDescription: cygwin-Fstab
 | 
						|
oMSyntax: 64
 | 
						|
searchFlags: 1
 | 
						|
lDAPDisplayName: cygwinFstab
 | 
						|
systemOnly: FALSE
 | 
						|
 | 
						|
dn:
 | 
						|
changetype: modify
 | 
						|
add: schemaUpdateNow
 | 
						|
schemaUpdateNow: 1
 | 
						|
-
 | 
						|
 | 
						|
# Attribute definition for cygwinUnixUid
 | 
						|
 | 
						|
dn: CN=cygwin-UnixUid,CN=Schema,CN=Configuration,DC=X
 | 
						|
changetype: ntdsschemaadd
 | 
						|
objectClass: top
 | 
						|
objectClass: attributeSchema
 | 
						|
cn: cygwin-UnixUid
 | 
						|
attributeID: 1.3.6.1.4.1.2312.15.2.5
 | 
						|
# attributeSyntax 2.5.5.9 is Integer with oMSyntax == 2
 | 
						|
attributeSyntax: 2.5.5.9
 | 
						|
isSingleValued: TRUE
 | 
						|
adminDisplayName: cygwin-UnixUid
 | 
						|
adminDescription: cygwin-UnixUid
 | 
						|
oMSyntax: 2
 | 
						|
searchFlags: 1
 | 
						|
lDAPDisplayName: cygwinUnixUid
 | 
						|
systemOnly: FALSE
 | 
						|
 | 
						|
dn:
 | 
						|
changetype: modify
 | 
						|
add: schemaUpdateNow
 | 
						|
schemaUpdateNow: 1
 | 
						|
-
 | 
						|
 | 
						|
# Attribute definition for cygwinUnixGid
 | 
						|
 | 
						|
dn: CN=cygwin-UnixGid,CN=Schema,CN=Configuration,DC=X
 | 
						|
changetype: ntdsschemaadd
 | 
						|
objectClass: top
 | 
						|
objectClass: attributeSchema
 | 
						|
cn: cygwin-UnixGid
 | 
						|
attributeID: 1.3.6.1.4.1.2312.15.2.6
 | 
						|
attributeSyntax: 2.5.5.9
 | 
						|
isSingleValued: TRUE
 | 
						|
adminDisplayName: cygwin-UnixGid
 | 
						|
adminDescription: cygwin-UnixGid
 | 
						|
oMSyntax: 2
 | 
						|
searchFlags: 1
 | 
						|
lDAPDisplayName: cygwinUnixGid
 | 
						|
systemOnly: FALSE
 | 
						|
 | 
						|
dn:
 | 
						|
changetype: modify
 | 
						|
add: schemaUpdateNow
 | 
						|
schemaUpdateNow: 1
 | 
						|
-
 | 
						|
 | 
						|
# cygwin-User auxiliary class
 | 
						|
 | 
						|
dn: CN=cygwin-User,CN=Schema,CN=Configuration,DC=X
 | 
						|
changetype: ntdsschemaadd
 | 
						|
objectClass: top
 | 
						|
objectClass: classSchema
 | 
						|
cn: cygwin-User
 | 
						|
governsID: 1.3.6.1.4.1.2312.15.1.1
 | 
						|
mayContain: cygwinHome
 | 
						|
mayContain: cygwinShell
 | 
						|
mayContain: cygwinGecos
 | 
						|
mayContain: cygwinFstab
 | 
						|
mayContain: cygwinUnixUid
 | 
						|
rDNAttID: cn
 | 
						|
adminDisplayName: cygwin-User
 | 
						|
adminDescription: cygwin-User
 | 
						|
objectClassCategory: 3
 | 
						|
lDAPDisplayName: cygwinUser
 | 
						|
name: cygwin-User
 | 
						|
systemOnly: FALSE
 | 
						|
 | 
						|
dn:
 | 
						|
changetype: modify
 | 
						|
add: schemaUpdateNow
 | 
						|
schemaUpdateNow: 1
 | 
						|
-
 | 
						|
 | 
						|
# cygwin-Group auxiliary class
 | 
						|
 | 
						|
dn: CN=cygwin-Group,CN=Schema,CN=Configuration,DC=X
 | 
						|
changetype: ntdsschemaadd
 | 
						|
objectClass: top
 | 
						|
objectClass: classSchema
 | 
						|
cn: cygwin-Group
 | 
						|
governsID: 1.3.6.1.4.1.2312.15.1.2
 | 
						|
mayContain: cygwinUnixGid
 | 
						|
rDNAttID: cn
 | 
						|
adminDisplayName: cygwin-Group
 | 
						|
adminDescription: cygwin-Group
 | 
						|
objectClassCategory: 3
 | 
						|
lDAPDisplayName: cygwinGroup
 | 
						|
name: cygwin-Group
 | 
						|
systemOnly: FALSE
 | 
						|
 | 
						|
dn:
 | 
						|
changetype: modify
 | 
						|
add: schemaUpdateNow
 | 
						|
schemaUpdateNow: 1
 | 
						|
-
 | 
						|
 | 
						|
# Attach cygwin-User to User
 | 
						|
 | 
						|
dn: CN=User,CN=Schema,CN=Configuration,DC=X
 | 
						|
changetype: ntdsschemamodify
 | 
						|
add: auxiliaryClass
 | 
						|
auxiliaryClass: cygwinUser
 | 
						|
-
 | 
						|
 | 
						|
dn:
 | 
						|
changetype: modify
 | 
						|
add: schemaUpdateNow
 | 
						|
schemaUpdateNow: 1
 | 
						|
-
 | 
						|
 | 
						|
# Attach cygwin-Group to Group
 | 
						|
 | 
						|
dn: CN=Group,CN=Schema,CN=Configuration,DC=X
 | 
						|
changetype: ntdsschemamodify
 | 
						|
add: auxiliaryClass
 | 
						|
auxiliaryClass: cygwinGroup
 | 
						|
-
 | 
						|
 | 
						|
dn:
 | 
						|
changetype: modify
 | 
						|
add: schemaUpdateNow
 | 
						|
schemaUpdateNow: 1
 | 
						|
-
 |