This file is indexed.

/usr/include/gridsite.h is in libgridsite-dev 1.7.16-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
/*
   Copyright (c) 2002-10, Andrew McNab, University of Manchester
   All rights reserved.

   Redistribution and use in source and binary forms, with or
   without modification, are permitted provided that the following
   conditions are met:

     o Redistributions of source code must retain the above
       copyright notice, this list of conditions and the following
       disclaimer. 
     o Redistributions in binary form must reproduce the above
       copyright notice, this list of conditions and the following
       disclaimer in the documentation and/or other materials
       provided with the distribution. 

   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
   CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
   BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
   TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
   ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   POSSIBILITY OF SUCH DAMAGE.
*/

/*---------------------------------------------------------------*
 * For more about GridSite: http://www.gridsite.org/             *
 *---------------------------------------------------------------*/

#ifndef HEADER_GRIDSITE_H
#define HEADER_GRIDSITE_H

#ifndef GRST_VERSION
#define GRST_VERSION 010716
#endif

#ifdef __cplusplus
extern "C" {
#endif

#ifndef GRST_NO_OPENSSL

#ifndef HEADER_SSL_H
#include <openssl/ssl.h>
#endif

#ifndef HEADER_CRYPTO_H
#include <openssl/crypto.h>
#endif

#endif

#ifndef _TIME_H
#include <time.h>
#endif

#ifndef _STDIO_H
#include <stdio.h>
#endif

#ifndef _STDINT_H
#include <stdint.h>
#endif

#ifndef FALSE
#define FALSE (0)
#endif
#ifndef TRUE
#define TRUE (!FALSE)
#endif

// Everything ok (= OpenSSL X509_V_OK)
#define GRST_RET_OK		0

// Failed for unspecified reason
#define GRST_RET_FAILED		1000

// Failed to find certificate in some cert store / directory
#define GRST_RET_CERT_NOT_FOUND	1001

// Bad signature
#define GRST_RET_BAD_SIGNATURE	1002

// No such file or directory
#define GRST_RET_NO_SUCH_FILE	1003

/* We use && now rather than if so this macro can be used inside if...else
   but that means the function must return an int rather than be void */
#define GRSTerrorLog(GRSTerrorLevel, ...) ((GRSTerrorLogFunc != NULL) && ((GRSTerrorLogFunc)(__FILE__, __LINE__, GRSTerrorLevel, __VA_ARGS__)))

extern int (*GRSTerrorLogFunc)(char *, int, int, char *, ...);

/* these levels are the same as Unix syslog() and Apache ap_log_error() */

#define GRST_LOG_EMERG   0
#define GRST_LOG_ALERT   1
#define GRST_LOG_CRIT    2
#define GRST_LOG_ERR     3
#define GRST_LOG_WARNING 4
#define GRST_LOG_NOTICE  5
#define GRST_LOG_INFO    6
#define GRST_LOG_DEBUG   7

#define GRST_MAX_TIME_T	 INT32_MAX

typedef struct { char                      *auri;
                 int			    delegation;
                 int			    nist_loa;
                 time_t			    notbefore;
                 time_t			    notafter;
                 void                      *next;     } GRSTgaclCred;

/* used by pre-AURI GRSTgaclCred structs */ 
__attribute__ ((deprecated))
typedef struct { char                      *name;
                 char                      *value;
                 void                      *next;  } GRSTgaclNamevalue;

typedef int                GRSTgaclAction;
typedef unsigned int       GRSTgaclPerm;
 
typedef struct { GRSTgaclCred   *firstcred;
                 GRSTgaclPerm    allowed;
                 GRSTgaclPerm    denied;
                 void           *next;    } GRSTgaclEntry;
 
typedef struct { GRSTgaclEntry *firstentry; } GRSTgaclAcl;
 
typedef struct { GRSTgaclCred *firstcred; char *dnlists; } GRSTgaclUser;

#define GRST_PERM_NONE   0
#define GRST_PERM_READ   1
#define GRST_PERM_EXEC   2
#define GRST_PERM_LIST   4
#define GRST_PERM_WRITE  8
#define GRST_PERM_ADMIN 16
#define GRST_PERM_ALL   31

/* DO NOT USE PermIsNone!! */
#define GRSTgaclPermIsNone(perm)    ((perm) == 0)

#define GRSTgaclPermHasNone(perm)    ((perm) == 0)
#define GRSTgaclPermHasRead(perm)  (((perm) & GRST_PERM_READ ) != 0)
#define GRSTgaclPermHasExec(perm)  (((perm) & GRST_PERM_EXEC ) != 0)
#define GRSTgaclPermHasList(perm)  (((perm) & GRST_PERM_LIST ) != 0)
#define GRSTgaclPermHasWrite(perm) (((perm) & GRST_PERM_WRITE) != 0)
#define GRSTgaclPermHasAdmin(perm) (((perm) & GRST_PERM_ADMIN) != 0)

#define GRST_ACTION_ALLOW 0
#define GRST_ACTION_DENY  1

#define GRST_HIST_PREFIX  ".grsthist"
#define GRST_ACL_FILE     ".gacl"
#define GRST_DN_LISTS     "/etc/grid-security/dn-lists"
#define GRST_RECURS_LIMIT 9

#define GRST_PROXYCERTINFO_OLD_OID	"1.3.6.1.4.1.3536.1.222"
#define GRST_PROXYCERTINFO_OID		"1.3.6.1.5.5.7.1.14"
#define GRST_VOMS_OID		"1.3.6.1.4.1.8005.100.100.5"
#define GRST_VOMS_PK_CERT_LIST_OID	"1.3.6.1.4.1.8005.100.100.10"
#define GRST_VOMS_DIR		"/etc/grid-security/vomsdir"
#define GRST_KEYUSAGE_OID       "2.5.29.15"

#define GRST_ASN1_MAXCOORDLEN	50
#define GRST_ASN1_MAXTAGS	500

struct GRSTasn1TagList { char treecoords[GRST_ASN1_MAXCOORDLEN+1];
                         int  start;
                         int  headerlength;
                         int  length;
                         int  tag; } ;

#define GRST_X509_SERIAL_DIGITS 49

typedef struct { int    type;		/* CA, user, proxy, VOMS, ... */
                 int    errors;		/* unchecked, bad sig, bad time */
                 char   *issuer;	/* Cert CA DN, EEC of PC, or VOMS DN */
                 char   *dn;		/* Cert DN, or VOMS AC holder DN */
                 char   *value;		/* VOMS FQAN or NULL */
                 time_t notbefore;
                 time_t notafter;
                 int    delegation;	/* relative to END of any chain */
                 char   serial[GRST_X509_SERIAL_DIGITS+1];
                 char   *ocsp;		/* accessLocation field */
                 void   *raw;		/* X509 or VOMS Extension object */
                 void   *next; } GRSTx509Cert;

#define GRST_CERT_BAD_FORMAT 1
#define GRST_CERT_BAD_CHAIN  2
#define GRST_CERT_BAD_SIG    4
#define GRST_CERT_BAD_TIME   8
#define GRST_CERT_BAD_OCSP  16

#define GRST_CERT_TYPE_CA    1
#define GRST_CERT_TYPE_EEC   2
#define GRST_CERT_TYPE_PROXY 3
#define GRST_CERT_TYPE_VOMS  4

/* a chain of certs, starting from the first CA */
typedef struct { GRSTx509Cert *firstcert; } GRSTx509Chain;

#ifndef GRST_NO_OPENSSL
int GRSTx509CertLoad(GRSTx509Cert *, X509 *);
int GRSTx509ChainLoadCheck(GRSTx509Chain **, STACK_OF(X509) *, X509 *, char *, char *);
#endif
int GRSTx509ChainFree(GRSTx509Chain *);

#define GRST_HTTP_PORT		777
#define GRST_HTTPS_PORT		488
#define GRST_HTCP_PORT		777
#define GRST_GSIFTP_PORT	2811
                         
#define GRSThtcpNOPop 0
#define GRSThtcpTSTop 1

typedef struct { unsigned char length_msb;
                 unsigned char length_lsb;
                 char text[1]; } GRSThtcpCountstr;

#define GRSThtcpCountstrLen(string) (256*((string)->length_msb) + (string)->length_lsb)

typedef struct { unsigned char total_length_msb;
                 unsigned char total_length_lsb;
                 unsigned char version_msb;
                 unsigned char version_lsb;
                 unsigned char data_length_msb;
                 unsigned char data_length_lsb;
                 unsigned int  response : 4;
                 unsigned int  opcode   : 4;
                 unsigned int  rr       : 1;                 
                 unsigned int  f1       : 1;
                 unsigned int  reserved : 6;
                 unsigned int  trans_id;	/* must be 4 bytes */
                 GRSThtcpCountstr *method;
                 GRSThtcpCountstr *uri;
                 GRSThtcpCountstr *version;
                 GRSThtcpCountstr *req_hdrs;
                 GRSThtcpCountstr *resp_hdrs;
                 GRSThtcpCountstr *entity_hdrs;
                 GRSThtcpCountstr *cache_hdrs;   } GRSThtcpMessage;

int GRSTgaclInit(void);

__attribute__ ((deprecated))
GRSTgaclCred *GRSTgaclCredNew(char *);

GRSTgaclCred *GRSTgaclCredCreate(char *, char *);

__attribute__ ((deprecated))
int	GRSTgaclCredAddValue(GRSTgaclCred *, char *, char *);

#define GRSTgaclCredGetAuri(cred) ((cred)->auri)

#define GRSTgaclCredSetNotBefore(cred, time) ((cred)->notbefore = (time))
#define GRSTgaclCredGetNotBefore(cred) ((cred)->notbefore)

#define GRSTgaclCredSetNotAfter(cred, time) ((cred)->notafter = (time))
#define GRSTgaclCredGetNotAfter(cred) ((cred)->notafter)

#define GRSTgaclCredSetDelegation(cred, level) ((cred)->delegation = (level))
#define GRSTgaclCredGetDelegation(cred) ((cred)->delegation)

#define GRSTgaclCredSetNistLoa(cred, level) ((cred)->nist_loa = (level))
#define GRSTgaclCredGetNistLoa(cred) ((cred)->nist_loa)

/* #define GACLfreeCred(x)		GRSTgaclCredFree((x)) */
int        GRSTgaclCredFree(GRSTgaclCred *);

/*  #define GACLaddCred(x,y)	GRSTgaclEntryAddCred((x),(y)) */
int        GRSTgaclEntryAddCred(GRSTgaclEntry *, GRSTgaclCred *);

/*  #define GACLdelCred(x,y)	GRSTgaclEntryDelCred((x),(y)) */
int        GRSTgaclEntryDelCred(GRSTgaclEntry *, GRSTgaclCred *);

/*  #define GACLprintCred(x,y)	GRSTgaclCredPrint((x),(y)) */
int        GRSTgaclCredCredPrint(GRSTgaclCred *, FILE *);

int	   GRSTgaclCredCmpAuri(GRSTgaclCred *, GRSTgaclCred *);

/*  #define GACLnewEntry(x)		GRSTgaclEntryNew((x)) */
GRSTgaclEntry *GRSTgaclEntryNew(void);

/*  #define GACLfreeEntry(x)	GRSTgaclEntryFree((x)) */
int        GRSTgaclEntryFree(GRSTgaclEntry *);

/*  #define GACLaddEntry(x,y)	GRSTgaclAclAddEntry((x),(y)) */
int        GRSTgaclAclAddEntry(GRSTgaclAcl *, GRSTgaclEntry *);

/*  #define GACLprintEntry(x,y)	GRSTgaclEntryPrint((x),(y)) */
int        GRSTgaclEntryPrint(GRSTgaclEntry *, FILE *);


/*  #define GACLprintPerm(x,y)	GRSTgaclPermPrint((x),(y)) */
int        GRSTgaclPermPrint(GRSTgaclPerm, FILE *);

/*  #define GACLallowPerm(x,y)	GRSTgaclEntryAllowPerm((x),(y)) */
int        GRSTgaclEntryAllowPerm(GRSTgaclEntry *, GRSTgaclPerm);

/*  #define GACLunallowPerm(x,y)	GRSTgaclEntryUnallowPerm((x),(y)) */
int        GRSTgaclEntryUnallowPerm(GRSTgaclEntry *, GRSTgaclPerm);

/*  #define GACLdenyPerm(x,y)	GRSTgaclEntryDenyPerm((x),(y)) */
int        GRSTgaclEntryDenyPerm(GRSTgaclEntry *, GRSTgaclPerm);

/*  #define GACLundenyPerm(x,y)	GRSTgaclEntryUndenyPerm((x),(y)) */
int        GRSTgaclEntryUndenyPerm(GRSTgaclEntry *, GRSTgaclPerm);

/*  #define GACLpermToChar(x)	GRSTgaclPermToChar((x)) */
char      *GRSTgaclPermToChar(GRSTgaclPerm);

/*  #define GACLcharToPerm(x)	GRSTgaclPermFromChar((x)) */
GRSTgaclPerm   GRSTgaclPermFromChar(char *);

/*  #define GACLnewAcl(x)		GRSTgaclAclNew((x)) */
GRSTgaclAcl   *GRSTgaclAclNew(void);

/*  #define GACLfreeAcl(x)		GRSTgaclAclFree((x)) */
int        GRSTgaclAclFree(GRSTgaclAcl *);

/*  #define GACLprintAcl(x,y)	GRSTgaclAclPrint((x),(y)) */
int        GRSTgaclAclPrint(GRSTgaclAcl *, FILE *);

/*  #define GACLsaveAcl(x,y)	GRSTgaclAclSave((y),(x)) */
int        GRSTgaclAclSave(GRSTgaclAcl *, char *);

/*  #define GACLloadAcl(x)		GRSTgaclFileLoadAcl((x)) */
GRSTgaclAcl   *GRSTgaclAclLoadFile(char *);

/*  #define GACLfindAclForFile(x)	GRSTgaclFileFindAclname((x)) */
char      *GRSTgaclFileFindAclname(char *);

/*  #define GACLloadAclForFile(x)	GRSTgaclFileLoadAcl((x)) */
GRSTgaclAcl   *GRSTgaclAclLoadforFile(char *);

/*  #define GACLisAclFile(x)	GRSTgaclFileIsAcl((x)) */
int        GRSTgaclFileIsAcl(char *);


/*  #define GACLnewUser(x)		GRSTgaclUserNew((x)) */
GRSTgaclUser *GRSTgaclUserNew(GRSTgaclCred *);

/*  #define GACLfreeUser(x)		GRSTgaclUserFree((x)) */
int       GRSTgaclUserFree(GRSTgaclUser *);

/*  #define GACLuserAddCred(x,y)	GRSTgaclUserAddCred((x),(y)) */
int       GRSTgaclUserAddCred(GRSTgaclUser *, GRSTgaclCred *);

/*  #define GACLuserHasCred(x,y)	GRSTgaclUserHasCred((x),(y)) */
int       GRSTgaclUserHasCred(GRSTgaclUser *, GRSTgaclCred *);

__attribute__ ((deprecated))
int       GRSTgaclUserSetDNlists(GRSTgaclUser *, char *);

int       GRSTgaclUserLoadDNlists(GRSTgaclUser *, char *);

/*  #define GACLuserFindCredType(x,y) GRSTgaclUserFindCredtype((x),(y)) */
GRSTgaclCred *GRSTgaclUserFindCredtype(GRSTgaclUser *, char *);

__attribute__ ((deprecated))
int GRSTgaclDNlistHasUser(char *, GRSTgaclUser *);

int GRSTgaclUserHasAURI(GRSTgaclUser *, char *);

/*  #define GACLtestUserAcl(x,y)	GRSTgaclAclTestUser((x),(y)) */
GRSTgaclPerm   GRSTgaclAclTestUser(GRSTgaclAcl *, GRSTgaclUser *);

/*  #define GACLtestExclAcl(x,y)	GRSTgaclAclTestexclUser((x),(y)) */
GRSTgaclPerm   GRSTgaclAclTestexclUser(GRSTgaclAcl *, GRSTgaclUser *);

char      *GRSThttpUrlDecode(char *);

/*  #define GACLurlEncode(x)	GRSThttpUrlEncode((x)) */
char      *GRSThttpUrlEncode(char *);

/*  #define GACLmildUrlEncode(x)	GRSThttpMildUrlEncode((x)) */
char      *GRSThttpUrlMildencode(char *);

int GRSTx509NameCmp(char *, char *);

#ifndef GRST_NO_OPENSSL
int GRSTx509KnownCriticalExts(X509 *);

int GRSTx509IsCA(X509 *);
int GRSTx509CheckChain(int *, X509_STORE_CTX *);
int GRSTx509VerifyCallback(int, X509_STORE_CTX *);

__attribute__ ((deprecated))
int GRSTx509GetVomsCreds(int *, int, size_t, char *, X509 *, STACK_OF(X509) *, char *);

__attribute__ ((deprecated))
GRSTgaclCred *GRSTx509CompactToCred(char *);

__attribute__ ((deprecated))
int GRSTx509CompactCreds(int *, int, size_t, char *, STACK_OF(X509) *, char *, X509 *);
#endif 

char *GRSTx509CachedProxyFind(char *, char *, char *);
char *GRSTx509FindProxyFileName(void);
int GRSTx509MakeProxyCert(char **, FILE *, char *, char *, char *, int);
char *GRSTx509CachedProxyKeyFind(char *, char *, char *);
int GRSTx509ProxyDestroy(char *, char *, char *);
int GRSTx509ProxyGetTimes(char *, char *, char *, time_t *, time_t *);
int GRSTx509CreateProxyRequest(char **, char **, char *);
int GRSTx509MakeProxyRequest(char **, char *, char *, char *);

char *GRSTx509MakeDelegationID(void);

#ifndef GRST_NO_OPENSSL
int GRSTx509StringToChain(STACK_OF(X509) **, char *);
char *GRSTx509MakeProxyFileName(char *, STACK_OF(X509) *);
#endif

int GRSTx509CacheProxy(char *, char *, char *, char *);

#define GRST_HEADFILE   "gridsitehead.txt"
#define GRST_FOOTFILE   "gridsitefoot.txt"
#define GRST_ADMIN_FILE "gridsite-admin.cgi"

typedef struct { char *text;
                 void *next; } GRSThttpCharsList;

typedef struct { size_t             size;
                 GRSThttpCharsList *first;
                 GRSThttpCharsList *last;  } GRSThttpBody;

void  GRSThttpBodyInit(GRSThttpBody *); 
void  GRSThttpPrintf(GRSThttpBody *, char *, ...);
int   GRSThttpCopy(GRSThttpBody *, char *);
void  GRSThttpWriteOut(GRSThttpBody *);
int   GRSThttpPrintHeaderFooter(GRSThttpBody *, char *, char *);
int   GRSThttpPrintHeader(GRSThttpBody *, char *);
int   GRSThttpPrintFooter(GRSThttpBody *, char *);
char *GRSThttpGetCGI(char *);

time_t GRSTasn1TimeToTimeT(char *, size_t);
int    GRSTasn1SearchTaglist(struct GRSTasn1TagList taglist[], int, char *);
#ifndef GRST_NO_OPENSSL
int    GRSTasn1ParseDump(BIO *, unsigned char *, long,
                         struct GRSTasn1TagList taglist[], int, int *);
#endif
int    GRSTasn1GetX509Name(char *, int, char *, char *,
                           struct GRSTasn1TagList taglist[], int);

int    GRSThtcpNOPrequestMake(char **, int *, unsigned int);
int    GRSThtcpNOPresponseMake(char **, int *, unsigned int);
int    GRSThtcpTSTrequestMake(char **, int *, unsigned int, char *, char *, char *);
int    GRSThtcpTSTresponseMake(char **, int *, unsigned int, char *, char *, char *);
int    GRSThtcpMessageParse(GRSThtcpMessage *, char *, int);

#ifndef GRST_PASSCODE_JS
//#define __GRST_PASSCODE_JS__
#define GRST_PASSCODE_JS "<script type=\"text/javascript\" language=\"Javascript\"><!--\nfunction changeValue(formName){        if( document.forms[formName].passcode.value==\"\" ) document.forms[formName].passcode.value=getCookie(\"GRIDHTTP_PASSCODE\");       return true;   } \nfunction getCookie(c_name){ if (document.cookie.length>0)  {  c_start=document.cookie.indexOf(c_name + \"=\");  if (c_start!=-1)    {    c_start=c_start + c_name.length+1;    c_end=document.cookie.indexOf(\";\",c_start);    if (c_end==-1) c_end=document.cookie.length;    return unescape(document.cookie.substring(c_start,c_end)); }} return \"\"; } \n -->\n</script>"
#endif

#ifdef __cplusplus
} // extern "C"
#endif

#endif // HEADER_GRIDSITE_H