1 /* $NetBSD: kafs.h,v 1.2 2017/01/28 21:31:49 christos Exp $ */ 2 3 /* 4 * Copyright (c) 1995 - 2001, 2003 Kungliga Tekniska Högskolan 5 * (Royal Institute of Technology, Stockholm, Sweden). 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 12 * 1. Redistributions of source code must retain the above copyright 13 * notice, this list of conditions and the following disclaimer. 14 * 15 * 2. Redistributions in binary form must reproduce the above copyright 16 * notice, this list of conditions and the following disclaimer in the 17 * documentation and/or other materials provided with the distribution. 18 * 19 * 3. Neither the name of the Institute nor the names of its contributors 20 * may be used to endorse or promote products derived from this software 21 * without specific prior written permission. 22 * 23 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * SUCH DAMAGE. 34 */ 35 36 /* Id */ 37 38 #ifndef __KAFS_H 39 #define __KAFS_H 40 41 /* XXX must include krb5.h or krb.h */ 42 43 /* sys/ioctl.h must be included manually before kafs.h */ 44 45 /* 46 */ 47 #define AFSCALL_PIOCTL 20 48 #define AFSCALL_SETPAG 21 49 50 #ifndef _VICEIOCTL 51 #ifdef __GNU__ 52 #define _IOT_ViceIoctl _IOT(_IOTS(caddr_t), 2, _IOTS(short), 2, 0, 0) 53 #endif 54 #define _VICEIOCTL(id) ((unsigned int ) _IOW('V', id, struct ViceIoctl)) 55 #define _AFSCIOCTL(id) ((unsigned int ) _IOW('C', id, struct ViceIoctl)) 56 #endif /* _VICEIOCTL */ 57 58 #define VIOCSETAL _VICEIOCTL(1) 59 #define VIOCGETAL _VICEIOCTL(2) 60 #define VIOCSETTOK _VICEIOCTL(3) 61 #define VIOCGETVOLSTAT _VICEIOCTL(4) 62 #define VIOCSETVOLSTAT _VICEIOCTL(5) 63 #define VIOCFLUSH _VICEIOCTL(6) 64 #define VIOCGETTOK _VICEIOCTL(8) 65 #define VIOCUNLOG _VICEIOCTL(9) 66 #define VIOCCKSERV _VICEIOCTL(10) 67 #define VIOCCKBACK _VICEIOCTL(11) 68 #define VIOCCKCONN _VICEIOCTL(12) 69 #define VIOCWHEREIS _VICEIOCTL(14) 70 #define VIOCACCESS _VICEIOCTL(20) 71 #define VIOCUNPAG _VICEIOCTL(21) 72 #define VIOCGETFID _VICEIOCTL(22) 73 #define VIOCSETCACHESIZE _VICEIOCTL(24) 74 #define VIOCFLUSHCB _VICEIOCTL(25) 75 #define VIOCNEWCELL _VICEIOCTL(26) 76 #define VIOCGETCELL _VICEIOCTL(27) 77 #define VIOC_AFS_DELETE_MT_PT _VICEIOCTL(28) 78 #define VIOC_AFS_STAT_MT_PT _VICEIOCTL(29) 79 #define VIOC_FILE_CELL_NAME _VICEIOCTL(30) 80 #define VIOC_GET_WS_CELL _VICEIOCTL(31) 81 #define VIOC_AFS_MARINER_HOST _VICEIOCTL(32) 82 #define VIOC_GET_PRIMARY_CELL _VICEIOCTL(33) 83 #define VIOC_VENUSLOG _VICEIOCTL(34) 84 #define VIOC_GETCELLSTATUS _VICEIOCTL(35) 85 #define VIOC_SETCELLSTATUS _VICEIOCTL(36) 86 #define VIOC_FLUSHVOLUME _VICEIOCTL(37) 87 #define VIOC_AFS_SYSNAME _VICEIOCTL(38) 88 #define VIOC_EXPORTAFS _VICEIOCTL(39) 89 #define VIOCGETCACHEPARAMS _VICEIOCTL(40) 90 #define VIOC_GCPAGS _VICEIOCTL(48) 91 92 #define VIOCGETTOK2 _AFSCIOCTL(7) 93 #define VIOCSETTOK2 _AFSCIOCTL(8) 94 95 struct ViceIoctl { 96 caddr_t in, out; 97 unsigned short in_size; 98 unsigned short out_size; 99 }; 100 101 struct ClearToken { 102 int32_t AuthHandle; 103 char HandShakeKey[8]; 104 int32_t ViceId; 105 int32_t BeginTimestamp; 106 int32_t EndTimestamp; 107 }; 108 109 /* Use k_hasafs() to probe if the machine supports AFS syscalls. 110 The other functions will generate a SIGSYS if AFS is not supported */ 111 112 int k_hasafs (void); 113 int k_hasafs_recheck (void); 114 115 int krb_afslog (const char *cell, const char *realm); 116 int krb_afslog_uid (const char *cell, const char *realm, uid_t uid); 117 int krb_afslog_home (const char *cell, const char *realm, 118 const char *homedir); 119 int krb_afslog_uid_home (const char *cell, const char *realm, uid_t uid, 120 const char *homedir); 121 122 int krb_realm_of_cell (const char *cell, char **realm); 123 124 /* compat */ 125 #define k_afsklog krb_afslog 126 #define k_afsklog_uid krb_afslog_uid 127 128 int k_pioctl (char *a_path, 129 int o_opcode, 130 struct ViceIoctl *a_paramsP, 131 int a_followSymlinks); 132 int k_unlog (void); 133 int k_setpag (void); 134 int k_afs_cell_of_file (const char *path, char *cell, int len); 135 136 137 138 /* XXX */ 139 #ifdef KFAILURE 140 #define KRB_H_INCLUDED 141 #endif 142 143 #ifdef KRB5_RECVAUTH_IGNORE_VERSION 144 #define KRB5_H_INCLUDED 145 #endif 146 147 void kafs_set_verbose (void (*kafs_verbose)(void *, const char *), void *); 148 int kafs_settoken_rxkad (const char *, struct ClearToken *, 149 void *ticket, size_t ticket_len); 150 #ifdef KRB_H_INCLUDED 151 int kafs_settoken (const char*, uid_t, CREDENTIALS*); 152 #endif 153 #ifdef KRB5_H_INCLUDED 154 int kafs_settoken5 (krb5_context, const char*, uid_t, krb5_creds*); 155 #endif 156 157 158 #ifdef KRB5_H_INCLUDED 159 krb5_error_code krb5_afslog_uid (krb5_context context, 160 krb5_ccache id, 161 const char *cell, 162 krb5_const_realm realm, 163 uid_t uid); 164 krb5_error_code krb5_afslog (krb5_context context, 165 krb5_ccache id, 166 const char *cell, 167 krb5_const_realm realm); 168 krb5_error_code krb5_afslog_uid_home (krb5_context context, 169 krb5_ccache id, 170 const char *cell, 171 krb5_const_realm realm, 172 uid_t uid, 173 const char *homedir); 174 175 krb5_error_code krb5_afslog_home (krb5_context context, 176 krb5_ccache id, 177 const char *cell, 178 krb5_const_realm realm, 179 const char *homedir); 180 181 krb5_error_code krb5_realm_of_cell (const char *cell, char **realm); 182 183 #endif 184 185 186 #define _PATH_VICE "/usr/vice/etc/" 187 #define _PATH_THISCELL _PATH_VICE "ThisCell" 188 #define _PATH_CELLSERVDB _PATH_VICE "CellServDB" 189 #define _PATH_THESECELLS _PATH_VICE "TheseCells" 190 191 #define _PATH_ARLA_VICE "/usr/arla/etc/" 192 #define _PATH_ARLA_THISCELL _PATH_ARLA_VICE "ThisCell" 193 #define _PATH_ARLA_CELLSERVDB _PATH_ARLA_VICE "CellServDB" 194 #define _PATH_ARLA_THESECELLS _PATH_ARLA_VICE "TheseCells" 195 196 #define _PATH_OPENAFS_DEBIAN_VICE "/etc/openafs/" 197 #define _PATH_OPENAFS_DEBIAN_THISCELL _PATH_OPENAFS_DEBIAN_VICE "ThisCell" 198 #define _PATH_OPENAFS_DEBIAN_CELLSERVDB _PATH_OPENAFS_DEBIAN_VICE "CellServDB" 199 #define _PATH_OPENAFS_DEBIAN_THESECELLS _PATH_OPENAFS_DEBIAN_VICE "TheseCells" 200 201 #define _PATH_OPENAFS_MACOSX_VICE "/var/db/openafs/etc/" 202 #define _PATH_OPENAFS_MACOSX_THISCELL _PATH_OPENAFS_MACOSX_VICE "ThisCell" 203 #define _PATH_OPENAFS_MACOSX_CELLSERVDB _PATH_OPENAFS_MACOSX_VICE "CellServDB" 204 #define _PATH_OPENAFS_MACOSX_THESECELLS _PATH_OPENAFS_MACOSX_VICE "TheseCells" 205 206 #define _PATH_ARLA_DEBIAN_VICE "/etc/arla/" 207 #define _PATH_ARLA_DEBIAN_THISCELL _PATH_ARLA_DEBIAN_VICE "ThisCell" 208 #define _PATH_ARLA_DEBIAN_CELLSERVDB _PATH_ARLA_DEBIAN_VICE "CellServDB" 209 #define _PATH_ARLA_DEBIAN_THESECELLS _PATH_ARLA_DEBIAN_VICE "TheseCells" 210 211 #define _PATH_ARLA_OPENBSD_VICE "/etc/afs/" 212 #define _PATH_ARLA_OPENBSD_THISCELL _PATH_ARLA_OPENBSD_VICE "ThisCell" 213 #define _PATH_ARLA_OPENBSD_CELLSERVDB _PATH_ARLA_OPENBSD_VICE "CellServDB" 214 #define _PATH_ARLA_OPENBSD_THESECELLS _PATH_ARLA_OPENBSD_VICE "TheseCells" 215 216 extern int _kafs_debug; 217 218 #endif /* __KAFS_H */ 219