mirror of
https://github.com/ZeroTier/ZeroTierOne
synced 2025-08-14 10:37:33 -07:00
Beginning CMake configuration for ZT
Only tested on Windows so far
This commit is contained in:
parent
af5d3a7f0b
commit
0b3b5f6174
111 changed files with 19586 additions and 36 deletions
71
ext/librabbitmq/tests/test_hostcheck.c
Normal file
71
ext/librabbitmq/tests/test_hostcheck.c
Normal file
|
@ -0,0 +1,71 @@
|
|||
/*
|
||||
* Copyright 2014 Michael Steinert
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use, copy,
|
||||
* modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
* of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "amqp_hostcheck.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
static void hostcheck_success(const char *match_pattern, const char *url) {
|
||||
int ok;
|
||||
|
||||
ok = amqp_hostcheck(match_pattern, url);
|
||||
if (!ok) {
|
||||
fprintf(stderr, "Expected hostname check to pass, but didn't: %s (%s)\n",
|
||||
url, match_pattern);
|
||||
abort();
|
||||
}
|
||||
|
||||
fprintf(stdout, "ok: [success] %s, %s\n", url, match_pattern);
|
||||
}
|
||||
|
||||
static void hostcheck_fail(const char *match_pattern, const char *url) {
|
||||
int ok;
|
||||
|
||||
ok = amqp_hostcheck(match_pattern, url);
|
||||
if (ok) {
|
||||
fprintf(stderr, "Expected hostname check to fail, but didn't: %s (%s)\n",
|
||||
url, match_pattern);
|
||||
abort();
|
||||
}
|
||||
|
||||
fprintf(stdout, "ok: [fail] %s, %s\n", url, match_pattern);
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
hostcheck_success("www.rabbitmq.com", "www.rabbitmq.com");
|
||||
hostcheck_success("www.rabbitmq.com", "wWw.RaBbItMq.CoM");
|
||||
hostcheck_success("*.rabbitmq.com", "wWw.RaBbItMq.CoM");
|
||||
hostcheck_fail("rabbitmq.com", "www.rabbitmq.com");
|
||||
hostcheck_success("*.rabbitmq.com", "www.rabbitmq.com");
|
||||
hostcheck_fail("*.com", "www.rabbitmq.com");
|
||||
hostcheck_fail("*.rabbitmq.com", "long.url.rabbitmq.com");
|
||||
hostcheck_success("*.url.rabbitmq.com", "long.url.rabbitmq.com");
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue