shelldap
changeset 42 b8c6d4e8f828
parent 41 3e7c107f8b93
child 43 b8836c9018fb
equal deleted inserted replaced
41:3e7c107f8b93 42:b8c6d4e8f828
     1 #!/usr/bin/env perl
     1 #!/usr/bin/env perl
     2 # vim: set nosta noet ts=4 sw=4:
     2 # vim: set nosta noet ts=4 sw=4:
     3 #
     3 #
     4 # Copyright (c) 2006-2011, Mahlon E. Smith <mahlon@martini.nu>
     4 # Copyright (c) 2006-2012, Mahlon E. Smith <mahlon@martini.nu>
     5 # All rights reserved.
     5 # All rights reserved.
     6 # Redistribution and use in source and binary forms, with or without
     6 # Redistribution and use in source and binary forms, with or without
     7 # modification, are permitted provided that the following conditions are met:
     7 # modification, are permitted provided that the following conditions are met:
     8 #
     8 #
     9 #     * Redistributions of source code must retain the above copyright
     9 #     * Redistributions of source code must retain the above copyright
   118 
   118 
   119 =back
   119 =back
   120 
   120 
   121 =over 4
   121 =over 4
   122 
   122 
   123 =item B< tls>
   123 =item B<promptpass>
       
   124 
       
   125 Force password prompting.  Useful to temporarily override cached
       
   126 credentials.
       
   127 
       
   128 =back
       
   129 
       
   130 =over 4
       
   131 
       
   132 =item B<tls>
   124 
   133 
   125 Enables TLS over what would normally be an insecure connection.
   134 Enables TLS over what would normally be an insecure connection.
   126 Requires server side support.
   135 Requires server side support.
   127 
   136 
   128 =item B<tls_cacert>
   137 =item B<tls_cacert>
   461 		eval 'use IO::Socket::SSL';
   470 		eval 'use IO::Socket::SSL';
   462 		die qq{IO::Socket::SSL not installed, but is required for SSL or TLS connections.
   471 		die qq{IO::Socket::SSL not installed, but is required for SSL or TLS connections.
   463 You may try connecting insecurely, or install the module and try again.\n} if $@;
   472 You may try connecting insecurely, or install the module and try again.\n} if $@;
   464 	}
   473 	}
   465 
   474 
   466 	if ( $conf->{'binddn'} && ! $conf->{'bindpass'} ) {
   475 	if ( ($conf->{'binddn'} && ! $conf->{'bindpass'}) || $conf->{'promptpass'} ) {
   467 		print "Bind password: ";
   476 		print "Bind password: ";
   468 		Term::ReadKey::ReadMode 2;
   477 		Term::ReadKey::ReadMode 2;
   469 		chomp($conf->{'bindpass'} = <STDIN>);
   478 		chomp($conf->{'bindpass'} = <STDIN>);
   470 		Term::ReadKey::ReadMode 0;
   479 		Term::ReadKey::ReadMode 0;
   471 		print "\n";
   480 		print "\n";
  1730 package main;
  1739 package main;
  1731 use strict;
  1740 use strict;
  1732 use warnings;
  1741 use warnings;
  1733 
  1742 
  1734 $0 = 'shelldap';
  1743 $0 = 'shelldap';
  1735 my $VERSION = '0.5';
  1744 my $VERSION = '0.6';
  1736 
  1745 
  1737 use Getopt::Long;
  1746 use Getopt::Long;
  1738 use YAML::Syck;
  1747 use YAML::Syck;
  1739 use Pod::Usage;
  1748 use Pod::Usage;
  1740 eval 'use Term::ReadLine::Gnu';
  1749 eval 'use Term::ReadLine::Gnu';
  1748 	$conf, 
  1757 	$conf, 
  1749 	'server|H=s',
  1758 	'server|H=s',
  1750 	'binddn|D=s',
  1759 	'binddn|D=s',
  1751 	'basedn|b=s',
  1760 	'basedn|b=s',
  1752 	'cacheage=i',
  1761 	'cacheage=i',
       
  1762 	'promptpass|W',
  1753 	'timeout=i',
  1763 	'timeout=i',
  1754 	'tls_cacert=s',
  1764 	'tls_cacert=s',
  1755 	'tls_cert=s',
  1765 	'tls_cert=s',
  1756 	'tls_key=s',
  1766 	'tls_key=s',
  1757 	'tls', 'debug', 'version',
  1767 	'tls', 'debug', 'version',