惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

H
Help Net Security
博客园 - Franky
GbyAI
GbyAI
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
爱范儿
爱范儿
IT之家
IT之家
酷 壳 – CoolShell
酷 壳 – CoolShell
aimingoo的专栏
aimingoo的专栏
博客园_首页
MongoDB | Blog
MongoDB | Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Recent Announcements
Recent Announcements
Scott Helme
Scott Helme
有赞技术团队
有赞技术团队
M
MIT News - Artificial intelligence
C
CERT Recently Published Vulnerability Notes
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Jina AI
Jina AI
F
Fortinet All Blogs
N
Netflix TechBlog - Medium
L
LangChain Blog
L
LINUX DO - 最新话题
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
H
Hacker News: Front Page
MyScale Blog
MyScale Blog
P
Palo Alto Networks Blog
G
Google Developers Blog
Google DeepMind News
Google DeepMind News
AI
AI
T
Troy Hunt's Blog
Microsoft Azure Blog
Microsoft Azure Blog
阮一峰的网络日志
阮一峰的网络日志
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Vercel News
Vercel News
Microsoft Security Blog
Microsoft Security Blog
罗磊的独立博客
S
Secure Thoughts
大猫的无限游戏
大猫的无限游戏
博客园 - 叶小钗
人人都是产品经理
人人都是产品经理
Blog — PlanetScale
Blog — PlanetScale
博客园 - 司徒正美
Apple Machine Learning Research
Apple Machine Learning Research
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 三生石上(FineUI控件)
S
Security @ Cisco Blogs
Cloudbric
Cloudbric
E
Exploit-DB.com RSS Feed
Attack and Defense Labs
Attack and Defense Labs

博客园 - 彭斌

[博客园广州俱乐部活动通知]Windows 7社区发布(2009-10-24) 广州.NET俱乐部活动通知(3月30日 星期天) 我的生活博客和相册 微软广州.NET 俱乐部2008新技术激情碰撞活动报道 广州.NET俱乐部活动通知(11月17日) 微软广州.NET俱乐部活动通知(08月18日) Portal 页面加载引擎思考(上) Pontus Portal 展现层次结构 广州.NET俱乐部 VSTS活动报道 广州.NET俱乐部 VSTS专题日(4月15日) 线下交流活动 微软广州.NET俱乐部活动通知(11月19日) 微软广州.NET俱乐部活动预告 致歉微软广州.net俱乐部会员 SQL LIKE 通配符随笔 Community Server2.0专注细节专题Doc下载(2006-3-9更新) Community Server2.0专注细节一 邮件提醒按钮实现(上) Community Server 2.0中如何调试项目?我告诉你! Community Server 2.0 (SDK) 发布了 广州.NET 俱乐部联系邮件变更通知
CommunityServer 2.0中Files 与 Reader 项目的授权机制
彭斌 · 2006-02-24 · via 博客园 - 彭斌

CommunityServer 2.0 出来已经有几天了,开放了部分的源代码。其中新增加的CommunityServer.Files、CommunityServer.Reader两个项目是不开源的。并且在free版本里有一些限制。

那么CommunityServer 2.0 中是进行相关的控制呢:
借助一些工具,我们很容易查看到CommunityServer.Files、与CommunityServer.Reader 的元数据。我分别在两个类下发现了授权的方法:
CommunityServer.Files 项目对应Entries类、CommunityServer.Reader项目对应Feeds类。
在Entries类下有一个方法如下描述:

public static bool ValidateCreateEntryAccess()
        
{
            
bool flag1;
            
object obj1 = CSCache.Get("CreateEntryAccess");
            
if (obj1 != null)
            
{
                
return (bool) obj1;
            }

            
if (CommunityServer.FileGalleryLimit == 0x7fffffff)
            
{
                flag1 
= true;
            }

            
else
            
{
                
int num1 = 0;
                
foreach (Folder folder1 in Folders.GetFolders(CSContext.Current.UserID, truetruetrue))
                
{
                    num1 
+= folder1.TotalThreads;
                }

                flag1 
= num1 < CommunityServer.FileGalleryLimit;
            }

            CSCache.Insert(
"CreateEntryAccess", flag1, CSCache.HourFactor);
            
return flag1;
        }

从以上类我们可以知道 File的最大数量是0x7fffffff,这个是十六进制的表示,换算成十进制为:2147483647。
如果不是最大授权,那么就要判断所有文件夹下有多少文件,如果文件数量超过了授权的FileGalleryLimit就返回一个false。当然这种验证很有比较消耗系统资源,所有CS在这里做了一个缓存机制,缓存时间为一个小时。这里就会出现一点点小问题:也就是说,如果你在一个小时前做的一次验证如果没有超过授权的文件数量,在之后的一个小时里,你可以随意上传你想要的文件数量,而CS是不会监控的。但是过了缓存时间后,CS又会判断。嘿嘿,如果你想多上传点文件就算好那个小时,疯狂一点...

如果你超过了授权的数量,那么由什么方法处理,结果又是如何,看看下面的代码就明白:

 public static void CreateEntryAccessCheck()
        
{
            
if (!Entries.ValidateCreateEntryAccess())
            
{
                
throw new CSException(CSExceptionType.InvalidLicense, "You have exceeded the maximum number of uploads allowed by your current license.");
            }

        }

整个授权机制,就这一个入口点,如果授权没有通过,抛出一个异常:显示:You have exceeded the maximum number of uploads allowed by your current license.

CommunityServer.Reader项目的授权机制在Feeds类下,我们可以看到类似代码,如下:

public static bool ValidateUserAccess()
        
{
            
if (CommunityServer.FeedReaderLimit != 0x7fffffff)
            
{
                ArrayList list1 
= Feeds.GetUsers();
                
if (list1.Count >= CommunityServer.FeedReaderLimit)
                
{
                    
return Feeds.CheckUserInList(CSContext.Current.User, list1);
                }

            }

            
return true;
        }

首先判断是不是最大的授权值,如果不是,就Feeds.GetUsers()取得使用 Reader的所有用户,再如果使用的Reaser的人数操作了FeedReaderLimit的授权值,这个时候还需要进行一次判断,看是否当前登录的用户是Reader的使用者,如果是才会返回false。
整个授权也有一个唯一的入口:

 public static void UserAccessCheck()
        
{
            
if (!Feeds.ValidateUserAccess())
            
{
                
throw new CSException(CSExceptionType.InvalidLicense, "You have exceeded the maximum number of users allowed by your current license.");
            }

        }

如果发挥得是false,就抛出You have exceeded the maximum number of users allowed by your current license.的异常信息。

其实如何进行FeedReaderLimit与FileGalleryLimit 数量限制的,这些是在一个叫Telligent.Registration.dll 的类库下完成的,由于该类进行了混淆,所以分析起来有困难。

本次Blog着落于此,CS2.0 更多的文章我会陆续奉上。