nl_elseif_brace=add
nl_else_brace=add
nl_else_if=remove
+nl_for_brace=add
+nl_while_brace=add
+nl_switch_brace=add
+nl_fdef_brace=add
+nl_do_brace=add
sp_func_proto_paren=Remove
sp_func_def_paren=Remove
sp_func_call_paren=Remove
# Always use scoping braces for conditionals
mod_full_brace_if=add
mod_full_brace_if_chain=false
+mod_full_brace_while=add
+mod_full_brace_for=add
+mod_full_brace_do=add
# Annotate #else and #endif statements
mod_add_long_ifdef_endif_comment=20
daemon(int nochdir, int noclose)
{
#if defined(HAVE_FORK) && defined(HAVE_SETSID)
- switch (fork()) {
+ switch (fork())
+ {
case -1:
return (-1);
const char *end = str;
end += n - 1; /* Go to the end of the string */
- while (end >= str) {
+ while (end >= str)
+ {
if (c == *end)
{
return end;
char *runp;
for (runp = last_slash; runp != path; --runp)
+ {
if (runp[-1] != separator)
{
break;
}
+ }
/* The '/' is the last character, we have to look further. */
if (runp != path)
char *runp;
for (runp = last_slash; runp != path; --runp)
+ {
if (runp[-1] != separator)
{
break;
}
+ }
/* Terminate the path. */
if (runp == path)
ZeroMemory(&ss, sizeof(ss));
ss.ss_family = af;
- switch (af) {
+ switch (af)
+ {
case AF_INET:
((struct sockaddr_in *)&ss)->sin_addr = *(struct in_addr *)src;
break;
if (WSAStringToAddress(src_copy, af, NULL, (struct sockaddr *)&ss, &size) == 0)
{
- switch (af) {
+ switch (af)
+ {
case AF_INET:
*(struct in_addr *)dst = ((struct sockaddr_in *)&ss)->sin_addr;
return 1;
}
VERSIONHELPERAPI
-IsWindowsXPOrGreater(void) {
+IsWindowsXPOrGreater(void)
+{
return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINXP), LOBYTE(_WIN32_WINNT_WINXP), 0);
}
VERSIONHELPERAPI
-IsWindowsXPSP1OrGreater(void) {
+IsWindowsXPSP1OrGreater(void)
+{
return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINXP), LOBYTE(_WIN32_WINNT_WINXP), 1);
}
VERSIONHELPERAPI
-IsWindowsXPSP2OrGreater(void) {
+IsWindowsXPSP2OrGreater(void)
+{
return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINXP), LOBYTE(_WIN32_WINNT_WINXP), 2);
}
VERSIONHELPERAPI
-IsWindowsXPSP3OrGreater(void) {
+IsWindowsXPSP3OrGreater(void)
+{
return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINXP), LOBYTE(_WIN32_WINNT_WINXP), 3);
}
VERSIONHELPERAPI
-IsWindowsVistaOrGreater(void) {
+IsWindowsVistaOrGreater(void)
+{
return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_VISTA), LOBYTE(_WIN32_WINNT_VISTA), 0);
}
VERSIONHELPERAPI
-IsWindowsVistaSP1OrGreater(void) {
+IsWindowsVistaSP1OrGreater(void)
+{
return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_VISTA), LOBYTE(_WIN32_WINNT_VISTA), 1);
}
VERSIONHELPERAPI
-IsWindowsVistaSP2OrGreater(void) {
+IsWindowsVistaSP2OrGreater(void)
+{
return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_VISTA), LOBYTE(_WIN32_WINNT_VISTA), 2);
}
VERSIONHELPERAPI
-IsWindows7OrGreater(void) {
+IsWindows7OrGreater(void)
+{
return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN7), LOBYTE(_WIN32_WINNT_WIN7), 0);
}
VERSIONHELPERAPI
-IsWindows7SP1OrGreater(void) {
+IsWindows7SP1OrGreater(void)
+{
return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN7), LOBYTE(_WIN32_WINNT_WIN7), 1);
}
VERSIONHELPERAPI
-IsWindows8OrGreater(void) {
+IsWindows8OrGreater(void)
+{
return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN8), LOBYTE(_WIN32_WINNT_WIN8), 0);
}
VERSIONHELPERAPI
-IsWindows8Point1OrGreater(void) {
+IsWindows8Point1OrGreater(void)
+{
return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINBLUE), LOBYTE(_WIN32_WINNT_WINBLUE), 0);
}
VERSIONHELPERAPI
-IsWindowsServer(void) {
+IsWindowsServer(void)
+{
OSVERSIONINFOEXW vi = {sizeof(vi),0,0,0,0,{0},0,0,0,VER_NT_WORKSTATION};
return !VerifyVersionInfoW(&vi, VER_PRODUCT_TYPE, VerSetConditionMask(0, VER_PRODUCT_TYPE, VER_EQUAL));
}
{
size_t i;
for (i = 0; i < a->argc; ++i)
+ {
free(a->argv[i]);
+ }
free(a->argv);
argv_init(a);
}
size_t i;
ALLOC_ARRAY_CLEAR(newargv, char *, newcap);
for (i = 0; i < a->argc; ++i)
+ {
newargv[i] = a->argv[i];
+ }
free(a->argv);
a->argv = newargv;
a->capacity = newcap;
argv_init(&r);
for (i = 0; i < headroom; ++i)
+ {
argv_append(&r, NULL);
+ }
if (a)
{
for (i = 0; i < a->argc; ++i)
+ {
argv_append(&r, string_alloc(a->argv[i], NULL));
+ }
}
return r;
}
{
int i;
for (i = 0; i < nparms; ++i)
+ {
argv_append(a, string_alloc(parms[i], NULL));
+ }
}
else
{
}
q = (const unsigned char *) data;
i = 0;
- for (i = 0; i < size; ) {
+ for (i = 0; i < size; )
+ {
c = q[i++];
c *= 256;
if (i < size)
{
char *p;
for (p = base64_chars; *p; p++)
+ {
if (*p == c)
{
return p - base64_chars;
}
+ }
return -1;
}
{
return DECODE_ERROR;
}
- for (i = 0; i < 4; i++) {
+ for (i = 0; i < 4; i++)
+ {
val *= 64;
if (token[i] == '=')
{
{
e = q + size;
}
- for (p = str; *p && (*p == '=' || strchr(base64_chars, *p)); p += 4) {
+ for (p = str; *p && (*p == '=' || strchr(base64_chars, *p)); p += 4)
+ {
unsigned int val = token_decode(p);
unsigned int marker = (val >> 24) & 0xff;
if (val == DECODE_ERROR)
if (e)
{
while (e->next != NULL)
+ {
e = e->next;
+ }
e->next = dest->list;
dest->list = src->list;
src->list = NULL;
rm_trailing_chars(char *str, const char *what_to_delete)
{
bool modified;
- do {
+ do
+ {
const int len = strlen(str);
modified = false;
if (len > 0)
if (array)
{
while (array[i])
+ {
++i;
+ }
}
return i;
}
{
bl = buffer_list_new(0);
while (fgets(line, max_line_len, fp) != NULL)
+ {
buffer_list_push(bl, (unsigned char *)line);
+ }
free(line);
}
fclose(fp);
#else
volatile char *p = (volatile char *) data;
while (len--)
+ {
*p++ = 0;
+ }
#endif
}
#else /* if defined(ENABLE_LZ4) */
static void
-dummy(void) {
+dummy(void)
+{
}
#endif /* ENABLE_LZ4 */
#else /* if defined(USE_COMP) */
static void
-dummy(void) {
+dummy(void)
+{
}
#endif /* USE_STUB */
{
int i;
- for (i = 0; i < QUERY_USER_NUMSLOTS; i++) {
+ for (i = 0; i < QUERY_USER_NUMSLOTS; i++)
+ {
CLEAR(query_user[i]);
}
}
ASSERT( prompt_len > 0 && prompt != NULL && resp_len > 0 && resp != NULL );
/* Seek to the last unused slot */
- for (i = 0; i < QUERY_USER_NUMSLOTS; i++) {
+ for (i = 0; i < QUERY_USER_NUMSLOTS; i++)
+ {
if (query_user[i].prompt == NULL)
{
break;
static void
openvpn_encrypt_aead(struct buffer *buf, struct buffer work,
- struct crypto_options *opt) {
+ struct crypto_options *opt)
+{
#ifdef HAVE_AEAD_CIPHER_MODES
struct gc_arena gc;
int outlen = 0;
bool
crypto_check_replay(struct crypto_options *opt,
const struct packet_id_net *pin, const char *error_prefix,
- struct gc_arena *gc) {
+ struct gc_arena *gc)
+{
bool ret = false;
packet_id_reap_test(&opt->packet_id.rec);
if (packet_id_test(&opt->packet_id.rec, pin))
struct gc_arena gc = gc_new();
- do {
+ do
+ {
CLEAR(*key);
if (kt)
{
}
static const cipher_name_pair *
-get_cipher_name_pair(const char *cipher_name) {
+get_cipher_name_pair(const char *cipher_name)
+{
const cipher_name_pair *pair;
size_t i = 0;
}
const char *
-translate_cipher_name_from_openvpn(const char *cipher_name) {
+translate_cipher_name_from_openvpn(const char *cipher_name)
+{
const cipher_name_pair *pair = get_cipher_name_pair(cipher_name);
if (NULL == pair)
}
const char *
-translate_cipher_name_to_openvpn(const char *cipher_name) {
+translate_cipher_name_to_openvpn(const char *cipher_name)
+{
const cipher_name_pair *pair = get_cipher_name_pair(cipher_name);
if (NULL == pair)
* Returns 0 when data is equal, non-zero otherwise.
*/
static inline int
-memcmp_constant_time(const void *a, const void *b, size_t size) {
+memcmp_constant_time(const void *a, const void *b, size_t size)
+{
const uint8_t *a1 = a;
const uint8_t *b1 = b;
int ret = 0;
/** Wraps mbed_log_func_line() to prevent function calls for non-errors */
static inline bool
mbed_log_func_line_lite(unsigned int flags, int errval,
- const char *func, int line) {
+ const char *func, int line)
+{
if (errval)
{
return mbed_log_func_line(flags, errval, func, line);
}
void
-crypto_print_openssl_errors(const unsigned int flags) {
+crypto_print_openssl_errors(const unsigned int flags)
+{
size_t err = 0;
while ((err = ERR_get_error()))
}
int
-cipher_kt_block_size(const EVP_CIPHER *cipher) {
- /* OpenSSL reports OFB/CFB/GCM cipher block sizes as '1 byte'. To work
+cipher_kt_block_size(const EVP_CIPHER *cipher)
+{
+ /*
+ * OpenSSL reports OFB/CFB/GCM cipher block sizes as '1 byte'. To work
* around that, try to replace the mode with 'CBC' and return the block size
* reported for that cipher, if possible. If that doesn't work, just return
* the value reported by OpenSSL.
}
/* and now, we have to reverse the byte-order in the result from CryptSignHash()... */
for (i = 0; i < len; i++)
+ {
to[i] = buf[len - i - 1];
+ }
free(buf);
CryptDestroyHash(hash);
}
hash[i] = x;
/* skip any space(s) between hex numbers */
- for (p++; *p && *p == ' '; p++) ;
+ for (p++; *p && *p == ' '; p++)
+ {
+ }
}
blob.cbData = i;
blob.pbData = (unsigned char *) &hash;
#else /* ifdef ENABLE_CRYPTOAPI */
#ifdef _MSC_VER /* Dummy function needed to avoid empty file compiler warning in Microsoft VC */
static void
-dummy(void) {
+dummy(void)
+{
}
#endif
#endif /* _WIN32 */
/* make 16 bit words out of every two adjacent 8 bit words and */
/* calculate the sum of all 16 bit words */
- for (i = 0; i < len_udp; i += 2) {
+ for (i = 0; i < len_udp; i += 2)
+ {
word16 = ((buf[i] << 8) & 0xFF00) + ((i + 1 < len_udp) ? (buf[i+1] & 0xFF) : 0);
sum += word16;
}
/* add the UDP pseudo header which contains the IP source and destination addresses */
- for (i = 0; i < 4; i += 2) {
+ for (i = 0; i < 4; i += 2)
+ {
word16 = ((src_addr[i] << 8) & 0xFF00) + (src_addr[i+1] & 0xFF);
sum += word16;
}
- for (i = 0; i < 4; i += 2) {
+ for (i = 0; i < 4; i += 2)
+ {
word16 = ((dest_addr[i] << 8) & 0xFF00) + (dest_addr[i+1] & 0xFF);
sum += word16;
}
/* keep only the last 16 bits of the 32 bit calculated sum and add the carries */
while (sum >> 16)
+ {
sum = (sum & 0xFFFF) + (sum >> 16);
+ }
/* Take the one's complement of sum */
return ((uint16_t) ~sum);
* Posix equivalents.
*/
#if 1
- switch (errnum) {
+ switch (errnum)
+ {
/*
* When the TAP-Windows driver returns STATUS_UNSUCCESSFUL, this code
* gets returned to user space.
/** Convert fatal errors to nonfatal, don't touch other errors */
static inline unsigned int
-nonfatal(const unsigned int err) {
+nonfatal(const unsigned int err)
+{
return err & M_FATAL ? (err ^ M_FATAL) | M_NONFATAL : err;
}
{
int i;
for (i = 0; i < wes->n_events; ++i)
+ {
dmsg(D_EVENT_WAIT, "[%d] ev=%p rwflags=0x%04x arg=" ptr_format,
i,
wes->events[i],
wes->esr[i].rwflags,
(ptr_type)wes->esr[i].arg);
+ }
}
#endif
FD_ZERO(&ses->readfds);
FD_ZERO(&ses->writefds);
for (i = 0; i <= ses->maxfd; ++i)
+ {
ses->args[i] = NULL;
+ }
ses->maxfd = -1;
}
{
int i;
for (i = 0; i < N_FRAG_BUF; ++i)
+ {
list->fragments[i].buf = alloc_buf(BUF_SIZE(frame));
+ }
}
static void
{
int i;
for (i = 0; i < N_FRAG_BUF; ++i)
+ {
free_buf(&list->fragments[i].buf);
+ }
}
/*
{
int i;
for (i = 0; i < N_FRAG_BUF; ++i)
+ {
list->fragments[i].defined = false;
+ }
list->index = 0;
list->seq_id = seq_id;
diff = 0;
#else /* ifdef ENABLE_FRAGMENT */
static void
-dummy(void) {
+dummy(void)
+{
}
#endif /* ifdef ENABLE_FRAGMENT */
* Return true with probability 1/n
*/
static bool
-flip(int n) {
+flip(int n)
+{
return (get_random() % n) == 0;
}
* low and high.
*/
static int
-roll(int low, int high) {
+roll(int low, int high)
+{
int ret;
ASSERT(low <= high);
ret = low + (get_random() % (high - low + 1));
* Possibly corrupt a packet.
*/
void
-corrupt_gremlin(struct buffer *buf, int flags) {
+corrupt_gremlin(struct buffer *buf, int flags)
+{
const int corrupt_level = GREMLIN_CORRUPT_LEVEL(flags);
if (corrupt_level)
{
uint8_t r = roll(0, 255);
int method = roll(0, 5);
- switch (method) {
+ switch (method)
+ {
case 0: /* corrupt the first byte */
*BPTR(buf) = r;
break;
#else /* ifdef ENABLE_DEBUG */
static void
-dummy(void) {
+dummy(void)
+{
}
#endif /* ifdef ENABLE_DEBUG */
unsigned short i;
unsigned char j;
- for (i = 0; i < HASHLEN; i++) {
+ for (i = 0; i < HASHLEN; i++)
+ {
j = (Bin[i] >> 4) & 0xf;
if (j <= 9)
{
struct connection_entry *ce;
int n_cycles = 0;
- do {
+ do
+ {
ce_defined = true;
if (c->options.no_advance && l->current >= 0)
{
int i;
pkcs11_initialize(true, c->options.pkcs11_pin_cache_period);
for (i = 0; i<MAX_PARMS && c->options.pkcs11_providers[i] != NULL; i++)
+ {
pkcs11_addProvider(c->options.pkcs11_providers[i], c->options.pkcs11_protected_authentication[i],
c->options.pkcs11_private_mode[i], c->options.pkcs11_cert_private[i]);
+ }
}
#endif
{
int i;
for (i = 0; i < argc; ++i)
+ {
msg(M_INFO, "argv[%d] = '%s'", i, argv[i]);
+ }
}
#endif
{
int i;
for (i = 0; i < SIZE(text); ++i)
+ {
buffer_list_push(bl, (unsigned char *)text[i]);
+ }
}
printf("[cap=%d i=%d] *************************\n", listcap, iter);
if (!(iter & 8))
int c;
printf("'");
while ((c = buf_read_u8(buf)) >= 0)
+ {
putchar(c);
+ }
printf("'\n");
buffer_list_advance(bl, 0);
}
* In wakeup seconds, interval_test will return true once.
*/
static inline void
-interval_future_trigger(struct interval *top, interval_t wakeup) {
+interval_future_trigger(struct interval *top, interval_t wakeup)
+{
if (wakeup)
{
#if INTERVAL_DEBUG
int inc = 0;
int count = 0;
- for (base = 0; base < hash_n_buckets(hash); base += inc) {
+ for (base = 0; base < hash_n_buckets(hash); base += inc)
+ {
struct hash_iterator hi;
struct hash_element *he;
inc = (get_random() % 3) + 1;
#else /* if P2MP_SERVER */
static void
-dummy(void) {
+dummy(void)
+{
}
#endif /* P2MP_SERVER */
#else /* if defined(ENABLE_LZO) */
static void
-dummy(void) {
+dummy(void)
+{
}
#endif /* ENABLE_LZO */
{
int i;
for (i = 0; i < nparms; ++i)
+ {
msg(M_INFO, "[%d] '%s'", i, parms[i]);
+ }
}
#endif
if (net_events & FD_READ)
{
while (man_read(man) > 0)
- ;
+ {
+ }
net_event_win32_clear_selected_events(&man->connection.ne32, FD_READ);
}
{
msg(D_MANAGEMENT, "Need information from management interface, waiting...");
}
- do {
+ do
+ {
man_standalone_event_loop(man, signal_received, expire);
if (signal_received && *signal_received)
{
{
int i;
for (i = 0; i < h->size; ++i)
+ {
log_entry_free_contents(&h->array[log_index(h, i)]);
+ }
free(h->array);
}
log_history_obj_init(&newlog, capacity);
for (i = 0; i < h->size; ++i)
+ {
log_history_add(&newlog, &h->array[log_index(h, i)]);
+ }
log_history_free_contents(h);
*h = newlog;
#else /* ifdef ENABLE_MANAGEMENT */
static void
-dummy(void) {
+dummy(void)
+{
}
#endif /* ENABLE_MANAGEMENT */
#else /* if P2MP */
static void
-dummy(void) {
+dummy(void)
+{
}
#endif /* P2MP */
env_set_get(const struct env_set *es, const char *name)
{
const struct env_item *item = es->list;
- while (item && !env_string_equal(item->string, name)) {
+ while (item && !env_string_equal(item->string, name))
+ {
item = item->next;
}
return item ? item->string : NULL;
if (es)
{
for (e = es->list; e != NULL; e = e->next)
+ {
++n;
+ }
}
/* alloc return array */
buf_set_read(&buf, (const uint8_t *) str, strlen(str));
while (buf_parse(&buf, '\n', line, sizeof(line)))
+ {
++len;
+ }
/* alloc return array */
ALLOC_ARRAY_CLEAR_GC(ret, char *, len + 1, gc);
ALLOC_ARRAY_CLEAR_GC(ret, char *, max_parms, gc);
for (i = 0; i < len; ++i)
+ {
ret[i] = p[i];
+ }
return (const char **)ret;
}
#else /* if P2MP_SERVER */
static void
-dummy(void) {
+dummy(void)
+{
}
#endif /* P2MP_SERVER */
for (olen = hlen - sizeof(struct openvpn_tcphdr),
opt = (uint8_t *)(tc + 1);
olen > 0;
- olen -= optlen, opt += optlen) {
+ olen -= optlen, opt += optlen)
+ {
if (*opt == OPENVPN_TCPOPT_EOL)
{
break;
{
bool tun_input_pending = false;
- do {
+ do
+ {
dmsg(D_MULTI_DEBUG, "MULTI TCP: multi_tcp_action a=%s p=%d",
pract(action),
poll);
if (TUNNEL_TYPE(mi->context.c1.tuntap) == DEV_TYPE_TUN)
{
for (ir = mi->context.options.iroutes; ir != NULL; ir = ir->next)
+ {
mroute_helper_del_iroute46(m->route_helper, ir->netbits);
+ }
for (ir6 = mi->context.options.iroutes_ipv6; ir6 != NULL; ir6 = ir6->next)
+ {
mroute_helper_del_iroute46(m->route_helper, ir6->netbits);
+ }
}
}
mi->did_iter = true;
#ifdef MANAGEMENT_DEF_AUTH
- do {
+ do
+ {
mi->context.c2.mda_context.cid = m->cid_counter++;
} while (!hash_add(m->cid_hash, &mi->context.c2.mda_context.cid, mi, false));
mi->did_cid_hash = true;
parm.packet_size);
for (i = 0; i < parm.packet_size; ++i)
+ {
ASSERT(buf_write_u8(&buf, get_random() & 0xFF));
+ }
for (i = 0; i < parm.n_packets; ++i)
+ {
multi_bcast(m, &buf, NULL, NULL);
+ }
gc_free(&gc);
}
#else /* if P2MP_SERVER */
static void
-dummy(void) {
+dummy(void)
+{
}
#endif /* P2MP_SERVER */
/* Generates 8 random bytes to be used as client nonce */
int i;
- for (i = 0; i<8; i++) {
+ for (i = 0; i<8; i++)
+ {
nonce[i] = (unsigned char)get_random();
}
}
/* converts string to uppercase in place */
unsigned char *tmp = str;
- do *str = toupper(*str); while (*(++str));
+ do
+ {
+ *str = toupper(*str);
+ } while (*(++str));
return tmp;
}
#else /* if NTLM */
static void
-dummy(void) {
+dummy(void)
+{
}
#endif /* if NTLM */
#else /* ifdef ENABLE_OCC */
static void
-dummy(void) {
+dummy(void)
+{
}
#endif /* ifdef ENABLE_OCC */
#ifdef _WIN32
int
-wmain(int argc, wchar_t *wargv[]) {
+wmain(int argc, wchar_t *wargv[])
+{
char **argv;
int ret;
int i;
}
#else /* ifdef _WIN32 */
int
-main(int argc, char *argv[]) {
+main(int argc, char *argv[])
+{
return openvpn_main(argc, argv);
}
#endif /* ifdef _WIN32 */
{
int i;
for (i = 0; i < o->connection_list->len; ++i)
+ {
setenv_connection_entry(es, o->connection_list->array[i], i+1);
+ }
}
else
{
{
int i;
for (i = 0; i<MAX_PARMS; i++)
+ {
SHOW_INT(remote_cert_ku[i]);
+ }
}
SHOW_STR(remote_cert_eku);
SHOW_INT(ssl_flags);
{
int i;
for (i = 0; i<MAX_PARMS && o->pkcs11_providers[i] != NULL; i++)
+ {
SHOW_PARM(pkcs11_providers, o->pkcs11_providers[i], "%s");
+ }
}
{
int i;
for (i = 0; i<MAX_PARMS; i++)
+ {
SHOW_PARM(pkcs11_protected_authentication, o->pkcs11_protected_authentication[i] ? "ENABLED" : "DISABLED", "%s");
+ }
}
{
int i;
for (i = 0; i<MAX_PARMS; i++)
+ {
SHOW_PARM(pkcs11_private_mode, o->pkcs11_private_mode[i], "%08x");
+ }
}
{
int i;
for (i = 0; i<MAX_PARMS; i++)
+ {
SHOW_PARM(pkcs11_cert_private, o->pkcs11_cert_private[i] ? "ENABLED" : "DISABLED", "%s");
+ }
}
SHOW_INT(pkcs11_pin_cache_period);
SHOW_STR(pkcs11_id);
{
int i;
for (i = 0; i < o->connection_list->len; ++i)
+ {
options_postprocess_verify_ce(o, o->connection_list->array[i]);
+ }
}
else
{
ASSERT(o->connection_list);
for (i = 0; i < o->connection_list->len; ++i)
+ {
options_postprocess_mutate_ce(o, o->connection_list->array[i]);
+ }
#ifdef ENABLE_CRYPTO
if (o->tls_server)
char *p = gc_malloc(OPTION_PARM_SIZE, true, &gc);
while (buf_parse(&b, delim, p, OPTION_PARM_SIZE))
+ {
options_warning_safe_scan2(msglevel, delim, report_inconsistent, p, b2_src, b1_name, b2_name);
+ }
gc_free(&gc);
}
{
char *line_ptr = line;
/* Remove leading spaces */
- while (isspace(*line_ptr)) line_ptr++;
+ while (isspace(*line_ptr))
+ {
+ line_ptr++;
+ }
if (!strncmp(line_ptr, close_tag, strlen(close_tag)))
{
endtagfound = true;
VERIFY_PERMISSION(OPT_P_GENERAL);
/* Find out how many options to be ignored */
for (i = 1; p[i]; i++)
+ {
numignored++;
+ }
/* add number of options already ignored */
for (i = 0; options->ignore_unknown_option
&& options->ignore_unknown_option[i]; i++)
+ {
numignored++;
+ }
/* Allocate array */
ALLOC_ARRAY_GC(ignore, const char *, numignored+1, &options->gc);
for (i = 0; options->ignore_unknown_option
&& options->ignore_unknown_option[i]; i++)
+ {
ignore[i] = options->ignore_unknown_option[i];
+ }
options->ignore_unknown_option = ignore;
struct http_custom_header *custom_header = NULL;
int i;
/* Find the first free header */
- for (i = 0; i < MAX_CUSTOM_HTTP_HEADER; i++) {
+ for (i = 0; i < MAX_CUSTOM_HTTP_HEADER; i++)
+ {
if (!ho->custom_headers[i].name)
{
custom_header = &ho->custom_headers[i];
VERIFY_PERMISSION(OPT_P_GENERAL);
for (j = 1; j < MAX_PARMS && p[j] != NULL; ++j)
+ {
sscanf(p[j], "%x", &(options->remote_cert_ku[j-1]));
+ }
}
else if (streq(p[0], "remote-cert-eku") && p[1] && !p[2])
{
if (strncmp("ext:", s, 4) != 0)
{
size_t i = 0;
- while (s[i] && !isupper(s[i])) i++;
+ while (s[i] && !isupper(s[i]))
+ {
+ i++;
+ }
if (strlen(s) == i)
{
- while ((*s = toupper(*s)) != '\0') s++;
+ while ((*s = toupper(*s)) != '\0')
+ {
+ s++;
+ }
msg(M_WARN, "DEPRECATED FEATURE: automatically upcased the "
"--x509-username-field parameter to '%s'; please update your"
"configuration", p[1]);
VERIFY_PERMISSION(OPT_P_GENERAL);
for (j = 1; j < MAX_PARMS && p[j] != NULL; ++j)
+ {
options->pkcs11_providers[j-1] = p[j];
+ }
}
else if (streq(p[0], "pkcs11-protected-authentication"))
{
VERIFY_PERMISSION(OPT_P_GENERAL);
for (j = 1; j < MAX_PARMS && p[j] != NULL; ++j)
+ {
options->pkcs11_protected_authentication[j-1] = atoi(p[j]) != 0 ? 1 : 0;
+ }
}
else if (streq(p[0], "pkcs11-private-mode") && p[1])
{
VERIFY_PERMISSION(OPT_P_GENERAL);
for (j = 1; j < MAX_PARMS && p[j] != NULL; ++j)
+ {
sscanf(p[j], "%x", &(options->pkcs11_private_mode[j-1]));
+ }
}
else if (streq(p[0], "pkcs11-cert-private"))
{
VERIFY_PERMISSION(OPT_P_GENERAL);
for (j = 1; j < MAX_PARMS && p[j] != NULL; ++j)
+ {
options->pkcs11_cert_private[j-1] = atoi(p[j]) != 0 ? 1 : 0;
+ }
}
else if (streq(p[0], "pkcs11-pin-cache") && p[1] && !p[2])
{
* called again.
*/
static inline void
-interval_earliest_wakeup(interval_t *wakeup, time_t at, time_t current) {
+interval_earliest_wakeup(interval_t *wakeup, time_t at, time_t current)
+{
if (at > current)
{
const interval_t delta = (interval_t) (at - current);
packet_id_init(&pid, seq_backtrack, time_backtrack);
- while (true) {
+ while (true)
+ {
char buf[80];
if (!fgets(buf, sizeof(buf), stdin))
{
{
int i;
for (i = 0; i < sindex; ++i)
+ {
if (perf_set.stack[i] == pindex)
{
perf_print_state(M_INFO);
msg(M_FATAL, "PERF: push_perf_index %s failed",
metric_names [pindex]);
}
+ }
perf_set.stack[sindex] = pindex;
perf_set.stack_len = newlen;
#else /* ifdef ENABLE_PERFORMANCE_METRICS */
#ifdef _MSC_VER /* Dummy function needed to avoid empty file compiler warning in Microsoft VC */
static void
-dummy(void) {
+dummy(void)
+{
}
#endif
#endif /* ifdef ENABLE_PERFORMANCE_METRICS */
#else /* ifdef ENABLE_PERFORMANCE_METRICS */
static inline void
-perf_push(int type) {
+perf_push(int type)
+{
}
static inline void
-perf_pop(void) {
+perf_pop(void)
+{
}
static inline void
-perf_output_results(void) {
+perf_output_results(void)
+{
}
#endif /* ifdef ENABLE_PERFORMANCE_METRICS */
static
time_t
-__mytime(void) {
+__mytime(void)
+{
return openvpn_time(NULL);
}
#if !defined(_WIN32)
static
int
-__mygettimeofday(struct timeval *tv) {
+__mygettimeofday(struct timeval *tv)
+{
return gettimeofday(tv, NULL);
}
#endif
static
void
-__mysleep(const unsigned long usec) {
+__mysleep(const unsigned long usec)
+{
#if defined(_WIN32)
Sleep(usec/1000);
#else
unsigned
_pkcs11_msg_pkcs112openvpn(
const unsigned flags
- ) {
+ )
+{
unsigned openvpn_flags;
- switch (flags) {
+ switch (flags)
+ {
case PKCS11H_LOG_DEBUG2:
openvpn_flags = D_PKCS11_DEBUG;
break;
unsigned
_pkcs11_msg_openvpn2pkcs11(
const unsigned flags
- ) {
+ )
+{
unsigned pkcs11_flags;
if ((flags & D_PKCS11_DEBUG) != 0)
unsigned flags,
const char *const szFormat,
va_list args
- ) {
+ )
+{
char Buffer[10*1024];
(void)global_data;
void *const user_data,
const pkcs11h_token_id_t token,
const unsigned retry
- ) {
+ )
+{
struct user_pass token_resp;
(void)global_data;
const unsigned retry,
char *const pin,
const size_t pin_max
- ) {
+ )
+{
struct user_pass token_pass;
char prompt[1024];
pkcs11_initialize(
const bool protected_auth,
const int nPINCachePeriod
- ) {
+ )
+{
CK_RV rv = CKR_FUNCTION_FAILED;
dmsg(
}
void
-pkcs11_terminate() {
+pkcs11_terminate()
+{
dmsg(
D_PKCS11_DEBUG,
"PKCS#11: pkcs11_terminate - entered"
const bool protected_auth,
const unsigned private_mode,
const bool cert_private
- ) {
+ )
+{
CK_RV rv = CKR_OK;
ASSERT(provider!=NULL);
}
int
-pkcs11_logout() {
+pkcs11_logout()
+{
return pkcs11h_logout() == CKR_OK;
}
int
-pkcs11_management_id_count() {
+pkcs11_management_id_count()
+{
pkcs11h_certificate_id_list_t id_list = NULL;
pkcs11h_certificate_id_list_t t = NULL;
CK_RV rv = CKR_OK;
goto cleanup;
}
- for (count = 0, t = id_list; t != NULL; t = t->next) {
+ for (count = 0, t = id_list; t != NULL; t = t->next)
+ {
count++;
}
const int index,
char **id,
char **base64
- ) {
+ )
+{
pkcs11h_certificate_id_list_t id_list = NULL;
pkcs11h_certificate_id_list_t entry = NULL;
#if 0 /* certificate_id seems to be unused -- JY */
entry = id_list;
count = 0;
- while (entry != NULL && count != index) {
+ while (entry != NULL && count != index)
+ {
count++;
entry = entry->next;
}
struct tls_root_ctx *const ssl_ctx,
bool pkcs11_id_management,
const char *const pkcs11_id
- ) {
+ )
+{
pkcs11h_certificate_id_t certificate_id = NULL;
pkcs11h_certificate_t certificate = NULL;
CK_RV rv = CKR_OK;
const unsigned retry,
char *const pin,
const size_t pin_max
- ) {
+ )
+{
struct gc_arena gc = gc_new();
struct buffer pass_prompt = alloc_buf_gc(128, &gc);
show_pkcs11_ids(
const char *const provider,
bool cert_private
- ) {
+ )
+{
struct gc_arena gc = gc_new();
pkcs11h_certificate_id_list_t user_certificates = NULL;
pkcs11h_certificate_id_list_t current = NULL;
"--pkcs11-id option please remember to use single quote mark.\n"
)
);
- for (current = user_certificates; current != NULL; current = current->next) {
+ for (current = user_certificates; current != NULL; current = current->next)
+ {
pkcs11h_certificate_t certificate = NULL;
char *dn = NULL;
char serial[1024] = {0};
#else /* if defined(ENABLE_PKCS11) */
#ifdef _MSC_VER /* Dummy function needed to avoid empty file compiler warning in Microsoft VC */
static void
-dummy(void) {
+dummy(void)
+{
}
#endif
#endif /* ENABLE_PKCS11 */
int i;
for (i = 0; i < pc->n; ++i)
+ {
plugin_close_item(&pc->plugins[i]);
+ }
free(pc);
}
}
int i;
for (i = 0; i < pc->n; ++i)
+ {
plugin_abort_item(&pc->plugins[i]);
+ }
}
}
dest->n = 0;
for (i = 0; i < src->n; ++i)
+ {
dest->list[i] = openvpn_plugin_string_list_find(src->list[i], colname);
+ }
dest->n = i;
}
{
int i;
for (i = 0; i < pr->n; ++i)
+ {
openvpn_plugin_string_list_free(pr->list[i]);
+ }
pr->n = 0;
}
#else /* ifdef ENABLE_PLUGIN */
static void
-dummy(void) {
+dummy(void)
+{
}
#endif /* ENABLE_PLUGIN */
{
int i;
for (i = 0; i < pool->size; ++i)
+ {
ifconfig_pool_entry_free(&pool->list[i], true);
+ }
free(pool->list);
free(pool);
}
bool escape = false;
for (c = max_key_len-1; (*str && (*str != '=') && c--); )
+ {
*key++ = *str++;
+ }
*key = '\0';
if ('=' != *str++)
++content;
}
while (*content && isspace(*content))
+ {
++content;
+ }
}
}
/* receive and discard everything else */
while (recv_line(sd, NULL, 0, 2, true, NULL, signal_received))
- ;
+ {
+ }
/* now send the phase 3 reply */
* start of the OpenVPN data stream (put it in lookahead).
*/
while (recv_line(sd, NULL, 0, 2, false, lookahead, signal_received))
- ;
+ {
+ }
/* reset queried_creds so that we don't think that the next creds request is due to an auth error */
p->queried_creds = false;
{
int i;
for (i = 0; i < ack->len; ++i)
+ {
if (ack->packet_id[i] == pid)
{
return true;
}
+ }
return false;
}
ASSERT(session_id_defined(sid));
ASSERT(session_id_write(sid, &sub));
for (i = 0, j = n; j < ack->len; )
+ {
ack->packet_id[i++] = ack->packet_id[j++];
+ }
ack->len = i;
}
#else /* ifdef ENABLE_CRYPTO */
static void
-dummy(void) {
+dummy(void)
+{
}
#endif /* ENABLE_CRYPTO */
(rol->flags & RG_LOCAL) != 0);
}
for (ro = rol->routes; ro; ro = ro->next)
+ {
print_route_option(ro, level);
+ }
}
void
{
struct route_ipv4 *r;
for (r = rl->routes; r; r = r->next)
+ {
print_route(r, level);
+ }
}
static void
int i = 1;
struct route_ipv4 *r;
for (r = rl->routes; r; r = r->next)
+ {
setenv_route(es, r, i++);
+ }
}
static void
int i = 1;
struct route_ipv6 *r6;
for (r6 = rl6->routes_ipv6; r6; r6 = r6->next)
+ {
setenv_route_ipv6(es, r6, i++);
+ }
}
/*
{
struct route_ipv4 *r;
for (r = rl->routes, len = 0; r; r = r->next, ++len)
+ {
test_route_helper(&ret, &count, &good, &ambig, adapters, r->gateway);
+ }
if ((rl->flags & RG_ENABLE) && (rl->spec.flags & RTSA_REMOTE_ENDPOINT))
{
msg(M_WARN, "GDG: problem writing to routing socket");
goto done;
}
- do {
+ do
+ {
l = read(sockfd, (char *)&m_rtmsg, sizeof(m_rtmsg));
} while (l > 0 && (rtm.rtm_seq != seq || rtm.rtm_pid != pid));
close(sockfd);
#else /* ifdef _WIN32 */
static inline bool
-test_routes(const struct route_list *rl, const struct tuntap *tt) {
+test_routes(const struct route_list *rl, const struct tuntap *tt)
+{
return true;
}
#endif
* keeps the tree balanced. Move the node up the tree until
* its own priority is greater than that of its parent */
while (e->parent && e->parent->pri > e->pri)
+ {
schedule_rotate_up(s, e);
+ }
}
/*
struct gc_arena gc = gc_new();
int i;
for (i = 0; i < indent; ++i)
+ {
printf(" ");
+ }
if (e)
{
printf("%s [%u] e=" ptr_format ", p=" ptr_format " lt=" ptr_format " gt=" ptr_format "\n",
#else /* ifdef ENABLE_CRYPTO */
static void
-dummy(void) {
+dummy(void)
+{
}
#endif /* ENABLE_CRYPTO */
#else /* ifdef ENABLE_FEATURE_SHAPER */
static void
-dummy(void) {
+dummy(void)
+{
}
#endif /* ENABLE_FEATURE_SHAPER */
{
struct cached_dns_entry *prev = c->c1.dns_cache;
while (prev->next)
+ {
prev = prev->next;
+ }
prev->next = ph;
}
phase2_tcp_client(struct link_socket *sock, struct signal_info *sig_info)
{
bool proxy_retry = false;
- do {
+ do
+ {
socket_connect(&sock->sd,
sock->info.lsa->current_remote->ai_addr,
get_server_poll_remaining_time(sock->server_poll_timeout),
(int)from_addr->dest.addr.sa.sa_family,
print_sockaddr_ex(info->lsa->remote_list->ai_addr,":",PS_SHOW_PORT, &gc));
/* print additional remote addresses */
- for (ai = info->lsa->remote_list->ai_next; ai; ai = ai->ai_next) {
+ for (ai = info->lsa->remote_list->ai_next; ai; ai = ai->ai_next)
+ {
msg(D_LINK_ERRORS,"or from peer address: %s",
print_sockaddr_ex(ai->ai_addr,":",PS_SHOW_PORT, &gc));
}
{
int i;
for (i = 0; i < SIZE(proto_names); ++i)
+ {
if (!strcmp(proto_name, proto_names[i].short_form))
{
return proto_names[i].proto;
}
+ }
return -1;
}
{
int i;
for (i = 0; i < SIZE(proto_names); ++i)
+ {
if (!strcmp(proto_name, proto_names[i].short_form))
{
return proto_names[i].proto_af;
}
+ }
return 0;
}
{
return 0;
}
- switch (addr->addr.sa.sa_family) {
+ switch (addr->addr.sa.sa_family)
+ {
case AF_INET: return addr->addr.in4.sin_addr.s_addr != 0;
case AF_INET6: return !IN6_IS_ADDR_UNSPECIFIED(&addr->addr.in6.sin6_addr);
{
return false;
}
- switch (addr->sa_family) {
+ switch (addr->sa_family)
+ {
case AF_INET:
return ((const struct sockaddr_in *)addr)->sin_addr.s_addr == htonl(INADDR_LOOPBACK);
{
return 0;
}
- switch (lsa->dest.addr.sa.sa_family) {
+ switch (lsa->dest.addr.sa.sa_family)
+ {
#if defined(HAVE_IN_PKTINFO) && defined(HAVE_IPI_SPEC_DST)
case AF_INET: return lsa->pi.in4.ipi_spec_dst.s_addr != 0;
static inline bool
addr_match(const struct openvpn_sockaddr *a1, const struct openvpn_sockaddr *a2)
{
- switch (a1->addr.sa.sa_family) {
+ switch (a1->addr.sa.sa_family)
+ {
case AF_INET:
return a1->addr.in4.sin_addr.s_addr == a2->addr.in4.sin_addr.s_addr;
static inline bool
addr_port_match(const struct openvpn_sockaddr *a1, const struct openvpn_sockaddr *a2)
{
- switch (a1->addr.sa.sa_family) {
+ switch (a1->addr.sa.sa_family)
+ {
case AF_INET:
return a1->addr.in4.sin_addr.s_addr == a2->addr.in4.sin_addr.s_addr
&& a1->addr.in4.sin_port == a2->addr.in4.sin_port;
static inline void
addr_zero_host(struct openvpn_sockaddr *addr)
{
- switch (addr->addr.sa.sa_family) {
+ switch (addr->addr.sa.sa_family)
+ {
case AF_INET:
addr->addr.in4.sin_addr.s_addr = 0;
break;
static inline int
af_addr_size(sa_family_t af)
{
- switch (af) {
+ switch (af)
+ {
case AF_INET: return sizeof(struct sockaddr_in);
case AF_INET6: return sizeof(struct sockaddr_in6);
{
if (buf->len > 0)
{
- switch (from_addr->dest.addr.sa.sa_family) {
+ switch (from_addr->dest.addr.sa.sa_family)
+ {
case AF_INET6:
case AF_INET:
if (!link_socket_actual_defined(from_addr))
key_ctx_update_implicit_iv(struct key_ctx *ctx, uint8_t *key, size_t key_len);
const tls_cipher_name_pair *
-tls_get_cipher_name_pair(const char *cipher_name, size_t len) {
+tls_get_cipher_name_pair(const char *cipher_name, size_t len)
+{
const tls_cipher_name_pair *pair = tls_cipher_name_translation_table;
- while (pair->openssl_name != NULL) {
+ while (pair->openssl_name != NULL)
+ {
if ((strlen(pair->openssl_name) == len && 0 == memcmp(cipher_name, pair->openssl_name, len))
|| (strlen(pair->iana_name) == len && 0 == memcmp(cipher_name, pair->iana_name, len)))
{
/* Randomize session # if it is 0 */
while (!session_id_defined(&session->session_id))
+ {
session_id_random(&session->session_id);
+ }
/* Are we a TLS server or client? */
ASSERT(session->opt->key_method >= 1);
free_buf(&session->tls_wrap.work);
for (i = 0; i < KS_SIZE; ++i)
+ {
key_state_free(&session->key[i], false);
+ }
if (session->common_name)
{
* called again.
*/
static inline void
-compute_earliest_wakeup(interval_t *earliest, interval_t seconds_from_now) {
+compute_earliest_wakeup(interval_t *earliest, interval_t seconds_from_now)
+{
if (seconds_from_now < *earliest)
{
*earliest = seconds_from_now;
free(multi->remote_ciphername);
for (i = 0; i < TM_SIZE; ++i)
+ {
tls_session_free(&multi->session[i], false);
+ }
if (clear)
{
tls1_P_hash(sha1,S2,len,label,label_len,out2,olen);
for (i = 0; i<olen; i++)
+ {
out1[i] ^= out2[i];
+ }
secure_memzero(out2, olen);
}
static void
-key_ctx_update_implicit_iv(struct key_ctx *ctx, uint8_t *key, size_t key_len) {
+key_ctx_update_implicit_iv(struct key_ctx *ctx, uint8_t *key, size_t key_len)
+{
const cipher_kt_t *cipher_kt = cipher_ctx_get_cipher_kt(ctx->cipher);
/* Only use implicit IV in AEAD cipher mode, where HMAC key is not used */
}
bool
-tls_check_ncp_cipher_list(const char *list) {
+tls_check_ncp_cipher_list(const char *list)
+{
bool unsupported_cipher_found = false;
ASSERT(list);
#else /* if defined(ENABLE_CRYPTO) */
static void
-dummy(void) {
+dummy(void)
+{
}
#endif /* ENABLE_CRYPTO */
}
static const char *
-tls_translate_cipher_name(const char *cipher_name) {
+tls_translate_cipher_name(const char *cipher_name)
+{
const tls_cipher_name_pair *pair = tls_get_cipher_name_pair(cipher_name, strlen(cipher_name));
if (NULL == pair)
/* Get number of ciphers */
for (i = 0, cipher_count = 1; i < ciphers_len; i++)
+ {
if (ciphers[i] == ':')
{
cipher_count++;
}
+ }
/* Allocate an array for them */
ALLOC_ARRAY_CLEAR(ctx->allowed_ciphers, int, cipher_count+1)
* Must be a valid pointer.
*/
static void
-tls_version_to_major_minor(int tls_ver, int *major, int *minor) {
+tls_version_to_major_minor(int tls_ver, int *major, int *minor)
+{
ASSERT(major);
ASSERT(minor);
/* Translate IANA cipher suite names to OpenSSL names */
begin_of_cipher = end_of_cipher = 0;
- for (; begin_of_cipher < strlen(ciphers); begin_of_cipher = end_of_cipher) {
+ for (; begin_of_cipher < strlen(ciphers); begin_of_cipher = end_of_cipher)
+ {
end_of_cipher += strcspn(&ciphers[begin_of_cipher], ":");
cipher_pair = tls_get_cipher_name_pair(&ciphers[begin_of_cipher], end_of_cipher - begin_of_cipher);
{
int i, j;
for (i = 0; i < TM_SIZE; ++i)
+ {
for (j = 0; j < KS_SIZE; ++j)
+ {
multi->session[i].key[j].authenticated = false;
+ }
+ }
}
}
{
int i;
for (i = 0; i < MAX_CERT_DEPTH; ++i)
+ {
free(chs->ch[i]);
+ }
free(chs);
}
}
char *val;
for (i = 0; i < orig->len; ++i)
+ {
if (orig->p[i] == '\0')
{
return "ERROR: embedded null value";
}
+ }
val = gc_malloc(orig->len+1, false, gc);
memcpy(val, orig->p, orig->len);
val[orig->len] = '\0';
ASSERT(size > 0);
*out = '\0';
- do {
+ do
+ {
lastpos = tmp;
tmp = X509_NAME_get_index_by_NID(x509, nid, lastpos);
} while (tmp > -1);
void
tls_crypt_init_key(struct key_ctx_bi *key, const char *key_file,
- const char *key_inline, bool tls_server) {
+ const char *key_inline, bool tls_server)
+{
const int key_direction = tls_server ?
KEY_DIRECTION_NORMAL : KEY_DIRECTION_INVERSE;
bool
tls_crypt_wrap(const struct buffer *src, struct buffer *dst,
- struct crypto_options *opt) {
+ struct crypto_options *opt)
+{
const struct key_ctx *ctx = &opt->key_ctx_bi.encrypt;
struct gc_arena gc;
* make sure they do not clash with our virtual subnet.
*/
- for (curele = local_public; curele; curele = curele->ai_next) {
+ for (curele = local_public; curele; curele = curele->ai_next)
+ {
if (curele->ai_family == AF_INET)
{
check_addr_clash("local",
}
}
- for (curele = remote_public; curele; curele = curele->ai_next) {
+ for (curele = remote_public; curele; curele = curele->ai_next)
+ {
if (curele->ai_family == AF_INET)
{
check_addr_clash("remote",
struct buffer out = alloc_buf_gc(64, &gc);
char *top;
- switch (tt->topology) {
+ switch (tt->topology)
+ {
case TOP_NET30:
top = "net30";
break;
/* Prefer IPv6 DNS servers,
* Android will use the DNS server in the order we specify*/
- for (int i = 0; i < tt->options.dns6_len; i++) {
+ for (int i = 0; i < tt->options.dns6_len; i++)
+ {
management_android_control(management, "DNS6SERVER",
print_in6_addr(tt->options.dns6[i], 0, &gc));
}
- for (int i = 0; i < tt->options.dns_len; i++) {
+ for (int i = 0; i < tt->options.dns_len; i++)
+ {
management_android_control(management, "DNSSERVER",
print_in_addr_t(tt->options.dns[i], 0, &gc));
}
{
ptr = dev;
while (*ptr && !isdigit((int) *ptr))
+ {
ptr++;
+ }
ppa = atoi(ptr);
}
{
/* ensure that dev name is "tap+<digits>" *only* */
p = &dev[3];
- while (isdigit(*p) ) p++;
+ while (isdigit(*p) )
+ {
+ p++;
+ }
if (*p != '\0')
{
msg( M_FATAL, "TAP device name must be '--dev tapNNNN'" );
buf_write_u8(buf, type);
buf_write_u8(buf, size);
for (i = 0; i < len; ++i)
+ {
buf_write_u32(buf, data[i]);
+ }
}
}
int i;
ASSERT(IPW32_SET_N == SIZE(ipset_names));
for (i = 0; i < IPW32_SET_N; ++i)
+ {
if (!strcmp(name, ipset_names[i].short_form))
{
return i;
}
+ }
return -1;
}
if (HANDLE_DEFINED(ws->in.read))
{
INPUT_RECORD ir;
- do {
+ do
+ {
DWORD n;
if (!keyboard_input_available(ws))
{
{
int status;
msg(M_INFO|M_NOPREFIX, "Press any key to continue...");
- do {
+ do
+ {
status = WaitForSingleObject(ws->in.read, INFINITE);
} while (!win32_keyboard_get(ws));
}
bool path_seen = false;
for (e = es->list; e != NULL; e = e->next)
+ {
nchars += strlen(e->string) + 1;
+ }
nchars += strlen(force_path)+1;
/*
* Loop over each config file
*/
- do {
+ do
+ {
HANDLE log_handle = NULL;
STARTUPINFO start_info;
PROCESS_INFORMATION proc_info;
handles[0] = io_event;
for (i = 0; i < count; i++)
+ {
handles[i + 1] = events[i];
+ }
res = WaitForMultipleObjects(count + 1, handles, FALSE,
op == peek ? INFINITE : IO_TIMEOUT);
PHANDLE handles = NULL;
DWORD handle_count;
BOOL
- CmpHandle(LPVOID item, LPVOID hnd) {
+ CmpHandle(LPVOID item, LPVOID hnd)
+ {
return item == hnd;
}
return strdup(tosearch);
}
- while (scratch) {
+ while (scratch)
+ {
strncat(temp,searching,scratch-searching);
strcat(temp,replacewith);
if (array)
{
while (array[i])
+ {
++i;
+ }
}
return i;
}
if (array)
{
while (array[i])
+ {
++i;
+ }
}
return i;
}