Windows: Do not double increment cm_data.currentCells
[openafs.git] / src / WINNT / afsd / afskfw.h
1 /*
2 * Copyright (c) 2004, 2005, 2006 Secure Endpoints Inc.
3 * Copyright (c) 2003 SkyRope, LLC
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are met:
8  *
9  * - Redistributions of source code must retain the above copyright notice,
10  *   this list of conditions and the following disclaimer.
11  * - Redistributions in binary form must reproduce the above copyright notice,
12  *   this list of conditions and the following disclaimer in the documentation
13  *   and/or other materials provided with the distribution.
14  * - Neither the name of Skyrope, LLC nor the names of its contributors may be
15  *   used to endorse or promote products derived from this software without
16  *   specific prior written permission from Skyrope, LLC.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
21  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
22  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  *
30  */
31
32 #ifndef AFSKFW_H
33 #define AFSKFW_H
34
35 #ifdef  __cplusplus
36 extern "C" {
37 #endif
38 #include <afs/stds.h>
39 #include <afs/auth.h>
40 #include <afs/cellconfig.h>
41 #include <cm_config.h>
42 #include <rx/rxkad.h>
43
44 #define CELL_MAXNAMELEN 256
45 #define MAXHOSTCHARS   64
46 #define MAXHOSTSPERCELL 8
47 #define TRANSARCAFSDAEMON "TransarcAFSDaemon"
48
49 void KFW_initialize(void);
50 void KFW_cleanup(void);
51 int  KFW_is_available(void);
52 int  KFW_AFS_destroy_tickets_for_cell(char *);
53 int  KFW_AFS_destroy_tickets_for_principal(char *);
54 int  KFW_AFS_renew_expiring_tokens(void);
55 int  KFW_AFS_get_cred( char * username,
56                         char * cell,
57                         char * password,
58                         int lifetime,
59                         char * smbname,
60                         char ** reasonP );
61 int  KFW_AFS_renew_token_for_cell(char * cell);
62 int  KFW_AFS_renew_tokens_for_all_cells(void);
63 BOOL KFW_AFS_wait_for_service_start(void);
64 BOOL KFW_probe_kdc(struct afsconf_cell *);
65 int  KFW_AFS_get_cellconfig(char *, struct afsconf_cell *, char *);
66 void KFW_import_windows_lsa(void);
67 BOOL KFW_AFS_get_lsa_principal(char *, DWORD *);
68 int  KFW_AFS_set_file_cache_dacl(char *filename, HANDLE hUserToken);
69 int  KFW_AFS_obtain_user_temp_directory(HANDLE hUserToken, char *newfilename, int size);
70 int  KFW_AFS_copy_file_cache_to_default_cache(char * filename);
71 char * KFW_get_default_realm(void);
72
73
74 /* These functions are only to be used in the afslogon.dll */
75 void KFW_AFS_copy_cache_to_system_file(char *, char *);
76 int  KFW_AFS_copy_system_file_to_default_cache(char *);
77
78 /* From afs/krb_prot.h */
79 /* values for kerb error codes */
80 #define         KERB_ERR_OK                              0
81 #define         KERB_ERR_NAME_EXP                        1
82 #define         KERB_ERR_SERVICE_EXP                     2
83 #define         KERB_ERR_AUTH_EXP                        3
84 #define         KERB_ERR_PKT_VER                         4
85 #define         KERB_ERR_NAME_MAST_KEY_VER               5
86 #define         KERB_ERR_SERV_MAST_KEY_VER               6
87 #define         KERB_ERR_BYTE_ORDER                      7
88 #define         KERB_ERR_PRINCIPAL_UNKNOWN               8
89 #define         KERB_ERR_PRINCIPAL_NOT_UNIQUE            9
90 #define         KERB_ERR_NULL_KEY                       10
91
92 /* From afs/krb.h */
93 #ifndef RD_AP_TIME
94 #define           RD_AP_TIME     37       /* delta_t too big */
95 #endif
96 #ifndef INTK_BADPW
97 #define           INTK_BADPW     62       /* Incorrect password */
98 #endif
99
100 #define PROBE_USERNAME               "OPENAFS-KDC-PROBE"
101 #define PROBE_PASSWORD_LEN           16
102
103 #define DO_NOT_REGISTER_VARNAME  "OPENAFS_DO_NOT_REGISTER_AFS_ID"
104 #ifdef  __cplusplus
105 }
106 #endif
107 #endif /* AFSKFW_H */