jivekb

skyleaf24
03-09-10 7 343

一个人恢复代码,好无聊,还有没谁正玩这个的,一起啦。

skyleaf24
2003-09-11 11:04

我们来打靶吧
jivekb.jar
kb.action.KbSearch
kb.action.EditCategories
kb.database.CommentBlockIterator
kb.database.DbEntry
kb.database.DbCategory
kb.database.DbQuery
kb.database.DbQueryLogger
kb.database.DbSearchManager
kb.database.DbWatchManager
kb.database.EntryBlockIterator
kb.database.EntryPartBlockIterator
kb.database.KbCategoryBlockIterator
kb.database.RecommendationBlockIterator
kb.database.WatchListener

jivebase.jar
com.jivesoftware.base.AuthFactory
com.jivesoftware.base.JivePropertyClusterTask
com.jivesoftware.base.util.PDFExtractor
com.jivesoftware.base.log.output.AsyncLogTarget
com.jivesoftware.base.database.ConnectionPool
com.jivesoftware.base.database.DbPresenceManager
com.jivesoftware.base.database.DbRoster
com.jivesoftware.base.database.SSOAuthFactory

差不多就剩这些啦。


skyleaf24
2003-09-11 11:25

开始打啦。
我用的工具DJ Java Decompiler 3.5
AuthFactory反编译后,
protected AuthToken createAuthToken(HttpServletRequest request, HttpServletResponse response)不正确,结果如下:

protected AuthToken createAuthToken(HttpServletRequest request, HttpServletResponse response)
throws UnauthorizedException
{
HttpSession session;
AuthToken authToken;
Cookie cookie;
session = request.getSession();
authToken = (AuthToken)session.getAttribute("jive.authToken");
if(authToken != null)
return authToken;
cookie = CookieUtils.getCookie(request, "jive.authToken.autologin");
if(cookie == null)
break MISSING_BLOCK_LABEL_110;
String authInfo[] = decryptAuthInfo(cookie.getValue());
if(authInfo == null)
break MISSING_BLOCK_LABEL_90;
String username = authInfo[0];
String password = authInfo[1];
authToken = getAuthToken(username, password);
session.setAttribute("jive.authToken", authToken);
return authToken;
try
{
CookieUtils.deleteCookie(response, cookie);
}
catch(UnauthorizedException ue)
{
CookieUtils.deleteCookie(response, cookie);
throw ue;
}
throw new UnauthorizedException();
}


修改后:
protected AuthToken createAuthToken(HttpServletRequest request, HttpServletResponse response)
throws UnauthorizedException
{
HttpSession session;
AuthToken authToken;
Cookie cookie;
session = request.getSession();
authToken = (AuthToken)session.getAttribute("jive.authToken");
if(authToken != null)
return authToken;
cookie = CookieUtils.getCookie(request, "jive.authToken.autologin");
if(cookie == null)
throw new UnauthorizedException();
String authInfo[] = decryptAuthInfo(cookie.getValue());
if(authInfo == null)
{
CookieUtils.deleteCookie(response, cookie);
throw new UnauthorizedException();
}
String username = authInfo[0];
String password = authInfo[1];
authToken = getAuthToken(username, password);
session.setAttribute("jive.authToken", authToken);
return authToken;
}

skyleaf24
2003-09-11 11:41

JivePropertyClusterTask
编译后run()
public void run()
{
int i;
if(name != null && (value == null || "".equals(value.trim())))
{
JiveGlobals.deleteJiveProperty(name, false);
break MISSING_BLOCK_LABEL_119;
}
if(name == null || value == null)
break MISSING_BLOCK_LABEL_119;
i = 0;
_L2:
if(i >= excludedProperties.size())
break MISSING_BLOCK_LABEL_99;
String s = (String)excludedProperties.get(i);
if(name.equals(s))
return;
i++;
if(true) goto _L2; else goto _L1
_L1:
JiveGlobals.setJiveProperty(name, value, false);
break MISSING_BLOCK_LABEL_119;
Exception e;
e;
Log.error(e);
}
这些_L1,_L2的弄得心里真不舒服

修改后
public void run()
{
if (name != null && (value == null || "".equals(value.trim()))) {
JiveGlobals.deleteJiveProperty(name, false);
return;
}
if (name == null || value == null)
return;
for (int i = 0; i < excludedProperties.size(); i++) {
String s = (String) excludedProperties.get(i);
if (name.equals(s))
JiveGlobals.setJiveProperty(name, value, false);
}
}

skyleaf24
2003-09-11 12:01

哦,JiveProperty应该不会是重名吧。
再改一下,


public void run()
{
if (name != null && (value == null || "".equals(value.trim()))) {
JiveGlobals.deleteJiveProperty(name, false);
return;
}
if (name == null || value == null)
return;
for (int i = 0; i < excludedProperties.size(); i++) {
String s = (String) excludedProperties.get(i);
if (name.equals(s))
{
JiveGlobals.setJiveProperty(name, value, false);
return;
}
}
}

2Go 1 2 下一页