/*****************************************************************************/ /* MapUrl.h */ /*****************************************************************************/ #ifndef MAPURL_H_LOADED #define MAPURL_H_LOADED 1 #include "wasd.h" #include "metacon.h" #define MAPURL_RULE_EXEC 1 #define MAPURL_RULE_FAIL 2 #define MAPURL_RULE_MAP 3 #define MAPURL_RULE_PASS 4 #define MAPURL_RULE_REDIRECT 5 #define MAPURL_RULE_SCRIPT 6 #define MAPURL_RULE_SET 7 #define MAPURL_RULE_USER 8 #define MAPURL_RULE_UXEC 9 #define MAPURL_RULE_PROTECT 10 #define MAPURL_REPORT_MATCH_NOT 0 #define MAPURL_REPORT_MATCH_RULE 1 #define MAPURL_REPORT_MATCH_RULECOND 2 #define MAPURL_REPORT_MATCH_RULENOCOND 3 #define MAPURL_REPORT_MATCH_VIRT 4 #define MAPURL_PATH_ODS_0 -1 #define MAPURL_PATH_ODS_2 2 #define MAPURL_PATH_ODS_5 5 #define MAPURL_PATH_ODS_ADS 66 #define MAPURL_PATH_ODS_PWK 77 #define MAPURL_PATH_ODS_SMB 88 #define MAPURL_PATH_ODS_SRI 99 #define MAPURL_PATH_ODS_SRI 99 #define MAPURL_DIR_FONT_INHERIT 1 #define MAPURL_DIR_FONT_MONOSPACE 2 #define MAPURL_DIR_STYLE_DEFAULT -1 #define MAPURL_DIR_STYLE_DEFAULT2 -2 #define MAPURL_DIR_STYLE_NONE 0 #define MAPURL_DIR_STYLE_ORIGINAL 1 /* pre-v8.2 */ #define MAPURL_DIR_STYLE_ORIGINAL2 2 /* pre-v8.2 minus
s */ #define MAPURL_DIR_STYLE_ANCHOR 3 /* post-v8.2 */ #define MAPURL_DIR_STYLE_ANCHOR2 4 /* post-v8.2 minus
s */ #define MAPURL_DIR_STYLE_SORT 5 /* HTML table and sortable */ #define MAPURL_DIR_STYLE_SORT2 6 /* table and sortable minus
s */ #define MAPURL_DIR_STYLE_HTDIR 7 /* Alex Ivanov's HTdir, etc. */ #define MAPURL_DIR_STYLE_HTDIR2 8 /* HTdir, etc. minus
s */ #define MAPURL_DIR_STYLE_TABLE 9 /* post-v10.4 table element */ #define MAPURL_DIR_STYLE_TABLE2 10 /* post-v10.4 table element */ #define MAPURL_DIR_TITLE_THIS -5 /* literal string */ #define MAPURL_DIR_TITLE_OWNER -4 #define MAPURL_DIR_TITLE_REMOTE -3 #define MAPURL_DIR_TITLE_DEFAULT -2 #define MAPURL_DIR_TITLE_NONE -1 /* then as 1, 2, 3 .. 99999 */ #define MAPURL_DIR_DELIMIT_BOTH 1 #define MAPURL_DIR_DELIMIT_HEADER 2 #define MAPURL_DIR_DELIMIT_FOOTER 3 #define MAPURL_DIR_DELIMIT_NONE 4 #define MAPURL_PATH_ALERT_END 0x0001 #define MAPURL_PATH_ALERT_AUTH 0x0002 #define MAPURL_PATH_ALERT_MAP 0x0004 #define MAPURL_PATH_ALERT_DONE 0x8000 /* bit that is ORed into the flag */ #define MAPURL_ODS_DEFAULT -1 #define MAPURL_ODS_8BIT 1 /* native encoding (default) */ #define MAPURL_ODS_UTF8 2 /* utf-8 encoding */ #define MAPURL_CLIENT_FORWARDED 1 #define MAPURL_CLIENT_IF_FORWARDED 2 #define MAPURL_CLIENT_LITERAL 3 #define MAPURL_CLIENT_RESET 4 #define MAPURL_CLIENT_XFORWARDEDFOR 5 #define MAPURL_CLIENT_IF_XFORWARDEDFOR 6 #define MAPURL_RESPONSE_GZIP_NONE -1 #define MAPURL_RESPONSE_GZIP_ALL -2 /* any other non-zero integer represents kilobytes */ /* used to mask the actual reason for denying access to a USER rule username */ #define MAPURL_USER_RULE_FORBIDDEN_MSG "\0" "403 USER forbidden!" /* put a brake on potentially runaway mapping restarts */ #define MAPURL_RESTART_MAX 5 #define MAPURL_NO_REVERSE_PATH "NO:[REVERSE.MAPPING.FOR.THIS]FILE.PATH!" #define MAPURL_PROXY_HEADER_MAX 4 /*******************/ /* data structures */ /*******************/ #ifndef __VAX # pragma member_alignment __save # pragma member_alignment #endif typedef struct MapPathSetMetaStruct MAP_SET_META; struct MapPathSetMetaStruct { BOOL AcceptLangWildcard, AcceptLangTypeVariant, NoAcceptLang, AccessProfile, AccessNoProfile, AccessRead, AccessNoRead, AccessServer, AccessNoServer, AccessWrite, AccessNoWrite, Alert, NoAlert, AuthAll, NoAuthAll, AuthMapped, NoAuthMapped, AuthOnce, NoAuthOnce, Cache, NoCache, CacheCGI, CacheNoCGI, CacheCookie, CacheNoCookie, CacheFile, CacheNoFile, CacheNet, CacheNoNet, CacheNPH, CacheNoNPH, CachePermanent, CacheNoPermanent, CacheQuery, CacheNoQuery, CacheScript, CacheNoScript, CacheSSI, CacheNoSSI, CacheSetting, CgiPlusInWriteof, CgiPlusInNoWriteof, DefaultSearch, NoDefaultSearch, DirAccess, DirAccessSelective, DirNoAccess, DirIconLink, DirNoIconLink, DirImpliedWildcard, DirNoImpliedWildcard, DirWildcard, DirNoWildcard, Expired, NoExpired, Extended, GetUai, NoGetUai, NoHtmlEquals, Http2SendPing, Http2ToHttp11, Log, NoLog, MapEllipsis, NoMapEllipsis, MapEmpty, MapNonEmpty, MapExtensionMethod, NoMapExtensionMethod, MapOnce, NoMapOnce, MapRestart, MapSetIgnore, MapSetNoIgnore, MapSetRequest, MapSetNoRequest, MapUri, PrivSsi, NoPrivSsi, Profile, NoProfile, ProxyAffinity, ProxyNoAffinity, ProxyReverseVerify, NoProxyReverseVerify, ProxyReverseAuthHeader, NoProxyReverseAuthHeader, ProxyUnknownRequestFields, NoProxyUnknownRequestFields, ResponseChunked, ResponseNoChunked, ResponseHeaderBegin, ResponseHeaderFull, ResponseHeaderNone, ResponseHeaderNoAdd, ResponseHttpOriginal, ResponseHttpNoOriginal, ScriptBodyDecode, ScriptBodyNoDecode, ScriptFind, ScriptNoFind, ScriptPathFind, ScriptNoPathFind, ScriptQueryNone, ScriptNoQueryNone, ScriptQueryRelaxed, ScriptNoQueryRelaxed, ScriptSymbolTruncate, ScriptSymbolNoTruncate, ScriptSyntaxUnix, ScriptSyntaxNoUnix, StmLF, ThrottleSet, ThrottleNoSet, NoStmLF, WildcardEllipsis, NoWildcardEllipsis, WebDavHidden, WebDavNoHidden, WebDavLock, WebDavNoLock, WebDavMetaDirLength, WebDavProfile, WebDavNoProfile, WebDavProp, WebDavNoProp, WebDavPutLock, WebDavNoPutLock, WebDavRead, WebDavNoRead, WebDavServer, WebDavNoServer, WebDavWinProp, WebDavNoWinProp, WebDavWrite, WebDavNoWrite; int AcceptLangLength, AuthRevalidateTimeout, AuthSysUafPwdExpUrlLength, CacheExpiresAfter, CacheGuardSeconds, CacheMaxKBytes, CgiPrefixLength, ChangeServiceLength, CharsetLength, ClientAddress, ClientAddressLiteralLength, ContentTypeLength, CorsAllowCredentials, CorsNoAllowCredentials, CorsAllowHeadersLength, CorsAllowMethodsLength, CorsAllowOriginLength, CorsExposeHeadersLength, CorsMaxAge, DirCharsetLength, DirTargetLength, DirTheseLength, DirTitle, DirTitleLength, DirDelimit, DirFont, DirStyle, DirVersionsOf, HtmlBodyTagLength, HtmlFooterLength, HtmlFooterTagLength, HtmlHeaderLength, HtmlHeaderTagLength, Http2MaxStreams, Http2SendGoAway, Http2SendReset, Http2WriteQueue, HttpAcceptCharsetLength, HttpAcceptLangLength, IndexLength, MapRootLength, OdsName, PathOds, ProxyBindIpAddressLength, ProxyChainCredLength, ProxyChainHostPortLength, ProxyChainPort, ProxyForwardedBy, ProxyHeaderCount, ProxyReverseLocationLength, ProxyTunnelRequestLength, ProxyXForwardedFor, PutRFM, PutMaxKbytes, QueryStringLength, RegexSyntax, Report400as, Report403as, Report404as, ReportType, Response200is203, ResponseCspLength, ResponseCsproLength, ResponseGzip, ResponseHeaderAddLength, ResponseStrictTransSecLength, ResponseVarRecord, ScriptAgentAsLength, ScriptAsLength, ScriptCommandLength, ScriptControlLength, ScriptBitBucketTimeout, ScriptCpuMax, ScriptDefaultLength, ScriptLifeTime, ScriptParamsLength, SsiExecLength, SSLCGIvar, StyleSheetLength, ThrottleIndex, ThrottleBusy, ThrottleFrom, ThrottlePerUser, ThrottleResume, ThrottleTo, ThrottleTimeoutBusy, ThrottleTimeoutQueue, TimeoutNoProgress, TimeoutOutput, TimeoutPersistent, WebDavLockTimeoutDefault, WebDavLockTimeoutMax, WebSocketInputSize, WebSocketOutputSize, WebSocketFraming; char AcceptLangChar, RmsSubChar; char *AcceptLangPtr, *AuthSysUafPwdExpUrlPtr, *CgiPrefixPtr, *ChangeServicePtr, *CharsetPtr, *ClientAddressLiteralPtr, *ContentTypePtr, *CorsAllowHeadersPtr, *CorsAllowMethodsPtr, *CorsAllowOriginPtr, *CorsExposeHeadersPtr, *DictionaryPtr, *DirCharsetPtr, *DirTargetPtr, *DirThesePtr, *DirTitlePtr, *HtmlBodyTagPtr, *HtmlFooterPtr, *HtmlFooterTagPtr, *HtmlHeaderPtr, *HtmlHeaderTagPtr, *HttpAcceptCharsetPtr, *HttpAcceptLangPtr, *IndexPtr, *MapRootPtr, *NotePadPtr, *ProxyBindIpAddressPtr, *ProxyChainCredPtr, *ProxyChainHostPortPtr, *ProxyReverseLocationPtr, *ProxyTunnelRequestPtr, *QueryStringPtr, *ResponseCspPtr, *ResponseCsproPtr, *ResponseHeaderAddPtr, *ResponseStrictTransSecPtr, *ScriptAgentAsPtr, *ScriptAsPtr, *ScriptCommandPtr, *ScriptControlPtr, *ScriptDefaultPtr, *ScriptParamsPtr, *SsiExecPtr, *StyleSheetPtr, *WebDavMetaDirPtr; char *ProxyHeader [MAPURL_PROXY_HEADER_MAX]; char DirSort [3]; IPADDRESS ProxyBindIpAddress, ProxyChainIpAddress; char CgiPlusInCC [4]; }; typedef struct MappingRuleMetaStruct MAP_RULE_META; struct MappingRuleMetaStruct { BOOL IsCgiPlusScript, PathSet; int MetaConNumber, ResultLength, ResultPathOds, RuleType; char *ConditionalPtr, *ResultPtr, *TemplatePtr; /* storage for pre-compiled regular expression */ regex_t RegexPregTemplate; MAP_SET_META mpPathSet; /* strings are stored straight after and pointed to by the above */ char Storage[]; }; typedef struct MappingMetaStruct MAPPING_META; struct MappingMetaStruct { int ThrottleIndex, ThrottlePerUserTotal, ThrottleTotal; REQUEST_STRUCT *RequestPtr; }; #define MAPURL_USER_NAME_SIZE 12 #define MAPURL_USER_DEFDEV_SIZE 31 #define MAPURL_USER_DEFDIR_SIZE 63 #define MAPURL_USER_PATH_SIZE MAPURL_USER_DEFDEV_SIZE + MAPURL_USER_DEFDIR_SIZE typedef struct MapUrlUserCacheStruct MAP_URL_USER_ENTRY; struct MapUrlUserCacheStruct { LIST_ENTRY UserCacheListEntry; int HitCount, PathOds, ReuseCount; unsigned long LastBinaryTime [2]; char UserName [MAPURL_USER_NAME_SIZE+1], UserPath [MAPURL_USER_PATH_SIZE+1]; }; #ifndef __VAX # pragma member_alignment __restore #endif /***********************/ /* function prototypes */ /***********************/ /* "quick and dirty" return path equivalent of VMS file specification */ #define MapVmsPath(vp,rp) \ MapUrl_Map (NULL, 0, vp, 0, NULL, 0, NULL, 0, NULL, 0, NULL, rp, NULL) /* (re)load the mappings */ #define MapUrl_Load() \ MapUrl_Map (NULL,0,NULL,0,NULL,0,NULL,0,NULL,0,NULL,NULL,NULL) /************/ /* MAPURL.C */ /************/ char* MapUrl_Map (char*, int, char*, int, char*, int, char*, int, char*, int, int*, REQUEST_STRUCT*, REQUEST_PATHSET*); char* MapUrl__Map (char*, int, char*, int, char*, int, char*, int, char*, int, int*, REQUEST_STRUCT*, REQUEST_PATHSET*); int MapUrl_ConfigLoad (META_CONFIG**); BOOL MapUrl_ConfigLoadCallBack (META_CONFIG*); MapUrl_ConfigUnload (META_CONFIG*); MapUrl_ConfigUnloadLineData (void*); MapUrl_ControlReload (); char* MapUrl_ExplainPathSet (REQUEST_STRUCT*, MAP_RULE_META*); char* MapUrl_GuaranteeAccess (REQUEST_STRUCT*, char*); int MapUrl_PathSet (REQUEST_STRUCT*, REQUEST_PATHSET*, MAP_SET_META*); char* MapUrl_ReportMessage (struct MappingRuleListStruct*, char*, int); void MapUrl_ResetClientAddress (REQUEST_STRUCT*); char* MapUrl_SetClientAddress (REQUEST_STRUCT*); int MapUrl_SetSeconds (struct MappingRuleListStruct*, char*, int); char* MapUrl_Substitute (REQUEST_STRUCT*, char*); MAP_RULE_META* MapUrl_ThrottleRule (int); MapUrl_ConfigParseValue (char*); int MapUrl_VirtualPath (char*, char*, char*, int); MapUrl_WatchRule (REQUEST_STRUCT*, MAP_RULE_META*, char*, int, int, BOOL); /************/ /* MAPCON.C */ /************/ BOOL MapConList (REQUEST_STRUCT*, char*, char*); BOOL MapConString (REQUEST_STRUCT*, MAP_RULE_META*, REQUEST_PATHSET*); /************/ /* MAPODS.C */ /************/ int MapOds2VmsToUrl (char*, char*, int, BOOL); int MapOds5VmsToUrl (char*, char*, int, BOOL); int MapOdsAdsVmsToUrl (char*, char*, int, BOOL); char* MapOdsAdsFileType (char*); int MapOdsElementsToVms (char*, int, char*, int, BOOL); int MapOdsPwkVmsToUrl (char*, char*, int, BOOL); char MapOdsSriCharVmsToUrl (char**, BOOL*); char* MapOdsSriFileType (char*); int MapOdsSriVmsToUrl (char*, char*, int, BOOL); int MapOdsUrlToVms (char*, char*, int, char, BOOL, int); int MapOdsUrlToAdsVms (char*, char*, int, BOOL); int MapOdsUrlToPwkVms (char*, char*, int, BOOL); int MapOdsUrlToSriVms (char*, char*, int, BOOL); int MapOdsUrlToOds2Vms (char*, char*, int, BOOL, char); int MapOdsUrlToOds5Vms (char*, char*, int, BOOL); int MapOdsVmsToUrl (char*, char*, int, BOOL, int); int MapOdsVmsToUnix (char*, char*, int); /*************/ /* MAPUSER.C */ /*************/ char* MapUserName (REQUEST_STRUCT*, char*, int*); char* MapUserNameCache (REQUEST_STRUCT*, char*, char*, int*); #endif /* MAPURL_H_LOADED */ /*****************************************************************************/