[PATCH] MungedDial field in LDAPSAM

Aurélien Degrémont adegremont at idealx.com
Tue Nov 25 14:44:32 GMT 2003


Hi,

To complete my previous patch concerning the MungedD ial field, here is 
some code to add it inside LDAPSAM.

This code has been succesfully tested with NT4 TSE, W2k + TS, W2k3 + TS 
and it works well. Samba can handle TS Servers has member servers if the 
MungedDial field is correctly stored.

Aurélien
-------------- next part --------------
Index: examples/LDAP/samba.schema
===================================================================
RCS file: /opt/cvs/prj/infra/serveur_proximite/samba/devel/examples/LDAP/samba.schema,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- examples/LDAP/samba.schema	6 Nov 2003 14:08:33 -0000	1.1
+++ examples/LDAP/samba.schema	24 Nov 2003 13:41:35 -0000	1.2
@@ -236,6 +236,11 @@
 	EQUALITY caseIgnoreMatch
 	SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{128} )
 
+attributetype ( 1.3.6.1.4.1.7165.2.1.43 NAME 'sambaMungedDial'
+	DESC ''
+	EQUALITY caseExactMatch
+	SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{1050} )
+
 ##
 ## SID, of any type
 ##
@@ -308,7 +313,7 @@
 	       sambaPwdCanChange $ sambaPwdMustChange $ sambaAcctFlags $
                displayName $ sambaHomePath $ sambaHomeDrive $ sambaLogonScript $
 	       sambaProfilePath $ description $ sambaUserWorkstations $
-	       sambaPrimaryGroupSID $ sambaDomainName ))
+	       sambaPrimaryGroupSID $ sambaDomainName $ sambaMungedDial))
 
 ##
 ## Group mapping info
Index: source/include/smbldap.h
===================================================================
RCS file: /opt/cvs/prj/infra/serveur_proximite/samba/devel/source/include/smbldap.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- source/include/smbldap.h	6 Nov 2003 14:08:50 -0000	1.1
+++ source/include/smbldap.h	24 Nov 2003 13:41:36 -0000	1.2
@@ -90,6 +90,7 @@
 #define LDAP_ATTR_NEXT_RID              34
 #define LDAP_ATTR_BAD_PASSWORD_COUNT	35
 #define LDAP_ATTR_LOGON_COUNT		36
+#define LDAP_ATTR_MUNGED_DIAL		37
 
 typedef struct _attrib_map_entry {
 	int		attrib;
Index: source/lib/smbldap.c
===================================================================
RCS file: /opt/cvs/prj/infra/serveur_proximite/samba/devel/source/lib/smbldap.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- source/lib/smbldap.c	6 Nov 2003 14:08:51 -0000	1.1
+++ source/lib/smbldap.c	24 Nov 2003 13:41:36 -0000	1.2
@@ -97,6 +97,7 @@
 	{ LDAP_ATTR_DOMAIN,		"sambaDomainName"	},
 	{ LDAP_ATTR_OBJCLASS,		"objectClass"		},
 	{ LDAP_ATTR_ACB_INFO,		"sambaAcctFlags"	},
+	{ LDAP_ATTR_MUNGED_DIAL,	"sambaMungedDial"	},
 	{ LDAP_ATTR_LIST_END,		NULL 			}
 };
 

Index: source/passdb/pdb_ldap.c
===================================================================
RCS file: /opt/cvs/prj/infra/serveur_proximite/samba/devel/source/passdb/pdb_ldap.c,v
retrieving revision 1.1
diff -u -r1.1 pdb_ldap.c
--- source/passdb/pdb_ldap.c	6 Nov 2003 14:08:56 -0000	1.1
+++ source/passdb/pdb_ldap.c	24 Nov 2003 16:39:03 -0000
@@ -415,8 +415,8 @@
 			logon_script,
 			profile_path,
 			acct_desc,
-			munged_dial,
 			workstations;
+	char		munged_dial[2048];
 	uint32 		user_rid; 
 	uint8 		smblmpwd[LM_HASH_LEN],
 			smbntpwd[NT_HASH_LEN];
@@ -660,6 +660,13 @@
 		pdb_set_workstations(sampass, workstations, PDB_SET);
 	}
 
+	if (!smbldap_get_single_attribute(ldap_state->smbldap_state->ldap_struct, entry, 
+		get_userattr_key2string(ldap_state->schema_ver, LDAP_ATTR_MUNGED_DIAL), munged_dial)) {
+		/* leave as default */;
+	} else {
+		pdb_set_munged_dial(sampass, munged_dial, PDB_SET);
+	}
+	
 	/* FIXME: hours stuff should be cleaner */
 	
 	logon_divs = 168;
@@ -703,7 +710,7 @@
 	pdb_set_hours_len(sampass, hours_len, PDB_SET);
 	pdb_set_logon_divs(sampass, logon_divs, PDB_SET);
 
-	pdb_set_munged_dial(sampass, munged_dial, PDB_SET);
+/*	pdb_set_munged_dial(sampass, munged_dial, PDB_SET); */
 	
 	/* pdb_set_unknown_3(sampass, unknown3, PDB_SET); */
 
@@ -851,7 +858,12 @@
 		smbldap_make_mod(ldap_state->smbldap_state->ldap_struct, existing, mods,
 			get_userattr_key2string(ldap_state->schema_ver, LDAP_ATTR_USER_WKS), 
 			pdb_get_workstations(sampass));
-
+	
+	if (need_update(sampass, PDB_MUNGEDDIAL))
+		smbldap_make_mod(ldap_state->smbldap_state->ldap_struct, existing, mods,
+			get_userattr_key2string(ldap_state->schema_ver, LDAP_ATTR_MUNGED_DIAL), 
+			pdb_get_munged_dial(sampass));
+	
 	if (need_update(sampass, PDB_SMBHOME))
 		smbldap_make_mod(ldap_state->smbldap_state->ldap_struct, existing, mods,
 			get_userattr_key2string(ldap_state->schema_ver, LDAP_ATTR_HOME_PATH), 


More information about the samba-technical mailing list