mirror of
https://github.com/samba-team/samba.git
synced 2025-01-22 22:04:08 +03:00
tests: Work audit_log CLIENT_IP out from config instead of env var
Instead of passing the CLIENT_IP to the audit_log tests, we can just work out the source-IP that the client will use from its smb.conf file. Because the audit_log tests are all run on the non-local testenv, they'll already use the client.conf and the 127.0.0.11 address. The main advantage of this change is it avoids having hardcoded IP addresses in the selftest framework. Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
4f21f1ca8d
commit
c185bf1dcf
@ -54,6 +54,17 @@ class AuditLogTestBase(samba.tests.TestCase):
|
||||
self.msg_ctx = Messaging((1,), lp_ctx=lp_ctx)
|
||||
self.msg_ctx.irpc_add_name(self.event_type)
|
||||
|
||||
# Now switch back to using the client-side smb.conf. The tests will
|
||||
# use the first interface in the client.conf (we need to strip off
|
||||
# the subnet mask portion)
|
||||
lp_ctx = self.get_loadparm()
|
||||
client_ip_and_mask = lp_ctx.get('interfaces')[0]
|
||||
client_ip = client_ip_and_mask.split('/')[0]
|
||||
|
||||
# the messaging ctx is the server's view of the world, so our own
|
||||
# client IP will be the remoteAddress when connections are logged
|
||||
self.remoteAddress = client_ip
|
||||
|
||||
#
|
||||
# Check the remote address of a message against the one beimg used
|
||||
# for the tests.
|
||||
|
@ -43,7 +43,6 @@ class AuditLogDsdbTests(AuditLogTestBase):
|
||||
self.event_type = DSDB_EVENT_NAME
|
||||
super(AuditLogDsdbTests, self).setUp()
|
||||
|
||||
self.remoteAddress = os.environ["CLIENT_IP"]
|
||||
self.server_ip = os.environ["SERVER_IP"]
|
||||
|
||||
host = "ldap://%s" % os.environ["SERVER"]
|
||||
|
@ -48,7 +48,6 @@ class AuditLogPassChangeTests(AuditLogTestBase):
|
||||
self.event_type = DSDB_PWD_EVENT_NAME
|
||||
super(AuditLogPassChangeTests, self).setUp()
|
||||
|
||||
self.remoteAddress = os.environ["CLIENT_IP"]
|
||||
self.server_ip = os.environ["SERVER_IP"]
|
||||
|
||||
host = "ldap://%s" % os.environ["SERVER"]
|
||||
|
@ -50,7 +50,6 @@ class GroupAuditTests(AuditLogTestBase):
|
||||
self.event_type = DSDB_GROUP_EVENT_NAME
|
||||
super(GroupAuditTests, self).setUp()
|
||||
|
||||
self.remoteAddress = os.environ["CLIENT_IP"]
|
||||
self.server_ip = os.environ["SERVER_IP"]
|
||||
|
||||
host = "ldap://%s" % os.environ["SERVER"]
|
||||
|
@ -738,14 +738,11 @@ if have_heimdal_support:
|
||||
"samba.tests.auth_log_winbind",
|
||||
extra_args=['-U"$DC_USERNAME%$DC_PASSWORD"'])
|
||||
planoldpythontestsuite("ad_dc", "samba.tests.audit_log_pass_change",
|
||||
extra_args=['-U"$USERNAME%$PASSWORD"'],
|
||||
environ={'CLIENT_IP': '127.0.0.11'})
|
||||
extra_args=['-U"$USERNAME%$PASSWORD"'])
|
||||
planoldpythontestsuite("ad_dc", "samba.tests.audit_log_dsdb",
|
||||
extra_args=['-U"$USERNAME%$PASSWORD"'],
|
||||
environ={'CLIENT_IP': '127.0.0.11'})
|
||||
extra_args=['-U"$USERNAME%$PASSWORD"'])
|
||||
planoldpythontestsuite("ad_dc", "samba.tests.group_audit",
|
||||
extra_args=['-U"$USERNAME%$PASSWORD"'],
|
||||
environ={'CLIENT_IP': '127.0.0.11'})
|
||||
extra_args=['-U"$USERNAME%$PASSWORD"'])
|
||||
|
||||
planoldpythontestsuite("fl2008r2dc:local",
|
||||
"samba.tests.getdcname",
|
||||
|
Loading…
x
Reference in New Issue
Block a user