man-pages/man3/XauGetAuthByAddr.3.html
2021-03-31 01:06:50 +01:00

141 lines
4.9 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of Xau</TITLE>
</HEAD><BODY>
<H1>Xau</H1>
Section: C Library Functions (3)<BR>Updated: libXau 1.0.9<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
Xau library: XauFileName, XauReadAuth, XauLockAuth, XauUnlockAuth,
XauWriteAuth, XauDisposeAuth,
XauGetAuthByAddr, XauGetBestAuthByAddr - X authority database routines
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<PRE>
#include &lt;<A HREF="file:///usr/include/X11/Xauth.h">X11/Xauth.h</A>&gt;
typedef struct xauth {
unsigned short family;
unsigned short address_length;
char *address;
unsigned short number_length;
char *number;
unsigned short name_length;
char *name;
unsigned short data_length;
char *data;
} Xauth;
<DL COMPACT>
<DT id="1"><DD>char *XauFileName (void);
<DT id="2"><DD>Xauth *XauReadAuth (FILE *<I>auth_file</I>);
<DT id="3"><DD>int XauWriteAuth (FILE *<I>auth_file</I>, Xauth *<I>auth</I>);
<DT id="4"><DD>Xauth *XauGetAuthByAddr (unsigned short <I>family</I>, unsigned short
<I>address_length</I>, const char *<I>address</I>, unsigned short
<I>number_length</I>, const char *<I>number</I>, unsigned short
<I>name_length</I>, const char *<I>name</I>);
<DT id="5"><DD>Xauth *XauGetBestAuthByAddr (unsigned short <I>family</I>, unsigned short
<I>address_length</I>, const char *<I>address</I>, unsigned short
<I>number_length</I>, const char *<I>number</I>, int <I>types_length</I>,
char **<I>types</I>, const int *<I>type_lengths</I>);
<DT id="6"><DD>int XauLockAuth (const char *<I>file_name</I>, int <I>retries</I>, int
<I>timeout</I>, long <I>dead</I>);
<DT id="7"><DD>int XauUnlockAuth (const char *<I>file_name</I>);
<DT id="8"><DD>int XauDisposeAuth (Xauth *<I>auth</I>);
</PRE>
</DL>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
<P>
<B>XauFileName</B> generates the default authorization file name by first
checking the XAUTHORITY environment variable if set, else it returns
$HOME/.Xauthority. This name is statically allocated and should
not be freed.
<P>
<B>XauReadAuth</B> reads the next entry from <I>auth_file</I>. The entry is
<B>not</B> statically allocated and should be freed by calling
<I>XauDisposeAuth</I>.
<P>
<B>XauWriteAuth</B> writes an authorization entry to <I>auth_file</I>. It
returns 1 on success, 0 on failure.
<P>
<B>XauGetAuthByAddr</B> searches for an entry which matches the given network
address/display number pair. The entry is <B>not</B> statically allocated
and should be freed by calling <I>XauDisposeAuth</I>.
<P>
<B>XauGetBestAuthByAddr</B> is similar to <B>XauGetAuthByAddr</B>, except
that a list of acceptable authentication methods is specified. Xau will
choose the file entry which matches the earliest entry in this list (e.g., the
most secure authentication method). The <I>types</I> argument is an array of
strings, one string for each authentication method. <I>types_length</I>
specifies how many elements are in the <I>types</I> array.
<I>types_lengths</I> is an array of integers representing the length
of each string.
<P>
<B>XauLockAuth</B> does the work necessary to synchronously update an
authorization file. First it makes two file names, one with ``-c'' appended
to <I>file_name</I>, the other with ``-l'' appended. If the ``-c'' file
already exists and is more than <I>dead</I> seconds old, <I>XauLockAuth</I>
removes it and the associated ``-l'' file. To prevent possible
synchronization troubles with NFS, a <I>dead</I> value of zero forces the
files to be removed. <I>XauLockAuth</I> makes <I>retries</I> attempts to
create and link the file names, pausing <I>timeout</I> seconds between each
attempt. <I>XauLockAuth</I> returns a collection of values depending on the
results:
<DL COMPACT>
<DT id="9">LOCK_ERROR<DD>
A system error occurred, either a file_name which is too long, or an
unexpected failure from a system call. errno may prove useful.
<DT id="10">LOCK_TIMEOUT<DD>
<I>retries</I> attempts failed
<DT id="11">LOCK_SUCCESS<DD>
The lock succeeded.
</DL>
<P>
<B>XauUnlockAuth</B> undoes the work of <I>XauLockAuth</I> by unlinking both
the ``-c'' and ``-l'' file names.
<P>
<B>XauDisposeAuth</B> frees storage allocated to hold an authorization entry.
<A NAME="lbAE">&nbsp;</A>
<H2>SEE ALSO</H2>
<A HREF="/cgi-bin/man/man2html?1+xauth">xauth</A>(1), <A HREF="/cgi-bin/man/man2html?1+xdm">xdm</A>(1)
<A NAME="lbAF">&nbsp;</A>
<H2>AUTHOR</H2>
Keith Packard, MIT X Consortium
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="12"><A HREF="#lbAB">NAME</A><DD>
<DT id="13"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="14"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="15"><A HREF="#lbAE">SEE ALSO</A><DD>
<DT id="16"><A HREF="#lbAF">AUTHOR</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:06:00 GMT, March 31, 2021
</BODY>
</HTML>