亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? auth_digest.c

?? 代理服務(wù)器 squid-2.6.STABLE16
?? C
?? 第 1 頁 / 共 4 頁
字號:
/* * $Id: auth_digest.c,v 1.21.2.1 2007/08/31 14:08:53 hno Exp $ * * DEBUG: section 29    Authenticator * AUTHOR: Robert Collins * * SQUID Internet Object Cache  http://squid.nlanr.net/Squid/ * ---------------------------------------------------------- * *  Squid is the result of efforts by numerous individuals from the *  Internet community.  Development is led by Duane Wessels of the *  National Laboratory for Applied Network Research and funded by the *  National Science Foundation.  Squid is Copyrighted (C) 1998 by *  the Regents of the University of California.  Please see the *  COPYRIGHT file for full details.  Squid incorporates software *  developed and/or copyrighted by other sources.  Please see the *  CREDITS file for full details. * *  This program is free software; you can redistribute it and/or modify *  it under the terms of the GNU General Public License as published by *  the Free Software Foundation; either version 2 of the License, or *  (at your option) any later version. *   *  This program is distributed in the hope that it will be useful, *  but WITHOUT ANY WARRANTY; without even the implied warranty of *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the *  GNU General Public License for more details. *   *  You should have received a copy of the GNU General Public License *  along with this program; if not, write to the Free Software *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. * *//* The functions in this file handle authentication. * They DO NOT perform access control or auditing. * See acl.c for access control and client_side.c for auditing */#include "squid.h"#include "rfc2617.h"#include "auth_digest.h"extern AUTHSSETUP authSchemeSetup_digest;static voidauthenticateStateFree(authenticateStateData * r){    if (r->auth_user_request) {	authenticateAuthUserRequestUnlock(r->auth_user_request);	r->auth_user_request = NULL;    }    cbdataFree(r);}/* Digest Scheme */static HLPCB authenticateDigestHandleReply;static AUTHSACTIVE authenticateDigestActive;static AUTHSADDHEADER authDigestAddHeader;#if WAITING_FOR_TEstatic AUTHSADDTRAILER authDigestAddTrailer;#endifstatic AUTHSAUTHED authDigestAuthenticated;static AUTHSAUTHUSER authenticateDigestAuthenticateUser;static AUTHSCONFIGURED authDigestConfigured;static AUTHSDIRECTION authenticateDigestDirection;static AUTHSDECODE authenticateDigestDecodeAuth;static AUTHSDUMP authDigestCfgDump;static AUTHSFIXERR authenticateDigestFixHeader;static AUTHSFREE authenticateDigestUserFree;static AUTHSFREECONFIG authDigestFreeConfig;static AUTHSINIT authDigestInit;static AUTHSPARSE authDigestParse;static AUTHSCHECKCONFIG authDigestCheckConfig;static AUTHSREQFREE authDigestAURequestFree;static AUTHSSTART authenticateDigestStart;static AUTHSSTATS authenticateDigestStats;static AUTHSUSERNAME authenticateDigestUsername;static AUTHSSHUTDOWN authDigestDone;static helper *digestauthenticators = NULL;static hash_table *digest_nonce_cache;static auth_digest_config *digestConfig = NULL;static int authdigest_initialised = 0;static MemPool *digest_user_pool = NULL;static MemPool *digest_request_pool = NULL;static MemPool *digest_nonce_pool = NULL;CBDATA_TYPE(authenticateStateData);/* * * Nonce Functions * */static void authenticateDigestNonceCacheCleanup(void *data);static digest_nonce_h *authenticateDigestNonceFindNonce(const char *nonceb64);static digest_nonce_h *authenticateDigestNonceNew(void);static void authenticateDigestNonceDelete(digest_nonce_h * nonce);static void authenticateDigestNonceSetup(void);static void authenticateDigestNonceShutdown(void);static void authenticateDigestNonceReconfigure(void);static const char *authenticateDigestNonceNonceb64(digest_nonce_h * nonce);static int authDigestNonceIsValid(digest_nonce_h * nonce, char nc[9]);static int authDigestNonceIsStale(digest_nonce_h * nonce);static void authDigestNonceEncode(digest_nonce_h * nonce);static int authDigestNonceLastRequest(digest_nonce_h * nonce);static void authDigestNonceLink(digest_nonce_h * nonce);static void authDigestNonceUnlink(digest_nonce_h * nonce);#if NOT_USEDstatic int authDigestNonceLinks(digest_nonce_h * nonce);#endifstatic void authDigestNonceUserUnlink(digest_nonce_h * nonce);static void authDigestNoncePurge(digest_nonce_h * nonce);static voidauthDigestNonceEncode(digest_nonce_h * nonce){    if (!nonce)	return;    if (nonce->hash.key)	xfree(nonce->hash.key);    nonce->hash.key = xstrdup(base64_encode_bin((char *) &(nonce->noncedata), sizeof(digest_nonce_data)));}static digest_nonce_h *authenticateDigestNonceNew(void){    digest_nonce_h *newnonce = memPoolAlloc(digest_nonce_pool);    digest_nonce_h *temp;/* NONCE CREATION - NOTES AND REASONING. RBC 20010108 * === EXCERPT FROM RFC 2617 === * The contents of the nonce are implementation dependent. The quality * of the implementation depends on a good choice. A nonce might, for * example, be constructed as the base 64 encoding of *  * time-stamp H(time-stamp ":" ETag ":" private-key) *  * where time-stamp is a server-generated time or other non-repeating * value, ETag is the value of the HTTP ETag header associated with * the requested entity, and private-key is data known only to the * server.  With a nonce of this form a server would recalculate the * hash portion after receiving the client authentication header and * reject the request if it did not match the nonce from that header * or if the time-stamp value is not recent enough. In this way the * server can limit the time of the nonce's validity. The inclusion of * the ETag prevents a replay request for an updated version of the * resource.  (Note: including the IP address of the client in the * nonce would appear to offer the server the ability to limit the * reuse of the nonce to the same client that originally got it. * However, that would break proxy farms, where requests from a single * user often go through different proxies in the farm. Also, IP * address spoofing is not that hard.) * ==== *  * Now for my reasoning: * We will not accept a unrecognised nonce->we have all recognisable * nonces stored If we send out unique base64 encodings we guarantee * that a given nonce applies to only one user (barring attacks or * really bad timing with expiry and creation).  Using a random * component in the nonce allows us to loop to find a unique nonce. * We use H(nonce_data) so the nonce is meaningless to the reciever. * So our nonce looks like base64(H(timestamp,pointertohash,randomdata)) * And even if our randomness is not very random (probably due to * bad coding on my part) we don't really care - the timestamp and * memory pointer should provide enough protection for the users * authentication. */    /* create a new nonce */    newnonce->nc = 0;    newnonce->flags.valid = 1;    newnonce->noncedata.self = newnonce;    newnonce->noncedata.creationtime = current_time.tv_sec;    newnonce->noncedata.randomdata = squid_random();    authDigestNonceEncode(newnonce);    /*     * loop until we get a unique nonce. The nonce creation must     * have a random factor     */    while ((temp = authenticateDigestNonceFindNonce(newnonce->hash.key))) {	/* create a new nonce */	newnonce->noncedata.randomdata = squid_random();	authDigestNonceEncode(newnonce);    }    hash_join(digest_nonce_cache, &newnonce->hash);    /* the cache's link */    authDigestNonceLink(newnonce);    newnonce->flags.incache = 1;    debug(29, 5) ("authenticateDigestNonceNew: created nonce %p at %ld\n", newnonce, (long int) newnonce->noncedata.creationtime);    return newnonce;}static voidauthenticateDigestNonceDelete(digest_nonce_h * nonce){    if (nonce) {	assert(nonce->references == 0);#if UNREACHABLECODE	if (nonce->flags.incache)	    hash_remove_link(digest_nonce_cache, &nonce->hash);#endif	assert(nonce->flags.incache == 0);	safe_free(nonce->hash.key);	memPoolFree(digest_nonce_pool, nonce);    }}static voidauthenticateDigestNonceSetup(void){    if (!digest_nonce_pool)	digest_nonce_pool = memPoolCreate("Digest Scheme nonce's", sizeof(digest_nonce_h));    if (!digest_nonce_cache) {	digest_nonce_cache = hash_create((HASHCMP *) strcmp, 7921, hash_string);	assert(digest_nonce_cache);	eventAdd("Digest none cache maintenance", authenticateDigestNonceCacheCleanup, NULL, digestConfig->nonceGCInterval, 1);    }}static voidauthenticateDigestNonceShutdown(void){    /*      * We empty the cache of any nonces left in there.     */    digest_nonce_h *nonce;    if (digest_nonce_cache) {	debug(29, 2) ("authenticateDigestNonceShutdown: Shutting down nonce cache \n");	hash_first(digest_nonce_cache);	while ((nonce = ((digest_nonce_h *) hash_next(digest_nonce_cache)))) {	    assert(nonce->flags.incache);	    authDigestNoncePurge(nonce);	}    }    if (digest_nonce_pool) {	assert(memPoolInUseCount(digest_nonce_pool) == 0);	memPoolDestroy(digest_nonce_pool);	digest_nonce_pool = NULL;    }    debug(29, 2) ("authenticateDigestNonceShutdown: Nonce cache shutdown\n");}static voidauthenticateDigestNonceReconfigure(void){}static voidauthenticateDigestNonceCacheCleanup(void *data){    /*     * We walk the hash by nonceb64 as that is the unique key we     * use.  For big hash tables we could consider stepping through     * the cache, 100/200 entries at a time. Lets see how it flies     * first.     */    digest_nonce_h *nonce;    debug(29, 3) ("authenticateDigestNonceCacheCleanup: Cleaning the nonce cache now\n");    debug(29, 3) ("authenticateDigestNonceCacheCleanup: Current time: %ld\n",	(long int) current_time.tv_sec);    hash_first(digest_nonce_cache);    while ((nonce = ((digest_nonce_h *) hash_next(digest_nonce_cache)))) {	debug(29, 3) ("authenticateDigestNonceCacheCleanup: nonce entry  : %p '%s'\n", nonce, (char *) nonce->hash.key);	debug(29, 4) ("authenticateDigestNonceCacheCleanup: Creation time: %ld\n", (long int) nonce->noncedata.creationtime);	if (authDigestNonceIsStale(nonce)) {	    debug(29, 4) ("authenticateDigestNonceCacheCleanup: Removing nonce %s from cache due to timeout.\n", (char *) nonce->hash.key);	    assert(nonce->flags.incache);	    /* invalidate nonce so future requests fail */	    nonce->flags.valid = 0;	    /* if it is tied to a auth_user, remove the tie */	    authDigestNonceUserUnlink(nonce);	    authDigestNoncePurge(nonce);	}    }    debug(29, 3) ("authenticateDigestNonceCacheCleanup: Finished cleaning the nonce cache.\n");    if (authenticateDigestActive())	eventAdd("Digest none cache maintenance", authenticateDigestNonceCacheCleanup, NULL, digestConfig->nonceGCInterval, 1);}static voidauthDigestNonceLink(digest_nonce_h * nonce){    assert(nonce != NULL);    nonce->references++;    debug(29, 9) ("authDigestNonceLink: nonce '%p' now at '%d'.\n", nonce, nonce->references);}#if NOT_USEDstatic intauthDigestNonceLinks(digest_nonce_h * nonce){    if (!nonce)	return -1;    return nonce->references;}#endifstatic voidauthDigestNonceUnlink(digest_nonce_h * nonce){    assert(nonce != NULL);    if (nonce->references > 0) {	nonce->references--;    } else {	debug(29, 1) ("authDigestNonceUnlink; Attempt to lower nonce %p refcount below 0!\n", nonce);    }    debug(29, 9) ("authDigestNonceUnlink: nonce '%p' now at '%d'.\n", nonce, nonce->references);    if (nonce->references == 0)	authenticateDigestNonceDelete(nonce);}static const char *authenticateDigestNonceNonceb64(digest_nonce_h * nonce){    if (!nonce)	return NULL;    return nonce->hash.key;}static digest_nonce_h *authenticateDigestNonceFindNonce(const char *nonceb64){    digest_nonce_h *nonce = NULL;    if (nonceb64 == NULL)	return NULL;    debug(29, 9) ("authDigestNonceFindNonce:looking for nonceb64 '%s' in the nonce cache.\n", nonceb64);    nonce = hash_lookup(digest_nonce_cache, nonceb64);    if ((nonce == NULL) || (strcmp(nonce->hash.key, nonceb64)))	return NULL;    debug(29, 9) ("authDigestNonceFindNonce: Found nonce '%p'\n", nonce);    return nonce;}static intauthDigestNonceIsValid(digest_nonce_h * nonce, char nc[9]){    unsigned long intnc;    /* do we have a nonce ? */    if (!nonce)	return 0;    intnc = strtol(nc, NULL, 16);    /* has it already been invalidated ? */    if (!nonce->flags.valid) {	debug(29, 4) ("authDigestNonceIsValid: Nonce already invalidated\n");	return 0;    }    /* is the nonce-count ok ? */    if (!digestConfig->CheckNonceCount) {	nonce->nc++;	return -1;		/* forced OK by configuration */    }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲制服丝袜在线| 亚洲成人激情综合网| 日本欧美韩国一区三区| 欧美日韩在线精品一区二区三区激情 | 久久精品久久99精品久久| 欧美伦理视频网站| 欧美a级理论片| 久久综合丝袜日本网| 国产精品一级黄| 国产精品福利一区| 在线免费不卡电影| 日本女人一区二区三区| 欧美大片国产精品| 国产精品白丝jk白祙喷水网站| 国产欧美一区二区精品久导航 | 国产剧情一区二区| 亚洲欧美影音先锋| 欧美日韩五月天| 精品在线一区二区| 一区二区中文字幕在线| 欧美日韩在线综合| 国产美女精品在线| 亚洲免费大片在线观看| 日韩亚洲欧美综合| 国产成人精品一区二| 一区二区成人在线| 欧美成人在线直播| 99久久精品国产一区二区三区 | 欧美一卡2卡三卡4卡5免费| 国产伦精品一区二区三区视频青涩| 国产精品久久午夜| 欧美男同性恋视频网站| 国产不卡在线一区| 亚洲va在线va天堂| 国产女主播一区| 欧美精选一区二区| 粉嫩嫩av羞羞动漫久久久| 亚洲一区二区在线免费观看视频 | 久久婷婷一区二区三区| 色综合天天性综合| 精品一区二区三区视频在线观看| 亚洲人吸女人奶水| 亚洲精品一区二区精华| 欧美最猛性xxxxx直播| 国产精品亚洲第一| 亚洲h动漫在线| 中文久久乱码一区二区| 日韩小视频在线观看专区| 91免费观看在线| 国产福利一区二区三区视频在线| 石原莉奈在线亚洲二区| 中文字幕在线不卡一区二区三区 | 久久亚洲一区二区三区明星换脸| 色综合天天综合在线视频| 国产在线不卡一区| 图片区小说区国产精品视频 | 亚洲人成精品久久久久| 国产欧美日韩综合| 日韩女优av电影| 欧美精品在线视频| 91久久精品一区二区二区| 成人综合在线视频| 国产精品亚洲一区二区三区妖精| 久久精品99国产精品日本| 亚洲成在线观看| 亚洲高清中文字幕| 亚洲一区二区三区在线播放| 国产精品久久久久影院亚瑟| 国产午夜三级一区二区三| 欧美电影免费观看高清完整版在线| 欧美日韩二区三区| 欧美系列在线观看| 色哦色哦哦色天天综合| 97精品电影院| 色噜噜夜夜夜综合网| av一区二区三区黑人| 成人免费看视频| 成人免费观看视频| 国产99久久久精品| 成人h动漫精品一区二区| 国产精品一区二区男女羞羞无遮挡 | 欧美精品电影在线播放| 欧美日本一区二区三区四区| 69久久夜色精品国产69蝌蚪网| 高清在线观看日韩| 久久99精品国产麻豆婷婷洗澡| 蜜臀久久99精品久久久久宅男| 男女视频一区二区| 韩国三级在线一区| 国产综合久久久久影院| 国产精品18久久久| 不卡的av电影| 色狠狠综合天天综合综合| 色噜噜狠狠色综合欧洲selulu| 欧美三级欧美一级| 337p亚洲精品色噜噜噜| 欧美一卡二卡三卡| 国产欧美一区二区精品性色| 国产精品国产三级国产普通话蜜臀| 中文字幕在线一区| 亚洲一区二区三区视频在线播放| 丝瓜av网站精品一区二区| 六月丁香婷婷色狠狠久久| 国产在线一区二区综合免费视频| 国产v综合v亚洲欧| 91国产丝袜在线播放| 日韩一区二区精品葵司在线| 国产网站一区二区| 亚洲激情五月婷婷| 日韩av成人高清| 高清不卡在线观看| 欧美天堂一区二区三区| 日韩女优制服丝袜电影| 亚洲欧洲日本在线| 日韩精品久久久久久| 国产精品99久久久久久久女警 | 久久久无码精品亚洲日韩按摩| 中文字幕国产一区二区| 亚洲大片在线观看| 国产·精品毛片| 在线播放欧美女士性生活| 国产欧美一区二区精品性| 婷婷综合在线观看| 成人精品一区二区三区中文字幕| 欧美日韩色一区| 国产日产欧美精品一区二区三区| 亚洲国产精品麻豆| 国产美女一区二区三区| 欧美男女性生活在线直播观看| 国产午夜精品久久久久久免费视 | 日韩精品亚洲专区| 99这里只有精品| wwwwxxxxx欧美| 午夜精品免费在线| 成人理论电影网| 精品成人一区二区| 五月天婷婷综合| 91在线porny国产在线看| 欧美成人精品高清在线播放| 亚洲激情图片一区| 不卡影院免费观看| 精品久久久久久无| 亚洲第一狼人社区| 91网站最新地址| 国产女主播一区| 国产在线一区观看| 日韩一区二区三区免费看 | 国产视频一区不卡| 香蕉影视欧美成人| 色又黄又爽网站www久久| 亚洲国产成人一区二区三区| 美女脱光内衣内裤视频久久影院| 日本精品一级二级| 亚洲视频狠狠干| 成人免费黄色大片| 中文字幕高清不卡| 国产精品资源在线观看| 精品国产91久久久久久久妲己| 亚洲mv大片欧洲mv大片精品| 欧美私人免费视频| 一区二区三区中文字幕电影| 99精品视频免费在线观看| 国产性做久久久久久| 国产成人av影院| 久久综合久久99| 国内精品免费在线观看| 精品成人一区二区三区四区| 激情伊人五月天久久综合| 精品久久久久久亚洲综合网| 激情小说欧美图片| 久久九九影视网| 成人高清免费在线播放| 中文字幕在线观看不卡| 一本一道综合狠狠老| 亚洲精品视频在线看| 欧美午夜一区二区三区免费大片| 亚洲伊人伊色伊影伊综合网| 欧美影片第一页| 婷婷一区二区三区| 日韩免费看网站| 国产成人av电影免费在线观看| 中文字幕av一区 二区| 91啪亚洲精品| 亚洲动漫第一页| 欧美一区二区三区公司| 韩国精品主播一区二区在线观看 | 国产精品美女久久久久久久久| 岛国一区二区在线观看| 亚洲免费毛片网站| 欧美色综合网站| 久久国产剧场电影| 欧美国产综合色视频| 91麻豆6部合集magnet| 亚洲国产精品视频| www亚洲一区| 91污片在线观看| 日韩国产精品91| 欧美激情一区二区三区四区| 一本大道久久a久久精品综合| 五月天精品一区二区三区|