1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

r25522: Convert to standard bool types.

This commit is contained in:
Jelmer Vernooij 2007-10-05 18:03:01 +00:00 committed by Gerald (Jerry) Carter
parent e5cabe14c7
commit 5e814287ba
19 changed files with 150 additions and 147 deletions

View File

@ -46,7 +46,7 @@ enum opt { OPT_SIMPLE_BIND_DN, OPT_PASSWORD, OPT_KERBEROS };
*/
void popt_common_dont_ask(void)
{
dont_ask = True;
dont_ask = true;
}
static void popt_common_credentials_callback(poptContext con,
@ -105,7 +105,7 @@ static void popt_common_credentials_callback(poptContext con,
case OPT_KERBEROS:
{
BOOL use_kerberos = True;
bool use_kerberos = true;
/* Force us to only use kerberos */
if (arg) {
if (!set_boolean(arg, &use_kerberos)) {

View File

@ -31,9 +31,9 @@ static DATA_BLOB data_blob_repeat_byte(uint8_t byte, size_t length)
/*
This uses the test values from rfc 2104, 2202
*/
BOOL torture_local_crypto_hmacmd5(struct torture_context *torture)
bool torture_local_crypto_hmacmd5(struct torture_context *torture)
{
BOOL ret = True;
bool ret = true;
uint32_t i;
struct {
DATA_BLOB key;
@ -90,7 +90,7 @@ BOOL torture_local_crypto_hmacmd5(struct torture_context *torture)
dump_data(0, testarray[i].data.data, testarray[i].data.length);
dump_data(0, testarray[i].md5.data, testarray[i].md5.length);
dump_data(0, md5, sizeof(md5));
ret = False;
ret = false;
}
}

View File

@ -31,9 +31,9 @@ static DATA_BLOB data_blob_repeat_byte(uint8_t byte, size_t length)
/*
This uses the test values from rfc2202
*/
BOOL torture_local_crypto_hmacsha1(struct torture_context *torture)
bool torture_local_crypto_hmacsha1(struct torture_context *torture)
{
BOOL ret = True;
bool ret = true;
uint32_t i;
struct {
DATA_BLOB key;
@ -89,7 +89,7 @@ BOOL torture_local_crypto_hmacsha1(struct torture_context *torture)
dump_data(0, testarray[i].data.data, testarray[i].data.length);
dump_data(0, testarray[i].sha1.data, testarray[i].sha1.length);
dump_data(0, sha1, sizeof(sha1));
ret = False;
ret = false;
}
}

View File

@ -25,9 +25,9 @@ struct torture_context;
/*
This uses the test values from rfc1320
*/
BOOL torture_local_crypto_md4(struct torture_context *torture)
bool torture_local_crypto_md4(struct torture_context *torture)
{
BOOL ret = True;
bool ret = true;
uint32_t i;
struct {
const char *data;
@ -74,7 +74,7 @@ BOOL torture_local_crypto_md4(struct torture_context *torture)
dump_data(0, data.data, data.length);
dump_data(0, md4blob.data, md4blob.length);
dump_data(0, md4, sizeof(md4));
ret = False;
ret = false;
}
talloc_free(md4blob.data);
}

View File

@ -25,9 +25,9 @@ struct torture_context;
/*
This uses the test values from rfc1321
*/
BOOL torture_local_crypto_md5(struct torture_context *torture)
bool torture_local_crypto_md5(struct torture_context *torture)
{
BOOL ret = True;
bool ret = true;
uint32_t i;
struct {
const char *data;
@ -84,7 +84,7 @@ BOOL torture_local_crypto_md5(struct torture_context *torture)
dump_data(0, data.data, data.length);
dump_data(0, md5blob.data, md5blob.length);
dump_data(0, md5, sizeof(md5));
ret = False;
ret = false;
}
talloc_free(md5blob.data);
}

View File

@ -57,7 +57,7 @@ bool torture_local_crypto_sha1(struct torture_context *tctx)
struct SHA1Context sha;
int i, j, err;
uint8_t Message_Digest[20];
BOOL ret = True;
bool ret = true;
char tmp[60 + 10];
/*
@ -94,7 +94,7 @@ bool torture_local_crypto_sha1(struct torture_context *tctx)
torture_comment(tctx, "\n");
torture_comment(tctx, "Should match:\n\t%s\n", resultarray[j]);
if (strcmp(resultarray[j], tmp) != 0) {
ret = False;
ret = false;
}
}

View File

@ -80,11 +80,11 @@ bool event_register_backend(const char *name, const struct event_ops *ops)
{
struct event_ops_list *e;
e = talloc(talloc_autofree_context(), struct event_ops_list);
if (e == NULL) return False;
if (e == NULL) return false;
e->name = name;
e->ops = ops;
DLIST_ADD(event_backends, e);
return True;
return true;
}
/*

View File

@ -217,8 +217,8 @@ struct signal_event *common_event_add_signal(struct event_context *ev,
if (sig_state->pipe_hack[0] == 0 &&
sig_state->pipe_hack[1] == 0) {
pipe(sig_state->pipe_hack);
set_blocking(sig_state->pipe_hack[0], False);
set_blocking(sig_state->pipe_hack[1], False);
set_blocking(sig_state->pipe_hack[0], false);
set_blocking(sig_state->pipe_hack[1], false);
}
ev->pipe_fde = event_add_fd(ev, ev, sig_state->pipe_hack[0],
EVENT_FD_READ, signal_pipe_handler, NULL);

View File

@ -646,7 +646,7 @@ static int ildb_rename(struct ldb_module *module, struct ldb_request *req)
return LDB_ERR_INVALID_DN_SYNTAX;
}
msg->r.ModifyDNRequest.deleteolddn = True;
msg->r.ModifyDNRequest.deleteolddn = true;
return ildb_request_send(ildb, msg, req);
}

View File

@ -90,7 +90,10 @@ static struct ldb_handle *init_handle(void *mem_ctx, struct ldb_module *module,
ac->up_context = context;
ac->up_callback = callback;
ac->pending = False;
ac->pending = false;
ac->saved_referrals = NULL;
ac->num_referrals = 0;
@ -110,7 +113,7 @@ static int check_ps_continuation(struct ldb_reply *ares, struct ps_context *ac)
rep_control = talloc_get_type(ares->controls[0]->data, struct ldb_paged_control);
if (rep_control->cookie_len == 0) {
/* we are done */
ac->pending = False;
ac->pending = false;
return LDB_SUCCESS;
}
@ -135,7 +138,7 @@ static int check_ps_continuation(struct ldb_reply *ares, struct ps_context *ac)
rep_control->cookie_len);
req_control->cookie_len = rep_control->cookie_len;
ac->pending = True;
ac->pending = true;
return LDB_SUCCESS;
}
@ -395,7 +398,7 @@ static int check_supported_paged(struct ldb_context *ldb, void *context,
if (ldb_msg_check_string_attribute(ares->message,
"supportedControl",
LDB_CONTROL_PAGED_RESULTS_OID)) {
data->paged_supported = True;
data->paged_supported = true;
}
}
return LDB_SUCCESS;
@ -415,7 +418,7 @@ static int ps_init(struct ldb_module *module)
return LDB_ERR_OTHER;
}
module->private_data = data;
data->paged_supported = False;
data->paged_supported = false;
req = talloc(module, struct ldb_request);
if (req == NULL) {

View File

@ -355,7 +355,7 @@ static struct schema_conv process_convert(struct ldb_context *ldb, enum convert_
const char *description = ldb_msg_find_attr_as_string(msg, "description", NULL);
const char *oid = ldb_msg_find_attr_as_string(msg, "attributeID", NULL);
const char *syntax = ldb_msg_find_attr_as_string(msg, "attributeSyntax", NULL);
BOOL single_value = ldb_msg_find_attr_as_bool(msg, "isSingleValued", False);
bool single_value = ldb_msg_find_attr_as_bool(msg, "isSingleValued", false);
const struct syntax_map *map = find_syntax_map_by_ad_oid(syntax);
char *schema_entry = NULL;
int j;

View File

@ -39,7 +39,7 @@
#define ALLONES ((uint32_t)0xFFFFFFFF)
/* masked_match - match address against netnumber/netmask */
static BOOL masked_match(TALLOC_CTX *mem_ctx, const char *tok, const char *slash, const char *s)
static bool masked_match(TALLOC_CTX *mem_ctx, const char *tok, const char *slash, const char *s)
{
uint32_t net;
uint32_t mask;
@ -47,7 +47,7 @@ static BOOL masked_match(TALLOC_CTX *mem_ctx, const char *tok, const char *slash
char *tok_cpy;
if ((addr = interpret_addr(s)) == INADDR_NONE)
return False;
return false;
tok_cpy = talloc_strdup(mem_ctx, tok);
tok_cpy[PTR_DIFF(slash,tok)] = '\0';
@ -64,14 +64,14 @@ static BOOL masked_match(TALLOC_CTX *mem_ctx, const char *tok, const char *slash
if (net == INADDR_NONE || mask == INADDR_NONE) {
DEBUG(0,("access: bad net/mask access control: %s\n", tok));
return False;
return false;
}
return (addr & mask) == (net & mask);
}
/* string_match - match string against token */
static BOOL string_match(TALLOC_CTX *mem_ctx, const char *tok,const char *s, char *invalid_char)
static bool string_match(TALLOC_CTX *mem_ctx, const char *tok,const char *s, char *invalid_char)
{
size_t tok_len;
size_t str_len;
@ -79,50 +79,50 @@ static BOOL string_match(TALLOC_CTX *mem_ctx, const char *tok,const char *s, cha
*invalid_char = '\0';
/* Return True if a token has the magic value "ALL". Return
/* Return true if a token has the magic value "ALL". Return
* FAIL if the token is "FAIL". If the token starts with a "."
* (domain name), return True if it matches the last fields of
* (domain name), return true if it matches the last fields of
* the string. If the token has the magic value "LOCAL",
* return True if the string does not contain a "."
* return true if the string does not contain a "."
* character. If the token ends on a "." (network number),
* return True if it matches the first fields of the
* return true if it matches the first fields of the
* string. If the token begins with a "@" (netgroup name),
* return True if the string is a (host) member of the
* netgroup. Return True if the token fully matches the
* return true if the string is a (host) member of the
* netgroup. Return true if the token fully matches the
* string. If the token is a netnumber/netmask pair, return
* True if the address is a member of the specified subnet.
* true if the address is a member of the specified subnet.
*/
if (tok[0] == '.') { /* domain: match last fields */
if ((str_len = strlen(s)) > (tok_len = strlen(tok))
&& strcasecmp(tok, s + str_len - tok_len)==0) {
return True;
return true;
}
} else if (tok[0] == '@') { /* netgroup: look it up */
DEBUG(0,("access: netgroup support is not available\n"));
return False;
return false;
} else if (strcmp(tok, "ALL")==0) { /* all: match any */
return True;
return true;
} else if (strcmp(tok, "FAIL")==0) { /* fail: match any */
return FAIL;
} else if (strcmp(tok, "LOCAL")==0) { /* local: no dots */
if (strchr(s, '.') == 0 && strcasecmp(s, "unknown") != 0) {
return True;
return true;
}
} else if (strcasecmp(tok, s)==0) { /* match host name or address */
return True;
return true;
} else if (tok[(tok_len = strlen(tok)) - 1] == '.') { /* network */
if (strncmp(tok, s, tok_len) == 0)
return True;
return true;
} else if ((cut = strchr(tok, '/')) != 0) { /* netnumber/netmask */
if (isdigit((int)s[0]) && masked_match(mem_ctx, tok, cut, s))
return True;
return true;
} else if (strchr(tok, '*') != 0) {
*invalid_char = '*';
} else if (strchr(tok, '?') != 0) {
*invalid_char = '?';
}
return False;
return false;
}
struct client_addr {
@ -131,9 +131,9 @@ struct client_addr {
};
/* client_match - match host name and address against token */
static BOOL client_match(TALLOC_CTX *mem_ctx, const char *tok, struct client_addr *client)
static bool client_match(TALLOC_CTX *mem_ctx, const char *tok, struct client_addr *client)
{
BOOL match;
bool match;
char invalid_char = '\0';
/*
@ -158,12 +158,12 @@ token '%s' in an allow/deny hosts line.\n", invalid_char, tok ));
}
/* list_match - match an item against a list of tokens with exceptions */
static BOOL list_match(TALLOC_CTX *mem_ctx, const char **list, struct client_addr *client)
static bool list_match(TALLOC_CTX *mem_ctx, const char **list, struct client_addr *client)
{
BOOL match = False;
bool match = false;
if (!list)
return False;
return false;
/*
* Process tokens one at a time. We have exhausted all possible matches
@ -175,18 +175,18 @@ static BOOL list_match(TALLOC_CTX *mem_ctx, const char **list, struct client_add
for (; *list ; list++) {
if (strcmp(*list, "EXCEPT")==0) /* EXCEPT: give up */
break;
if ((match = client_match(mem_ctx, *list, client))) /* True or FAIL */
if ((match = client_match(mem_ctx, *list, client))) /* true or FAIL */
break;
}
/* Process exceptions to True or FAIL matches. */
if (match != False) {
/* Process exceptions to true or FAIL matches. */
if (match != false) {
while (*list && strcmp(*list, "EXCEPT")!=0)
list++;
for (; *list; list++) {
if (client_match(mem_ctx, *list, client)) /* Exception Found */
return False;
return false;
}
}
@ -194,7 +194,7 @@ static BOOL list_match(TALLOC_CTX *mem_ctx, const char **list, struct client_add
}
/* return true if access should be allowed */
static BOOL allow_access_internal(TALLOC_CTX *mem_ctx,
static bool allow_access_internal(TALLOC_CTX *mem_ctx,
const char **deny_list,const char **allow_list,
const char *cname, const char *caddr)
{
@ -213,15 +213,15 @@ static BOOL allow_access_internal(TALLOC_CTX *mem_ctx,
list_match(mem_ctx, deny_list, &client) &&
(!allow_list ||
!list_match(mem_ctx, allow_list, &client))) {
return False;
return false;
}
return True;
return true;
}
/* if theres no deny list and no allow list then allow access */
if ((!deny_list || *deny_list == 0) &&
(!allow_list || *allow_list == 0)) {
return True;
return true;
}
/* if there is an allow list but no deny list then allow only hosts
@ -237,27 +237,27 @@ static BOOL allow_access_internal(TALLOC_CTX *mem_ctx,
/* if there are both types of list then allow all hosts on the
allow list */
if (list_match(mem_ctx, allow_list, &client))
return True;
return true;
/* if there are both types of list and it's not on the allow then
allow it if its not on the deny */
if (list_match(mem_ctx, deny_list, &client))
return False;
return false;
return True;
return true;
}
/* return true if access should be allowed */
BOOL allow_access(TALLOC_CTX *mem_ctx,
bool allow_access(TALLOC_CTX *mem_ctx,
const char **deny_list, const char **allow_list,
const char *cname, const char *caddr)
{
BOOL ret;
bool ret;
char *nc_cname = talloc_strdup(mem_ctx, cname);
char *nc_caddr = talloc_strdup(mem_ctx, caddr);
if (!nc_cname || !nc_caddr) {
return False;
return false;
}
ret = allow_access_internal(mem_ctx, deny_list, allow_list, nc_cname, nc_caddr);
@ -271,12 +271,12 @@ BOOL allow_access(TALLOC_CTX *mem_ctx,
/* return true if the char* contains ip addrs only. Used to avoid
gethostbyaddr() calls */
static BOOL only_ipaddrs_in_list(const char** list)
static bool only_ipaddrs_in_list(const char** list)
{
BOOL only_ip = True;
bool only_ip = true;
if (!list)
return True;
return true;
for (; *list ; list++) {
/* factor out the special strings */
@ -293,7 +293,7 @@ static BOOL only_ipaddrs_in_list(const char** list)
* have a '/' in them
*/
if ((strchr(*list, '/')) == NULL) {
only_ip = False;
only_ip = false;
DEBUG(3,("only_ipaddrs_in_list: list has non-ip address (%s)\n", *list));
break;
}
@ -304,30 +304,30 @@ static BOOL only_ipaddrs_in_list(const char** list)
}
/* return true if access should be allowed to a service for a socket */
BOOL socket_check_access(struct socket_context *sock,
bool socket_check_access(struct socket_context *sock,
const char *service_name,
const char **allow_list, const char **deny_list)
{
BOOL ret;
bool ret;
const char *name="";
struct socket_address *addr;
TALLOC_CTX *mem_ctx;
if ((!deny_list || *deny_list==0) &&
(!allow_list || *allow_list==0)) {
return True;
return true;
}
mem_ctx = talloc_init("socket_check_access");
if (!mem_ctx) {
return False;
return false;
}
addr = socket_get_peer_addr(sock, mem_ctx);
if (!addr) {
DEBUG(0,("socket_check_access: Denied connection from unknown host: could not get peer address from kernel\n"));
talloc_free(mem_ctx);
return False;
return false;
}
/* bypass gethostbyaddr() calls if the lists only contain IP addrs */
@ -342,7 +342,7 @@ BOOL socket_check_access(struct socket_context *sock,
if (!addr) {
DEBUG(0,("socket_check_access: Denied connection from unknown host\n"));
talloc_free(mem_ctx);
return False;
return false;
}
ret = allow_access(mem_ctx, deny_list, allow_list, name, addr->addr);

View File

@ -120,7 +120,7 @@ struct composite_context *socket_connect_send(struct socket_context *sock,
state->flags = flags;
set_blocking(socket_get_fd(sock), False);
set_blocking(socket_get_fd(sock), false);
if (server_address->addr && strcmp(sock->backend_name, "ipv4") == 0) {
struct nbt_name name;

View File

@ -54,7 +54,7 @@ static struct ipv4_addr tov4(struct in_addr in)
/****************************************************************************
Try and find an interface that matches an ip. If we cannot, return NULL
**************************************************************************/
static struct interface *iface_find(struct in_addr ip, BOOL CheckMask)
static struct interface *iface_find(struct in_addr ip, bool CheckMask)
{
struct interface *i;
if (is_zero_ip(tov4(ip))) return local_interfaces;
@ -321,7 +321,7 @@ const char *iface_best_ip(const char *dest)
load_interfaces();
ip.s_addr = interpret_addr(dest);
iface = iface_find(ip, True);
iface = iface_find(ip, true);
if (iface) {
return iface->ip_s;
}
@ -329,25 +329,25 @@ const char *iface_best_ip(const char *dest)
}
/**
return True if an IP is one one of our local networks
return true if an IP is one one of our local networks
*/
BOOL iface_is_local(const char *dest)
bool iface_is_local(const char *dest)
{
struct in_addr ip;
load_interfaces();
ip.s_addr = interpret_addr(dest);
if (iface_find(ip, True)) {
return True;
if (iface_find(ip, true)) {
return true;
}
return False;
return false;
}
/**
return True if a IP matches a IP/netmask pair
return true if a IP matches a IP/netmask pair
*/
BOOL iface_same_net(const char *ip1, const char *ip2, const char *netmask)
bool iface_same_net(const char *ip1, const char *ip2, const char *netmask)
{
return same_net(interpret_addr2(ip1),
interpret_addr2(ip2),

View File

@ -77,7 +77,7 @@ _PUBLIC_ NTSTATUS socket_create_with_ops(TALLOC_CTX *mem_ctx, const struct socke
/* we don't do a connect() on dgram sockets, so need to set
non-blocking at socket create time */
if (!(flags & SOCKET_FLAG_BLOCK) && type == SOCKET_TYPE_DGRAM) {
set_blocking(socket_get_fd(*new_sock), False);
set_blocking(socket_get_fd(*new_sock), false);
}
talloc_set_destructor(*new_sock, socket_destructor);
@ -502,12 +502,12 @@ _PUBLIC_ void set_socket_options(int fd, const char *options)
int ret=0,i;
int value = 1;
char *p;
BOOL got_value = False;
bool got_value = false;
if ((p = strchr(tok,'='))) {
*p = 0;
value = atoi(p+1);
got_value = True;
got_value = true;
}
for (i=0;socket_options[i].name;i++)

View File

@ -72,7 +72,7 @@ static NTSTATUS ip_connect_complete(struct socket_context *sock, uint32_t flags)
}
if (!(flags & SOCKET_FLAG_BLOCK)) {
ret = set_blocking(sock->fd, False);
ret = set_blocking(sock->fd, false);
if (ret == -1) {
return map_nt_error_from_unix(errno);
}
@ -190,7 +190,7 @@ static NTSTATUS ipv4_listen(struct socket_context *sock,
}
if (!(flags & SOCKET_FLAG_BLOCK)) {
ret = set_blocking(sock->fd, False);
ret = set_blocking(sock->fd, false);
if (ret == -1) {
return map_nt_error_from_unix(errno);
}
@ -217,7 +217,7 @@ static NTSTATUS ipv4_accept(struct socket_context *sock, struct socket_context *
}
if (!(sock->flags & SOCKET_FLAG_BLOCK)) {
int ret = set_blocking(new_fd, False);
int ret = set_blocking(new_fd, false);
if (ret == -1) {
close(new_fd);
return map_nt_error_from_unix(errno);
@ -673,7 +673,7 @@ static NTSTATUS ipv6_listen(struct socket_context *sock,
}
if (!(flags & SOCKET_FLAG_BLOCK)) {
ret = set_blocking(sock->fd, False);
ret = set_blocking(sock->fd, false);
if (ret == -1) {
return map_nt_error_from_unix(errno);
}
@ -700,7 +700,7 @@ static NTSTATUS ipv6_tcp_accept(struct socket_context *sock, struct socket_conte
}
if (!(sock->flags & SOCKET_FLAG_BLOCK)) {
int ret = set_blocking(new_fd, False);
int ret = set_blocking(new_fd, false);
if (ret == -1) {
close(new_fd);
return map_nt_error_from_unix(errno);

View File

@ -82,7 +82,7 @@ static NTSTATUS unixdom_connect_complete(struct socket_context *sock, uint32_t f
}
if (!(flags & SOCKET_FLAG_BLOCK)) {
ret = set_blocking(sock->fd, False);
ret = set_blocking(sock->fd, false);
if (ret == -1) {
return map_nt_error_from_unix(errno);
}
@ -161,7 +161,7 @@ static NTSTATUS unixdom_listen(struct socket_context *sock,
}
if (!(flags & SOCKET_FLAG_BLOCK)) {
ret = set_blocking(sock->fd, False);
ret = set_blocking(sock->fd, false);
if (ret == -1) {
return unixdom_error(errno);
}
@ -190,7 +190,7 @@ static NTSTATUS unixdom_accept(struct socket_context *sock,
}
if (!(sock->flags & SOCKET_FLAG_BLOCK)) {
int ret = set_blocking(new_fd, False);
int ret = set_blocking(new_fd, false);
if (ret == -1) {
close(new_fd);
return map_nt_error_from_unix(errno);

View File

@ -39,13 +39,13 @@ struct packet_context {
size_t packet_size;
void *private;
struct fd_event *fde;
BOOL serialise;
bool serialise;
int processing;
BOOL recv_disable;
BOOL nofree;
bool recv_disable;
bool nofree;
BOOL busy;
BOOL destructor_called;
bool busy;
bool destructor_called;
struct send_element {
struct send_element *next, *prev;
@ -63,7 +63,7 @@ struct packet_context {
static int packet_destructor(struct packet_context *pc)
{
if (pc->busy) {
pc->destructor_called = True;
pc->destructor_called = true;
/* now we refuse the talloc_free() request. The free will
happen again in the packet_recv() code */
return -1;
@ -156,7 +156,7 @@ _PUBLIC_ void packet_set_fde(struct packet_context *pc, struct fd_event *fde)
*/
_PUBLIC_ void packet_set_serialise(struct packet_context *pc)
{
pc->serialise = True;
pc->serialise = true;
}
/*
@ -173,7 +173,7 @@ _PUBLIC_ void packet_set_initial_read(struct packet_context *pc, uint32_t initia
*/
_PUBLIC_ void packet_set_nofree(struct packet_context *pc)
{
pc->nofree = True;
pc->nofree = true;
}
@ -373,11 +373,11 @@ next_partial:
pc->processing = 1;
}
pc->busy = True;
pc->busy = true;
status = pc->callback(pc->private, blob);
pc->busy = False;
pc->busy = false;
if (pc->destructor_called) {
talloc_free(pc);
@ -429,7 +429,7 @@ next_partial:
_PUBLIC_ void packet_recv_disable(struct packet_context *pc)
{
EVENT_FD_NOT_READABLE(pc->fde);
pc->recv_disable = True;
pc->recv_disable = true;
}
/*
@ -438,7 +438,7 @@ _PUBLIC_ void packet_recv_disable(struct packet_context *pc)
_PUBLIC_ void packet_recv_enable(struct packet_context *pc)
{
EVENT_FD_READABLE(pc->fde);
pc->recv_disable = False;
pc->recv_disable = false;
if (pc->num_read != 0 && pc->packet_size >= pc->num_read) {
event_add_timed(pc->ev, pc, timeval_zero(), packet_next_event, pc);
}

View File

@ -40,7 +40,7 @@ typedef gnutls_datum gnutls_datum_t;
struct tls_params {
gnutls_certificate_credentials x509_cred;
gnutls_dh_params dh_params;
BOOL tls_enabled;
bool tls_enabled;
};
#endif
@ -48,32 +48,32 @@ struct tls_params {
struct tls_context {
struct socket_context *socket;
struct fd_event *fde;
BOOL tls_enabled;
bool tls_enabled;
#if ENABLE_GNUTLS
gnutls_session session;
BOOL done_handshake;
BOOL have_first_byte;
bool done_handshake;
bool have_first_byte;
uint8_t first_byte;
BOOL tls_detect;
bool tls_detect;
const char *plain_chars;
BOOL output_pending;
bool output_pending;
gnutls_certificate_credentials xcred;
BOOL interrupted;
bool interrupted;
#endif
};
BOOL tls_enabled(struct socket_context *sock)
bool tls_enabled(struct socket_context *sock)
{
struct tls_context *tls;
if (!sock) {
return False;
return false;
}
if (strcmp(sock->backend_name, "tls") != 0) {
return False;
return false;
}
tls = talloc_get_type(sock->private_data, struct tls_context);
if (!tls) {
return False;
return false;
}
return tls->tls_enabled;
}
@ -117,7 +117,7 @@ static ssize_t tls_pull(gnutls_transport_ptr ptr, void *buf, size_t size)
if (tls->have_first_byte) {
*(uint8_t *)buf = tls->first_byte;
tls->have_first_byte = False;
tls->have_first_byte = false;
return 1;
}
@ -213,7 +213,7 @@ static NTSTATUS tls_handshake(struct tls_context *tls)
DEBUG(0,("TLS gnutls_handshake failed - %s\n", gnutls_strerror(ret)));
return NT_STATUS_UNEXPECTED_NETWORK_ERROR;
}
tls->done_handshake = True;
tls->done_handshake = true;
return NT_STATUS_OK;
}
@ -235,7 +235,7 @@ static NTSTATUS tls_interrupted(struct tls_context *tls)
if (ret == GNUTLS_E_INTERRUPTED || ret == GNUTLS_E_AGAIN) {
return STATUS_MORE_ENTRIES;
}
tls->interrupted = False;
tls->interrupted = false;
return NT_STATUS_OK;
}
@ -274,15 +274,15 @@ static NTSTATUS tls_socket_recv(struct socket_context *sock, void *buf,
status = socket_recv(tls->socket, &tls->first_byte, 1, nread);
NT_STATUS_NOT_OK_RETURN(status);
if (*nread == 0) return NT_STATUS_OK;
tls->tls_detect = False;
tls->tls_detect = false;
/* look for the first byte of a valid HTTP operation */
if (strchr(tls->plain_chars, tls->first_byte)) {
/* not a tls link */
tls->tls_enabled = False;
tls->tls_enabled = false;
*(uint8_t *)buf = tls->first_byte;
return NT_STATUS_OK;
}
tls->have_first_byte = True;
tls->have_first_byte = true;
}
if (!tls->tls_enabled) {
@ -300,7 +300,7 @@ static NTSTATUS tls_socket_recv(struct socket_context *sock, void *buf,
if (gnutls_record_get_direction(tls->session) == 1) {
EVENT_FD_WRITEABLE(tls->fde);
}
tls->interrupted = True;
tls->interrupted = true;
return STATUS_MORE_ENTRIES;
}
if (ret < 0) {
@ -336,7 +336,7 @@ static NTSTATUS tls_socket_send(struct socket_context *sock,
if (gnutls_record_get_direction(tls->session) == 1) {
EVENT_FD_WRITEABLE(tls->fde);
}
tls->interrupted = True;
tls->interrupted = true;
return STATUS_MORE_ENTRIES;
}
if (ret < 0) {
@ -371,7 +371,7 @@ struct tls_params *tls_initialise(TALLOC_CTX *mem_ctx)
}
if (!lp_tls_enabled(global_loadparm) || keyfile == NULL || *keyfile == 0) {
params->tls_enabled = False;
params->tls_enabled = false;
talloc_free(tmp_ctx);
return params;
}
@ -438,14 +438,14 @@ struct tls_params *tls_initialise(TALLOC_CTX *mem_ctx)
gnutls_certificate_set_dh_params(params->x509_cred, params->dh_params);
params->tls_enabled = True;
params->tls_enabled = true;
talloc_free(tmp_ctx);
return params;
init_failed:
DEBUG(0,("GNUTLS failed to initialise - %s\n", gnutls_strerror(ret)));
params->tls_enabled = False;
params->tls_enabled = false;
talloc_free(tmp_ctx);
return params;
}
@ -510,16 +510,16 @@ struct socket_context *tls_init_server(struct tls_params *params,
tls->plain_chars = plain_chars;
if (plain_chars) {
tls->tls_detect = True;
tls->tls_detect = true;
} else {
tls->tls_detect = False;
tls->tls_detect = false;
}
tls->output_pending = False;
tls->done_handshake = False;
tls->have_first_byte = False;
tls->tls_enabled = True;
tls->interrupted = False;
tls->output_pending = false;
tls->done_handshake = false;
tls->have_first_byte = false;
tls->tls_enabled = true;
tls->interrupted = false;
new_sock->state = SOCKET_STATE_SERVER_CONNECTED;
@ -586,13 +586,13 @@ struct socket_context *tls_init_client(struct socket_context *socket,
gnutls_transport_set_pull_function(tls->session, (gnutls_pull_func)tls_pull);
gnutls_transport_set_push_function(tls->session, (gnutls_push_func)tls_push);
gnutls_transport_set_lowat(tls->session, 0);
tls->tls_detect = False;
tls->tls_detect = false;
tls->output_pending = False;
tls->done_handshake = False;
tls->have_first_byte = False;
tls->tls_enabled = True;
tls->interrupted = False;
tls->output_pending = false;
tls->done_handshake = false;
tls->have_first_byte = false;
tls->tls_enabled = true;
tls->interrupted = false;
new_sock->state = SOCKET_STATE_CLIENT_CONNECTED;
@ -600,7 +600,7 @@ struct socket_context *tls_init_client(struct socket_context *socket,
failed:
DEBUG(0,("TLS init connection failed - %s\n", gnutls_strerror(ret)));
tls->tls_enabled = False;
tls->tls_enabled = false;
return new_sock;
}
@ -649,7 +649,7 @@ static const struct socket_ops tls_socket_ops = {
.fn_get_fd = tls_socket_get_fd
};
BOOL tls_support(struct tls_params *params)
bool tls_support(struct tls_params *params)
{
return params->tls_enabled;
}
@ -685,9 +685,9 @@ struct socket_context *tls_init_client(struct socket_context *socket,
return NULL;
}
BOOL tls_support(struct tls_params *params)
bool tls_support(struct tls_params *params)
{
return False;
return false;
}
#endif