[PATCH] Add support for SASL EXTERNAL to libads

Luke Howard lukeh at PADL.COM
Mon Jun 9 01:20:06 GMT 2003


The attached patch adds the ADS_AUTH_EXTERNAL_BIND authentication flag.

-- Luke

-------------- next part --------------
Index: include/ads.h
===================================================================
RCS file: /home/project/cvs/samba/source/include/ads.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -u -r1.1.1.2 -r1.2
--- include/ads.h	2003/05/15 02:09:20	1.1.1.2
+++ include/ads.h	2003/06/09 00:40:00	1.2
@@ -205,6 +205,7 @@
 #define ADS_AUTH_NO_BIND          0x02
 #define ADS_AUTH_ANON_BIND        0x04
 #define ADS_AUTH_SIMPLE_BIND      0x08
+#define ADS_AUTH_EXTERNAL_BIND    0x10
 
 /* Kerberos environment variable names */
 #define KRB5_ENV_CCNAME "KRB5CCNAME"
Index: libads/sasl.c
===================================================================
RCS file: /home/project/cvs/samba/source/libads/sasl.c,v
retrieving revision 1.1.1.1
retrieving revision 1.3
diff -u -r1.1.1.1 -r1.3
--- libads/sasl.c	2003/04/15 13:57:41	1.1.1.1
+++ libads/sasl.c	2003/06/09 00:39:54	1.3
@@ -378,6 +378,22 @@
 }
 #endif
 
+static ADS_STATUS ads_sasl_external_bind(ADS_STRUCT *ads)
+{
+	struct berval cred;
+	int rc;
+	ADS_STATUS status;
+
+	cred.bv_val = "";
+	cred.bv_len = 0;
+
+	rc = ldap_sasl_bind_s(ads->ld, NULL, "EXTERNAL", &cred, NULL, NULL,
+			      NULL);
+	status = ADS_ERROR(rc);
+
+	return status;
+}
+
 /* mapping between SASL mechanisms and functions */
 static struct {
 	const char *name;
@@ -387,6 +403,7 @@
 #ifdef HAVE_GSSAPI
 	{"GSSAPI", ads_sasl_gssapi_bind}, /* doesn't work with .NET RC1. No idea why */
 #endif
+	{"EXTERNAL", ads_sasl_external_bind},
 	{NULL, NULL}
 };
 
@@ -397,6 +414,10 @@
 	ADS_STATUS status;
 	int i, j;
 	void *res;
+
+	if (ads->auth.flags & ADS_AUTH_EXTERNAL_BIND) {
+		return ads_sasl_external_bind(ads);
+	}
 
 	/* get a list of supported SASL mechanisms */
 	status = ads_do_search(ads, "", LDAP_SCOPE_BASE, "(objectclass=*)", attrs, &res);
-------------- next part --------------
--
Luke Howard | PADL Software Pty Ltd | www.padl.com


More information about the samba-technical mailing list