|
NAMEConfig::Parser::ldap - configuration file parser for ldap.confSYNOPSIS$cfg = new Config::Parser::ldap($filename); $base = $cfg->get('base'); DESCRIPTIONA parser for ldap.conf and similar files.The syntax of ldap.conf configuration file is very simple. Each statement occupies one physical line and consists of a keyword and its value separated by one or more space characters. Keywords are case-insensitive. A value starts with the first non-blank character after the keyword, and terminates at the end of the line, or at the last sequence of blanks before the end of the line. Blank lines and lines beginning with a hash mark are ignored. CONSTRUCTOR$cfg = new Config::Parser::ldap(%opts);Parses the supplied configuration file and creates a new object for manipulating its settings. Keyword arguments %opts are:
METHODSAll methods for accessing the configuration settings are inherited from Config::AST.If you wish to use this class as a base class, please refer to Config::Parser for implementation details. EXAMPLEThe following simplified example shows how to use this module to connect and bind to a LDAP server.use Config::Parser::ldap; use Net::LDAP; # Parse configuration file $cf = new Config::Parser::ldap(filename => '/etc/ldap.conf'); # Connect to server. $ldap = Net::LDAP->new($cf->uri->value); # Start TLS if required $args{capath} = $cf->get('tls_cacertdir'); $args{cafile} = $cf->get('tls_cacert'); $args{clientcert} = $cf->get('tls_cert'); $args{clientkey} = $cf->get('tls_key'); $args{ciphers} = $cf->get('tls_cipher_suite'); if ($reqcert = $cf->get('tls_reqcert')) { my %tab = ( none => 'never', allow => 'optional', demand => 'require', hard => 'require', try => 'optional' ); $args{verify} = $tab{$reqcert} or die "unrecognized tls_reqcert: $reqcert"; } $mesg = $ldap->start_tls(%args); $mesg->code && die $mesg->error; # Bind @bindargs = (); if (my $v = $cf->get('binddn')) { push @bindargs, $v } if (my $v = $cf->get('bindpw')) { push @bindargs, password => $v; } $mesg = $ldap->bind(@bindargs); $mesg->code && die $mesg->error; SEE ALSOConfig::AST.Config::Parser.
Visit the GSP FreeBSD Man Page Interface. |