Thanks for the code. But can we do this in UNIX shell script or Java? Thanks again
Steven --- Charlie Mengler <[EMAIL PROTECTED]> wrote: > I hope you can read UGLY Perl code. > > HTH & YMMV! > > #!/usr/local/bin/perl > # File: chg-oracle-passwd.cgi > use Net::LDAP; > use Carp; > use DBI; > $ENV{"ORACLE_HOME"} = > "/db02/app/oracle/product/8.1.6"; > print "Content-type: text/html\n\n"; > print "<HTML>\n\n<BODY>\n\n"; > #print "METHOD = $ENV{'REQUEST_METHOD'}\n"; > if ($ENV{'REQUEST_METHOD'} eq 'GET') { > $form_info = $ENV{'QUERY_STRING'}; > } > elsif ($ENV{'REQUEST_METHOD'} eq 'POST') { > $form_info = ''; > $bytes = $ENV{'CONTENT_LENGTH'}; > read (STDIN, $form_info, $bytes); > } > @pairs = split(/&/, $form_info); > foreach $pair (@pairs) { > ($name, $value) = split(/=/, $pair); > $value =~ tr/+/ /; > $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", > hex($1))/eg; > if ($name eq "UNAME") { > $istring = $value; > } > if ($name eq "PWORD") { > $passwd = $value; > } > if ($name eq "DATABASE") { > $dbase = $value; > } > } > # > my ($ldap, $res, $code); > $mypasswd = $passwd; > $myuid = $istring; > $ldap = Net::LDAP->new('ldap.mwh.com:389') || die > "$@"; > $mesg = $ldap->bind('cn=Directory Manager') || > die("failed to bind with ", > $mesg->code(),"\n"); > $res = $ldap->search > ( > base => "ou=People,o=mwh.com", > filter => "&(uid=$myuid ) > (!(objectclass=alias))", > attrs => [] > ) || die; > $code = $res->code; > $cnt = $res->count; > #print "After 1st LDAP call using $myuid with > results = $code<br>\n"; > #die "User $myuid not found" if $code || $res->count > != 1; > if ( $code == 1 || $cnt == 1 ) > { > $valid_username = 1; > #print "code equal to $code and count = $cnt > <br>\n"; > my $entry = $res->entry(0); > $res = $ldap->bind(dn => $entry->dn, password => > $mypasswd) or die; > $code = $res->code; > #print "LDAP return value = $code \n"; > #die "Login failed" if $code; > if ( $code != 0 ) > { > $pwmatch = 0; > } else > { > $pwmatch = 1; > } > #$mesg = $ldap->search > #print "mesg is $mesg <br>"; > } else > { > $valid_username = 0; > $pwmatch = 0; > #print "invalid username <br>"; > } > $ldap->unbind; > > Steven Joshua wrote: > > > > Hello: > > > > Hope the subject make sense. I'm new to LDAP, and > > don't know how it works. > > I need to use SQL Loader to load a text file into > > Oracle817 Database from a unix box. The file/data > > comes from LDAP server. My question is: how do I > get > > the file/object from LDAP site from my unix > script? > > > > Does anyone has any examples? or know a helpful > URL? > > > > Thanks > > > > From Steven > > > > __________________________________________________ > > Do You Yahoo!? > > Yahoo! Health - your guide to health and wellness > > http://health.yahoo.com > > -- > > Please see the official ORACLE-L FAQ: > http://www.orafaq.com > > -- > > Author: Steven Joshua > > INET: [EMAIL PROTECTED] > > > > Fat City Network Services -- (858) 538-5051 > FAX: (858) 538-5051 > > San Diego, California -- Public Internet > access / Mailing Lists > > > -------------------------------------------------------------------- > > To REMOVE yourself from this mailing list, send an > E-Mail message > > to: [EMAIL PROTECTED] (note EXACT spelling of > 'ListGuru') and in > > the message BODY, include a line containing: UNSUB > ORACLE-L > > (or the name of mailing list you want to be > removed from). You may > > also send the HELP command for other information > (like subscribing). > > -- > Charlie Mengler > Maintenance Warehouse > [EMAIL PROTECTED] 10641 > Scripps Summit Ct. > 858-831-2229 San Diego, > CA 92131 > Am I sure? Of course I'm sure. I could be wrong, but > I'm sure for now! > -- > Please see the official ORACLE-L FAQ: > http://www.orafaq.com > -- > Author: Charlie Mengler > INET: [EMAIL PROTECTED] > > Fat City Network Services -- (858) 538-5051 FAX: > (858) 538-5051 > San Diego, California -- Public Internet > access / Mailing Lists > -------------------------------------------------------------------- > To REMOVE yourself from this mailing list, send an > E-Mail message > to: [EMAIL PROTECTED] (note EXACT spelling of > 'ListGuru') and in > the message BODY, include a line containing: UNSUB > ORACLE-L > (or the name of mailing list you want to be removed > from). You may > also send the HELP command for other information > (like subscribing). __________________________________________________ Do You Yahoo!? Yahoo! Health - your guide to health and wellness http://health.yahoo.com -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Steven Joshua INET: [EMAIL PROTECTED] Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).