summaryrefslogtreecommitdiff
path: root/php/tests/004.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'php/tests/004.phpt')
-rw-r--r--php/tests/004.phpt44
1 files changed, 44 insertions, 0 deletions
diff --git a/php/tests/004.phpt b/php/tests/004.phpt
new file mode 100644
index 0000000..818bde5
--- /dev/null
+++ b/php/tests/004.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Check setting source IP
+--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