2003-01-21 09:20:13 -05:00
|
|
|
\chapter{Parsing Netrc Files}\label{cha:netrc}
|
2002-02-12 06:50:54 -05:00
|
|
|
%
|
2003-01-21 09:20:13 -05:00
|
|
|
The \ex{netrc} structures provides procedures to parse authentication
|
|
|
|
information contained in \ex{~/.netrc}.
|
2002-02-12 06:50:54 -05:00
|
|
|
|
2003-01-21 09:20:13 -05:00
|
|
|
On Unix systems the netrc file may contain information allowing
|
|
|
|
automatic login to remote hosts. The format of the file is defined in
|
|
|
|
the \ex{ftp(1)} manual page. Example lines are
|
|
|
|
%
|
|
|
|
\begin{verbatim}
|
2002-02-12 06:50:54 -05:00
|
|
|
machine ondine.cict.fr login marsden password secret
|
2003-01-21 09:20:13 -05:00
|
|
|
default login anonymous password user@site
|
|
|
|
\end{verbatim}
|
|
|
|
%
|
|
|
|
The netrc file should be protected by appropriate permissions, and
|
2002-02-12 06:50:54 -05:00
|
|
|
(like \ex{/usr/bin/ftp}) this library will refuse to read the file if it is
|
2003-01-21 09:20:13 -05:00
|
|
|
badly protected. (unlike \ex{ftp} this library will always refuse
|
|
|
|
to read the file----\ex{ftp} refuses it only if the password is
|
|
|
|
given for a non-default account). Appropriate permissions are set if
|
2002-02-12 06:50:54 -05:00
|
|
|
only the user has permissions on the file.
|
|
|
|
|
2003-01-21 09:20:13 -05:00
|
|
|
\defun{netrc-machine-entry}{host accept-default? [file-name]}{netrc-entry-or-\sharpf}
|
2002-04-03 14:15:52 -05:00
|
|
|
\begin{desc}
|
2003-01-21 09:20:13 -05:00
|
|
|
This procedure looks for the entry related to given host in the
|
|
|
|
user's netrc file. The host is specified in \var{host}.
|
|
|
|
\var{Accept-default?} specifies whether \ex{netrc-machine-entry}
|
|
|
|
should fall back to the default entry if there is no macht for
|
|
|
|
\var{host} in the netrc file. If specified, \var{file-name}
|
|
|
|
specifies an alternate file name for the netrc data. It defaults to
|
|
|
|
\ex{.netrc} in the current user's home directory.
|
|
|
|
|
|
|
|
\ex{Netrc-machine-entry} returns a netrc entry (see below) if it was
|
|
|
|
able to find the requested information; if not, it returns \sharpf.
|
|
|
|
|
|
|
|
If the netrc file had inappropriate permissions, \ex{netrc-machine-entry}
|
|
|
|
raises an error.
|
2002-04-03 14:15:52 -05:00
|
|
|
\end{desc}
|
2002-02-12 06:50:54 -05:00
|
|
|
|
2003-01-21 09:20:13 -05:00
|
|
|
\defun{netrc-entry?}{thing}{boolean}
|
|
|
|
\defunx{netrc-entry-machine}{netrc-entry}{string}
|
|
|
|
\defunx{netrc-entry-login}{netrc-entry}{string-or-\sharpf}
|
|
|
|
\defunx{netrc-entry-password}{netrc-entry}{string-or-\sharpf}
|
|
|
|
\defunx{netrc-entry-account}{netrc-entry}{string-or-\sharpf}
|
|
|
|
\begin{desc}
|
|
|
|
\ex{Netrc-entry?} is the predicate for netrc entries. The other
|
|
|
|
procedures are selectors for netrc entries as returned by
|
|
|
|
\ex{netrc-machine-entry}. They return \sharpf{} if the netrc file
|
|
|
|
didn't contain a binding for the corresponding field.
|
|
|
|
\end{desc}
|
2002-02-12 06:50:54 -05:00
|
|
|
|
2003-01-21 09:20:13 -05:00
|
|
|
\defun{netrc-macro-definitions}{[file-name]}{alist}
|
|
|
|
\begin{desc}
|
|
|
|
This returns the macro definitions from the netrc files, represented
|
|
|
|
as an alist mapping macro names---represented as strings---to
|
|
|
|
definitions---represented as lists of strings.
|
|
|
|
\end{desc}
|
2002-02-12 06:50:54 -05:00
|
|
|
|
|
|
|
%%% Local Variables:
|
|
|
|
%%% mode: latex
|
2002-08-21 10:52:34 -04:00
|
|
|
%%% TeX-master: "man"
|
2002-02-12 06:50:54 -05:00
|
|
|
%%% End:
|