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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? prepaid.py

?? freeradius-server-2.1.3.tar.gz安裝源文件
?? PY
字號:
#! /usr/bin/env python## 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA## Copyright 2002 Miguel A.L. Paraz <mparaz@mparaz.com># Copyright 2002 Imperium Technology, Inc.## $Id$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"')))

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美性生活久久| 国产一区二区在线观看视频| 国产日韩精品一区二区浪潮av | 视频在线观看一区| 午夜不卡在线视频| 亚洲国产cao| 日韩不卡在线观看日韩不卡视频| 亚洲成人动漫一区| 日本成人中文字幕在线视频 | 日韩国产一二三区| 免费人成在线不卡| 美国精品在线观看| 国产裸体歌舞团一区二区| 国产乱国产乱300精品| 国产精品一区二区在线播放| 国产白丝网站精品污在线入口| 国产不卡视频在线播放| 不卡一区二区三区四区| 91久久香蕉国产日韩欧美9色| 在线观看91视频| 777午夜精品免费视频| 久久网这里都是精品| 国产精品久久久久aaaa樱花| 亚洲男人的天堂av| 免费观看成人鲁鲁鲁鲁鲁视频| 精品无人区卡一卡二卡三乱码免费卡| 国产一区免费电影| 91丨九色丨蝌蚪丨老版| 欧美美女激情18p| 国产亚洲一区二区在线观看| 亚洲精品国产成人久久av盗摄| 日韩av一级片| 成人免费三级在线| 欧美日本国产视频| 亚洲国产精品精华液2区45| 一区二区三区中文字幕| 国产自产视频一区二区三区| 91免费国产视频网站| 日韩午夜在线观看视频| 国产精品视频你懂的| 日韩中文字幕区一区有砖一区| 大尺度一区二区| 91精品国产黑色紧身裤美女| 国产精品久线观看视频| 美女视频黄免费的久久| 91丝袜美女网| 欧美高清一级片在线观看| 七七婷婷婷婷精品国产| 91免费看`日韩一区二区| 2020国产成人综合网| 婷婷开心激情综合| 99re视频这里只有精品| 久久久综合九色合综国产精品| 亚洲国产综合视频在线观看| a级高清视频欧美日韩| 久久一区二区三区国产精品| 午夜欧美电影在线观看| 91在线国产观看| 国产欧美日韩亚州综合| 久草热8精品视频在线观看| 欧洲视频一区二区| 亚洲色图在线播放| 不卡的电影网站| 国产丝袜在线精品| 国精产品一区一区三区mba桃花| 欧美日韩日日摸| 亚洲婷婷在线视频| 成人精品鲁一区一区二区| 久久美女高清视频| 国内不卡的二区三区中文字幕 | 欧美aaa在线| 欧美电影在哪看比较好| 亚洲成人自拍一区| 欧美日韩在线免费视频| 亚洲图片有声小说| 欧美色偷偷大香| 性做久久久久久久久| 欧美性淫爽ww久久久久无| 一区二区三区在线观看网站| 91搞黄在线观看| 无吗不卡中文字幕| 9191成人精品久久| 麻豆精品一区二区三区| 欧美大胆人体bbbb| 国产精品自产自拍| 成人欧美一区二区三区视频网页| 99久免费精品视频在线观看| 中文字幕一区视频| 制服丝袜在线91| 国产精品亲子乱子伦xxxx裸| 日韩精品一区二区三区在线播放 | 欧美成人一区二区三区片免费 | 视频一区二区中文字幕| 久久一区二区三区国产精品| 日韩精彩视频在线观看| 欧美哺乳videos| 毛片av一区二区| 精品国产乱码久久久久久久久| 亚洲成人动漫一区| 欧美一区二区三区的| 美女精品一区二区| 中文字幕欧美区| 色综合天天综合网天天看片| 亚洲免费观看高清完整版在线 | 91原创在线视频| 国产精品国产三级国产aⅴ入口 | 7799精品视频| 日韩电影免费一区| 国产精品成人免费在线| 一本一道久久a久久精品| 亚洲男人的天堂一区二区| 欧美在线啊v一区| 亚洲国产三级在线| 欧美老肥妇做.爰bbww视频| 午夜久久久影院| 日韩欧美一区二区在线视频| 国产综合色视频| 国产丝袜美腿一区二区三区| 91麻豆免费看| 日本免费新一区视频| 国产色产综合产在线视频| 99精品国产一区二区三区不卡| 亚洲人成影院在线观看| 日韩精品一区二区三区四区视频| 国产99久久久久| 亚洲综合色成人| 这里只有精品免费| 成人妖精视频yjsp地址| 午夜国产精品影院在线观看| 亚洲欧美自拍偷拍色图| 3d成人h动漫网站入口| 国产盗摄一区二区| 久久精品男人的天堂| 成人免费av资源| 综合色天天鬼久久鬼色| 日韩三级在线观看| hitomi一区二区三区精品| 免费成人在线观看| 亚洲成人黄色影院| 国产精品成人网| 精品国产乱码久久久久久浪潮| 色婷婷综合久久久久中文 | 成人激情av网| 美女网站一区二区| 亚洲国产精品一区二区www在线| 欧美不卡视频一区| 欧美日本国产视频| 欧美性三三影院| 99久久精品国产导航| 国产在线国偷精品免费看| 亚洲国产成人精品视频| 中文字幕一区二区三区在线播放| 欧美情侣在线播放| 欧美日韩在线观看一区二区 | 欧美午夜一区二区三区 | 国产伦精一区二区三区| 偷拍亚洲欧洲综合| 日韩在线观看一区二区| 亚洲在线成人精品| 亚洲三级理论片| 国产日韩欧美在线一区| 久久婷婷久久一区二区三区| 日韩视频一区二区三区在线播放 | 成人av电影免费观看| 国产一区二区三区观看| 国产在线一区观看| 亚洲日本中文字幕区| 亚洲精品视频在线观看免费| 国产精品蜜臀在线观看| 亚洲欧美日韩国产中文在线| 亚洲欧洲日韩在线| 亚洲欧美在线aaa| 国产欧美一区二区精品仙草咪| 精品三级在线观看| 欧美成人激情免费网| 日韩精品自拍偷拍| 久久精品亚洲精品国产欧美kt∨| 欧洲另类一二三四区| 欧美一二三在线| 日韩一区二区三区免费看 | 久久久91精品国产一区二区精品| 久久久777精品电影网影网 | 国产不卡免费视频| 成人av电影在线播放| 91毛片在线观看| 欧美日韩成人一区二区| 日韩一区二区影院| 精品捆绑美女sm三区| 国产日韩欧美精品一区| 亚洲欧美日韩久久| 久久99精品国产.久久久久久| 国产乱码精品1区2区3区| av电影一区二区| 欧美精品一卡二卡| 日韩一区二区免费视频| 亚洲视频每日更新| 午夜av区久久| 亚洲国产成人porn| 国产一区二区0| 91搞黄在线观看|