s3-pdb_ldap: support comment field for user objects. master-editposix
authorGünther Deschner <gd@samba.org>
Tue, 23 Jun 2009 22:25:39 +0000 (00:25 +0200)
committerGünther Deschner <gd@samba.org>
Wed, 2 Sep 2009 10:42:02 +0000 (12:42 +0200)
Guenther

examples/LDAP/samba-schema-FDS.ldif
examples/LDAP/samba.schema
source3/include/smbldap.h
source3/lib/smbldap.c
source3/passdb/pdb_ldap.c

index fb16486374468016ebe9325934d3d01f2d509a6a..3d36944f348e47565b278bc6fe6a7b709994ed06 100644 (file)
@@ -61,6 +61,7 @@ attributeTypes: ( 1.3.6.1.4.1.7165.2.1.37 NAME 'sambaHomePath' DESC 'Home direct
 attributeTypes: ( 1.3.6.1.4.1.7165.2.1.38 NAME 'sambaDomainName' DESC 'Windows NT domain to which the user belongs' EQUALITY caseIgnoreMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{128} )
 attributeTypes: ( 1.3.6.1.4.1.7165.2.1.47 NAME 'sambaMungedDial' DESC 'Base64 encoded user parameter string' EQUALITY caseExactMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{1050} )
 attributeTypes: ( 1.3.6.1.4.1.7165.2.1.54 NAME 'sambaPasswordHistory' DESC 'Concatenated MD5 hashes of the salted NT passwords used on this account' EQUALITY caseIgnoreIA5Match SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{32} )
+attributeTypes: ( 1.3.6.1.4.1.7165.2.1.70 NAME 'sambaComment' DESC 'Admin comment' EQUALITY caseIgnoreMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{255} SINGLE-VALUE )
 ##
 ## SID, of any type
 ##
@@ -131,7 +132,7 @@ attributeTypes: ( 1.3.6.1.4.1.7165.2.1.69 NAME 'sambaPreviousClearTextPassword'
 ## added new objectClasses: (and OID) for 3.0 to help us deal with backwards
 ## compatibility with 2.2 installations (e.g. ldapsam_compat)  --jerry
 ##
-objectClasses: ( 1.3.6.1.4.1.7165.2.2.6 NAME 'sambaSamAccount' SUP top AUXILIARY DESC 'Samba 3.0 Auxilary SAM Account' MUST ( uid $ sambaSID ) MAY  ( cn $ sambaLMPassword $ sambaNTPassword $ sambaPwdLastSet $ sambaLogonTime $ sambaLogoffTime $ sambaKickoffTime $ sambaPwdCanChange $ sambaPwdMustChange $ sambaAcctFlags $ displayName $ sambaHomePath $ sambaHomeDrive $ sambaLogonScript $ sambaProfilePath $ description $ sambaUserWorkstations $ sambaPrimaryGroupSID $ sambaDomainName $ sambaMungedDial $ sambaBadPasswordCount $ sambaBadPasswordTime $ sambaPasswordHistory $ sambaLogonHours))
+objectClasses: ( 1.3.6.1.4.1.7165.2.2.6 NAME 'sambaSamAccount' SUP top AUXILIARY DESC 'Samba 3.0 Auxilary SAM Account' MUST ( uid $ sambaSID ) MAY  ( cn $ sambaLMPassword $ sambaNTPassword $ sambaPwdLastSet $ sambaLogonTime $ sambaLogoffTime $ sambaKickoffTime $ sambaPwdCanChange $ sambaPwdMustChange $ sambaAcctFlags $ displayName $ sambaHomePath $ sambaHomeDrive $ sambaLogonScript $ sambaProfilePath $ description $ sambaUserWorkstations $ sambaPrimaryGroupSID $ sambaDomainName $ sambaMungedDial $ sambaBadPasswordCount $ sambaBadPasswordTime $ sambaPasswordHistory $ sambaLogonHours $ sambaComment))
 ##
 ## Group mapping info
 ##
index 8f82dddeb38092e19e332372fa48a85f71dac74f..c2ad6542f078e8db4d28121fe885e8810563ae61 100644 (file)
@@ -469,7 +469,10 @@ attributetype ( 1.3.6.1.4.1.7165.2.1.69 NAME 'sambaPreviousClearTextPassword'
        EQUALITY octetStringMatch
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 )
 
-
+attributetype ( 1.3.6.1.4.1.7165.2.1.70 NAME 'sambaComment'
+       DESC 'Admin comment'
+       EQUALITY caseIgnoreMatch
+       SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{255} SINGLE-VALUE )
 
 #######################################################################
 ##              objectClasses used by Samba 3.0 schema               ##
@@ -493,7 +496,8 @@ objectclass ( 1.3.6.1.4.1.7165.2.2.6 NAME 'sambaSamAccount' SUP top AUXILIARY
               sambaProfilePath $ description $ sambaUserWorkstations $
               sambaPrimaryGroupSID $ sambaDomainName $ sambaMungedDial $
               sambaBadPasswordCount $ sambaBadPasswordTime $
-              sambaPasswordHistory $ sambaLogonHours))
+              sambaPasswordHistory $ sambaLogonHours $
+              sambaComment ))
 
 ##
 ## Group mapping info
index 8710e77f3d667b5bca883d71bab059d613c00605..80b2c23eebe05dd164290c7764727005bf85d63e 100644 (file)
@@ -102,6 +102,7 @@ struct smbldap_state;
 #define LDAP_ATTR_LOGON_HOURS          42 
 #define LDAP_ATTR_TRUST_PASSWD_FLAGS    43
 #define LDAP_ATTR_SN                   44
+#define LDAP_ATTR_COMMENT              45
 
 
 typedef struct _attrib_map_entry {
index c96801a72b2961f6e3e3800f53e9b8d4b9391021..6ec8c84aabf1c67460bdbaa0971e0d2d7151fae0 100644 (file)
@@ -127,6 +127,7 @@ ATTRIB_MAP_ENTRY attrib_map_v30[] = {
        { LDAP_ATTR_PWD_HISTORY,        "sambaPasswordHistory"  },
        { LDAP_ATTR_MOD_TIMESTAMP,      "modifyTimestamp"       },
        { LDAP_ATTR_LOGON_HOURS,        "sambaLogonHours"       },
+       { LDAP_ATTR_COMMENT,            "sambaComment"          },
        { LDAP_ATTR_LIST_END,           NULL                    }
 };
 
index e0ba3f7648bb607283fbc5c76c29fd5a5e35ebf6..a2cd2ee51daf3199b63696715e38240e17dd3b48 100644 (file)
@@ -527,6 +527,7 @@ static bool init_sam_from_ldap(struct ldapsam_privates *ldap_state,
                        *logon_script = NULL,
                        *profile_path = NULL,
                        *acct_desc = NULL,
+                       *comment = NULL,
                        *workstations = NULL,
                        *munged_dial = NULL;
        uint32          user_rid;
@@ -808,6 +809,16 @@ static bool init_sam_from_ldap(struct ldapsam_privates *ldap_state,
                pdb_set_acct_desc(sampass, acct_desc, PDB_SET);
        }
 
+       comment = smbldap_talloc_single_attribute(
+                       ldap_state->smbldap_state->ldap_struct,
+                       entry,
+                       get_userattr_key2string(ldap_state->schema_ver,
+                               LDAP_ATTR_COMMENT),
+                       ctx);
+       if (comment) {
+               pdb_set_comment(sampass, comment, PDB_SET);
+       }
+
        workstations = smbldap_talloc_single_attribute(
                        ldap_state->smbldap_state->ldap_struct,
                        entry,
@@ -1220,6 +1231,11 @@ static bool init_ldap_from_sam (struct ldapsam_privates *ldap_state,
                        get_userattr_key2string(ldap_state->schema_ver, LDAP_ATTR_DESC), 
                        pdb_get_acct_desc(sampass));
 
+       if (need_update(sampass, PDB_COMMENT))
+               smbldap_make_mod(ldap_state->smbldap_state->ldap_struct, existing, mods,
+                       get_userattr_key2string(ldap_state->schema_ver, LDAP_ATTR_COMMENT),
+                       pdb_get_comment(sampass));
+
        if (need_update(sampass, PDB_WORKSTATIONS))
                smbldap_make_mod(ldap_state->smbldap_state->ldap_struct, existing, mods,
                        get_userattr_key2string(ldap_state->schema_ver, LDAP_ATTR_USER_WKS),