Re: [Fwd] Writing in nonascii (binary) format
This is follow-up of my pervious question ...when i try to add values say CN=" test"; (Having a white space character in front) or name =" "; (null value) i expected the values as cn= test; but when i read the cn attribute in directroy server its giving me in non readable format like VGVzdCwgT3RoZXIgVGVsICA= Any body came across this issue. Any advise will greatly help me. Thanks in advance . Graham Barr <[EMAIL PROTECTED]> wrote: ----- Forwarded message from Neo - - Date: Thu, 29 May 2003 08:41:09 -0700 (PDT) To: [EMAIL PROTECTED] From: Neo - Subject: Writing in nonascii (binary) format Hi grahm, I am new bee to net ldap your documentation really helped me to get through all my needs . also now i got into a problem while adding or modifying the data some of the attributes are added in non ascii format .. i checked the data which i supposed to write its in ascii format but when i checked in directory server its in non ascii format (binary) but the attribute is not defined as binary...I would really appreciate any help. Regards, Neo - Do you Yahoo!? Free online calendar with sync to Outlook(TM). - End forwarded message - - Do you Yahoo!? Free online calendar with sync to Outlook(TM).
Re: [Fwd] Writing in nonascii (binary) format
No graham i am not using LDIF module . Just reading the values from ldapsearch command i knew excatly which entry has that particular leading space problem . here is the sample snap shot D:\>ldapsearch -h hostname -p port -w -b "filter" objectClass: top objectClass: person objectClass: organizationalperson objectClass: inetorgperson cn:: VGVzdCwgT3RoZXIgVGVsICA= givenName: Other Tel sn: Test Here is the code that does the addition i am collecting all the attribute name and thier values in %prod_hash $addresult = $prod_ldap->add (dn => $dn , attr => [%prod_hash]); $addresult->code && warn "failed to add entry: ", $addresult->code; hope this clears up ... Thanks again. -Neo Graham Barr <[EMAIL PROTECTED]> wrote: On Thu, May 29, 2003 at 09:15:23AM -0700, Neo - wrote: > This is follow-up of my pervious question ...when i try to add values say > > CN=" test"; (Having a white space character in front) > > or name =" "; (null value) If you are using LDIF tou output the entries then any attribute where the value starts with a space or a : or contains non-ascii characters will be base64 encoded. > > i expected the values as cn= test; > but when i read the cn attribute in directroy server its giving me in non readable > format like VGVzdCwgT3RoZXIgVGVsICA= perl -MMIME::Base64=decode_base64 -le 'print decode_base64("VGVzdCwgT3RoZXIgVGVsICA=")' | hexdump -C 54 65 73 74 2c 20 4f 74 68 65 72 20 54 65 6c 20 |Test, Other Tel | 0010 20 0a | .| Its odd that Net::LDAP::LDIF would output that in b64, I assume you are using the LDIF module to output the entry ? Can you post the code you use to fetch and display the entry Graham. - Do you Yahoo!? Free online calendar with sync to Outlook(TM).
Re: [Fwd] Writing in nonascii (binary) format
I didn't know ldapsearch is b64 encoding ...got it. Thanks all for your valuable feedback. -Neo Graham Barr <[EMAIL PROTECTED]> wrote: On Thu, May 29, 2003 at 12:15:23PM -0700, Neo - wrote: > No graham i am not using LDIF module . > > Just reading the values from ldapsearch command i knew excatly which entry has that > particular leading space problem . > > here is the sample snap shot > > D:\>ldapsearch -h hostname -p port -w -b "filter" > objectClass: top > objectClass: person > objectClass: organizationalperson > objectClass: inetorgperson > cn:: VGVzdCwgT3RoZXIgVGVsICA= > givenName: Other Tel > sn: Test Ah, ldapsearch is b64 encoding because the value ends with a space $ perl -MMIME::Base64=decode_base64 -le 'print q{"},decode_base64("VGVzdCwgT3RoZXIgVGVsICA="),q{"}' "Test, Other Tel " Graham. > > > Here is the code that does the addition > > i am collecting all the attribute name and thier values in %prod_hash > > $addresult = $prod_ldap->add (dn => $dn , attr => [%prod_hash]); > $addresult->code && warn "failed to add entry: ", $addresult->code; > > > hope this clears up ... > > Thanks again. > -Neo > > > Graham Barr wrote: > On Thu, May 29, 2003 at 09:15:23AM -0700, Neo - wrote: > > This is follow-up of my pervious question ...when i try to add values say > > > > CN=" test"; (Having a white space character in front) > > > > or name =" "; (null value) > > If you are using LDIF tou output the entries then any attribute > where the value starts with a space or a : or contains non-ascii > characters will be base64 encoded. > > > > > i expected the values as cn= test; > > but when i read the cn attribute in directroy server its giving me in non readable > > format like VGVzdCwgT3RoZXIgVGVsICA= > > perl -MMIME::Base64=decode_base64 -le 'print > decode_base64("VGVzdCwgT3RoZXIgVGVsICA=")' | hexdump -C > 54 65 73 74 2c 20 4f 74 68 65 72 20 54 65 6c 20 |Test, Other Tel | > 0010 20 0a | .| > > Its odd that Net::LDAP::LDIF would output that in b64, I assume > you are using the LDIF module to output the entry ? Can you post > the code you use to fetch and display the entry > > Graham. > > > - > Do you Yahoo!? > Free online calendar with sync to Outlook(TM). - Do you Yahoo!? Free online calendar with sync to Outlook(TM).
Re: New bee question
OS : Free BSD Cheers Chris Ridd <[EMAIL PROTECTED]> wrote: On 6/8/03 2:33 pm, Neo - wrote: > Thanks Brisby and Shiva. I am able to ping for ldap.domain.edu from my > machine. . > > May be i am missing something here .. sadly my sys admin on vacation. Does your ping program use the same resolver as your copy of perl? That's probably hard to tell, but a clue might be in what OS you are running? Cheers, Chris - Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software
New bee question
Hi All! A new bee question . I am using Net::LDAP module to connect openldap it works fine when i use ipaddress of the machine . but it didn't respond when i use the domain name $dn="cn=admin,dc=domain,dc=edu"; $password="password"; $version=3; $url="ldap.domain.edu:389"; (didn't work) #$url='210.30.320.704'; (works) $ldap1 = Net::LDAP->new($url) or die "$@"; $mesg1 = $ldap1->bind(dn => $dn, password => $password, version => $version); Thanks in advance. - Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software
Re: New bee question
Thanks Brisby and Shiva. I am able to ping for ldap.domain.edu from my machine. . May be i am missing something here .. sadly my sys admin on vacation. Cheers "Mrs. Brisby" <[EMAIL PROTECTED]> wrote:Net::LDAP uses IO::Socket::INET to resolve a name. This doesn't have anything to do with the Net::LDAP perl module. Your stub-resolver configuration is either broken, or your name resolution services are broken. There are a lot of things that could go wrong there; You should contact your network administrator to find out what names to use, or to alert them that either your workstation is misconfigured or the name services your network relies on are completely borked. On Tue, 2003-08-05 at 18:39, Neo - wrote: > Hi All! > > A new bee question . I am using Net::LDAP module to connect openldap it works fine > when i use ipaddress of the machine . > but it didn't respond when i use the domain name > > $dn="cn=admin,dc=domain,dc=edu"; > $password="password"; > $version=3; > $url="ldap.domain.edu:389"; (didn't work) > #$url='210.30.320.704'; (works) > $ldap1 = Net::LDAP->new($url) or die "$@"; > $mesg1 = $ldap1->bind(dn => $dn, > password => $password, > version => $version); > > Thanks in advance. > > > - > Do you Yahoo!? > Yahoo! SiteBuilder - Free, easy-to-use web site design software - Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software
Re: Authenticating to Novell eDir 8.7 from Linux CGI with LDAP
Bill, try this if($mesg->code() != 0) { print "Bind failed. Improper UserID or Password\n"; exit; } else { print "Success\n\n"; } For users -- $ans=$result->count; if($ans == 0) { print "Sorry wrong user name & password"; exit; } if($ans == 1) { print " Success"; } if($ans > 1) { print "More than one entry"; } HTH Regards. k Bill Morris <[EMAIL PROTECTED]> wrote: Folks, I am moving my Perl CGI forms from a NetWare 5.1 box to a Red Hat 8.0 box. I have been authenticating my clients with UCSExt. I now will have to use LDAP to authenticate to one of our NetWare 5.1 servers running eDir 8.7 to verify the user should have access to the CGI form on the Linux server. My current problem is that my scripts perform the search anonymously if the authentication fails. I want it to bomb out if they enter the wrong ID or password. Any suggestions? Turning off anonymous LDAP is not an option. Here is my script: = #!/usr/bin/perl use Net::LDAP; use Net::LDAP::Util qw(ldap_error_text); $ldap=Net::LDAP->new('152.1.233.51') or die $@; #$ldap defines an LDAP connection handle, and 'ldap' is the name # of your LDAP server print "\n\nNCS UserID : "; chomp($CN = ); print "\n\nNCS password : "; chomp($PWD = ); print "\n\n"; $mesg = $ldap->bind(dn=>"cn=$CN,ou=ncs,ou=fnb,ou=ncs,o=ncsu", password=>"$PWD"); #$ldap->bind(dn=>'cn=admin,o=yoyodyne', password=>'plaintext'); # By the way, did I mention that you may have scripts where the # password is hardcoded in them? Sure, you can prompt as well, # but if you're doing batch processing, you'll need to be aware # of this. if($mesg->code() != 0) { print "Bind failed. Improper UserID or Password\n"; } else { print "Success\n\n"; } $result=$ldap->search( basedn=>"o=NCSU", filter=>"cn=$CN", ); die ldap_error_text($result->code) if $result->code; my $max = $result->count; print "\n\n"; for(my $index = 0; $index < $max ; $index++) { my $entry = $result->entry($index); print "Data is $entry\n"; } foreach $entry ($result->all_entries) { @ldap_results=$entry; $dn=$entry->dn; print ("Info for $dn:\n"); print ("Attribute: "); @givenname=$entry->get_value('givenName'); @initials=$entry->get_value('initials'); @surname=$entry->get_value('sn'); @department=$entry->get_value('ou'); @mail=$entry->get_value('mail'); @groupMembership=$entry->get_value('groupMembership'); $dn=$entry->dn; print ("Info for $dn:\n"); print ("First Name: "); foreach $givenvalue (@givenname) {print "$givenvalue ";} print ("\n"); print ("MI: "); foreach $initialsvalue (@initials) {print "$initialsvalue ";} print ("\n"); print ("Surname: "); foreach $surnamevalue (@surname) {print "$surnamevalue ";} print ("\n"); print ("Department: "); foreach $departmentvalue (@department) {print "$departmentvalue ";} print ("\n"); print ("email: "); foreach $mailvalue (@mail) {print "$mailvalue ";} print ("\n"); print ("Member of these Groups: "); foreach $groupmembershipvalue (@groupMembership) {print "$groupmembershipvalue \n";} print ("\n\n"); } $ldap->unbind; = Thanks for any help you can send my way, Bill Morris Bill Morris ([EMAIL PROTECTED]) Network & Client Services North Carolina State University Webmaster/Computing Consultant Campus Box 7231 14 Peele Hall 10 Watauga Club Dr. Raleigh, NC 27695-7231 - Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software
LDAP_TYPE_OR_VALUE_EXISTS
Hi all, I am trying to add a entry into my ldap DS but i am getting following error code LDAP_TYPE_OR_VALUE_EXISTS uid i am trying to add is unique uid=username2,ou=people,dc=domain,dc=com (DN) ..some attributes may be same with other users ...or is there any thing else i have look into it. Thanks __ Do you Yahoo!? Yahoo! Mail Address AutoComplete - You start. We finish. http://promotions.yahoo.com/new_mail
nsaccountlock attribute
Hi, I am not able to retrieve nsaccountlock attribute value using net ldap. I did able to retrive using ldapsearch command and ldap browser tools ..i am not sure what i am doing wrong in the code any advise greatly appreciated. here is the code i used to retrieve #!/usr/bin/perl use Net::LDAP::Entry; use Net::LDAP qw(:all); use IO::Socket; use Net::LDAP::Util qw(ldap_error_name ldap_error_text); $dn="cn=admin"; $password="comeon"; $version=3; $url='ldap'; $ldap1 = Net::LDAP->new($url,port=>389) or die "$@"; $mesg1 = $ldap1->bind(dn => $dn, password => $password, version => $version); $ldaperror_code=ldap_error_name($mesg1->code); $uid="username"; $base="ou=people,dc=com"; $scope="sub"; $filter="uid=$uid"; $result=$ldap1->search( base => "$base", scope => "$scope", filter => "$filter", ); $ans=$result->count; $searcherror_code=ldap_error_name($result->code); print "Searcherrorcode: $searcherror_code \n"; $entry=$result->entry(0); $arrayref1=$entry->get('status'); $status_value=$$arrayref1[0]; #I am able to print this value print "Status: $status_value \n"; $arrayref7=$entry->get('nsAccountlock'); $accountlock=$$arrayref7[0]; print "Accountlock: $accountlock \n"; # prints nothing __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Re: nsaccountlock attribute
Thanks Chris, It worked. - Original Message From: Chris Ridd <[EMAIL PROTECTED]> To: Neo - <[EMAIL PROTECTED]>; [EMAIL PROTECTED] Sent: Friday, April 13, 2007 2:17:01 PM Subject: Re: nsaccountlock attribute On 13/4/07 7:31, "Neo -" <[EMAIL PROTECTED]> wrote: > Hi, I am not able to retrieve nsaccountlock attribute value using net ldap. I > did able to retrive using ldapsearch command and ldap browser tools ..i am not > sure what i am doing wrong in the code any advise greatly appreciated. [...] > $result=$ldap1->search( > base => "$base", > scope => "$scope", > filter => "$filter", > ); You're implicitly asking the server for "all user attributes" here. > $arrayref7=$entry->get('nsAccountlock'); If nsAccountlock's an operational attribute (your server's documentation will say), you are not likely to get it returned by default with all the user attributes. Change the search so that it asks for it explicitly, perhaps including all user attributes as per: $result=$ldap1->search( base => "$base", scope => "$scope", filter => "$filter", attrs => [ "*", "nsAccountLock" ] ); Cheers, Chris __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Re: nsaccountlock attribute
Usually when you do replication your data should be in sync between two servers. If its not sync check the log file for error messages. easiest way to check update an attribute value in the master server and check other servers if that change is reflected. HTH - Original Message From: Bill <[EMAIL PROTECTED]> To: perl-ldap@perl.org Sent: Friday, April 20, 2007 8:30:45 AM Subject: Re: nsaccountlock attribute Hi All. What is the easiest way between syncing information from 1 server to another. We have 4 servers in peer to peer replication. But out of the 4 only 1 has the updated data. I need to check if the data exist on other servers and if not to add it to the other servers. What would be the easiest way to do this. Thanks - Bill - Original Message From: Neo - <[EMAIL PROTECTED]> To: Chris Ridd <[EMAIL PROTECTED]>; perl-ldap@perl.org Sent: Friday, April 13, 2007 3:40:00 PM Subject: Re: nsaccountlock attribute Thanks Chris, It worked. - Original Message From: Chris Ridd <[EMAIL PROTECTED]> To: Neo - <[EMAIL PROTECTED]>; perl-ldap@perl.org Sent: Friday, April 13, 2007 2:17:01 PM Subject: Re: nsaccountlock attribute On 13/4/07 7:31, "Neo -" <[EMAIL PROTECTED]> wrote: > Hi, I am not able to retrieve nsaccountlock attribute value using net ldap. I > did able to retrive using ldapsearch command and ldap browser tools ..i am not > sure what i am doing wrong in the code any advise greatly appreciated. [...] > $result=$ldap1->search( > base => "$base", > scope => "$scope", > filter => "$filter", > ); You're implicitly asking the server for "all user attributes" here. > $arrayref7=$entry->get('nsAccountlock'); If nsAccountlock's an operational attribute (your server's documentation will say), you are not likely to get it returned by default with all the user attributes. Change the search so that it asks for it explicitly, perhaps including all user attributes as per: $result=$ldap1->search( base => "$base", scope => "$scope", filter => "$filter", attrs => [ "*", "nsAccountLock" ] ); Cheers, Chris __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com