DEVEL15-windows-freelance-improved-dfs-handling-20080127
[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 #ifdef  __cplusplus
35 extern "C" {
36 #endif
37 #include <afs/stds.h>
38 #include <afs/auth.h>
39 #include <afs/cellconfig.h>
40 #include <rxkad.h>
41
42 #define MAXCELLCHARS   64
43 #define MAXHOSTCHARS   64
44 #define MAXHOSTSPERCELL 8
45 #define TRANSARCAFSDAEMON "TransarcAFSDaemon"
46
47 void KFW_initialize(void);
48 void KFW_cleanup(void);
49 int  KFW_is_available(void);
50 int  KFW_AFS_destroy_tickets_for_cell(char *);
51 int  KFW_AFS_destroy_tickets_for_principal(char *);
52 int  KFW_AFS_renew_expiring_tokens(void);
53 int  KFW_AFS_get_cred( char * username, 
54                         char * cell,
55                         char * password,
56                         int lifetime,
57                         char * smbname,
58                         char ** reasonP );
59 int  KFW_AFS_renew_token_for_cell(char * cell);
60 int  KFW_AFS_renew_tokens_for_all_cells(void);
61 BOOL KFW_AFS_wait_for_service_start(void);
62 BOOL KFW_probe_kdc(struct afsconf_cell *);
63 int  KFW_AFS_get_cellconfig(char *, struct afsconf_cell *, char *);
64 void KFW_import_windows_lsa(void);
65 BOOL KFW_AFS_get_lsa_principal(char *, DWORD *);
66 int  KFW_AFS_set_file_cache_dacl(char *filename, HANDLE hUserToken);
67 int  KFW_AFS_obtain_user_temp_directory(HANDLE hUserToken, char *newfilename, int size);
68 int  KFW_AFS_copy_file_cache_to_default_cache(char * filename);
69
70
71 /* These functions are only to be used in the afslogon.dll */
72 void KFW_AFS_copy_cache_to_system_file(char *, char *);
73 int  KFW_AFS_copy_system_file_to_default_cache(char *);
74
75 /* From afs/krb_prot.h */
76 /* values for kerb error codes */
77 #define         KERB_ERR_OK                              0
78 #define         KERB_ERR_NAME_EXP                        1
79 #define         KERB_ERR_SERVICE_EXP                     2
80 #define         KERB_ERR_AUTH_EXP                        3
81 #define         KERB_ERR_PKT_VER                         4
82 #define         KERB_ERR_NAME_MAST_KEY_VER               5
83 #define         KERB_ERR_SERV_MAST_KEY_VER               6
84 #define         KERB_ERR_BYTE_ORDER                      7
85 #define         KERB_ERR_PRINCIPAL_UNKNOWN               8
86 #define         KERB_ERR_PRINCIPAL_NOT_UNIQUE            9
87 #define         KERB_ERR_NULL_KEY                       10
88
89 /* From afs/krb.h */
90 #define           RD_AP_TIME     37       /* delta_t too big */
91 #define           INTK_BADPW     62       /* Incorrect password */
92
93 #define PROBE_USERNAME               "OPENAFS-KDC-PROBE"
94 #define PROBE_PASSWORD_LEN           16
95
96 #define DO_NOT_REGISTER_VARNAME  "OPENAFS_DO_NOT_REGISTER_AFS_ID"
97 #ifdef  __cplusplus
98 }
99 #endif
100 #endif /* AFSKFW_H */