[15433] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 2843 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Apr 22 14:10:31 2000

Date: Sat, 22 Apr 2000 11:10:12 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <956427012-v9-i2843@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sat, 22 Apr 2000     Volume: 9 Number: 2843

Today's topics:
        MD5 Passwords (was Re: setpwent/getpwent) <gellyfish@gellyfish.com>
        Open file 2 times writing then append  <chris@aol.com>
    Re: Passing Variables Out of Subprocedures <gellyfish@gellyfish.com>
    Re: setpwent/getpwent <gellyfish@gellyfish.com>
        UNC drive\path\file for NT Cgi/Perl script (Fred Zimmerman)
    Re: UNC drive\path\file for NT Cgi/Perl script <lr@hpl.hp.com>
    Re: Which book? <gellyfish@gellyfish.com>
    Re: Which book? <elaine@chaos.wustl.edu>
    Re: Which book? <uri@sysarch.com>
    Re: Which book? <uri@sysarch.com>
    Re: Which book? <elaine@chaos.wustl.edu>
    Re: Writing PDF Files... <DNess@Home.Com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 22 Apr 2000 12:29:17 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: MD5 Passwords (was Re: setpwent/getpwent)
Message-Id: <8ds2ed$m28$1@orpheus.gellyfish.com>

On 22 Apr 2000 11:10:29 +0100 Jonathan Stowe wrote:
> On Fri, 21 Apr 2000 17:33:26 -0600 Michael Roinestad wrote:
>> Craig Berry wrote:
>> 
>>> Michael Roinestad (michaelr@apgtest.com) wrote:
>>> : Thank you for your views, but I think the original question was
>>> : "why doesn't this code detect matches".
>>>
>>> It was indeed; free advice was dispensed along the way.  I believe your
>>> real problem is that the password file doesn't contain what you think it
>>> does.
>>>
>>
>> Since posting the original message, I got the code to work on an
>> in-house server.  The in-house server is running a HP flavored Unix. The
>> code revealed the password's for all but 4(outta 30) of our users.
>> However when I copied the code to the server of concern, again nothing.
>> Using the root login made no difference either.  The server of concern
>> is running Linux should that make a difference ?
> 
> 
> Er.  You didnt say that before.  It may well make a difference if you have
> say Red Hat 6 that uses MD5 to encrypt the passwords rather than the
> standard crypt (although it will use standard passwords if they are there).
> 
> i.e. the password looks like :
> 
>    $1$Q6V3CETr$1VhqjUp9VM430J8339fO/.
> 

I have just answered this for myself.  If you do have passwords look like
this and your crypt function doesnt return passwords that look like this
then you should get the module Crypt::PasswdMD5 which when passed the
second field as the 'salt' and your unencrypted password will return
a string like the above.

Having had a little poke around I have also discovered that libcrypt_p has
*two* functions crypt() that does the standard DES password encryption and
md5_crypt() that makes the MD5 crypted passwords as above.  I guess that it
would be a little tricky to have 'Configure' determine whether that function
(indeed library) is available and get the user to choose whether they wanted
to use DES or MD5 encryption for crypt() - bearing in mind that the normal
libcrypt doesnt make md5_crypt available externally (although it has the
function).  I guess that an extra test could be added to hints/linux.sh
to determine these things and then prompt the user so they can use the
crypt type that is used in their passwd file.  Maybe I'll have a little
hack around with this over the weekend.

/J\
-- 
Mmmm, forbidden donut.
-- 
fortune oscar homer


------------------------------

Date: Sat, 22 Apr 2000 11:09:07 -0700
From: chris <chris@aol.com>
Subject: Open file 2 times writing then append 
Message-Id: <3901EAC2.4B51F573@aol.com>

Hi all,
Quick question, I am trying to open a file 1 time to I am updating some
statistics.
open (NEWREG, ">$basepath$regdir/$form{'ALIAS'}.dat") or die "can't
append to file: $!";
print NEWREG "$np\n$nnn\n$pnn\n";
close NEWREG;

then next time i need to append information to the end of the file.

open(REGFILE, ">>$basepath$regdir/$form{'ALIAS'}.dat") or die "can't
append to file: $!";
print REGFILE "$form{'ALIAS2'}\[\]$form{'ITEM'}\[\]$form{'RATES'}\n";
close REGFILE;


However when I use both I cannot get the append to work.

with both it will update the counts correctly..but just overwrites the
line i am trying to add information after.

if i take out the writing (update the stats) it will append to the end
of the lines.

How can i accomplish both?




------------------------------

Date: 22 Apr 2000 14:09:26 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Passing Variables Out of Subprocedures
Message-Id: <8ds8a6$m93$1@orpheus.gellyfish.com>

On Fri, 21 Apr 2000 10:07:07 -0700 Gabe wrote:
> I'm sure this is covered in the docs somewhere, if so, please just tell me
> where.
> 
> Suppose I want to pass variables from one sub procedure to another. How?
> 
> i.e.
> 
> sub foo {
> my ($this,$that,$theother) = ();
> open (FILE, $file) or die &error;
> }
> 
> sub error {
> print $this $that $theother;
> }
> 

I would read the perlsub manpage.  In common with most modern languages
Perl supports the passing of parameters to subroutines and the return
of values from subroutines.

I think what you mean is something like :

sub foo {
open (FILE, $file) or die &error('this','that','theother');
}

sub error 
{
   my ($this,$that,$theother) = @_; 
   return "$this $that $theother";
}


Though I cant really be sure.  Go and read perlsub and then come back if
you have any further questions.

/J\
-- 
Get away bees!!!..shoo!...oow.....OOOWW!!!!! Oh, they're defending
themselves somehow...!!
-- 
fortune oscar homer


------------------------------

Date: 22 Apr 2000 12:37:40 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: setpwent/getpwent
Message-Id: <8ds2u4$m2v$1@orpheus.gellyfish.com>

On Fri, 21 Apr 2000 14:14:49 -0600 Michael Roinestad wrote:
> Our off-site administator likes to pick passwords that can be guessed
> with little or no effort (the users name for example or my favorite root
> for the root-account).
> I have been trying to convince him to make them at least a little
> harder. Oops... I'm rambling,
> The following code is supposed detect matches but doesn't.
> 
> == BEGIN
> #!/usr/bin/perl
> 
> $oldVal = $/;
> 
> $/ = undef;
> open(PASSWD, shift) || die "Invalid password file.\n";
> $Passwd = <PASSWD>;
> close(PASSWD);
> 
> @Passwd = split(/\n/, $Passwd);
> 
> setpwent;
> while(($u,$c) = getpwent) {
>     CrackedIt($u,$u) if crypt($u,$c) eq $c;
>     foreach (@Passwd) {
>         print "$u cmp $_\n";
>         CrackedIt($u,$_) if crypt($_,$c) eq $c;
>     }
> }
> 

BTW on some systems getpwent() *will not* return the encrypted password
from /etc/shadow because a separate set of library functions are used
to access this information.  OS that do this include SCO OpenServer and Linux.
If you need to access this information on such a system you will need to
read /etc/shadow directly I'm afraid until such time as someone comes up
with a way of overcoming this (I have an idea *how* it could be done but
I dont know if I could be arsed right now.)

/J\
-- 
Awww, there's only one beer left and it's Barts.
-- 
fortune oscar homer


------------------------------

Date: Sat, 22 Apr 2000 17:23:04 GMT
From: fredz@silversoftware.com (Fred Zimmerman)
Subject: UNC drive\path\file for NT Cgi/Perl script
Message-Id: <3901dfa1.454599880@news.ne.mediaone.net>

How do I specify a drivename:\pathname\filename within a Perl/CGI
script.
I am running CGI on NT/IIS system.

I tried the following which failed to open file:

file:///d:/cgi/movies.dat

Thanks,

fredz@silversoftware.com


------------------------------

Date: Sat, 22 Apr 2000 10:45:31 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: UNC drive\path\file for NT Cgi/Perl script
Message-Id: <MPG.136b84fcb39b08ca98a95c@nntp.hpl.hp.com>

In article <3901dfa1.454599880@news.ne.mediaone.net> on Sat, 22 Apr 2000 
17:23:04 GMT, Fred Zimmerman <fredz@silversoftware.com> says...
> How do I specify a drivename:\pathname\filename within a Perl/CGI
> script.
> I am running CGI on NT/IIS system.
> 
> I tried the following which failed to open file:
> 
> file:///d:/cgi/movies.dat

That 'file:///' is an artifact of a browser to provide a 'scheme', 
similar to 'http://'.

To open the file, give it the complete filesystem path.  Stick with the 
forward slashes, for readability and maintainability.

    'd:/cgi/movies.dat'

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


------------------------------

Date: 22 Apr 2000 14:15:45 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Which book?
Message-Id: <8ds8m1$m9q$1@orpheus.gellyfish.com>

On Sat, 22 Apr 2000 09:43:51 GMT mark_g@cyberdude.com wrote:
> Which of the O'Reilly Perl books is best for someone who knows a little
> bit of Perl programming but wants a more complete knowledge of the
> language, "Learning Perl" or "Programming Perl" ?
> 

Thats a bit loaded when you say "O'Reilly book" ;-}  I have both editions
of Programming Perl and both are very good.  For a wider examination of
all the books available you might want to look at Uri's book thing
via <http://www.sysarch.com>.

/J\
-- 
Oh, everything's too damned expensive these days. This Bible cost 15
bucks! And talk about a preachy book! Everybody's a sinner! Except
this guy.
-- 
fortune oscar homer


------------------------------

Date: Sat, 22 Apr 2000 16:58:04 GMT
From: Elaine Ashton <elaine@chaos.wustl.edu>
Subject: Re: Which book?
Message-Id: <B5275296.2CB7%elaine@chaos.wustl.edu>

in article 8ds8m1$m9q$1@orpheus.gellyfish.com, Jonathan Stowe at
gellyfish@gellyfish.com quoth:

> Thats a bit loaded when you say "O'Reilly book" ;-}  I have both editions
> of Programming Perl and both are very good.  For a wider examination of
> all the books available you might want to look at Uri's book thing
> via <http://www.sysarch.com>.

Well...ORA got in on the deal early :) But, I don't quite like Uri's book
thing just  yet as the ratings are quantified and there aren't enough of
them...it's a bit confusing methinks.

I like http://www.netaxs.com/~joc/perlbooks.html

e.



------------------------------

Date: Sat, 22 Apr 2000 17:07:49 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Which book?
Message-Id: <x7itxa5ajf.fsf@home.sysarch.com>

>>>>> "EA" == Elaine Ashton <elaine@chaos.wustl.edu> writes:

  EA> in article 8ds8m1$m9q$1@orpheus.gellyfish.com, Jonathan Stowe at
  EA> gellyfish@gellyfish.com quoth:

  >> Thats a bit loaded when you say "O'Reilly book" ;-}  I have both editions
  >> of Programming Perl and both are very good.  For a wider examination of
  >> all the books available you might want to look at Uri's book thing
  >> via <http://www.sysarch.com>.

  EA> Well...ORA got in on the deal early :) But, I don't quite like Uri's book
  EA> thing just  yet as the ratings are quantified and there aren't enough of
  EA> them...it's a bit confusing methinks.

help is always welcome. it is meant to be an open list and not my
personal fiefdom.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


------------------------------

Date: Sat, 22 Apr 2000 17:15:36 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Which book?
Message-Id: <x7em7y5a6g.fsf@home.sysarch.com>

>>>>> "EA" == Elaine Ashton <elaine@chaos.wustl.edu> writes:

  EA> I like http://www.netaxs.com/~joc/perlbooks.html

i just looked at this site and it is missing some very good and recent
books like OO Perl and elements. it seems to have not been updated in a
while and mostly has o'reilly books. but it looks nice and is useful in
its way. i am going to write to him and see if we can work together. my
goal is just to have a very good perl books list on the net with lots of
books and info.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


------------------------------

Date: Sat, 22 Apr 2000 17:24:14 GMT
From: Elaine Ashton <elaine@chaos.wustl.edu>
Subject: Re: Which book?
Message-Id: <B52758BA.2CC4%elaine@chaos.wustl.edu>

in article x7em7y5a6g.fsf@home.sysarch.com, Uri Guttman at uri@sysarch.com
quoth:
> its way. i am going to write to him and see if we can work together. my
> goal is just to have a very good perl books list on the net with lots of
> books and info.

Do! I like his presentation more than yours as its organisation is easier to
navigate. Perhaps you two can work together and create a canonical booklist.

e.



------------------------------

Date: Sat, 22 Apr 2000 17:18:55 GMT
From: David Ness <DNess@Home.Com>
Subject: Re: Writing PDF Files...
Message-Id: <3901DF02.6FCFA919@Home.Com>

For me the answer would depend (a lot) on whether I was generating the
documents `live' or not. If I wanted to do `serious' typesetting of
the documents I'd use some (La)TeX based PDF generator which you might
find via http://www.tug.org, the TeX User's Group site.

sept00@my-deja.com wrote:
> 
> I'm sorry if this has been asked before, but I've been trying to find a
> library to generate PDF-documents out of database data.
> 
> I need good formatting capabilities, but not much else.
> 
> I'd be very happy if someone could point me into the right direction
> here...
> 
> Thanks,
> Tom
>


------------------------------

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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 V9 Issue 2843
**************************************


home help back first fref pref prev next nref lref last post