All of lore.kernel.org
 help / color / mirror / Atom feed
* Autofs TLS and binddn/bindpw patch.
@ 2005-03-31  3:33 mzozd
  2005-04-03  9:58 ` raven
  0 siblings, 1 reply; 9+ messages in thread
From: mzozd @ 2005-03-31  3:33 UTC (permalink / raw)
  To: autofs

[-- Attachment #1: Type: text/plain, Size: 166 bytes --]

Dear maintainer,

this patch adds support for TLS and non-anonymous binds for autofs.


You could include it in your next release if you feel so.




Thanks,


MzOzD

[-- Attachment #2: autofs.patch --]
[-- Type: text/plain, Size: 2224 bytes --]

--- samples/autofs-ldap-auto-master.c.orig	2005-03-30 17:43:06.000000000 +0100
+++ samples/autofs-ldap-auto-master.c	2005-03-31 01:11:23.000000000 +0100
@@ -26,6 +26,8 @@
 #define ENTRYOC "nisObject"
 #define ENTRYKEY "cn"
 #define VALUE "nisMapEntry"
+#define BINDDN NULL
+#define BINDPW NULL
 
 static int
 dump_map(LDAP *ld,
@@ -162,12 +164,12 @@
 	int c;
 	const char *map_key = MAPKEY, *entry_key = ENTRYKEY, *value = VALUE;
 	const char *map_oc = MAPOC, *entry_oc = ENTRYOC;
-	const char *map = MAP;
+	const char *map = MAP, *bindpw=BINDPW, *binddn=BINDDN;  
 
 	setlocale(LC_ALL, "");
 
 	/* Scan through the argument list. */
-	while((c = getopt(argc, argv, "m:e:n:k:v:")) != -1) {
+	while((c = getopt(argc, argv, "m:e:n:k:v:U:P:")) != -1) {
 		switch(c) {
 			case 'm':
 				/* This is the object class we expect maps to
@@ -198,8 +200,22 @@
 				 * VALUE attribute. */
 				value = optarg;
 				break;
+			case 'U':
+			/* This is the BindDN for connecting to the server
+			 *  Particular usefull in my opinion...
+			 */
+				binddn = optarg;
+				break;
+			case 'P':
+			/* This is the BindPW for connecting to the server
+			 *  Particular usefull in my opinion...
+			 */
+				bindpw = optarg;
+				break;
 			default:
 				fprintf(stderr, "syntax: %s\n"
+					"\t[-U] BindDN\n"
+					"\t[-P] BindPW\n"
 					"\t[-m %s] (map object class)\n"
 					"\t[-e %s] (entry object class)\n"
 					"\t[-n %s] (attribute used as map key)\n"
@@ -235,8 +251,15 @@
 		ld = ldap_init(NULL, LDAP_PORT);
 	}
 
+	/* Start TLS */
+	result = ldap_start_tls_s(ld, NULL, NULL);
+	if (result != LDAP_SUCCESS) {
+		fprintf(stderr, "%s: ldap_connect: (TLS) ldap_start_tls() %s",
+                  argv[0], ldap_err2string(result));
+	}
+
 	/* Connect to the server anonymously. */
-	result = ldap_simple_bind_s(ld, NULL, NULL);
+	result = ldap_simple_bind_s(ld, binddn, bindpw);
 	if(result != LDAP_SUCCESS) {
 		fprintf(stderr, "%s: error binding to server: %s\n",
 			argv[0], ldap_err2string(result));
@@ -244,6 +267,7 @@
 		return 2;
 	}
 
+
 	/* Try to dump the map given the preferred or user-supplied schema. */
 	if(!dump_map(ld, map, map_oc, entry_oc, map_key, entry_key, value)) {
 		if(strcmp(map_oc, "automountMap") ||

[-- Attachment #3: Type: text/plain, Size: 140 bytes --]

_______________________________________________
autofs mailing list
autofs@linux.kernel.org
http://linux.kernel.org/mailman/listinfo/autofs

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2005-04-06  1:54 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-31  3:33 Autofs TLS and binddn/bindpw patch mzozd
2005-04-03  9:58 ` raven
2005-04-03 13:45   ` mzozd
2005-04-04  2:44     ` Ian Kent
2005-04-04  7:40       ` Timo Felbinger
2005-04-04 12:57         ` raven
2005-04-05 15:43           ` Timo Felbinger
2005-04-06  1:54             ` Ian Kent
2005-04-04 22:03       ` mzozd

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.