home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-bin / x11r6.1 / man / cat3 / xauwriteauth.0 < prev    next >
Encoding:
Text File  |  1996-10-17  |  6.3 KB  |  199 lines

  1.  
  2.  
  3.  
  4. Xau(3)                               Xau(3)
  5.  
  6.  
  7. NNAAMMEE
  8.        Xau library: XauFileName, XauReadAuth, XauLockAuth, XauUn-
  9.        lockAuth, XauWriteAuth, XauDisposeAuth,    XauGetAuthByAddr,
  10.        XauGetBestAuthByAddr - X authority database routines
  11.  
  12. SSYYNNOOPPSSIISS
  13.        ##iinncclluuddee <<XX1111//XXaauutthh..hh>>
  14.  
  15.        typedef struct xauth {
  16.         unsigned short family;
  17.         unsigned short address_length;
  18.         char       *address;
  19.         unsigned short number_length;
  20.         char       *number;
  21.         unsigned short name_length;
  22.         char       *name;
  23.         unsigned short data_length;
  24.         char       *data;
  25.        } Xauth;
  26.  
  27.        cchhaarr **XXaauuFFiilleeNNaammee (())
  28.  
  29.        XXaauutthh **XXaauuRReeaaddAAuutthh ((aauutthh__ffiillee))
  30.         _F_I_L_E _*_a_u_t_h___f_i_l_e_;
  31.  
  32.        iinntt XXaauuWWrriitteeAAuutthh ((aauutthh__ffiillee,, aauutthh))
  33.         _F_I_L_E _*_a_u_t_h___f_i_l_e_;
  34.         _X_a_u_t_h _*_a_u_t_h_;
  35.  
  36.        XXaauutthh **XXaauuGGeettAAuutthhBByyAAddddrr ((ffaammiillyy,,
  37.                 aaddddrreessss__lleennggtthh,, aaddddrreessss,,
  38.                 nnuummbbeerr__lleennggtthh,, nnuummbbeerr))
  39.         _u_n_s_i_g_n_e_d _s_h_o_r_t _f_a_m_i_l_y_;
  40.         _u_n_s_i_g_n_e_d _s_h_o_r_t _a_d_d_r_e_s_s___l_e_n_g_t_h_;
  41.         _c_h_a_r _*_a_d_d_r_e_s_s_;
  42.         _u_n_s_i_g_n_e_d _s_h_o_r_t _n_u_m_b_e_r___l_e_n_g_t_h_;
  43.         _c_h_a_r _*_n_u_m_b_e_r_;
  44.  
  45.        XXaauutthh **XXaauuGGeettBBeessttAAuutthhBByyAAddddrr ((ffaammiillyy,,
  46.                     aaddddrreessss__lleennggtthh,, aaddddrreessss,,
  47.                     nnuummbbeerr__lleennggtthh,, nnuummbbeerr,,
  48.                     ttyyppeess__lleennggtthh,, ttyyppeess,, ttyyppee__lleennggtthhss))
  49.         _u_n_s_i_g_n_e_d _s_h_o_r_t _f_a_m_i_l_y_;
  50.         _u_n_s_i_g_n_e_d _s_h_o_r_t _a_d_d_r_e_s_s___l_e_n_g_t_h_;
  51.         _c_h_a_r _*_a_d_d_r_e_s_s_;
  52.         _u_n_s_i_g_n_e_d _s_h_o_r_t _n_u_m_b_e_r___l_e_n_g_t_h_;
  53.         _c_h_a_r _*_n_u_m_b_e_r_;
  54.         _i_n_t _t_y_p_e_s___l_e_n_g_t_h_;
  55.         _c_h_a_r _*_*_t_y_p_e_s_;
  56.         _i_n_t _*_t_y_p_e___l_e_n_g_t_h_s_;
  57.  
  58.        iinntt XXaauuLLoocckkAAuutthh ((ffiillee__nnaammee,, rreettrriieess,, ttiimmeeoouutt,, ddeeaadd))
  59.         _c_h_a_r _*_f_i_l_e___n_a_m_e_;
  60.         _i_n_t _r_e_t_r_i_e_s_;
  61.  
  62.  
  63.  
  64. X Version 11           Release 6.1                1
  65.  
  66.  
  67.  
  68.  
  69.  
  70. Xau(3)                               Xau(3)
  71.  
  72.  
  73.         _i_n_t _t_i_m_e_o_u_t_;
  74.         _l_o_n_g _d_e_a_d_;
  75.  
  76.        iinntt XXaauuUUnnlloocckkAAuutthh ((ffiillee__nnaammee))
  77.         _c_h_a_r _*_f_i_l_e___n_a_m_e_;
  78.  
  79.        XXaauuDDiissppoosseeAAuutthh ((aauutthh))
  80.         _X_a_u_t_h _*_a_u_t_h_;
  81.  
  82.  
  83. DDEESSCCRRIIPPTTIIOONN
  84.        XXaauuFFiilleeNNaammee  generates the default authorization file name
  85.        by first checking the XAUTHORITY environment  variable  if
  86.        set,  else  it  returns    $HOME/.Xauthority.   This name is
  87.        statically allocated and should not be freed.
  88.  
  89.        XXaauuRReeaaddAAuutthh reads the  next  entry  from     _a_u_t_h___f_i_l_e.   The
  90.        entry  is  nnoott statically allocated and should be freed by
  91.        calling _X_a_u_D_i_s_p_o_s_e_A_u_t_h.
  92.  
  93.        XXuuWWrriitteeAAuutthh writes an authorization  entry  to  _a_u_t_h___f_i_l_e.
  94.        It returns 1 on success, 0 on failure.
  95.  
  96.        XXaauuGGeettAAuutthhBByyAAddddrr     searches  for an entry which matches the
  97.        given network address/display number pair.  The    entry  is
  98.        nnoott  statically    allocated  and should be freed by calling
  99.        _X_a_u_D_i_s_p_o_s_e_A_u_t_h.
  100.  
  101.        XXaauuGGeettBBeessttAAuutthhBByyAAddddrr  is     similar   to    XXaauuGGeettAAuutthhBByyAAddddrr,
  102.        except that a list of acceptable authentication methods is
  103.        specified.  Xau will choose the file entry  which  matches
  104.        the  earliest  entry  in     this list (e.g., the most secure
  105.        authentication method).    The _t_y_p_e_s argument is an array of
  106.        strings,      one  string  for  each  authentication  method.
  107.        _t_y_p_e_s___l_e_n_g_t_h specifies how many elements are in the  _t_y_p_e_s
  108.        array.  _t_y_p_e_s___l_e_n_g_t_h_s is an array of integers representing
  109.        the length of each string.
  110.  
  111.        XXaauuLLoocckkAAuutthh  does  the  work  necessary    to  synchronously
  112.        update  an  authorization  file.      First it makes two file
  113.        names, one with ``-c'' appended to  _f_i_l_e___n_a_m_e,  the  other
  114.        with  ``-l''  appended.    If the ``-c'' file already exists
  115.        and is more than _d_e_a_d seconds old, _X_a_u_L_o_c_k_A_u_t_h removes  it
  116.        and  the associated ``-l'' file.     To prevent possible syn-
  117.        chronization troubles with  NFS,     a  _d_e_a_d  value     of  zero
  118.        forces the files to be removed.    _X_a_u_L_o_c_k_A_u_t_h makes _r_e_t_r_i_e_s
  119.        attempts to create and link the file names, pausing  _t_i_m_e_-
  120.        _o_u_t  seconds  between each attempt.  _X_a_u_L_o_c_k_A_u_t_h returns a
  121.        collection of values depending on the results:
  122.  
  123.         LOCK_ERROR       A system error occurred, either a file_name
  124.                which is too long, or an unexpected failure from
  125.                a system call.  errno may prove useful.
  126.  
  127.  
  128.  
  129.  
  130. X Version 11           Release 6.1                2
  131.  
  132.  
  133.  
  134.  
  135.  
  136. Xau(3)                               Xau(3)
  137.  
  138.  
  139.         LOCK_TIMEOUT   _r_e_t_r_i_e_s attempts failed
  140.  
  141.         LOCK_SUCCESS   The lock succeeded.
  142.  
  143.  
  144.        XXaauuUUnnlloocckkAAuutthh undoes the work of _X_a_u_L_o_c_k_A_u_t_h by    unlinking
  145.        both the ``-c'' and ``-l'' file names.
  146.  
  147.        XXaauuDDiissppoosseeAAuutthh  frees  storage allocated to hold an autho-
  148.        rization entry.
  149.  
  150. SSEEEE AALLSSOO
  151.        xauth(1), xdm(1)
  152.  
  153. AAUUTTHHOORR
  154.        Keith Packard, MIT X Consortium
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196. X Version 11           Release 6.1                3
  197.  
  198.  
  199.