mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
Fix tests and add global option
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import ldap
|
||||
from flask import request, Flask
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
# GOOD
|
||||
|
||||
# SSL through ldap global variable option
|
||||
|
||||
ldap.set_option(ldap.OPT_X_TLS_DEMAND)
|
||||
|
||||
|
||||
@app.route("/one")
|
||||
def one():
|
||||
ldap_connection_5 = ldap.initialize("ldap://somethingon.theinternet.com")
|
||||
ldap_connection_5.simple_bind_s('', '')
|
||||
user = ldap_connection_5.search_s(
|
||||
"dn", ldap.SCOPE_SUBTREE, "search_filter")
|
||||
|
||||
return user
|
||||
|
||||
|
||||
# if __name__ == "__main__":
|
||||
# app.run(debug=True)
|
||||
@@ -54,7 +54,7 @@ def one_bad():
|
||||
@app.route("/one_bad_2")
|
||||
def one_bad_2():
|
||||
ldap_connection_4 = ldap.initialize(schema + remote_host)
|
||||
ldap_connection_4.set_option(ldap.OPT_X_TLS_NEVER)
|
||||
ldap_connection_4.set_option(ldap.OPT_X_TLS_NEVER, True)
|
||||
ldap_connection_4.simple_bind_s('', '')
|
||||
user = ldap_connection_4.search_s(
|
||||
"dn", ldap.SCOPE_SUBTREE, "search_filter")
|
||||
|
||||
@@ -54,7 +54,7 @@ def one_bad():
|
||||
@app.route("/one_bad_2")
|
||||
def one_bad_2():
|
||||
ldap_connection_8 = ldap.initialize(schema + remote_host)
|
||||
ldap_connection_8.set_option(ldap.OPT_X_TLS_NEVER)
|
||||
ldap_connection_8.set_option(ldap.OPT_X_TLS_NEVER, True)
|
||||
ldap_connection_8.simple_bind_s('', '')
|
||||
user = ldap_connection_8.search_s(
|
||||
"dn", ldap.SCOPE_SUBTREE, "search_filter")
|
||||
|
||||
@@ -13,7 +13,7 @@ full_host = "ldap://somethingon.theinternet.com"
|
||||
|
||||
@app.route("/one")
|
||||
def one():
|
||||
srv = Server("ldap://somethingon.theinternet.com", port=1337, True)
|
||||
srv = Server("ldap://somethingon.theinternet.com", 1337, True)
|
||||
conn = Connection(srv, "dn", "password")
|
||||
conn.search("dn", "search_filter")
|
||||
return conn.response
|
||||
|
||||
Reference in New Issue
Block a user