LDAP_EXOP_X_MODIFY_PASSWD macro was changed in OpenLDAP 2.1

Donny Davies djdavies at rogers.com
Tue Jun 3 17:37:53 GMT 2003


On Tue, May 27, 2003 at 11:30:26PM +1000, Andrew Bartlett wrote:
>The attached patch should cope with cases where we have the _X_, the 2.1
>version and where we are on a non-openldap library.

  Andrew,

  Thanks very much for this by the way, I've no problems at all with
it on 2.1.x.

  I assume you're waiting for some 2.0.x test results before
checking-it-in though I don't have any of those to give unfortunately.

  Just wanted to make sure this doesn't get forgotten, could it get
committed please!

  Thanks again, Cheers.

                            Donny

Index: passdb/pdb_ldap.c
===================================================================
RCS file: /home/cvs/samba/source/passdb/pdb_ldap.c,v
retrieving revision 1.28.2.61
diff -u -r1.28.2.61 pdb_ldap.c
--- passdb/pdb_ldap.c	16 May 2003 14:15:09 -0000	1.28.2.61
+++ passdb/pdb_ldap.c	27 May 2003 13:27:16 -0000
@@ -55,6 +55,24 @@
 #define LDAP_OPT_SUCCESS 0
 #endif
 
+#if defined(LDAP_EXOP_X_MODIFY_PASSWD) && !defined(LDAP_EXOP_MODIFY_PASSWD)
+#define LDAP_EXOP_MODIFY_PASSWD LDAP_EXOP_X_MODIFY_PASSWD
+#elif !defined(LDAP_EXOP_MODIFY_PASSWD)
+#define "1.3.6.1.4.1.4203.1.11.1"
+#endif
+
+#if defined(LDAP_EXOP_X_MODIFY_PASSWD_ID) && !defined(LDAP_EXOP_MODIFY_PASSWD_ID)
+#define LDAP_TAG_EXOP_MODIFY_PASSWD_ID LDAP_EXOP_X_MODIFY_PASSWD_ID
+#elif !defined(LDAP_EXOP_MODIFY_PASSWD_ID)
+#define LDAP_TAG_EXOP_MODIFY_PASSWD_ID        ((ber_tag_t) 0x80U)
+#endif
+
+#if defined(LDAP_EXOP_X_MODIFY_PASSWD_NEW) && !defined(LDAP_EXOP_MODIFY_PASSWD_NEW)
+#define LDAP_TAG_EXOP_MODIFY_PASSWD_NEW LDAP_EXOP_X_MODIFY_PASSWD_NEW
+#elif !defined(LDAP_EXOP_MODIFY_PASSWD_NEW)
+#define LDAP_TAG_EXOP_MODIFY_PASSWD_NEW       ((ber_tag_t) 0x82U)
+#endif
+
 #ifndef SAM_ACCOUNT
 #define SAM_ACCOUNT struct sam_passwd
 #endif
@@ -910,7 +928,6 @@
 	return rc;
 }
 
-#ifdef LDAP_EXOP_X_MODIFY_PASSWD
 static int ldapsam_extended_operation(struct ldapsam_privates *ldap_state, LDAP_CONST char *reqoid, struct berval *reqdata, LDAPControl **serverctrls, LDAPControl **clientctrls, char **retoidp, struct berval **retdatap)
 {
 	int 		rc = LDAP_SERVER_DOWN;
@@ -934,7 +951,6 @@
 		
 	return rc;
 }
-#endif
 
 /*******************************************************************
  run the search by name.
@@ -2713,7 +2729,6 @@
 		}  
 	}
 	
-#ifdef LDAP_EXOP_X_MODIFY_PASSWD
 	if (!(pdb_get_acct_ctrl(newpwd)&(ACB_WSTRUST|ACB_SVRTRUST|ACB_DOMTRUST)) &&
 		(lp_ldap_passwd_sync() != LDAP_PASSWD_SYNC_OFF) &&
 		need_update(newpwd, PDB_PLAINTEXT_PW) &&
@@ -2740,8 +2755,8 @@
 		}
 
 		ber_printf (ber, "{");
-		ber_printf (ber, "ts", LDAP_TAG_EXOP_X_MODIFY_PASSWD_ID, utf8_dn);
-	        ber_printf (ber, "ts", LDAP_TAG_EXOP_X_MODIFY_PASSWD_NEW, utf8_password);
+		ber_printf (ber, "ts", LDAP_TAG_EXOP_MODIFY_PASSWD_ID, utf8_dn);
+	        ber_printf (ber, "ts", LDAP_TAG_EXOP_MODIFY_PASSWD_NEW, utf8_password);
 	        ber_printf (ber, "N}");
 
 	        if ((rc = ber_flatten (ber, &bv))<0) {
@@ -2756,7 +2771,7 @@
 		SAFE_FREE(utf8_password);
 		ber_free(ber, 1);
 
-		if ((rc = ldapsam_extended_operation(ldap_state, LDAP_EXOP_X_MODIFY_PASSWD,
+		if ((rc = ldapsam_extended_operation(ldap_state, LDAP_EXOP_MODIFY_PASSWD,
 						    bv, NULL, NULL, &retoid, &retdata))!=LDAP_SUCCESS) {
 			DEBUG(0,("LDAP Password could not be changed for user %s: %s\n",
 				pdb_get_username(newpwd),ldap_err2string(rc)));
@@ -2770,9 +2785,6 @@
 		}
 		ber_bvfree(bv);
 	}
-#else
-	DEBUG(10,("LDAP PASSWORD SYNC is not supported!\n"));
-#endif /* LDAP_EXOP_X_MODIFY_PASSWD */
 	return NT_STATUS_OK;
 }
 
Index: param/loadparm.c
===================================================================
RCS file: /home/cvs/samba/source/param/loadparm.c,v
retrieving revision 1.397.2.56
diff -u -r1.397.2.56 loadparm.c
--- param/loadparm.c	14 May 2003 03:32:19 -0000	1.397.2.56
+++ param/loadparm.c	27 May 2003 13:27:19 -0000
@@ -625,18 +625,16 @@
 };
 
 static const struct enum_list enum_ldap_passwd_sync[] = {
-	{LDAP_PASSWD_SYNC_ON, "Yes"},
-	{LDAP_PASSWD_SYNC_ON, "yes"},
-	{LDAP_PASSWD_SYNC_ON, "on"},
-	{LDAP_PASSWD_SYNC_ON, "On"},
 	{LDAP_PASSWD_SYNC_OFF, "no"},
 	{LDAP_PASSWD_SYNC_OFF, "No"},
 	{LDAP_PASSWD_SYNC_OFF, "off"},
 	{LDAP_PASSWD_SYNC_OFF, "Off"},
-#ifdef LDAP_EXOP_X_MODIFY_PASSWD	
+	{LDAP_PASSWD_SYNC_ON, "Yes"},
+	{LDAP_PASSWD_SYNC_ON, "yes"},
+	{LDAP_PASSWD_SYNC_ON, "on"},
+	{LDAP_PASSWD_SYNC_ON, "On"},
 	{LDAP_PASSWD_SYNC_ONLY, "Only"},
 	{LDAP_PASSWD_SYNC_ONLY, "only"},
-#endif /* LDAP_EXOP_X_MODIFY_PASSWD */	
 	{-1, NULL}
 };
 



More information about the samba-technical mailing list