From: mzozd <mzozd@ad2u.gr>
To: autofs@linux.kernel.org
Subject: Autofs TLS and binddn/bindpw patch.
Date: Thu, 31 Mar 2005 04:33:04 +0100 [thread overview]
Message-ID: <424B6F70.8060802@ad2u.gr> (raw)
[-- 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
next reply other threads:[~2005-03-31 3:33 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-31 3:33 mzozd [this message]
2005-04-03 9:58 ` Autofs TLS and binddn/bindpw patch 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=424B6F70.8060802@ad2u.gr \
--to=mzozd@ad2u.gr \
--cc=autofs@linux.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.