2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
24 /*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
25 /*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
26 /*%% (c) Copyright 1993, 1994 Novell, Inc. */
27 /*%% $TOG: mp_auth.h /main/2 1999/09/10 15:01:41 mgreess $ */
29 * @(#)mp_auth.h 1.36 95/01/25
31 * Copyright (c) 1990 by Sun Microsystems, Inc.
33 * This file contains the implementation of the _Tt_auth object which
34 * implements the MIT-MAGIC-COOKIE authentication for the _TT_AUTH_ICEAUTH
35 * authentication type. This class is simply a wrapper for calls to
36 * code copied out of the X11 libICE library. Alternatively, one can
37 * compile with the OPT_ICE define and call the ICE routines directly.
41 #include "tt_options.h"
42 #include "mp/mp_auth_functions.h"
43 #include "util/tt_object.h"
44 #include "util/tt_list.h"
45 #include "util/tt_string.h"
48 * As of the CDE release of ToolTalk, _TT_AUTH_XAUTH is no longer supported.
49 * It has been removed along with all references in the TT code, but the
50 * value of _TT_AUTH_DES was not changed to the now-missing value of 1.
53 * As of 2.1.30, the libICE MIT-MAGIC-COOKIE authentication is added in
54 * place of _TT_AUTH_XAUTH. The code was inlined from libICE in such a
55 * way that it could be easily replaced by libICE itself.
58 #define _TT_ICEAUTH_AUTH_NAME "MIT-MAGIC-COOKIE-1"
59 #define _TT_ICEAUTH_MAGIC_COOKIE_LEN 16
60 #define _TT_ICEAUTH_PROTOCOL_NAME "TT"
62 #define _TT_ICEAUTH_DEFAULT_RETRIES 10 /* num of competitors we expect */
63 #define _TT_ICEAUTH_DEFAULT_TIMEOUT 2 /* in seconds, be quick */
64 #define _TT_ICEAUTH_DEFAULT_DEADTIME 600L /* 10 minutes in seconds */
69 _TT_AUTH_UNIX = 0, /* Unix "authentication" */
70 _TT_AUTH_ICEAUTH= 1, /* ICE MIT-COOKIE authentication (default) */
71 _TT_AUTH_DES = 2, /* Secure RPC (DES encryption) */
72 _TT_AUTH_NONE = 3 /* No authentication */
75 class _Tt_auth : public _Tt_object {
77 _Tt_auth(_Tt_auth_level auth_level = _TT_AUTH_ICEAUTH);
80 _Tt_auth_level auth_level() {
83 const _Tt_string &auth_cookie() const {
86 Tt_status generate_auth_cookie();
87 Tt_status retrieve_auth_cookie();
88 Tt_status set_auth_level(_Tt_auth_level auth_level);
89 Tt_status set_sessionid(
91 _Tt_auth_level auth_level,
99 _Tt_auth_level _auth_level;
100 _Tt_string _auth_cookie;
101 _Tt_string _hostaddr;
104 _Tt_string _sessionid;
105 _Tt_string _ttauthfile;
109 // variables associated with generating a .ttauthority file entry.
111 _tt_AuthFileEntryList *_entries_head;
112 _tt_AuthFileEntryList *_entries_tail;
114 Tt_status read_auth_file(char*);
115 Tt_status write_auth_file(char*);
117 Tt_status modify_auth_entry(_tt_AuthFileEntry*,
118 _tt_AuthFileEntryList**);
119 Tt_status read_auth_entries(FILE*,
120 _tt_AuthFileEntryList**);
123 #endif /* MP_AUTH_H */