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

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

?? prepaid.py

?? linux 下的radius 最新版。linux 下的radius 最新版.linux 下的radius 最新版
?? PY
字號:
## Example Python module for prepaid usage using MySQL# 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-1307  USA## Copyright 2002 Miguel A.L. Paraz <mparaz@mparaz.com># Copyright 2002 Imperium Technology, Inc.import radiusdimport MySQLdb# ConfigurationconfigDb = 'python'                     # Database nameconfigHost = 'localhost'                # Database hostconfigUser = 'python'                   # Database user and passwordconfigPasswd = 'python'         # xxx Database # GlobalsdbHandle = Nonedef log(level, s):  """Log function."""  radiusd.radlog(level, 'prepaid.py: ' + s)def instantiate(p):  """Module Instantiation.  0 for success, -1 for failure.  p is a dummy variable here."""  global dbHandle  p = p  try:    dbHandle = MySQLdb.connect(db=configDb, host=configHost,                               user=configUser, passwd=configPasswd)  except MySQLdb.OperationalError, e:    # Report the error and return -1 for failure.    # xxx A more advanced module would retry the database.    log(radiusd.L_ERR, str(e))    return -1  log(radiusd.L_INFO, 'db connection: ' + str(dbHandle))  return 0def authorize(authData):  """Authorization and authentication are done in one step."""  # Extract the data we need.  userName = None  userPasswd = None    for t in authData:    if t[0] == 'User-Name':      userName = t[1]    elif t[0] == 'Password':      userPasswd = t[1]  # Build and log the SQL statement  # radiusd puts double quotes (") around the string representation of  # the RADIUS packet.  sql = 'select passwd, maxseconds from users where username = ' +  userName    log(radiusd.L_DBG, sql)  # Get a cursor  # xxx Or should this be one cursor all throughout?  try:    dbCursor = dbHandle.cursor()  except MySQLdb.OperationalError, e:    log(radiusd.L_ERR, str(e))    return radiusd.RLM_MODULE_FAIL  # Execute the SQL statement  try:    dbCursor.execute(sql)  except MySQLdb.OperationalError, e:    log(radiusd.L_ERR, str(e))    dbCursor.close()    return radiusd.RLM_MODULE_FAIL    # Get the result. (passwd, maxseconds)  result = dbCursor.fetchone()  if not result:    # User not found    log(radiusd.L_INFO, 'user not found: ' + userName)    dbCursor.close()    return radiusd.RLM_MODULE_NOTFOUND   # Compare passwords  # Ignore the quotes around userPasswd.  if result[0] != userPasswd[1:-1]:    log(radiusd.L_DBG, 'user password mismatch: ' + userName)    return radiusd.RLM_MODULE_REJECT  maxSeconds = result[1]  # Compute their session limit    # Build and log the SQL statement  sql = 'select sum(seconds) from sessions where username = ' + userName  log(radiusd.L_DBG, sql)    # Execute the SQL statement  try:    dbCursor.execute(sql)  except MySQLdb.OperationalError, e:    log(radiusd.L_ERR, str(e))    dbCursor.close()    return radiusd.RLM_MODULE_FAIL    # Get the result. (sum,)  result = dbCursor.fetchone()  if (not result) or (not result[0]):    # No usage yet    secondsUsed = 0  else:    secondsUsed = result[0]  # Done with cursor  dbCursor.close()  # Note that MySQL returns the result of SUM() as a float.  sessionTimeout = maxSeconds - int(secondsUsed)    if sessionTimeout <= 0:    # No more time, reject outright    log(radiusd.L_INFO, 'user out of time: ' + userName)        return radiusd.RLM_MODULE_REJECT  # Log the success  log(radiusd.L_DBG, 'user accepted: %s, %d seconds' %      (userName, sessionTimeout))  # We are adding to the RADIUS packet  # Note that the session timeout integer must be converted to string.  # We need to set an Auth-Type.  return (radiusd.RLM_MODULE_UPDATED,          (('Session-Timeout', str(sessionTimeout)),),          (('Auth-Type', 'python'),))    def authenticate(p):  p = p  return radiusd.RLM_MODULE_OKdef preacct(p):  p = p  return radiusd.RLM_MODULE_OKdef accounting(acctData):  """Accounting."""  # Extract the data we need.  userName = None  acctSessionTime = None  acctStatusType = None  # xxx A dict would make this nice.  for t in acctData:    if t[0] == 'User-Name':      userName = t[1]    elif t[0] == 'Acct-Session-Time':      acctSessionTime = t[1]    elif t[0] == 'Acct-Status-Type':      acctStatusType = t[1]  # We will not deal with Start for now.  # We may later, for simultaneous checks and the like.  if acctStatusType == 'Start':    return radiusd.RLM_MODULE_OK    # Build and log the SQL statement  # radiusd puts double quotes (") around the string representation of  # the RADIUS packet.  #  # xxx This is simplistic as it does not record the time, etc.  #   sql = 'insert into sessions (username, seconds) values (%s, %d)' % \        (userName, int(acctSessionTime))    log(radiusd.L_DBG, sql)  # Get a cursor  # xxx Or should this be one cursor all throughout?  try:    dbCursor = dbHandle.cursor()  except MySQLdb.OperationalError, e:    log(radiusd.L_ERR, str(e))    return radiusd.RLM_MODULE_FAIL  # Execute the SQL statement  try:    dbCursor.execute(sql)  except MySQLdb.OperationalError, e:    log(radiusd.L_ERR, str(e))    dbCursor.close()    return radiusd.RLM_MODULE_FAIL    return radiusd.RLM_MODULE_OKdef detach():  """Detach and clean up."""  # Shut down the database connection.  global dbHandle  log(radiusd.L_DBG, 'closing database handle: ' + str(dbHandle))  dbHandle.close()  return radiusd.RLM_MODULE_OK# Test the modules if __name__ == '__main__':  instantiate(None)  print authorize((('User-Name', '"map"'), ('User-Password', '"abc"')))

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品久久久久久久久免费樱桃| 国产精品久久免费看| 丁香激情综合五月| 亚洲一区二区综合| 久久精品欧美一区二区三区不卡 | 欧美成人三级电影在线| 成人综合婷婷国产精品久久| 日韩制服丝袜先锋影音| 国产精品久久久久久久久久久免费看| 欧美精品一级二级三级| 91网上在线视频| 懂色av一区二区在线播放| 日韩综合小视频| 一区二区三区美女视频| 国产欧美中文在线| 精品国产一区二区在线观看| 欧美日韩mp4| 在线视频一区二区三区| 成人性生交大合| 国产在线看一区| 日韩—二三区免费观看av| 亚洲精品日日夜夜| 中文字幕在线一区| 国产欧美日韩综合精品一区二区| 婷婷综合在线观看| 亚洲欧洲精品天堂一级| 国产欧美日韩在线| 国产亚洲精品aa午夜观看| 欧美不卡在线视频| 91精品国产乱| 日韩一区二区高清| 日韩午夜av一区| 91精品国产一区二区三区蜜臀| 欧美性生活一区| 在线观看日韩av先锋影音电影院| 91视频国产资源| 色综合天天综合网国产成人综合天| 成人免费视频一区| 成人黄色国产精品网站大全在线免费观看| 国产在线国偷精品免费看| 久久精品国产一区二区| 精品一区二区三区的国产在线播放| 日本va欧美va精品发布| 免费人成精品欧美精品| 蜜臀a∨国产成人精品| 久久国产人妖系列| 国产一区二区三区久久久| 国产一区二区三区精品视频| 国产福利91精品一区二区三区| 国产黄色精品视频| 成人免费视频一区二区| 91一区二区三区在线观看| 在线日韩国产精品| 欧美日韩国产小视频在线观看| 欧美女孩性生活视频| 日韩一区二区精品葵司在线 | 欧美丰满少妇xxxbbb| 欧美精品久久久久久久多人混战 | 在线中文字幕一区| 欧美三级电影网站| 91精品国产91久久久久久一区二区 | 99久久99久久精品免费观看| 色诱视频网站一区| 欧美猛男超大videosgay| 日韩精品一区在线| 欧美激情一区不卡| 一区二区国产视频| 免费在线观看日韩欧美| 国产福利不卡视频| 91精品福利在线| 91精品视频网| 国产天堂亚洲国产碰碰| 亚洲精品欧美综合四区| 日日嗨av一区二区三区四区| 国产精品一区二区黑丝| 色欧美片视频在线观看| 欧美一区二区播放| 国产精品嫩草影院com| 亚洲福利视频一区二区| 国产精一区二区三区| 91福利社在线观看| 久久夜色精品国产噜噜av| 中文字幕五月欧美| 日本欧美一区二区在线观看| 成人h动漫精品| 欧美一区二区在线免费播放| 欧美激情一区在线| 日本欧美在线观看| 91色.com| 久久久久久久久久久黄色| 亚洲精品一二三| 国产精品一区二区不卡| 欧美日韩精品是欧美日韩精品| 国产偷国产偷精品高清尤物| 亚洲一区二区三区精品在线| 国产精品 日产精品 欧美精品| 欧美日韩和欧美的一区二区| 国产精品色眯眯| 精品一区二区三区欧美| 欧美性生活大片视频| 一区在线中文字幕| 精品一区二区在线免费观看| 欧美日韩中文字幕一区二区| 亚洲欧洲精品一区二区三区不卡| 精品亚洲国内自在自线福利| 欧美日韩精品欧美日韩精品| 国产精品不卡一区二区三区| 国产精品538一区二区在线| 欧美精品久久99| 亚洲一本大道在线| 91麻豆国产香蕉久久精品| 欧美经典一区二区| 国产在线一区观看| 日韩女优毛片在线| 视频一区欧美日韩| 欧美色电影在线| 一区二区三区四区不卡在线| 成人激情综合网站| 国产欧美日本一区二区三区| 狠狠色丁香婷婷综合久久片| 91精品国产91久久久久久最新毛片 | 亚洲国产精品传媒在线观看| 国产综合久久久久久鬼色| 欧美一区二区不卡视频| 日韩激情av在线| 欧美日韩国产电影| 亚洲成av人片在线观看| 欧美专区亚洲专区| 一区二区三区四区中文字幕| 一本久久a久久精品亚洲| 中文字幕一区二| av一区二区三区| 国产精品欧美一区二区三区| 成人黄动漫网站免费app| 国产日韩成人精品| 国产不卡免费视频| 国产精品成人网| 91丨九色丨蝌蚪富婆spa| 亚洲精品一二三| 欧美婷婷六月丁香综合色| 亚洲午夜精品一区二区三区他趣| 欧美丝袜丝交足nylons图片| 亚洲成人手机在线| 91精品国产aⅴ一区二区| 久久99在线观看| 久久精品人人做人人综合| 成人理论电影网| 亚洲精品欧美在线| 欧美色电影在线| 看国产成人h片视频| 精品播放一区二区| 成人午夜视频福利| 亚洲精品乱码久久久久久日本蜜臀| 91成人在线免费观看| 日韩专区在线视频| 久久久亚洲午夜电影| 99综合电影在线视频| 亚洲在线观看免费视频| 欧美一级日韩免费不卡| 国产毛片一区二区| 亚洲情趣在线观看| 欧美高清视频一二三区| 激情图片小说一区| 综合婷婷亚洲小说| 久久久亚洲精品一区二区三区| 亚洲综合色噜噜狠狠| 91精品久久久久久蜜臀| 国产精品一区二区三区网站| 最新高清无码专区| 欧美一区二区三区在线观看视频| 国产一区二区三区最好精华液| 亚洲欧美在线观看| 538在线一区二区精品国产| 国产裸体歌舞团一区二区| 一区二区三区四区高清精品免费观看| 91精品国产福利| 91丝袜美腿高跟国产极品老师| 亚洲成人第一页| 亚洲国产成人午夜在线一区| 欧美日韩在线直播| 国产成a人无v码亚洲福利| 婷婷久久综合九色国产成人 | 中文字幕字幕中文在线中不卡视频| 欧美日韩精品高清| 国产成人精品在线看| 婷婷综合另类小说色区| 亚洲国产精品传媒在线观看| 欧美精品第一页| 不卡一区中文字幕| 蜜桃免费网站一区二区三区| 亚洲日本在线看| 久久美女艺术照精彩视频福利播放| 欧美调教femdomvk| 国产91丝袜在线播放九色| 天天射综合影视| 亚洲人123区| 国产日韩影视精品| 91精品国产综合久久婷婷香蕉| av午夜一区麻豆| 韩国成人精品a∨在线观看|