1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
--TEST--
Check setting source IP
--CREDITS--
Russ Allbery
# Copyright 2011
# The Board of Trustees of the Leland Stanford Junior University
#
# SPDX-License-Identifier: MIT
--ENV--
KRB5CCNAME=remctl-test.cache
LD_LIBRARY_PATH=../client/.libs
--SKIPIF--
<?php
if (!file_exists("remctl-test.pid"))
echo "skip remctld not running";
?>
--FILE--
<?php
$fh = fopen("remctl-test.princ", "r");
$principal = rtrim(fread($fh, filesize("remctl-test.princ")));
$r = remctl_new();
if ($r == null) {
echo "remctl_new failed\n";
exit(2);
}
echo "Created object\n";
if (!remctl_set_source_ip($r, "127.0.0.1")) {
echo "remctl_set_source_ip failed\n";
exit(2);
}
if (!remctl_open($r, "127.0.0.1", 14373, $principal)) {
echo "remctl_open failed\n";
exit(2);
}
echo "Opened connection with source 127.0.0.1\n";
if (!remctl_set_source_ip($r, "::1")) {
echo "remctl_set_source_ip failed\n";
exit(2);
}
if (remctl_open($r, "127.0.0.1", 14373, $principal)) {
echo "remctl_open unexpectedly succeeded\n";
exit(2);
}
echo "Open failed with source ::1\n";
remctl_close($r);
?>
--EXPECT--
Created object
Opened connection with source 127.0.0.1
Open failed with source ::1
|