• R/O
  • SSH
  • HTTPS

sf-04webserver: Commit


Commit MetaInfo

Revisión461 (tree)
Tiempo2011-08-29 23:57:03
Autoryuh

Log Message

1.92候補2
digest認証において、nonceが期限切れになった場合の動作を修正

Cambiar Resumen

Diferencia incremental

--- 1xx/04WebServer/trunk/AuthenticateManager.cpp (revision 460)
+++ 1xx/04WebServer/trunk/AuthenticateManager.cpp (revision 461)
@@ -39,7 +39,7 @@
3939 m_privateKey += (TCHAR)((rand() % 27) + _T('a'));
4040
4141 // Nonce利用可能期間
42- m_expireTime = setting.GetKeyInt(_T("Authenticate::NonceLifeTime"), 60) * 60; // 60分間
42+ m_expireTime = setting.GetKeyInt(_T("Authenticate::NonceLifeTime"), 60) * 5; // 5分間
4343 }
4444
4545
--- 1xx/04WebServer/trunk/DigestAuthenticate.cpp (revision 460)
+++ 1xx/04WebServer/trunk/DigestAuthenticate.cpp (revision 461)
@@ -10,7 +10,7 @@
1010 /*!
1111 認証解析
1212
13- \return AUTH_PARSE_STATUS_OK:OK, AUTH_PARSE_STATUS_NONE:認証無し、AUTH_PARSE_STATUS_ERROR:異常な要求
13+ \return AUTH_PARSE_STATUS
1414 */
1515 AUTH_PARSE_STATUS CDigestAuthenticate::ParseAuthMethod(CAuthenticateManager *manager, CAlias &alias, CRequest &request)
1616 {
@@ -36,71 +36,56 @@
3636 // 分析
3737 if(ParseBasicAuth(authOptionLine, request))
3838 return(AUTH_PARSE_STATUS_ERROR);
39+
40+ // ユーザチェック
41+ if(!CheckBasicAuthUser(manager, alias, request))
42+ return(AUTH_PARSE_STATUS_FAILE);
43+
44+ // 認証OK
45+ return(AUTH_PARSE_STATUS_OK);
3946 }
4047 else if(authMethod == _T("digest"))
4148 {
4249 // 分析
43- if(ParseAuthOptionLine(authOptionLine, request))
50+ if(ParseDigestAuth(authOptionLine, request))
4451 return(AUTH_PARSE_STATUS_ERROR);
4552
4653 // 要求をチェック
4754 if(CheckDigestAuthRequest(manager, alias, request))
4855 return(AUTH_PARSE_STATUS_ERROR);
49- }
50- else
51- return(AUTH_PARSE_STATUS_ERROR);
5256
53- return(AUTH_PARSE_STATUS_OK);
54-}
57+ // 認証チェック(ユーザ、パスワードの確認)
58+ if(!CheckDigestAuthResponse(manager, alias, request))
59+ return(AUTH_PARSE_STATUS_FAILE);
5560
56-/*!
57- 認証チェック
61+ // 認証期限チェック
62+ if(!manager->CheckNonce(request.GetAuthDetailAccess().GetAccess(_T("DigestAuth")).GetKeyStr(_T("nonce"), _T(""))))
63+ return(AUTH_PARSE_STATUS_EXPIRE);
5864
59- \return FALSE:認証不可, TRUE:認証OK
60-*/
61-int CDigestAuthenticate::CheckAuthUser(CAuthenticateManager *manager, CAlias &alias, CRequest &request)
62-{
63- if(request.GetAuthDetailAccess().GetKeyStr(_T("AuthMethod"), _T("")) == _T("basic"))
64- {
65- CString passwd;
66- if(GetUserPasswd(manager, alias, request.GetUser(), passwd))
67- {
68- if(request.GetPasswd() == passwd)
69- return(TRUE);
70- }
71- return(FALSE);
65+ return(AUTH_PARSE_STATUS_OK);
7266 }
73- else if(request.GetAuthDetailAccess().GetKeyStr(_T("AuthMethod"), _T("")) == _T("digest"))
74- {
75- // ダイジェスト認証詳細
76- CWorkspaceAccess digestAuthOption = request.GetAuthDetailAccess().GetAccess(_T("DigestAuth"));
7767
78- // nonceをチェック
79- if(!manager->CheckNonce(digestAuthOption.GetKeyStr(_T("nonce"), _T(""))))
80- return(FALSE);
68+ // 非対応認証
69+ return(AUTH_PARSE_STATUS_ERROR);
70+}
8171
82- // realm確認
83- if(digestAuthOption.GetKeyStr(_T("realm"), _T("")) != GetRealm(alias.GetPathInfo().GetKeyStr(_T("Info"), _T(""))))
84- return(FALSE);
8572
86- CString passwd;
87- if(GetUserPasswd(manager, alias, request.GetUser(), passwd))
88- {
89- // ハッシュチェック
90- if(CheckDigestAuthResponse(alias, request, passwd))
91- return(TRUE);
92- }
93- return(FALSE);
94- }
95- else
96- return(FALSE);
97-}
9873
99-
10074 /////////////////////////////////////////////////////////////////////////////////////////
10175 // 生成
10276 /////////////////////////////////////////////////////////////////////////////////////////
10377 /*!
78+ 認証ライン取得
79+*/
80+CString CDigestAuthenticate::GetAuthOptionLine(int isDigest, CAuthenticateManager *manager, CAlias &alias, int stale)
81+{
82+ if(isDigest)
83+ return GetDigestAuthOptionLine(manager, alias, stale);
84+ else
85+ return GetBasicAuthOptionLine(alias);
86+}
87+
88+/*!
10489 認証ラインを取得(Basic)
10590 */
10691 CString CDigestAuthenticate::GetBasicAuthOptionLine(CAlias &alias)
@@ -113,20 +98,25 @@
11398 /*!
11499 認証ラインを取得(Digest)
115100 */
116-CString CDigestAuthenticate::GetDigestAuthOptionLine(CAuthenticateManager *manager, CAlias &alias)
101+CString CDigestAuthenticate::GetDigestAuthOptionLine(CAuthenticateManager *manager, CAlias &alias, int stale)
117102 {
118103 CString realm = GetRealm(alias.GetPathInfo().GetKeyStr(_T("Info"), _T("")));
119- CString line = CTextTools::GetFormat(_T("Digest realm=\"%s\", nonce=\"%s\", algorithm=MD5, qop=\"auth\""), realm, manager->CreateNonce());
120- return(line);
104+
105+ if(stale)
106+ return CTextTools::GetFormat(_T("Digest realm=\"%s\", nonce=\"%s\", stale=true, algorithm=MD5, qop=\"auth\""), realm, manager->CreateNonce());
107+ else
108+ return CTextTools::GetFormat(_T("Digest realm=\"%s\", nonce=\"%s\", stale=false, algorithm=MD5, qop=\"auth\""), realm, manager->CreateNonce());
121109 }
122110
123111
124112
125113 /////////////////////////////////////////////////////////////////////////////////////////
126-// 内部処理
114+// Basic認証
127115 /////////////////////////////////////////////////////////////////////////////////////////
128116 /*!
129117 基本認証の処理
118+
119+ \return -1:エラー、0:OK
130120 */
131121 int CDigestAuthenticate::ParseBasicAuth(CString authLine, CRequest &request)
132122 {
@@ -148,57 +138,31 @@
148138 }
149139
150140 /*!
151- ダイジェスト認証の詳細チェック
152-*/
153-int CDigestAuthenticate::CheckDigestAuthRequest(CAuthenticateManager *manager, CAlias &alias, CRequest &request)
154-{
155- // ダイジェスト認証詳細
156- CWorkspaceAccess digestAuthOption = request.GetAuthDetailAccess().GetAccess(_T("DigestAuth"));
141+ 基本認証の認証チェック
157142
158- // uri確認(後方一致で一致すればよい)
159- if(!CheckURIMatch(request.GetURI(), digestAuthOption.GetKeyStr(_T("uri"), _T(""))))
160- return(-1);
161-
162- return(0);
163-}
164-
165-/*!
166- ハッシュ取得
143+ \return FALSE:認証不可, TRUE:認証OK
167144 */
168-int CDigestAuthenticate::CheckDigestAuthResponse(CAlias &alias, CRequest &request, CString passwd, CString tag)
145+int CDigestAuthenticate::CheckBasicAuthUser(CAuthenticateManager *manager, CAlias &alias, CRequest &request)
169146 {
170- // ダイジェスト認証詳細
171- CWorkspaceAccess digestAuthOption = request.GetAuthDetailAccess().GetAccess(_T("DigestAuth"));
172-
173- CString responseClient = digestAuthOption.GetKeyStr(_T("response"), _T(""));
174- CString nonce = digestAuthOption.GetKeyStr(_T("nonce"), _T(""));
175- CString user = digestAuthOption.GetKeyStr(_T("username"), _T(""));
176- CString realm = digestAuthOption.GetKeyStr(_T("realm"), _T(""));
177- CString nc = digestAuthOption.GetKeyStr(_T("nc"), _T(""));
178- CString cnonce = digestAuthOption.GetKeyStr(_T("cnonce"), _T(""));
179- CString qop = digestAuthOption.GetKeyStr(_T("qop"), _T(""));
180- CString uri = digestAuthOption.GetKeyStr(_T("uri"), _T(""));
181- CString method = request.GetMethod();
182-
183- // A1文字列(MD5-HEX)
184- CString a1 = CCryptTools::GetMD5HexFromStr(user + _T(":") + realm + _T(":") + passwd);
185-
186- // A2文字列(MD5-HEX)
187- CString a2 = CCryptTools::GetMD5HexFromStr(method + _T(":") + uri);
188-
189- // Response文字列(MD5-HEX)
190- CString responseServer = CCryptTools::GetMD5HexFromStr(a1 + _T(":") + nonce + _T(":") + nc + _T(":") + cnonce + _T(":") + qop + _T(":") + a2);
191-
192- if(responseServer == responseClient)
193- return(TRUE);
147+ CString passwd;
148+ if(GetUserPasswd(manager, alias, request.GetUser(), passwd))
149+ {
150+ if(request.GetPasswd() == passwd)
151+ return(TRUE);
152+ }
194153 return(FALSE);
195154 }
196155
197156
157+/////////////////////////////////////////////////////////////////////////////////////////
158+// Digest認証
159+/////////////////////////////////////////////////////////////////////////////////////////
198160 /*!
199- Authorization オプション文字列を分解
161+ ダイジェスト認証を分析
162+
163+ \return -1:エラー、0:OK
200164 */
201-int CDigestAuthenticate::ParseAuthOptionLine(CString optionLine, CRequest &request)
165+int CDigestAuthenticate::ParseDigestAuth(CString optionLine, CRequest &request)
202166 {
203167 // ダイジェスト認証詳細
204168 CWorkspaceAccess digestAuthOption = request.GetAuthDetailAccess().GetAccess(_T("DigestAuth"));
@@ -232,25 +196,27 @@
232196 }
233197
234198 // チェック
235- if(digestAuthOption.GetKeyStr(_T("username"), _T("")).IsEmpty())
199+ if(!digestAuthOption.KeyIsExist(_T("username")))
236200 return(-1);
237201 if(!digestAuthOption.KeyIsExist(_T("realm")))
238202 return(-1);
239- if(digestAuthOption.GetKeyStr(_T("nonce"), _T("")).IsEmpty())
203+ if(!digestAuthOption.KeyIsExist(_T("nc")))
240204 return(-1);
241- if(digestAuthOption.GetKeyStr(_T("uri"), _T("")).IsEmpty())
205+ if(!digestAuthOption.KeyIsExist(_T("uri")))
242206 return(-1);
243- if(digestAuthOption.GetKeyStr(_T("algorithm"), _T("")).CompareNoCase(_T("MD5")) != 0)
207+
208+ if(digestAuthOption.GetKeyStr(_T("nonce"), _T("")).IsEmpty())
244209 return(-1);
245- if(digestAuthOption.GetKeyStr(_T("qop"), _T("")).CompareNoCase(_T("auth")) != 0)
246- return(-1);
247- if(digestAuthOption.GetKeyStr(_T("nc"), _T("")).IsEmpty())
248- return(-1);
249210 if(digestAuthOption.GetKeyStr(_T("cnonce"), _T("")).IsEmpty())
250211 return(-1);
251212 if(digestAuthOption.GetKeyStr(_T("response"), _T("")).IsEmpty())
252213 return(-1);
253214
215+ if(digestAuthOption.GetKeyStr(_T("algorithm"), _T("")).CompareNoCase(_T("MD5")) != 0)
216+ return(-1);
217+ if(digestAuthOption.GetKeyStr(_T("qop"), _T("")).CompareNoCase(_T("auth")) != 0)
218+ return(-1);
219+
254220 // ユーザ名
255221 request.SetUser(digestAuthOption.GetKeyStr(_T("username"), _T("")));
256222 return(0);
@@ -257,10 +223,75 @@
257223 }
258224
259225
226+
260227 /*!
228+ ダイジェスト認証の詳細チェック
229+
230+ \return -1:エラー、0:OK
231+*/
232+int CDigestAuthenticate::CheckDigestAuthRequest(CAuthenticateManager *manager, CAlias &alias, CRequest &request)
233+{
234+ // ダイジェスト認証詳細
235+ CWorkspaceAccess digestAuthOption = request.GetAuthDetailAccess().GetAccess(_T("DigestAuth"));
236+
237+ // uri確認(後方一致で一致すればよい)
238+ if(!CheckURIMatch(request.GetURI(), digestAuthOption.GetKeyStr(_T("uri"), _T(""))))
239+ return(-1);
240+
241+ return(0);
242+}
243+
244+/*!
245+ レスポンスチェック
246+*/
247+int CDigestAuthenticate::CheckDigestAuthResponse(CAuthenticateManager *manager, CAlias &alias, CRequest &request, CString tag)
248+{
249+ // ダイジェスト認証詳細
250+ CWorkspaceAccess digestAuthOption = request.GetAuthDetailAccess().GetAccess(_T("DigestAuth"));
251+
252+ CString responseClient = digestAuthOption.GetKeyStr(_T("response"), _T(""));
253+ CString nonce = digestAuthOption.GetKeyStr(_T("nonce"), _T(""));
254+ CString user = digestAuthOption.GetKeyStr(_T("username"), _T(""));
255+ CString realm = digestAuthOption.GetKeyStr(_T("realm"), _T(""));
256+ CString nc = digestAuthOption.GetKeyStr(_T("nc"), _T(""));
257+ CString cnonce = digestAuthOption.GetKeyStr(_T("cnonce"), _T(""));
258+ CString qop = digestAuthOption.GetKeyStr(_T("qop"), _T(""));
259+ CString uri = digestAuthOption.GetKeyStr(_T("uri"), _T(""));
260+ CString method = request.GetMethod();
261+
262+ // realm確認
263+ if(realm != GetRealm(alias.GetPathInfo().GetKeyStr(_T("Info"), _T(""))))
264+ return(FALSE);
265+
266+ // ユーザの確認、パスワード取得
267+ CString passwd;
268+ if(!GetUserPasswd(manager, alias, request.GetUser(), passwd))
269+ return(FALSE); // ユーザなし
270+
271+ // A1文字列(MD5-HEX)
272+ CString a1 = CCryptTools::GetMD5HexFromStr(user + _T(":") + realm + _T(":") + passwd);
273+
274+ // A2文字列(MD5-HEX)
275+ CString a2 = CCryptTools::GetMD5HexFromStr(method + _T(":") + uri);
276+
277+ // Response文字列(MD5-HEX)
278+ CString responseServer = CCryptTools::GetMD5HexFromStr(a1 + _T(":") + nonce + _T(":") + nc + _T(":") + cnonce + _T(":") + qop + _T(":") + a2);
279+
280+ // レスポンス確認
281+ if(responseServer != responseClient)
282+ return(FALSE);
283+
284+ return(TRUE);
285+}
286+
287+
288+/////////////////////////////////////////////////////////////////////////////////////////
289+// 補助関数
290+/////////////////////////////////////////////////////////////////////////////////////////
291+/*!
261292 ユーザ名・パスワードチェック
262293
263- \return FALSE:認証不可, TRUE:認証OK
294+ \return FALSE:ユーザなし, TRUE:ユーザあり
264295 */
265296 int CDigestAuthenticate::GetUserPasswd(CAuthenticateManager *manager, CAlias &alias, CString userName, CString &passwd)
266297 {
--- 1xx/04WebServer/trunk/DigestAuthenticate.h (revision 460)
+++ 1xx/04WebServer/trunk/DigestAuthenticate.h (revision 461)
@@ -6,9 +6,20 @@
66
77 enum AUTH_PARSE_STATUS
88 {
9- AUTH_PARSE_STATUS_NONE = 0,
10- AUTH_PARSE_STATUS_OK = 1,
11- AUTH_PARSE_STATUS_ERROR = -1,
9+ // 認証情報なし
10+ AUTH_PARSE_STATUS_NONE = 0,
11+
12+ // 認証情報期限切れ
13+ AUTH_PARSE_STATUS_EXPIRE = 10,
14+
15+ // 認証失敗
16+ AUTH_PARSE_STATUS_FAILE = 20,
17+
18+ // 認証成功
19+ AUTH_PARSE_STATUS_OK = 30,
20+
21+ // 異常な認証
22+ AUTH_PARSE_STATUS_ERROR = -1,
1223 };
1324
1425 /*!
@@ -21,42 +32,56 @@
2132 // チェック
2233 /////////////////////////////////////////////////////////////////////////////////////////
2334 //! 認証方式を解析
24- AUTH_PARSE_STATUS ParseAuthMethod(CAuthenticateManager *manager, CAlias &alias, CRequest &request);
35+ static AUTH_PARSE_STATUS ParseAuthMethod(CAuthenticateManager *manager, CAlias &alias, CRequest &request);
2536
26- //! 認証チェック
27- int CheckAuthUser(CAuthenticateManager *manager, CAlias &alias, CRequest &request);
28-
2937 /////////////////////////////////////////////////////////////////////////////////////////
3038 // 生成
3139 /////////////////////////////////////////////////////////////////////////////////////////
40+ //! 認証ライン取得
41+ static CString GetAuthOptionLine(int isDigest, CAuthenticateManager *manager, CAlias &alias, int stale);
42+
3243 //! 認証ラインを取得
33- CString GetBasicAuthOptionLine(CAlias &alias);
44+ static CString GetBasicAuthOptionLine(CAlias &alias);
3445
3546 //! 認証ラインを取得
36- CString GetDigestAuthOptionLine(CAuthenticateManager *manager, CAlias &alias);
47+ static CString GetDigestAuthOptionLine(CAuthenticateManager *manager, CAlias &alias, int stale);
3748
3849 protected:
3950 /////////////////////////////////////////////////////////////////////////////////////////
40- // 内部処理
51+ // Basic認証
4152 /////////////////////////////////////////////////////////////////////////////////////////
42- //! 基本認証の処理
43- int ParseBasicAuth(CString authLine, CRequest &request);
53+ //! 基本認証の分析
54+ static int ParseBasicAuth(CString authLine, CRequest &request);
4455
45- //! Authorization オプション文字列を分解
46- int ParseAuthOptionLine(CString optionLine, CRequest &request);
56+ //! 基本認証の認証チェック
57+ static int CheckBasicAuthUser(CAuthenticateManager *manager, CAlias &alias, CRequest &request);
4758
59+
60+ /////////////////////////////////////////////////////////////////////////////////////////
61+ // Digest認証
62+ /////////////////////////////////////////////////////////////////////////////////////////
63+ //! ダイジェスト認証を分析
64+ static int ParseDigestAuth(CString optionLine, CRequest &request);
65+
4866 //! ダイジェスト認証の詳細チェック
49- int CheckDigestAuthRequest(CAuthenticateManager *manager, CAlias &alias, CRequest &request);
67+ static int CheckDigestAuthRequest(CAuthenticateManager *manager, CAlias &alias, CRequest &request);
5068
51- //! ハッシュチェック
52- int CheckDigestAuthResponse(CAlias &alias, CRequest &request, CString passwd, CString tag = _T(""));
69+ //! レスポンスチェック
70+ static int CheckDigestAuthResponse(CAuthenticateManager *manager, CAlias &alias, CRequest &request, CString tag = _T(""));
5371
72+ //! 認証チェック
73+ static int CheckDigestAuthUser(CAuthenticateManager *manager, CAlias &alias, CRequest &request);
74+
75+
76+ /////////////////////////////////////////////////////////////////////////////////////////
77+ // 補助関数
78+ /////////////////////////////////////////////////////////////////////////////////////////
5479 //! ユーザ名・パスワードを確認
55- int GetUserPasswd(CAuthenticateManager *manager, CAlias &alias, CString userName, CString &passwd);
80+ static int GetUserPasswd(CAuthenticateManager *manager, CAlias &alias, CString userName, CString &passwd);
5681
5782 //! URIの一致を確認
58- int CheckURIMatch(CString serverURI, CString clientURI);
83+ static int CheckURIMatch(CString serverURI, CString clientURI);
5984
6085 //! realm取得
61- CString GetRealm(CString realmSrc);
86+ static CString GetRealm(CString realmSrc);
6287 };
--- 1xx/04WebServer/trunk/ModuleInfo.xml (revision 460)
+++ 1xx/04WebServer/trunk/ModuleInfo.xml (revision 461)
@@ -4,13 +4,13 @@
44 <Subnode name="CWorkspace">
55 <Subnode name="ModuleInfo">
66 <Key name="ModuleVersion">1.0.0</Key>
7- <Key name="ModuleBuild">1034</Key>
7+ <Key name="ModuleBuild">1035</Key>
88 <Key name="Target">.cpp .h .rc .rc2 .ico .bmp</Key>
99 <Key name="ReWrite">ServerConfig.h,res\version.rc</Key>
10- <Key name="ModuleUpdate">2011/08/29 00:09:19</Key>
10+ <Key name="ModuleUpdate">2011/08/29 23:53:39</Key>
1111 <Key name="ModuleVersionC">1, 0, 0</Key>
12- <Key name="ModuleUpdateDate">2011/08/29 00:09:19</Key>
13- <Key name="ModuleUpdateDateStr">20110829_000919</Key>
12+ <Key name="ModuleUpdateDate">2011/08/29 23:53:39</Key>
13+ <Key name="ModuleUpdateDateStr">20110829_235339</Key>
1414 <Key name="ModuleGUID">{B37D428C-FD85-4CD2-A5F5-158914825598}</Key>
1515 <Key name="ModuleGUID2">{4A183D00-43DF-4C6C-AEBD-D38EC92AA5E0}</Key>
1616 <Key name="ModuleGUID3">{925726F5-4C0A-4821-B350-0D584FD40719}</Key>
--- 1xx/04WebServer/trunk/IntervalTimer.cpp (revision 460)
+++ 1xx/04WebServer/trunk/IntervalTimer.cpp (revision 461)
@@ -3,8 +3,7 @@
33
44 CIntervalTimer::CIntervalTimer(int interval)
55 {
6- m_interval = interval;
7- m_oldTick = GetTickCount();
6+ SetInterval(interval);
87 }
98
109 CIntervalTimer::~CIntervalTimer(void)
@@ -24,23 +23,36 @@
2423 return(0);
2524 }
2625
26+/*!
27+ タイムアウトしたか?
28+*/
2729 CIntervalTimer::operator int()
2830 {
2931 return(IsTimeout());
3032 }
3133
34+/*!
35+ リセット
36+*/
3237 void CIntervalTimer::Reset()
3338 {
3439 m_oldTick = GetTickCount();
3540 }
3641
42+/*!
43+ 待ち時間をセット
44+*/
3745 void CIntervalTimer::SetInterval(int interval)
3846 {
47+ if(interval < 0)
48+ interval = 0;
3949 m_interval = interval;
4050 Reset();
4151 }
4252
43-// 残り時間を取得
53+/*!
54+ 残り時間を取得
55+*/
4456 int CIntervalTimer::GetLeftTime()
4557 {
4658 DWORD tick = GetTickCount();
--- 1xx/04WebServer/trunk/Connection.cpp (revision 460)
+++ 1xx/04WebServer/trunk/Connection.cpp (revision 461)
@@ -509,41 +509,42 @@
509509 {
510510 DEBUG_SET_THREAD_FUNCTION_NAME("CConnection::CheckAuthorize");
511511
512+ // 認証は有効か?
512513 if(alias.GetPathOptions().GetConfig("EnableAuthenticate", 0))
513514 {
514- CDigestAuthenticate auth;
515+ int stale = FALSE;
516+ switch(CDigestAuthenticate::ParseAuthMethod(m_server->GetAuthManager(), alias, request))
517+ {
518+ // 成功
519+ case AUTH_PARSE_STATUS_OK:
520+ break;
515521
516- AUTH_PARSE_STATUS ret = auth.ParseAuthMethod(m_server->GetAuthManager(), alias, request);
517- if(ret == AUTH_PARSE_STATUS_ERROR)
518- {
522+ // 認証エラー
523+ case AUTH_PARSE_STATUS_ERROR:
519524 throw new CSystemResponse(m_server, context, _T("認証の要求が異常です"), 400);
520- }
521- else
522- {
523- // 認証OK?
524- if(ret == AUTH_PARSE_STATUS_OK)
525- if(auth.CheckAuthUser(m_server->GetAuthManager(), alias, request))
526- return;
525+ break;
527526
528- // 認証を要求
529- CSystemResponse *move = new CSystemResponse(m_server, context, _T("認証が必要です"), 401);
530- switch(alias.GetPathOptions().GetConfig("AuthenticateType", 1))
527+ // 期限切れ(認証失敗へ)
528+ case AUTH_PARSE_STATUS_EXPIRE:
529+ stale = TRUE;
530+ // breakしない
531+
532+ // 認証失敗
533+ case AUTH_PARSE_STATUS_FAILE:
534+ case AUTH_PARSE_STATUS_NONE:
531535 {
532- case 0:
533- default:
534- move->m_responseOptions.SetConfig("WWW-Authenticate", auth.GetBasicAuthOptionLine(alias));
536+ // 認証を要求
537+ CSystemResponse *move = new CSystemResponse(m_server, context, _T("認証が必要です"), 401);
538+ move->m_responseOptions.SetConfig(_T("WWW-Authenticate"),
539+ CDigestAuthenticate::GetAuthOptionLine(alias.GetPathOptions().GetConfig(_T("AuthenticateType"), 0),
540+ m_server->GetAuthManager(), alias, stale));
535541 throw move;
536- break;
537-
538- case 1:
539- move->m_responseOptions.SetConfig("WWW-Authenticate", auth.GetDigestAuthOptionLine(m_server->GetAuthManager(), alias));
540- throw move;
541- break;
542542 }
543543 }
544544 }
545545 }
546546
547+
547548 /*!
548549 移動の確認
549550 */
@@ -1038,9 +1039,9 @@
10381039 return;
10391040
10401041 // 足りなければもっと待つ
1041- while(!timer.IsTimeout())
1042+ if(!timer.IsTimeout())
10421043 {
1043- if(m_interrupt.WaitInterrupt(20))
1044+ if(m_interrupt.WaitInterrupt(timer.GetLeftTime()))
10441045 return;
10451046 }
10461047 }
Show on old repository browser