gridsite.hGo to the documentation of this file.00001 /* 00002 Copyright (c) 2002-3, Andrew McNab, University of Manchester 00003 All rights reserved. 00004 00005 Redistribution and use in source and binary forms, with or 00006 without modification, are permitted provided that the following 00007 conditions are met: 00008 00009 o Redistributions of source code must retain the above 00010 copyright notice, this list of conditions and the following 00011 disclaimer. 00012 o Redistributions in binary form must reproduce the above 00013 copyright notice, this list of conditions and the following 00014 disclaimer in the documentation and/or other materials 00015 provided with the distribution. 00016 00017 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 00018 CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 00019 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00020 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00021 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 00022 BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00023 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 00024 TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00025 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 00026 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00027 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 00028 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00029 POSSIBILITY OF SUCH DAMAGE. 00030 */ 00031 00032 /*------------------------------------------------------------------------* 00033 * For more about GridSite: http://www.gridpp.ac.uk/gridsite/ * 00034 *------------------------------------------------------------------------*/ 00035 00036 #ifndef HEADER_SSL_H 00037 #include <ssl.h> 00038 #endif 00039 00040 #ifndef HEADER_CRYPTO_H 00041 #include <crypto.h> 00042 #endif 00043 00044 #ifndef FALSE 00045 #define FALSE (0) 00046 #endif 00047 #ifndef TRUE 00048 #define TRUE (!FALSE) 00049 #endif 00050 00052 #define GRST_RET_OK 0 00053 00055 #define GRST_RET_FAILED 1000 00056 00058 #define GRST_RET_CERT_NOT_FOUND 1001 00059 00061 #define GRST_RET_BAD_SIGNATURE 1002 00062 00064 #define GRST_RET_NO_SUCH_FILE 1003 00065 00066 #define GRST_PROXYCERTINFO_OID "1.3.6.1.4.1.3536.1.222" 00067 #define GRST_VOMS_OID "1.3.6.1.4.1.8005.100.100.1" 00068 #define GRST_VOMS_DIR "/etc/grid-security/vomsdir" 00069 00070 typedef struct { char *name; 00071 char *value; 00072 struct _GRSTgaclNamevalue *next; } GRSTgaclNamevalue; 00073 00074 typedef struct { char *type; 00075 int delegation; 00076 GRSTgaclNamevalue *firstname; 00077 void *next; } GRSTgaclCred; 00078 00079 typedef int GRSTgaclAction; 00080 typedef unsigned int GRSTgaclPerm; 00081 00082 typedef struct { GRSTgaclCred *firstcred; 00083 GRSTgaclPerm allowed; 00084 GRSTgaclPerm denied; 00085 void *next; } GRSTgaclEntry; 00086 00087 typedef struct { GRSTgaclEntry *firstentry; } GRSTgaclAcl; 00088 00089 typedef struct { GRSTgaclCred *firstcred; 00090 char *dnlists; } GRSTgaclUser; 00091 00092 #define GRST_PERM_NONE 0 00093 #define GRST_PERM_READ 1 00094 #define GRST_PERM_EXEC 2 00095 #define GRST_PERM_LIST 4 00096 #define GRST_PERM_WRITE 8 00097 #define GRST_PERM_ADMIN 16 00098 #define GRST_PERM_ALL 31 00099 00100 /* DO NOT USE PermIsNone!! */ 00101 #define GRSTgaclPermIsNone(perm) (perm == 0) 00102 00103 #define GRSTgaclPermHasNone(perm) (perm == 0) 00104 #define GRSTgaclPermHasRead(perm) ((perm & GRST_PERM_READ ) != 0) 00105 #define GRSTgaclPermHasExec(perm) ((perm & GRST_PERM_EXEC ) != 0) 00106 #define GRSTgaclPermHasList(perm) ((perm & GRST_PERM_LIST ) != 0) 00107 #define GRSTgaclPermHasWrite(perm) ((perm & GRST_PERM_WRITE) != 0) 00108 #define GRSTgaclPermHasAdmin(perm) ((perm & GRST_PERM_ADMIN) != 0) 00109 00110 #define GRST_ACTION_ALLOW 0 00111 #define GRST_ACTION_DENY 1 00112 00113 #define GRST_HIST_PREFIX ".grsthist" 00114 #define GRST_ACL_FILE ".gacl" 00115 #define GRST_DN_LISTS "/etc/grid-security/dn-lists" 00116 #define GRST_RECURS_LIMIT 9 00117 00118 int GRSTgaclInit(void); 00119 00120 // #define GACLnewCred(x) GRSTgaclCredNew((x)) 00121 GRSTgaclCred *GRSTgaclCredNew(char *); 00122 00123 // #define GACLaddToCred(x,y,z) GRSTgaclCredAddValue((x),(y),(z)) 00124 int GRSTgaclCredAddValue(GRSTgaclCred *, char *, char *); 00125 00126 #define GRSTgaclCredSetDelegation(cred, level) ((cred)->delegation = (level)) 00127 #define GRSTgaclCredGetDelegation(cred) ((cred)->delegation) 00128 00129 //#define GACLfreeCred(x) GRSTgaclCredFree((x)) 00130 int GRSTgaclCredFree(GRSTgaclCred *); 00131 00132 // #define GACLaddCred(x,y) GRSTgaclEntryAddCred((x),(y)) 00133 int GRSTgaclEntryAddCred(GRSTgaclEntry *, GRSTgaclCred *); 00134 00135 // #define GACLdelCred(x,y) GRSTgaclEntryDelCred((x),(y)) 00136 int GRSTgaclEntryDelCred(GRSTgaclEntry *, GRSTgaclCred *); 00137 00138 // #define GACLprintCred(x,y) GRSTgaclCredPrint((x),(y)) 00139 int GRSTgaclCredCredPrint(GRSTgaclCred *, FILE *); 00140 00141 00142 // #define GACLnewEntry(x) GRSTgaclEntryNew((x)) 00143 GRSTgaclEntry *GRSTgaclEntryNew(void); 00144 00145 // #define GACLfreeEntry(x) GRSTgaclEntryFree((x)) 00146 int GRSTgaclEntryFree(GRSTgaclEntry *); 00147 00148 // #define GACLaddEntry(x,y) GRSTgaclAclAddEntry((x),(y)) 00149 int GRSTgaclAclAddEntry(GRSTgaclAcl *, GRSTgaclEntry *); 00150 00151 // #define GACLprintEntry(x,y) GRSTgaclEntryPrint((x),(y)) 00152 int GRSTgaclEntryPrint(GRSTgaclEntry *, FILE *); 00153 00154 00155 // #define GACLprintPerm(x,y) GRSTgaclPermPrint((x),(y)) 00156 int GRSTgaclPermPrint(GRSTgaclPerm, FILE *); 00157 00158 // #define GACLallowPerm(x,y) GRSTgaclEntryAllowPerm((x),(y)) 00159 int GRSTgaclEntryAllowPerm(GRSTgaclEntry *, GRSTgaclPerm); 00160 00161 // #define GACLunallowPerm(x,y) GRSTgaclEntryUnallowPerm((x),(y)) 00162 int GRSTgaclEntryUnallowPerm(GRSTgaclEntry *, GRSTgaclPerm); 00163 00164 // #define GACLdenyPerm(x,y) GRSTgaclEntryDenyPerm((x),(y)) 00165 int GRSTgaclEntryDenyPerm(GRSTgaclEntry *, GRSTgaclPerm); 00166 00167 // #define GACLundenyPerm(x,y) GRSTgaclEntryUndenyPerm((x),(y)) 00168 int GRSTgaclUndenyPerm(GRSTgaclEntry *, GRSTgaclPerm); 00169 00170 // #define GACLpermToChar(x) GRSTgaclPermToChar((x)) 00171 char *GRSTgaclPermToChar(GRSTgaclPerm); 00172 00173 // #define GACLcharToPerm(x) GRSTgaclPermFromChar((x)) 00174 GRSTgaclPerm GRSTgaclPermFromChar(char *); 00175 00176 // #define GACLnewAcl(x) GRSTgaclAclNew((x)) 00177 GRSTgaclAcl *GRSTgaclAclNew(void); 00178 00179 // #define GACLfreeAcl(x) GRSTgaclAclFree((x)) 00180 int GRSTgaclAclFree(GRSTgaclAcl *); 00181 00182 // #define GACLprintAcl(x,y) GRSTgaclAclPrint((x),(y)) 00183 int GRSTgaclAclPrint(GRSTgaclAcl *, FILE *); 00184 00185 // #define GACLsaveAcl(x,y) GRSTgaclAclSave((y),(x)) 00186 int GRSTgaclAclSave(GRSTgaclAcl *, char *); 00187 00188 // #define GACLloadAcl(x) GRSTgaclFileLoadAcl((x)) 00189 GRSTgaclAcl *GRSTgaclAclLoadFile(char *); 00190 00191 // #define GACLfindAclForFile(x) GRSTgaclFileFindAclname((x)) 00192 char *GRSTgaclFileFindAclname(char *); 00193 00194 // #define GACLloadAclForFile(x) GRSTgaclFileLoadAcl((x)) 00195 GRSTgaclAcl *GRSTgaclAclLoadforFile(char *); 00196 00197 // #define GACLisAclFile(x) GRSTgaclFileIsAcl((x)) 00198 int GRSTgaclFileIsAcl(char *); 00199 00200 00201 // #define GACLnewUser(x) GRSTgaclUserNew((x)) 00202 GRSTgaclUser *GRSTgaclUserNew(GRSTgaclCred *); 00203 00204 // #define GACLfreeUser(x) GRSTgaclUserFree((x)) 00205 int GRSTgaclUserFree(GRSTgaclUser *); 00206 00207 // #define GACLuserAddCred(x,y) GRSTgaclUserAddCred((x),(y)) 00208 int GRSTgaclUserAddCred(GRSTgaclUser *, GRSTgaclCred *); 00209 00210 // #define GACLuserHasCred(x,y) GRSTgaclUserHasCred((x),(y)) 00211 int GRSTgaclUserHasCred(GRSTgaclUser *, GRSTgaclCred *); 00212 00213 int GRSTgaclUserSetDNlists(GRSTgaclUser *, char *); 00214 00215 // #define GACLuserFindCredType(x,y) GRSTgaclUserFindCredtype((x),(y)) 00216 GRSTgaclCred *GRSTgaclUserFindCredtype(GRSTgaclUser *, char *); 00217 00218 // #define GACLtestDnList(x,y) GRSTgaclDNlistHasUser((x),(y)) 00219 int GRSTgaclDNlistHasUser(char *, GRSTgaclUser *); 00220 00221 // #define GACLtestUserAcl(x,y) GRSTgaclAclTestUser((x),(y)) 00222 GRSTgaclPerm GRSTgaclAclTestUser(GRSTgaclAcl *, GRSTgaclUser *); 00223 00224 // #define GACLtestExclAcl(x,y) GRSTgaclAclTestexclUser((x),(y)) 00225 GRSTgaclPerm GRSTgaclAclTestexclUser(GRSTgaclAcl *, GRSTgaclUser *); 00226 00227 00228 char *GRSThttpUrlDecode(char *); 00229 00230 // #define GACLurlEncode(x) GRSThttpUrlEncode((x)) 00231 char *GRSThttpUrlEncode(char *); 00232 00233 // #define GACLmildUrlEncode(x) GRSThttpMildUrlEncode((x)) 00234 char *GRSThttpUrlMildencode(char *); 00235 00236 int GRSTx509NameCmp(char *, char *); 00237 00238 int GRSTx509KnownCriticalExts(X509 *); 00239 00240 time_t GRSTasn1TimeToTimeT(char *); 00241 int GRSTx509IsCA(X509 *); 00242 int GRSTx509CheckChain(int *, X509_STORE_CTX *); 00243 int GRSTx509VerifyCallback(int, X509_STORE_CTX *); 00244 00245 int GRSTx509CheckVomsSig(unsigned char *, unsigned int, 00246 unsigned char *, unsigned int, 00247 char *, char *, char *); 00248 int GRSTx509GetVomsCreds(int *, int, size_t, char *, X509 *, X509 *, char *); 00249 GRSTgaclCred *GRSTx509CompactToCred(char *); 00250 int GRSTx509CompactCreds(int *, int, size_t, char *, STACK_OF(X509) *, char *); 00251 00252 00253 #define GRST_HEADFILE "gridsitehead.txt" 00254 #define GRST_FOOTFILE "gridsitefoot.txt" 00255 #define GRST_ADMIN_FILE "gridsite-admin.cgi" 00256 00257 typedef struct { char *text; 00258 void *next; } GRSThttpCharsList; 00259 00260 typedef struct { size_t size; 00261 GRSThttpCharsList *first; 00262 GRSThttpCharsList *last; } GRSThttpBody; 00263 00264 void GRSThttpBodyInit(GRSThttpBody *); 00265 void GRSThttpPrintf(GRSThttpBody *, char *, ...); 00266 int GRSThttpCopy(GRSThttpBody *, char *); 00267 void GRSThttpWriteOut(GRSThttpBody *); 00268 int GRSThttpPrintHeaderFooter(GRSThttpBody *, char *, char *); 00269 char *GRSThttpGetCGI(char *); Generated on Fri Dec 19 20:43:58 2003 by 1.2.18
Last modified Fri 19 December 2003 . View page history Switch to HTTPS . Print View . Built with GridSite 1.4.3 |
|
| Funded by: GridPP STFC JISC University of Manchester | |