The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Grips::Gripsrc - OO interface to users gripsrc file

SYNOPSIS

    use Grips::Gripsrc;

    $mach = Grips::Gripsrc->lookup('some.host');
    $id = $mach->id;
    ($id, $user, $pwd) = $mach->iup;

DESCRIPTION

Grips::Gripsrc is a class implementing a simple interface to the .gripsrc file used as by the ftp program.

Grips::Gripsrc also implements security checks just like the ftp program, these checks are, first that the .gripsrc file must be owned by the id and second the ownership permissions should be such that only the owner has read and write access. If these conditions are not met then a warning is output and the .gripsrc file is not read.

THE .gripsrc FILE

The .gripsrc file contains id and initialization information used by the auto-login process. It resides in the user's home directory. The following tokens are recognized; they may be separated by spaces, tabs, or new-lines:

host name

Identify a remote host name. The auto-login process searches the .gripsrc file for a host token that matches the remote host specified. Once a match is made, the subsequent .gripsrc tokens are processed, stopping when the end of file is reached or an- other host or a default token is encountered.

default

This is the same as host name except that default matches any name. There can be only one default token, and it must be after all host tokens. This is normally used as:

    default id anonymous user id@site

thereby giving the user automatic anonymous login to hosts not specified in .gripsrc.

id name

Identify a id on the remote host. If this token is present, the auto-login process will initiate a login using the specified name.

user string

Supply a password. If this token is present, the auto-login process will supply the specified string if the remote server requires a password as part of the login process.

pwd string

Supply an additional password. If this token is present, the auto-login process will supply the specified string if the remote server requires an additional password.

macdef name

Define a macro. Grips::Gripsrc only parses this field to be compatible with ftp.

CONSTRUCTOR

The constructor for a Grips::Gripsrc object is not called new as it does not really create a new object. But instead is called lookup as this is essentially what it does.

lookup ( HOST [, ID ])

Lookup and return a reference to the entry for HOST. If ID is given then the entry returned will have the given login. If ID is not given then the first entry in the .gripsrc file for HOST will be returned.

If a matching entry cannot be found, and a default entry exists, then a reference to the default entry is returned.

METHODS

id ()

Return the id for the gripsrc entry

user ()

Return the user code for the gripsrc entry

pwd ()

Return the pwd information for the gripsrc entry

iup ()

Return a list of id, user and pwd information fir the gripsrc entry

AUTHOR

Tarek Ahmed <ahmed@dimdi.de>

SEE ALSO

Grips::Gripsrc Grips::Cmd

COPYRIGHT

Copyright (c) 2002 DIMDI. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Confession: I took most of the stuff of Net::Netrc and converted it to this module. Thanks, Graham Barr :-)

$Id: Gripsrc.pm,v 1.2 2003-02-04 12:19:08 ahmed Exp $