[Ultrapossum-cvs 790] projects/nss ...

Back to archive index

Masato Taruishi taru****@users*****
2004年 10月 11日 (月) 19:04:04 JST


===================================================================
RCS file: projects/nss/ldap2group.pl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- projects/nss/ldap2group.pl	2004/10/11 09:37:03	1.1
+++ projects/nss/ldap2group.pl	2004/10/11 10:04:04	1.2
@@ -22,6 +22,7 @@
 $ldapbase = '';
 $group = '';
 $outputfile = '';
+$starttls = '';
 
 eval q {
   use UltraPossum::Conf;
@@ -32,13 +33,20 @@
 
 GetOptions('host|h=s' => \$host,
 	   'base|b=s' => \$ldapbase,
-	   'outputfile|o=s' => \$outputfile);
+	   'outputfile|o=s' => \$outputfile,
+	   'starttls|Z' => \$starttls);
 if (!defined($ldapbase) || $ldapbase eq '') {
     print STDERR "usage: $0 [-h ldapserver] [-b base] group\n";
     exit 1;
 }
 
 $ldap = Net::LDAP->new("$host") or die "$@";
+
+if ( $starttls eq "1" ) {
+   $mesg = $ldap->start_tls();
+   $mesg->code && $mesg->error;
+}
+
 $mesg = $ldap->bind;
 $mesg->code && die $mesg->error;
 if ($outputfile ne '') {
===================================================================
RCS file: projects/nss/ldap2pw.pl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- projects/nss/ldap2pw.pl	2004/10/11 09:37:03	1.1
+++ projects/nss/ldap2pw.pl	2004/10/11 10:04:04	1.2
@@ -21,6 +21,7 @@
 $host = 'localhost';
 $ldapbase = '';
 $outputfile = '';
+$starttls = '';
 
 eval q {
   use UltraPossum::Conf;
@@ -31,15 +32,23 @@
 
 GetOptions('host|h=s' => \$host,
 	   'base|b=s' => \$ldapbase,
-           'outputfile|o=s' => \$outputfile);
+           'outputfile|o=s' => \$outputfile,
+	   'starttls|Z' => \$starttls);
 if (!defined($ldapbase) || $ldapbase eq '') {
     print STDERR "usage: $0 [-h ldapserver] [-b base]\n";
     exit 1;
 }
 
 $ldap = Net::LDAP->new("$host") or die "$@";
-my $result = $ldap->bind;
-die $result->error() if $result->code();
+
+if ( $starttls eq "1" ) {
+    $mesg = $ldap->start_tls();
+    die $mesg->error() if $mesg->code();
+}
+
+$mesg = $ldap->bind;
+die $mesg->error() if $mesg->code();
+
 $mesg = $ldap->search(base   => "$ldapbase",
 		      filter => "(&(uid=*)(objectclass=posixAccount))");
 $mesg->code && die $mesg->error;
===================================================================
RCS file: projects/nss/ldap2shadow.pl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- projects/nss/ldap2shadow.pl	2004/10/11 09:37:03	1.1
+++ projects/nss/ldap2shadow.pl	2004/10/11 10:04:04	1.2
@@ -25,6 +25,7 @@
 $bindpw = '';
 $promptpw = 0;
 $outputfile = '';
+$starttls = '';
 
 eval q {
   use UltraPossum::Conf;
@@ -41,20 +42,25 @@
 	   'bind|D=s' => \$binddn,
 	   'pw|w=s' => \$bindpw,
 	   'W!' => \$promptpw,
-           'outputfile|o=s' => \$outputfile);
+           'outputfile|o=s' => \$outputfile,
+	   'starttls|Z' => \$starttls);
 if (!defined($ldapbase) || $ldapbase eq '') {
     print STDERR "usage: $0 [-h ldapserver] [-b base] [-D binddn] [-w bindpw|-W]\n";
     exit 1;
 }
 
 $ldap = Net::LDAP->new("$host", version => 3) or die "$@";
+if ($starttls eq "1") {
+  $mesg = $ldap->start_tls();
+  $mesg->code && $mesg->error;
+}
 if ($promptpw && $bindpw eq "") {
     print STDERR "LDAP password ($binddn):";
     $bindpw = <STDIN>;
     chomp($bindpw);
 }
-my $result = $ldap->bind(dn => $binddn, password => $bindpw);
-die $result->error() if $result->code();
+$mesg = $ldap->bind(dn => $binddn, password => $bindpw);
+die $mesg->error() if $mesg->code();
 $mesg = $ldap->search(base   => "$ldapbase",
 		      filter => "(objectclass=shadowAccount)");
 $mesg->code && die $mesg->error;



Ultrapossum-cvs メーリングリストの案内
Back to archive index