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

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

?? prepaid.py

?? 新的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"')))

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
在线观看网站黄不卡| 51精品秘密在线观看| 欧美午夜精品一区二区蜜桃| 7777精品伊人久久久大香线蕉经典版下载| 欧美成人r级一区二区三区| 国产精品嫩草久久久久| 日韩av电影天堂| av不卡一区二区三区| 日韩欧美专区在线| 亚洲永久精品大片| av在线播放成人| 国产午夜精品一区二区三区嫩草| 亚洲va国产天堂va久久en| 成人免费福利片| 久久精品水蜜桃av综合天堂| 首页国产欧美久久| 欧美在线看片a免费观看| 国产精品三级在线观看| 加勒比av一区二区| 91精品国产全国免费观看| 亚洲最大成人综合| 一本一本久久a久久精品综合麻豆 一本一道波多野结衣一区二区 | 欧美性猛交xxxx乱大交退制版| 国产精品免费视频观看| 极品美女销魂一区二区三区 | 欧美日韩精品三区| 中文字幕日韩欧美一区二区三区| 国内精品伊人久久久久av一坑| 91精品黄色片免费大全| 爽爽淫人综合网网站| 欧美日韩国产在线播放网站| 亚洲在线中文字幕| 精品污污网站免费看| 亚洲不卡一区二区三区| 欧美日韩在线一区二区| 玉足女爽爽91| 欧美性一区二区| 日韩和欧美的一区| 日韩欧美在线网站| 国产一区二区三区四区五区入口| 精品国产精品网麻豆系列| 韩国一区二区在线观看| 久久午夜国产精品| 成人精品免费网站| 亚洲精品视频在线看| 欧美色图片你懂的| 麻豆国产一区二区| 国产网红主播福利一区二区| 99精品视频在线观看| 夜夜亚洲天天久久| 欧美精品国产精品| 狠狠色丁香久久婷婷综合丁香| 国产亚洲欧美在线| 色婷婷综合中文久久一本| 亚洲大片在线观看| 久久午夜免费电影| 91猫先生在线| 美女网站视频久久| 中文字幕的久久| 欧美日韩在线精品一区二区三区激情| 免费成人深夜小野草| 中文字幕欧美三区| 欧美三级日韩三级国产三级| 精品在线观看视频| 免费成人美女在线观看.| 精品日韩在线观看| 成人18视频在线播放| 亚洲国产综合视频在线观看| 日韩欧美色综合| 99国产精品视频免费观看| 日韩精品亚洲一区| 亚洲欧洲一区二区在线播放| 在线播放欧美女士性生活| 高清beeg欧美| 日本亚洲欧美天堂免费| 亚洲国产高清在线观看视频| 777色狠狠一区二区三区| 成熟亚洲日本毛茸茸凸凹| 视频一区中文字幕国产| 国产精品看片你懂得| 91精品国产免费| 色爱区综合激月婷婷| 国产精品综合在线视频| 亚洲最新视频在线观看| 国产欧美日韩亚州综合| 宅男在线国产精品| 成人黄色在线网站| 狠狠狠色丁香婷婷综合久久五月| 一级做a爱片久久| 国产精品美女久久久久久久久久久| 欧美美女喷水视频| 91成人网在线| caoporn国产一区二区| 青草国产精品久久久久久| 亚洲精品一二三| 国产精品久久久久久福利一牛影视| 欧美精品日韩精品| 91成人国产精品| 不卡电影一区二区三区| 国产麻豆视频一区二区| 六月丁香婷婷久久| 日韩二区三区四区| 婷婷开心久久网| 午夜精品久久久久影视| 夜夜嗨av一区二区三区四季av| 国产精品国产自产拍高清av | 国产精品妹子av| 国产精品乱码久久久久久| 久久综合视频网| 26uuu精品一区二区在线观看| 欧美一区二区三区爱爱| 91精品国产综合久久精品性色| 欧美性色黄大片| 欧美性受xxxx黑人xyx| 在线免费观看日本欧美| 欧洲色大大久久| 欧美三级乱人伦电影| 欧美蜜桃一区二区三区| 欧美久久久久免费| 91精品国产综合久久久久久漫画| 欧美一区二区在线播放| 日韩精品综合一本久道在线视频| 日韩欧美高清一区| 精品成人免费观看| 欧美高清在线一区二区| 17c精品麻豆一区二区免费| 欧美韩日一区二区三区四区| 中文字幕一区二区三区精华液| 免费观看久久久4p| 青青草97国产精品免费观看| 欧美bbbbb| 国产精品 日产精品 欧美精品| 成人免费精品视频| 色先锋aa成人| 91精品欧美久久久久久动漫| 欧美电视剧免费观看| 久久一日本道色综合| 国产欧美精品区一区二区三区 | 亚洲自拍偷拍网站| 丝瓜av网站精品一区二区| 美腿丝袜亚洲色图| 懂色av中文一区二区三区| 在线影院国内精品| 91精品免费在线观看| 日本一区二区三区在线观看| 亚洲精品第1页| 另类人妖一区二区av| 成人免费av网站| 欧美日韩国产一级片| 久久久九九九九| 亚洲午夜羞羞片| 国产自产视频一区二区三区| 一本到不卡免费一区二区| 在线不卡中文字幕| 国产欧美视频一区二区| 亚洲午夜视频在线观看| 国产一区二区在线影院| 在线欧美日韩精品| 久久精品视频免费观看| 亚洲影视资源网| 国产成a人亚洲| 91精品在线免费| 综合激情成人伊人| 国产在线视视频有精品| 欧美图片一区二区三区| 久久久久国产精品人| 亚洲v中文字幕| 91麻豆国产自产在线观看| 精品美女在线播放| 亚洲国产精品久久不卡毛片| 国产美女视频91| 日韩一区二区麻豆国产| 亚洲一区二区在线免费看| 高清不卡在线观看| 精品国产污污免费网站入口| 亚洲国产综合91精品麻豆| aa级大片欧美| 久久这里只精品最新地址| 午夜精品一区二区三区电影天堂| 国产白丝网站精品污在线入口| 欧美日韩高清一区| 一区二区三区四区在线| 国产91富婆露脸刺激对白| 亚洲精品一区二区三区四区高清| 亚洲午夜一区二区| 色哦色哦哦色天天综合| 中文字幕一区二区不卡| 懂色av一区二区三区蜜臀| 26uuu久久天堂性欧美| 麻豆精品视频在线| 日韩欧美一级二级三级久久久| 三级久久三级久久| 欧美日韩一区二区三区视频| 一区二区在线免费| 51精品秘密在线观看| 亚洲成人免费观看| 欧美日韩国产123区| 五月婷婷综合激情| 67194成人在线观看| 蜜臀av性久久久久蜜臀aⅴ四虎|