@@ -45,10 +45,7 @@ module NetLdap {
45
45
NetLdapConnection ( ) { this in [ ldap ( ) .getAnInstantiation ( ) , ldap ( ) .getAMethodCall ( "open" ) ] }
46
46
47
47
predicate usesSsl ( ) {
48
- [
49
- this .getKeywordArgument ( "encryption" ) , this .getAMethodCall ( "encryption" ) .getArgument ( 0 ) ,
50
- this .getAMethodCall ( "encryption" ) .getKeywordArgument ( "method" )
51
- ] .getConstantValue ( ) .isStringlikeValue ( "simple_tls" )
48
+ getValue ( this , "encryption" ) .getConstantValue ( ) .isStringlikeValue ( "simple_tls" )
52
49
}
53
50
54
51
DataFlow:: Node getAuthValue ( string arg ) {
@@ -88,13 +85,7 @@ module NetLdap {
88
85
89
86
NetLdapBind ( ) { this = l .getAMethodCall ( "bind" ) }
90
87
91
- override DataFlow:: Node getHost ( ) {
92
- result =
93
- [
94
- l .getKeywordArgument ( "host" ) , l .getAMethodCall ( "host" ) .getArgument ( 0 ) ,
95
- l .getAMethodCall ( "host" ) .getKeywordArgument ( "method" )
96
- ]
97
- }
88
+ override DataFlow:: Node getHost ( ) { result = getValue ( l , "host" ) }
98
89
99
90
override DataFlow:: Node getPassword ( ) {
100
91
result = l .getAuthValue ( "password" ) or
@@ -103,4 +94,13 @@ module NetLdap {
103
94
104
95
override predicate usesSsl ( ) { l .usesSsl ( ) }
105
96
}
97
+
98
+ /** LDAP Attribute value */
99
+ DataFlow:: Node getValue ( NetLdapConnection l , string attr ) {
100
+ result =
101
+ [
102
+ l .getKeywordArgument ( attr ) , l .getAMethodCall ( attr ) .getArgument ( 0 ) ,
103
+ l .getAMethodCall ( attr ) .getKeywordArgument ( attr )
104
+ ]
105
+ }
106
106
}
0 commit comments