[29859] in Perl-Users-Digest
Perl-Users Digest, Issue: 1102 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Dec 10 11:09:44 2007
Date: Mon, 10 Dec 2007 08:09:07 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 10 Dec 2007 Volume: 11 Number: 1102
Today's topics:
comparing binary strings <iler.ml@gmail.com>
Re: comparing binary strings <ben@morrow.me.uk>
Re: How can I print a number larger than 128? (Doug Miller)
Re: How can I print a number larger than 128? QoS@domain.invalid
How to execute tar inside a perl script ? (Matthew Lincoln)
Re: How to execute tar inside a perl script ? <joost@zeekat.nl>
Re: How to parse out specific data in text files and pl <josef.moellers@fujitsu-siemens.com>
Re: How to parse out specific data in text files and pl <ben@morrow.me.uk>
Information I hope will be passed to Larry Wall <georgepsSPAMMENOT@xmission.com>
Re: Information I hope will be passed to Larry Wall <smallpond@juno.com>
new CPAN modules on Mon Dec 10 2007 (Randal Schwartz)
Re: passing arguments to a shell script from a perl scr <josef.moellers@fujitsu-siemens.com>
Re: Problem in LDAP authentication <visitprakashindia@gmail.com>
Re: Problem in LDAP authentication <visitprakashindia@gmail.com>
Re: Questions about the operator \(...) xhoster@gmail.com
XTEA/MCrypt: Trying to port my application from C++. <deathplanter@gmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 10 Dec 2007 03:37:25 -0800 (PST)
From: Yakov <iler.ml@gmail.com>
Subject: comparing binary strings
Message-Id: <93924f24-f34b-464d-b1f3-0e871a9b9eb1@s19g2000prg.googlegroups.com>
Let's say I create binary strings using pack() or like this:
sub CreateEightByteString { return $_[0]; }
$a = CreateEightByteString("\301" x 8);
$b = CreateEightByteString("\277" x 8);
, and I need to ensure that comparison (lt, gt) of those strings
not depend on locale and not be utf-8 interpreted.
How can I "label" thise string "raw binary" in CreateEightByteString
so that any subsequent comparison be as raw binary 8 bytes,
independent on program's locale ?
Y.L.
------------------------------
Date: Mon, 10 Dec 2007 14:27:12 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: comparing binary strings
Message-Id: <0vuv25-603.ln1@osiris.mauzo.dyndns.org>
Quoth Yakov <iler.ml@gmail.com>:
> Let's say I create binary strings using pack() or like this:
>
> sub CreateEightByteString { return $_[0]; }
Uh... what's the point of this?
> $a = CreateEightByteString("\301" x 8);
> $b = CreateEightByteString("\277" x 8);
Don't use $a and $b, they are magic.
> , and I need to ensure that comparison (lt, gt) of those strings
> not depend on locale and not be utf-8 interpreted.
Don't attempt to mix POSIX locales and Perl's UTF8 support. The two
don't play well together at all yet.
> How can I "label" thise string "raw binary" in CreateEightByteString
> so that any subsequent comparison be as raw binary 8 bytes,
> independent on program's locale ?
You can't. You need to perform *the comparisons* under 'use bytes'.
If you aren't using locales, and you call CreateEightByteString under
'use bytes', you will get byte-strings back. If you only mix these with
other byte-strings, they will stay that way.
Ben
------------------------------
Date: Mon, 10 Dec 2007 11:47:21 GMT
From: spambait@milmac.com (Doug Miller)
Subject: Re: How can I print a number larger than 128?
Message-Id: <dH97j.76990$YL5.33407@newssvr29.news.prodigy.net>
In article <pan.2007.12.09.23.08.18@rtij.nl.invlalid>, Martijn Lievaart <m@rtij.nl.invlalid> wrote:
>On Sun, 09 Dec 2007 22:25:59 +0000, Doug Miller wrote:
>
>>>> >The one byte constraint is more than a bit limiting though.
>>>>
>>>> Huh? One byte = 8 bits, which can hold values up to 2^8 - 1 = 255. All
>>>> he needs to do is send it in binary.
>>>>
>>>>
>>>cause the OP says that he wishes to send _only one byte_
>>>
>>>
>> And your point would be....?
>>
>> 255 > 128, last time I checked.
>
>Ah I see it now. The OP wants to send a number GREATER than 128.
Wouldn't matter if he wanted to send a number less than 128. As long as it's
in the range 0..255, one byte is sufficient to express it. If it's out of that
range, it's not, and no compression algorithm is going to change that.
--
Regards,
Doug Miller (alphageek at milmac dot com)
It's time to throw all their damned tea in the harbor again.
------------------------------
Date: Mon, 10 Dec 2007 15:07:32 GMT
From: QoS@domain.invalid
Subject: Re: How can I print a number larger than 128?
Message-Id: <UCc7j.9484$0O1.4643@trnddc05>
spambait@milmac.com (Doug Miller) wrote in message-id: <dH97j.76990$YL5.33407@newssvr29.news.prodigy.net>
>
> In article <pan.2007.12.09.23.08.18@rtij.nl.invlalid>, Martijn Lievaart <m@rtij.nl.invlalid> wrote:
> >On Sun, 09 Dec 2007 22:25:59 +0000, Doug Miller wrote:
> >
> >>>> >The one byte constraint is more than a bit limiting though.
> >>>>
> >>>> Huh? One byte = 8 bits, which can hold values up to 2^8 - 1 = 255. All
> >>>> he needs to do is send it in binary.
> >>>>
> >>>>
> >>>cause the OP says that he wishes to send _only one byte_
> >>>
> >>>
> >> And your point would be....?
> >>
> >> 255 > 128, last time I checked.
> >
> >Ah I see it now. The OP wants to send a number GREATER than 128.
>
> Wouldn't matter if he wanted to send a number less than 128. As long as it's
> in the range 0..255, one byte is sufficient to express it. If it's out of that
> range, it's not, and no compression algorithm is going to change that.
>
Clocking.
Assume for a moment that the sending software and receiving software both
have hardcoded a _timing_ mechanism (asynchronous transmission).
Now the sending client starts the timer by sending its first bit, lets say
it is a zero, the sender will now not send any more bits until the value
of the bit is to change (lets say 14 cycles).
The receiver should now have a number like this, although it has received
only 1 bit. (the initial bit and 14 repetitions of that bit.)
0000000 00000000
Now the sender sends the next bit to indicate a change from 0 to 1.
Perhaps this time the sends waits 2 cycles after sending.
The reciever should now have a number like this, and we have sent
only 2 bits so far.
11 10000000 00000000
Some ethernet encodings work in a similar fashion to this.
Many more ways to do this.. gl
------------------------------
Date: 10 Dec 2007 12:59:34 GMT
From: mlincoln100@hotmail.com (Matthew Lincoln)
Subject: How to execute tar inside a perl script ?
Message-Id: <475d3836$0$16662$9b4e6d93@newsspool3.arcor-online.net>
When I code in a perl script
tar czvf "/usr/local/myname/$tarfile" ./*.php
I got the following error:
Search pattern not terminated at /usr/local/myname/bin/myscript.pl line 20.
If I code:
tar czvf "/usr/local/myname/$tarfile" ./*.php ./templates/
then I got this error:
Quantifier follows nothing in regex; marked by <-- HERE in m/* <-- HERE .php ./ at /usr/local/myname/bin/myscript.pl line 20.
So how do I correctly execute a tar command from within a perl script ?
Matthew
------------------------------
Date: 10 Dec 2007 13:57:19 GMT
From: Joost Diepenmaat <joost@zeekat.nl>
Subject: Re: How to execute tar inside a perl script ?
Message-Id: <475d45bf$0$31825$e4fe514c@dreader26.news.xs4all.nl>
On Mon, 10 Dec 2007 12:59:34 +0000, Matthew Lincoln wrote:
> When I code in a perl script
>
> tar czvf "/usr/local/myname/$tarfile" ./*.php
perl isn't a shell. tar isn't a perl function. czvf can be all kinds of
things in perl. If you want to execute an external commmand and
interpolate wildcards via the shell you have to explicitly say so.
> So how do I correctly execute a tar command from within a perl script ?
http://perldoc.perl.org/functions/system.html
Joost.
------------------------------
Date: Mon, 10 Dec 2007 09:53:18 +0100
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: How to parse out specific data in text files and plugs into the spreadsheet
Message-Id: <fjiuq6$bbn$2@nntp.fujitsu-siemens.com>
Ben Morrow wrote:
> my ($k, $v) =3D /([^:]*) \s* : \s* (.*)/x
ITYM ([^:]*?)
otherwise the first part would also eat all spaces up to the first=20
colon, as the re is greedy by default.
--=20
These are my personal views and not those of Fujitsu Siemens Computers!
Josef M=F6llers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize (T. Pratchett)
Company Details: http://www.fujitsu-siemens.com/imprint.html
------------------------------
Date: Mon, 10 Dec 2007 09:49:04 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: How to parse out specific data in text files and plugs into the spreadsheet
Message-Id: <glev25-mg1.ln1@osiris.mauzo.dyndns.org>
Quoth Josef Moellers <josef.moellers@fujitsu-siemens.com>:
> Ben Morrow wrote:
>
> > my ($k, $v) = /([^:]*) \s* : \s* (.*)/x
>
> ITYM ([^:]*?)
>
> otherwise the first part would also eat all spaces up to the first
> colon, as the re is greedy by default.
...in which case we might as well have
/(.*?) \s* : .../
as I had in the first place before I changed it :).
Ben
------------------------------
Date: Mon, 10 Dec 2007 09:19:33 +0000 (UTC)
From: George Peter Staplin <georgepsSPAMMENOT@xmission.com>
Subject: Information I hope will be passed to Larry Wall
Message-Id: <fjj0b5$lr$1@news.xmission.com>
Unfortunately it seems Larry Wall is lying about several aspects of Tcl
in his recent article on perl.com
I hope that some of you will please pass this thread along to him, or
that he will read it, and post a correction on perl.com
http://groups.google.com/group/comp.lang.tcl/browse_thread/thread/6b4aac569dadaba8?tvc=2
At the very least he could state that his knowledge of Tcl is
outdated. It would be the noble thing to do.
"The string metaphor tends to have bad performance ramifications, but
that's not why Tcl languished, I think. There were two reasons for
that."
He talks about Tcl as though it's dead or dying. There are TIPs (Tcl
improvement proposals) being submitted, performance improvements, bug
fixes, etc. going on almost everyday. It's not very respectful of the
work of others.
"First, Tcl stayed in the Unix mindset that controlling tools was the
opposite of creating tools, so they didn't optimize much. The fast parts
can always be written in C, after all."
I'm a Tcl core developer (though not on the core team) and I can tell
you that pure-Tcl speed is of upmost importance to most developers, and
many man hours have gone into optimizing, benchmarking, and figuring
out solutions. He does the Tcl community a disservice by stating
we don't optimize much.
"The second reason was the lack of a decent extension mechanism, so you
ended up with separate executables for expect, incr-tcl, etc."
This has not been true for many years. Expect and Incr-Tcl work as
loadable extensions. An extension is loaded using dlopen()/dlsym() in
POSIX/Unix and LoadLibrary()/etc. in Windows. A stubs mechanism is also
provided to allow for backwards compatibility in C extensions for Tcl.
Another common misconception is that Tcl doesn't support binary, which
also is untrue, and has been for many years. Though Larry didn't
specifically mention that.
Please Larry Wall, don't misinform developers that don't know any
better. I would appreciate a correction.
Thank you,
George
------------------------------
Date: Mon, 10 Dec 2007 06:47:20 -0800 (PST)
From: smallpond <smallpond@juno.com>
Subject: Re: Information I hope will be passed to Larry Wall
Message-Id: <9e87d49e-a4cd-4825-a0d9-09e82b7a783d@e67g2000hsc.googlegroups.com>
On Dec 10, 4:19 am, George Peter Staplin
<georgepsSPAMME...@xmission.com> wrote:
> Unfortunately it seems Larry Wall is lying about several aspects of Tcl
> in his recent article on perl.com
>
> I hope that some of you will please pass this thread along to him, or
> that he will read it, and post a correction on perl.com
>
> http://groups.google.com/group/comp.lang.tcl/browse_thread/thread/6b4...
>
> At the very least he could state that his knowledge of Tcl is
> outdated. It would be the noble thing to do.
>
> "The string metaphor tends to have bad performance ramifications, but
> that's not why Tcl languished, I think. There were two reasons for
> that."
>
> He talks about Tcl as though it's dead or dying. There are TIPs (Tcl
> improvement proposals) being submitted, performance improvements, bug
> fixes, etc. going on almost everyday. It's not very respectful of the
> work of others.
>
> "First, Tcl stayed in the Unix mindset that controlling tools was the
> opposite of creating tools, so they didn't optimize much. The fast parts
> can always be written in C, after all."
>
> I'm a Tcl core developer (though not on the core team) and I can tell
> you that pure-Tcl speed is of upmost importance to most developers, and
> many man hours have gone into optimizing, benchmarking, and figuring
> out solutions. He does the Tcl community a disservice by stating
> we don't optimize much.
>
> "The second reason was the lack of a decent extension mechanism, so you
> ended up with separate executables for expect, incr-tcl, etc."
>
> This has not been true for many years. Expect and Incr-Tcl work as
> loadable extensions. An extension is loaded using dlopen()/dlsym() in
> POSIX/Unix and LoadLibrary()/etc. in Windows. A stubs mechanism is also
> provided to allow for backwards compatibility in C extensions for Tcl.
>
> Another common misconception is that Tcl doesn't support binary, which
> also is untrue, and has been for many years. Though Larry didn't
> specifically mention that.
>
> Please Larry Wall, don't misinform developers that don't know any
> better. I would appreciate a correction.
>
> Thank you,
>
> George
Offtopic for this group. The email you want is larry@wall.org
--S
------------------------------
Date: Mon, 10 Dec 2007 05:42:14 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Mon Dec 10 2007
Message-Id: <JstJuE.1zvA@zorch.sf-bay.org>
The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN). You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.
Audio-Analyzer-0.03
http://search.cpan.org/~triddle/Audio-Analyzer-0.03/
----
CPAN-1.92_53
http://search.cpan.org/~andk/CPAN-1.92_53/
query, download and build perl modules from CPAN sites
----
Catalyst-Model-Estraier-0.0.3
http://search.cpan.org/~takeru/Catalyst-Model-Estraier-0.0.3/
Hyper Estraier model class for Catalyst
----
Class-AutoGenerate-0.01
http://search.cpan.org/~hanenkamp/Class-AutoGenerate-0.01/
Automatically generate code upon require or use
----
Class-Component-0.08
http://search.cpan.org/~yappo/Class-Component-0.08/
pluggable component framework
----
Data-Rlist-1.38
http://search.cpan.org/~aspindler/Data-Rlist-1.38/
A lightweight data language for Perl, C and C++
----
Exporter-5.61b
http://search.cpan.org/~ferreira/Exporter-5.61b/
Implements default import method for modules
----
Exporter-5.62c
http://search.cpan.org/~ferreira/Exporter-5.62c/
Implements default import method for modules
----
File-Tabular-Web-0.18
http://search.cpan.org/~dami/File-Tabular-Web-0.18/
turn a tabular file into a web application
----
Gnome2-Wnck-0.15
http://search.cpan.org/~tsch/Gnome2-Wnck-0.15/
Perl interface to the Window Navigator Construction Kit
----
HTML-Feature-2.00004
http://search.cpan.org/~miki/HTML-Feature-2.00004/
Extract Feature Sentences From HTML Documents
----
HTTP-RobotsTag-0.00001
http://search.cpan.org/~dmaki/HTTP-RobotsTag-0.00001/
Parse Robots Tag In HTTP Headers
----
InSilicoSpectro-Databanks-0.0.24
http://search.cpan.org/~alexmass/InSilicoSpectro-Databanks-0.0.24/
parsing protein/nucleotides sequence databanks (fasta, uniprot...)
----
InSilicoSpectro-Databanks-0.0.25
http://search.cpan.org/~alexmass/InSilicoSpectro-Databanks-0.0.25/
parsing protein/nucleotides sequence databanks (fasta, uniprot...)
----
InSilicoSpectro-Databanks-0.0.26
http://search.cpan.org/~alexmass/InSilicoSpectro-Databanks-0.0.26/
parsing protein/nucleotides sequence databanks (fasta, uniprot...)
----
InSilicoSpectro-Databanks-0.0.27
http://search.cpan.org/~alexmass/InSilicoSpectro-Databanks-0.0.27/
parsing protein/nucleotides sequence databanks (fasta, uniprot...)
----
JSON-1.99_03
http://search.cpan.org/~makamaka/JSON-1.99_03/
JSON (JavaScript Object Notation) encoder/decoder
----
Language-MuldisD-0.13.0
http://search.cpan.org/~duncand/Language-MuldisD-0.13.0/
Formal spec of Muldis D relational DBMS lang
----
Lingua-JA-Hepburn-Passport-0.02
http://search.cpan.org/~miyagawa/Lingua-JA-Hepburn-Passport-0.02/
Hepburn Romanization using Japanese passport rules
----
Mac-Errors-1.14
http://search.cpan.org/~bdfoy/Mac-Errors-1.14/
constants for Mac error codes
----
MacOSX-Alias-0.10_01
http://search.cpan.org/~bdfoy/MacOSX-Alias-0.10_01/
Read or create Mac OS X aliases
----
Math-GMPf-0.24
http://search.cpan.org/~sisyphus/Math-GMPf-0.24/
perl interface to the GMP library's floating point (mpf) functions.
----
Math-GMPq-0.24
http://search.cpan.org/~sisyphus/Math-GMPq-0.24/
perl interface to the GMP library's rational (mpq) functions.
----
Math-GMPz-0.24
http://search.cpan.org/~sisyphus/Math-GMPz-0.24/
perl interface to the GMP library's integer (mpz) functions.
----
Math-NoCarry-1.11
http://search.cpan.org/~bdfoy/Math-NoCarry-1.11/
Perl extension for no carry arithmetic
----
Muldis-DB-0.6.0
http://search.cpan.org/~duncand/Muldis-DB-0.6.0/
Full-featured truly relational DBMS in Perl
----
Music-Audioscrobbler-MPD-0.03
http://search.cpan.org/~ealleniii/Music-Audioscrobbler-MPD-0.03/
Module providing routines to submit songs to last.fm from MPD
----
Music-Tag-0.25
http://search.cpan.org/~ealleniii/Music-Tag-0.25/
Module for collecting information about music files.
----
Net-MirrorDir-0.06
http://search.cpan.org/~knorr/Net-MirrorDir-0.06/
Perl extension for compare local-directories and remote-directories with each other
----
Net-Netcraft-Query-0.01
http://search.cpan.org/~mcantoni/Net-Netcraft-Query-0.01/
Query the Netcraft webserver search
----
News-Newsrc-1.09
http://search.cpan.org/~swmcd/News-Newsrc-1.09/
manage newsrc files
----
Object-Iterate-1.11
http://search.cpan.org/~bdfoy/Object-Iterate-1.11/
iterators for objects that know the next element
----
Ogre-0.34
http://search.cpan.org/~slanning/Ogre-0.34/
Perl binding for the OGRE C++ graphics library
----
Ogre-BetaGUI-0.02
http://search.cpan.org/~slanning/Ogre-BetaGUI-0.02/
----
Parse-Marpa-0.001_052
http://search.cpan.org/~jkegl/Parse-Marpa-0.001_052/
(pre-Alpha) Jay Earley's general parsing algorithm, with LR(0) precomputation
----
Test-Harness-3.05
http://search.cpan.org/~andya/Test-Harness-3.05/
Run Perl standard test scripts with statistics
----
Text-Template-Simple-0.49_07
http://search.cpan.org/~burak/Text-Template-Simple-0.49_07/
Simple text template engine
----
Text-Undiacritic-0.01
http://search.cpan.org/~wollmers/Text-Undiacritic-0.01/
remove diacritics from a string
----
Text-Undiacritic-0.02
http://search.cpan.org/~wollmers/Text-Undiacritic-0.02/
remove diacritics from a string
----
Tie-Sub-0.05
http://search.cpan.org/~steffenw/Tie-Sub-0.05/
Tying a subroutine, function or method to a hash
----
Tk-LogScale-0.08
http://search.cpan.org/~srezic/Tk-LogScale-0.08/
A logarithmic Scale widget
----
Tree-DAG_Node-1.06
http://search.cpan.org/~cogent/Tree-DAG_Node-1.06/
(super)class for representing nodes in a tree
----
XML-Atom-Ext-Threading-0.01
http://search.cpan.org/~masaki/XML-Atom-Ext-Threading-0.01/
XML::Atom extension for Atom Threading Extensions (RFC 4685)
----
YAML-Syck-1.00
http://search.cpan.org/~audreyt/YAML-Syck-1.00/
Fast, lightweight YAML loader and dumper
----
vms-user-0_02
http://search.cpan.org/~cberry/vms-user-0_02/
If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.
This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
http://www.stonehenge.com/merlyn/LinuxMag/col82.html
print "Just another Perl hacker," # the original
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Mon, 10 Dec 2007 09:55:32 +0100
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: passing arguments to a shell script from a perl script
Message-Id: <fjiuu5$bbn$3@nntp.fujitsu-siemens.com>
aaah wrote:
> Hi
>=20
> You can actually actually indeed do this from within a perl script.=20
> You can also set environment variables from within perl. I'm sure=20
> you will get a few responses on this one as there are various ways,=20
> the simplest way would be to do:
> ______________
> my $script_to_execute =3D "script_name" ;
> my $parameters =3D "one two three" ;
> my $shell_call =3D $script_to_execute . " $parameters" # note the=20
> space
>=20
> system($shell_call)
> ______________
You're not doing anything with the environment other than passing it=20
along implicitly.
You'd have to modify %ENV.
--=20
These are my personal views and not those of Fujitsu Siemens Computers!
Josef M=F6llers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize (T. Pratchett)
Company Details: http://www.fujitsu-siemens.com/imprint.html
------------------------------
Date: Mon, 10 Dec 2007 01:18:23 -0800 (PST)
From: Praki <visitprakashindia@gmail.com>
Subject: Re: Problem in LDAP authentication
Message-Id: <1fdd0403-41b4-45d6-8628-deb083736284@b1g2000pra.googlegroups.com>
On Dec 9, 5:49 pm, "Peter J. Holzer" <hjp-usen...@hjp.at> wrote:
> On 2007-12-08 23:53, Big and Blue <N...@dsl.pipex.com> wrote:
>
> > To valid date with LDAP:
>
> > a) Open an *anonymous* connexion
> > b) search() for the given id with a relevant base (so probably the
> > ou=active,ou=employees,ou=people,o=abc.com" you mention)
> > c) check that you get one, and only one, result from b) and get the dn
> > (distinguished name)
> > d) bind using the dn and the given password
> > e) check whether d) succeeds
>
> > If your LDAP server doesn't allow anonymous connexions then a) needs to be
> > done using a known (to you) LDAP dn + password (so not allowing anon
> > connexions is a bit silly, since you'd need to supply all clienst with an
> > known id/pwd anyway).
>
> If there is a known mapping from the given id to the DN you can skip
> steps a) to c). Just compute the DN from the id, then do steps d) and
> e). Voila, no anonymous access needed.
>
> hp
Really thanks for your replies..
really it was clearing my doubts..
as it is known user i tried with the last two stpes.here is the full
code i m using.
#!/usr/local/bin/perl5
&top();
&login_check();
&bottom();
sub top{
print <<EOM1;
Content-type: text/html
<html>
<head>
<title>Login Authentication</title>
</head>
<body>
EOM1
}
sub bottom{
print <<EOM2;
</body>
</html>
EOM2
}
sub login_check{
use warnings;
use strict;
use Net::LDAP;
my ($userid,$ldap,$mesg,@entries,@attrs,$attr,$entry);
$userid='prakash';
$ldap = Net::LDAP->new('ldap.abc.com', port=> '389');
$mesg = $ldap-
>bind('ou=active,ou=employees,ou=people,o=abc.com',userPassword =>
'test');
$mesg = $ldap->search(filter=>"uid=$userid",
base=>"ou=active,ou=employees,ou=people,o=abc.com");
@entries = $mesg->entries;
foreach $entry (@entries) {
print "dn: " . $entry->dn() . "\n";
@attrs = $entry->attributes();
foreach $attr (@attrs) {
printf("\t%s: %s\n", $attr, $entry->get_value($attr));
}
}
}
$mesg = $ldap-
>bind('ou=active,ou=employees,ou=people,o=abc.com',userPassword =>
'test');
i have given here userPassword because it was given like this in our
schema or it is as standard password only will come. i tried givenin
password also.
problem is even when if i give the worong password it read the
directory ..
sorry for bugging u all.. i dont know where im going wrong.
------------------------------
Date: Mon, 10 Dec 2007 07:50:30 -0800 (PST)
From: Praki <visitprakashindia@gmail.com>
Subject: Re: Problem in LDAP authentication
Message-Id: <7697f2ce-44de-42eb-a717-93262799117b@e10g2000prf.googlegroups.com>
On Dec 10, 2:18 pm, Praki <visitprakashin...@gmail.com> wrote:
> On Dec 9, 5:49 pm, "Peter J. Holzer" <hjp-usen...@hjp.at> wrote:
>
>
>
> > On 2007-12-08 23:53, Big and Blue <N...@dsl.pipex.com> wrote:
>
> > > To valid date with LDAP:
>
> > > a) Open an *anonymous* connexion
> > > b) search() for the given id with a relevant base (so probably the
> > > ou=active,ou=employees,ou=people,o=abc.com" you mention)
> > > c) check that you get one, and only one, result from b) and get the dn
> > > (distinguished name)
> > > d) bind using the dn and the given password
> > > e) check whether d) succeeds
>
> > > If your LDAP server doesn't allow anonymous connexions then a) needs to be
> > > done using a known (to you) LDAP dn + password (so not allowing anon
> > > connexions is a bit silly, since you'd need to supply all clienst with an
> > > known id/pwd anyway).
>
> > If there is a known mapping from the given id to the DN you can skip
> > steps a) to c). Just compute the DN from the id, then do steps d) and
> > e). Voila, no anonymous access needed.
>
> > hp
>
> Really thanks for your replies..
>
> really it was clearing my doubts..
>
> as it is known user i tried with the last two stpes.here is the full
> code i m using.
>
> #!/usr/local/bin/perl5
> &top();
> &login_check();
> &bottom();
> sub top{
> print <<EOM1;
> Content-type: text/html
>
> <html>
> <head>
> <title>Login Authentication</title>
> </head>
> <body>
> EOM1}
>
> sub bottom{
> print <<EOM2;
> </body>
> </html>
> EOM2}
>
> sub login_check{
>
> use warnings;
> use strict;
> use Net::LDAP;
>
> my ($userid,$ldap,$mesg,@entries,@attrs,$attr,$entry);
> $userid='prakash';
> $ldap = Net::LDAP->new('ldap.abc.com', port=> '389');
>
> $mesg = $ldap->bind('ou=active,ou=employees,ou=people,o=abc.com',userPassword =>
>
> 'test');
>
> $mesg = $ldap->search(filter=>"uid=$userid",
> base=>"ou=active,ou=employees,ou=people,o=abc.com");
> @entries = $mesg->entries;
> foreach $entry (@entries) {
> print "dn: " . $entry->dn() . "\n";
> @attrs = $entry->attributes();
> foreach $attr (@attrs) {
> printf("\t%s: %s\n", $attr, $entry->get_value($attr));
> }
> }
>
> }
>
> $mesg = $ldap->bind('ou=active,ou=employees,ou=people,o=abc.com',userPassword =>
>
> 'test');
>
> i have given here userPassword because it was given like this in our
> schema or it is as standard password only will come. i tried givenin
> password also.
> problem is even when if i give the worong password it read the
> directory ..
>
> sorry for bugging u all.. i dont know where im going wrong.
really thanks for all your replies i got it working
i did the follwing change ..
$mesg = $ldap->bind( dn => "uid=$userid, ou=active, ou=employees,
ou=people, o=abc.com", password => $pw );
die return 0 if $mesg->code;
Thanks for all your help...
Prakash
------------------------------
Date: 10 Dec 2007 02:37:35 GMT
From: xhoster@gmail.com
Subject: Re: Questions about the operator \(...)
Message-Id: <20071209213738.499$vI@newsreader.com>
Ben Morrow <ben@morrow.me.uk> wrote:
> Quoth Todd <xueweizhong@gmail.com>:
> >
> > > perldoc perlref
> > I don't think perlref have the explanation about this.
>
> It's not terribly obvious: I had to read it several times before I found
> it. It's in "Making References", item 2 (about []):
>
> Taking a reference to an enumerated list is not the same as using
> square brackets‐‐instead it’s the same as creating a list of
> refer‐ ences!
>
> @list = (\$a, \@b, \%c);
> @list = \($a, @b, %c); # same thing!
>
> As a special case, "\(@foo)" returns a list of references to the
> contents of @foo, not a reference to @foo itself. Likewise for
> %foo, except that the key references are to copies (since the keys
> are just strings rather than full‐fledged scalars).
>
> The 'special case' is actually backwards here: one would expect (@foo)
> to interpolate the contents of @foo, so it's \(@foo, @bar) (and \@foo
> itself, of course) that is the special case.
Well, except that it just explicitly said what \(@foo, @bar) did.
So \(@foo) is a special case *compared to what it had just said*.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.
------------------------------
Date: Mon, 10 Dec 2007 04:15:07 -0800 (PST)
From: Jacoos Deathplanter <deathplanter@gmail.com>
Subject: XTEA/MCrypt: Trying to port my application from C++.
Message-Id: <d7f0e5dd-8e55-41b1-b3ad-be4bf1995dd6@l1g2000hsa.googlegroups.com>
Hi folks,
I have recently begun writing a simple Unix Tibia proxy server. The
problem was that I soon needed to add scripting support and my C++ toy
needed to be re-written from scratch into some more flexible
environment - re-compiling my server after every single patch is
simply not a task for me.
Anyways, I'm trying to implement Tibia protocol in Perl out of
boredom. Encryption's the problem - developers use a combination of
RSA while establishing the connection and both little endian and XTEA
which I have no clue about. I looked Wikipedia up, analysed the
similar project's source code (C++) and looks like I'm stuck. Here's
the code I'm trying to port: http://wklej.org/id/9b6ff662e9
I also tried to make MCrypt work with XTEA, but the documentation of
this library is just wrong. I can't seem to find there any info how to
use it with XTEA - there are a lot variants to use and it looks like
it works, but... although it encrypts and decrypts stuff properly,
even setting delta as it should be doesn't help the official Tibia
client connect to my proxy and I'm sure it's XTEA's fault. I'd love to
get some sample code.
Thank you all in advance,
Deathplanter.
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V11 Issue 1102
***************************************