@@ -26,11 +26,8 @@ private module Ldap {
26
26
API:: Node ldapInitialize ( ) { result = ldap ( ) .getMember ( "initialize" ) }
27
27
28
28
/** Gets a reference to a `ldap` operation. */
29
- private DataFlow:: TypeTrackingNode ldapOperation ( DataFlow:: TypeTracker t ) {
30
- t .start ( ) and
31
- result .( DataFlow:: AttrRead ) .getObject ( ) .getALocalSource ( ) = ldapInitialize ( ) .getACall ( )
32
- or
33
- exists ( DataFlow:: TypeTracker t2 | result = ldapOperation ( t2 ) .track ( t2 , t ) )
29
+ private API:: Node ldapOperation ( string name ) {
30
+ result = ldapInitialize ( ) .getReturn ( ) .getMember ( name )
34
31
}
35
32
36
33
/**
@@ -44,24 +41,13 @@ private module Ldap {
44
41
}
45
42
}
46
43
47
- /** Gets a reference to a `ldap` operation. */
48
- private DataFlow:: Node ldapOperation ( ) {
49
- ldapOperation ( DataFlow:: TypeTracker:: end ( ) ) .flowsTo ( result )
50
- }
51
-
52
- /** Gets a reference to a `ldap` query. */
53
- private DataFlow:: Node ldapQuery ( ) {
54
- result = ldapOperation ( ) and
55
- result .( DataFlow:: AttrRead ) .getAttributeName ( ) instanceof Ldap2QueryMethods
56
- }
57
-
58
44
/**
59
45
* A class to find `ldap` methods executing a query.
60
46
*
61
47
* See `LDAP2QueryMethods`
62
48
*/
63
49
private class Ldap2Query extends DataFlow:: CallCfgNode , LdapQuery:: Range {
64
- Ldap2Query ( ) { this . getFunction ( ) = ldapQuery ( ) }
50
+ Ldap2Query ( ) { this = ldapOperation ( any ( Ldap2QueryMethods m ) ) . getACall ( ) }
65
51
66
52
override DataFlow:: Node getQuery ( ) {
67
53
result in [ this .getArg ( 0 ) , this .getArg ( 2 ) , this .getArgByName ( "filterstr" ) ]
@@ -82,12 +68,6 @@ private module Ldap {
82
68
}
83
69
}
84
70
85
- /** Gets a reference to a `ldap` bind. */
86
- private DataFlow:: Node ldapBind ( ) {
87
- result = ldapOperation ( ) and
88
- result .( DataFlow:: AttrRead ) .getAttributeName ( ) instanceof Ldap2BindMethods
89
- }
90
-
91
71
/**List of SSL-demanding options */
92
72
private class LdapSslOptions extends DataFlow:: Node {
93
73
LdapSslOptions ( ) {
@@ -101,7 +81,7 @@ private module Ldap {
101
81
* See `LDAP2BindMethods`
102
82
*/
103
83
private class Ldap2Bind extends DataFlow:: CallCfgNode , LdapBind:: Range {
104
- Ldap2Bind ( ) { this . getFunction ( ) = ldapBind ( ) }
84
+ Ldap2Bind ( ) { this = ldapOperation ( any ( Ldap2BindMethods m ) ) . getACall ( ) }
105
85
106
86
override DataFlow:: Node getPassword ( ) {
107
87
result in [ this .getArg ( 1 ) , this .getArgByName ( "cred" ) ]
0 commit comments