r25454: Use standard bool types in a couple more places.
authorJelmer Vernooij <jelmer@samba.org>
Mon, 1 Oct 2007 22:13:02 +0000 (22:13 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 20:07:38 +0000 (15:07 -0500)
(This used to be commit 9243b551f30c7aa2763115516a6adcfe5bbddc58)

source4/smbd/pidfile.c
source4/smbd/server.c
source4/smbd/service_stream.c
source4/utils/nmblookup.c
source4/utils/ntlm_auth.c
source4/web_server/http.c
source4/winbind/wb_irpc.c
source4/winbind/wb_server.c
source4/winbind/wb_utils.c

index 9a8b095f151b0b7576e4bb25842d8c17751e1fca..4847ddd7b5253d1329cd1316dfa41efa9d0455f7 100644 (file)
@@ -103,7 +103,7 @@ void pidfile_create(const char *name)
                exit(1);
        }
 
-       if (fcntl_lock(fd,F_SETLK,0,1,F_WRLCK)==False) {
+       if (fcntl_lock(fd,F_SETLK,0,1,F_WRLCK)==false) {
                DEBUG(0,("ERROR: %s : fcntl lock of file %s failed. Error was %s\n",  
               name, pidFile, strerror(errno)));
                exit(1);
index e86ddc910b5eb94707e9ae47e5139f817125525c..dcec02d3b791281050b11c17231584eea87e546a 100644 (file)
@@ -123,25 +123,25 @@ static void sig_term(int sig)
 static void setup_signals(void)
 {
        /* we are never interested in SIGPIPE */
-       BlockSignals(True,SIGPIPE);
+       BlockSignals(true,SIGPIPE);
 
 #if defined(SIGFPE)
        /* we are never interested in SIGFPE */
-       BlockSignals(True,SIGFPE);
+       BlockSignals(true,SIGFPE);
 #endif
 
        /* We are no longer interested in USR1 */
-       BlockSignals(True, SIGUSR1);
+       BlockSignals(true, SIGUSR1);
 
 #if defined(SIGUSR2)
        /* We are no longer interested in USR2 */
-       BlockSignals(True,SIGUSR2);
+       BlockSignals(true,SIGUSR2);
 #endif
 
        /* POSIX demands that signals are inherited. If the invoking process has
         * these signals masked, we will have problems, as we won't recieve them. */
-       BlockSignals(False, SIGHUP);
-       BlockSignals(False, SIGTERM);
+       BlockSignals(false, SIGHUP);
+       BlockSignals(false, SIGTERM);
 
        CatchSignal(SIGHUP, sig_hup);
        CatchSignal(SIGTERM, sig_term);
index 31107df032563e4ef6f4e8aa113fb0fcf1473992..ad72f907bb366752e27cc36bb65d02af1b8bddbf 100644 (file)
@@ -84,13 +84,13 @@ void stream_terminate_connection(struct stream_connection *srv_conn, const char
 */
 static void stream_io_handler(struct stream_connection *conn, uint16_t flags)
 {
-       conn->processing = True;
+       conn->processing = true;
        if (flags & EVENT_FD_WRITE) {
                conn->ops->send_handler(conn, flags);
        } else if (flags & EVENT_FD_READ) {
                conn->ops->recv_handler(conn, flags);
        }
-       conn->processing = False;
+       conn->processing = false;
 
        if (conn->terminate) {
                stream_terminate_connection(conn, conn->terminate);
index affc38e3e7744355ef477e15332da4f2ac5e52ef..ada5b839b7082430a1e649eb1d1a823cb15920bc 100644 (file)
 static struct {
        const char *broadcast_address;
        const char *unicast_address;
-       BOOL find_master;
-       BOOL wins_lookup;
-       BOOL node_status;
-       BOOL root_port;
-       BOOL lookup_by_ip;
-       BOOL case_sensitive;
+       bool find_master;
+       bool wins_lookup;
+       bool node_status;
+       bool root_port;
+       bool lookup_by_ip;
+       bool case_sensitive;
 } options;
 
 /*
@@ -102,7 +102,7 @@ static char *node_status_flags(TALLOC_CTX *mem_ctx, uint16_t flags)
 }
 
 /* do a single node status */
-static BOOL do_node_status(struct nbt_name_socket *nbtsock,
+static bool do_node_status(struct nbt_name_socket *nbtsock,
                           const char *addr)
 {
        struct nbt_name_status io;
@@ -133,10 +133,10 @@ static BOOL do_node_status(struct nbt_name_socket *nbtsock,
                       io.out.status.statistics.unit_id[3],
                       io.out.status.statistics.unit_id[4],
                       io.out.status.statistics.unit_id[5]);
-               return True;
+               return true;
        }
 
-       return False;
+       return false;
 }
 
 /* do a single node query */
@@ -144,7 +144,7 @@ static NTSTATUS do_node_query(struct nbt_name_socket *nbtsock,
                              const char *addr, 
                              const char *node_name, 
                              enum nbt_name_type node_type,
-                             BOOL broadcast)
+                             bool broadcast)
 {
        struct nbt_name_query io;
        NTSTATUS status;
@@ -176,7 +176,7 @@ static NTSTATUS do_node_query(struct nbt_name_socket *nbtsock,
 }
 
 
-static BOOL process_one(const char *name)
+static bool process_one(const char *name)
 {
        TALLOC_CTX *tmp_ctx = talloc_new(NULL);
        enum nbt_name_type node_type = NBT_NAME_CLIENT;
@@ -184,7 +184,7 @@ static BOOL process_one(const char *name)
        struct socket_address *all_zero_addr;
        struct nbt_name_socket *nbtsock;
        NTSTATUS status = NT_STATUS_OK;
-       BOOL ret = True;
+       bool ret = true;
 
        if (!options.case_sensitive) {
                name = strupper_talloc(tmp_ctx, name);
@@ -214,14 +214,14 @@ static BOOL process_one(const char *name)
                
                if (!all_zero_addr) {
                        talloc_free(tmp_ctx);
-                       return False;
+                       return false;
                }
 
                status = socket_listen(nbtsock->sock, all_zero_addr, 0, 0);
                if (!NT_STATUS_IS_OK(status)) {
                        printf("Failed to bind to local port 137 - %s\n", nt_errstr(status));
                        talloc_free(tmp_ctx);
-                       return False;
+                       return false;
                }
        }
 
@@ -232,22 +232,22 @@ static BOOL process_one(const char *name)
        }
 
        if (options.broadcast_address) {
-               status = do_node_query(nbtsock, options.broadcast_address, node_name, node_type, True);
+               status = do_node_query(nbtsock, options.broadcast_address, node_name, node_type, true);
        } else if (options.unicast_address) {
-               status = do_node_query(nbtsock, options.unicast_address, node_name, node_type, False);
+               status = do_node_query(nbtsock, options.unicast_address, node_name, node_type, false);
        } else {
                int i, num_interfaces = iface_count();
                for (i=0;i<num_interfaces;i++) {
                        const char *bcast = iface_n_bcast(i);
                        if (bcast == NULL) continue;
-                       status = do_node_query(nbtsock, bcast, node_name, node_type, True);
+                       status = do_node_query(nbtsock, bcast, node_name, node_type, true);
                        if (NT_STATUS_IS_OK(status)) break;
                }
        }
 
        if (!NT_STATUS_IS_OK(status)) {
                printf("Lookup failed - %s\n", nt_errstr(status));
-               ret = False;
+               ret = false;
        }
 
        talloc_free(tmp_ctx);
@@ -259,7 +259,7 @@ static BOOL process_one(const char *name)
 */
 int main(int argc, const char *argv[])
 {
-       BOOL ret = True;
+       bool ret = true;
        poptContext pc;
        int opt;
        enum {
@@ -316,22 +316,22 @@ int main(int argc, const char *argv[])
                        options.unicast_address = poptGetOptArg(pc);
                        break;
                case OPT_FIND_MASTER:
-                       options.find_master = True;
+                       options.find_master = true;
                        break;
                case OPT_WINS_LOOKUP:
-                       options.wins_lookup = True;
+                       options.wins_lookup = true;
                        break;
                case OPT_NODE_STATUS:
-                       options.node_status = True;
+                       options.node_status = true;
                        break;
                case OPT_ROOT_PORT:
-                       options.root_port = True;
+                       options.root_port = true;
                        break;
                case OPT_LOOKUP_BY_IP:
-                       options.lookup_by_ip = True;
+                       options.lookup_by_ip = true;
                        break;
                case OPT_CASE_SENSITIVE:
-                       options.case_sensitive = True;
+                       options.case_sensitive = true;
                        break;
                }
        }
index 2fa393a9d46a592efd1226f973ede4a81f7f0413..c51b35aa0309aab4272a9ca0945ee1eba282a9cd 100644 (file)
@@ -128,14 +128,14 @@ static bool parse_ntlm_auth_domain_user(const char *domuser, fstring domain,
        char *p = strchr(domuser,*lp_winbind_separator(global_loadparm));
 
        if (!p) {
-               return False;
+               return false;
        }
         
        fstrcpy(user, p+1);
        fstrcpy(domain, domuser);
        domain[PTR_DIFF(p, domuser)] = 0;
 
-       return True;
+       return true;
 }
 
 /**
@@ -168,8 +168,8 @@ static void base64_decode_inplace(char *s)
 
 /* Authenticate a user with a plaintext password */
 
-static BOOL check_plaintext_auth(const char *user, const char *pass, 
-                                BOOL stdout_diagnostics)
+static bool check_plaintext_auth(const char *user, const char *pass, 
+                                bool stdout_diagnostics)
 {
         return (strcmp(pass, opt_password) == 0);
 }
@@ -259,7 +259,7 @@ static void manage_squid_basic_request(enum stdio_helper_mode stdio_helper_mode,
                rfc1738_unescape(pass);
        }
        
-       if (check_plaintext_auth(user, pass, False)) {
+       if (check_plaintext_auth(user, pass, false)) {
                mux_printf(mux_id, "OK\n");
        } else {
                mux_printf(mux_id, "ERR\n");
@@ -345,15 +345,15 @@ static bool in_list(const char *s, const char *list, bool casesensitive)
 
 static void gensec_want_feature_list(struct gensec_security *state, char* feature_list)
 {
-       if (in_list("NTLMSSP_FEATURE_SESSION_KEY", feature_list, True)) {
+       if (in_list("NTLMSSP_FEATURE_SESSION_KEY", feature_list, true)) {
                DEBUG(10, ("want GENSEC_FEATURE_SESSION_KEY\n"));
                gensec_want_feature(state, GENSEC_FEATURE_SESSION_KEY);
        }
-       if (in_list("NTLMSSP_FEATURE_SIGN", feature_list, True)) {
+       if (in_list("NTLMSSP_FEATURE_SIGN", feature_list, true)) {
                DEBUG(10, ("want GENSEC_FEATURE_SIGN\n"));
                gensec_want_feature(state, GENSEC_FEATURE_SIGN);
        }
-       if (in_list("NTLMSSP_FEATURE_SEAL", feature_list, True)) {
+       if (in_list("NTLMSSP_FEATURE_SEAL", feature_list, true)) {
                DEBUG(10, ("want GENSEC_FEATURE_SEAL\n"));
                gensec_want_feature(state, GENSEC_FEATURE_SEAL);
        }
@@ -376,7 +376,7 @@ static void manage_gensec_request(enum stdio_helper_mode stdio_helper_mode,
        struct messaging_context *msg;
 
        NTSTATUS nt_status;
-       BOOL first = False;
+       bool first = false;
        const char *reply_code;
        struct cli_credentials *creds;
 
@@ -461,7 +461,7 @@ static void manage_gensec_request(enum stdio_helper_mode stdio_helper_mode,
                        if (!ev) {
                                exit(1);
                        }
-                       msg = messaging_client_init(state, global_loadparm, ev);
+                       msg = messaging_client_init(state, lp_messaging_path(state, global_loadparm), ev);
                        if (!msg) {
                                exit(1);
                        }
@@ -508,12 +508,12 @@ static void manage_gensec_request(enum stdio_helper_mode stdio_helper_mode,
                case GSS_SPNEGO_SERVER:
                        nt_status = gensec_start_mech_by_oid(state->gensec_state, GENSEC_OID_SPNEGO);
                        if (!in.length) {
-                               first = True;
+                               first = true;
                        }
                        break;
                case NTLMSSP_CLIENT_1:
                        if (!in.length) {
-                               first = True;
+                               first = true;
                        }
                        /* fall through */
                case SQUID_2_5_NTLMSSP:
@@ -701,8 +701,8 @@ static void manage_ntlm_server_1_request(enum stdio_helper_mode stdio_helper_mod
        static char *username;
        static char *domain;
        static char *plaintext_password;
-       static BOOL ntlm_server_1_user_session_key;
-       static BOOL ntlm_server_1_lm_session_key;
+       static bool ntlm_server_1_user_session_key;
+       static bool ntlm_server_1_lm_session_key;
        
        if (strequal(buf, ".")) {
                if (!full_username && !username) {      
@@ -715,7 +715,7 @@ static void manage_ntlm_server_1_request(enum stdio_helper_mode stdio_helper_mod
                                        return;
                                }
                        }
-                       if (check_plaintext_auth(full_username, plaintext_password, False)) {
+                       if (check_plaintext_auth(full_username, plaintext_password, false)) {
                                mux_printf(mux_id, "Authenticated: Yes\n");
                        } else {
                                mux_printf(mux_id, "Authenticated: No\n");
@@ -808,8 +808,8 @@ static void manage_ntlm_server_1_request(enum stdio_helper_mode stdio_helper_mod
                SAFE_FREE(username);
                SAFE_FREE(domain);
                SAFE_FREE(plaintext_password);
-               ntlm_server_1_user_session_key = False;
-               ntlm_server_1_lm_session_key = False;
+               ntlm_server_1_user_session_key = false;
+               ntlm_server_1_lm_session_key = false;
                mux_printf(mux_id, ".\n");
 
                return;
@@ -1122,7 +1122,7 @@ int main(int argc, const char **argv)
                char *user;
 
                asprintf(&user, "%s%c%s", opt_domain, *lp_winbind_separator(global_loadparm), opt_username);
-               if (!check_plaintext_auth(user, opt_password, True)) {
+               if (!check_plaintext_auth(user, opt_password, true)) {
                        return 1;
                }
        }
index a5c546beb91191cc50c28d277826efe3c8ed2541..67329fba7ed0bbb4c8c7adf06120404b464e180b 100644 (file)
@@ -356,7 +356,7 @@ void http_error(struct websrv_context *web, int code, const char *info)
        http_output_headers(web);
        EVENT_FD_NOT_READABLE(web->conn->event.fde);
        EVENT_FD_WRITEABLE(web->conn->event.fde);
-       web->output.output_pending = True;
+       web->output.output_pending = true;
 }
 
 /*
@@ -452,7 +452,7 @@ static void http_setup_arrays(struct esp_state *esp)
        if (web->session) {
                SETVAR(ESP_REQUEST_OBJ, "SESSION_ID", web->session->id);
        }
-       SETVAR(ESP_REQUEST_OBJ, "COOKIE_SUPPORT", web->input.cookie?"True":"False");
+       SETVAR(ESP_REQUEST_OBJ, "COOKIE_SUPPORT", web->input.cookie?"true":"false");
 
        SETVAR(ESP_HEADERS_OBJ, "HTTP_REFERER", web->input.referer);
        SETVAR(ESP_HEADERS_OBJ, "HOST", web->input.host);
@@ -474,7 +474,7 @@ static void http_setup_arrays(struct esp_state *esp)
        SETVAR(ESP_SERVER_OBJ, "SERVER_PROTOCOL", tls_enabled(web->conn->socket)?"https":"http");
        SETVAR(ESP_SERVER_OBJ, "SERVER_SOFTWARE", "SAMBA");
        SETVAR(ESP_SERVER_OBJ, "GATEWAY_INTERFACE", "CGI/1.1");
-       SETVAR(ESP_SERVER_OBJ, "TLS_SUPPORT", tls_support(edata->tls_params)?"True":"False");
+       SETVAR(ESP_SERVER_OBJ, "TLS_SUPPORT", tls_support(edata->tls_params)?"true":"false");
 }
 
 #if HAVE_SETJMP_H
@@ -543,7 +543,7 @@ static void esp_request(struct esp_state *esp, const char *url)
 
   note that the preauth is run even for static pages such as images
 */
-static BOOL http_preauth(struct esp_state *esp)
+static bool http_preauth(struct esp_state *esp)
 {
        const char *path = http_local_path(esp->web,
                                            HTTP_PREAUTH_URI,
@@ -551,11 +551,11 @@ static BOOL http_preauth(struct esp_state *esp)
        int i;
        if (path == NULL) {
                http_error(esp->web, 500, "Internal server error");
-               return False;
+               return false;
        }
        if (!file_exist(path)) {
                /* if the preath script is not installed then allow access */
-               return True;
+               return true;
        }
        esp_request(esp, HTTP_PREAUTH_URI);
        for (i=0;i<esp->web->output.content.length;i++) {
@@ -564,11 +564,11 @@ static BOOL http_preauth(struct esp_state *esp)
                           to be html, so that we can show the login page for
                           failed access to images */
                        http_setHeader(esp->web, "Content-Type: text/html", 0);
-                       return False;
+                       return false;
                }
        }
        data_blob_free(&esp->web->output.content);
-       return True;
+       return true;
 }
 
 
@@ -704,7 +704,7 @@ static void http_setup_session(struct esp_state *esp)
        const char *key = NULL;
        struct esp_data *edata = talloc_get_type(esp->web->task->private, struct esp_data);
        struct session_data *s;
-       BOOL generated_key = False;
+       bool generated_key = false;
 
        /* look for our session key */
        if (cookie && (p = strstr(cookie, session_key)) && 
@@ -717,7 +717,7 @@ static void http_setup_session(struct esp_state *esp)
                key = esp->web->input.session_key;
        } else if (key == NULL) {
                key = generate_random_str_list(esp, 16, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ");
-               generated_key = True;
+               generated_key = true;
        }
 
        /* try to find this session in the existing session list */
@@ -739,7 +739,7 @@ static void http_setup_session(struct esp_state *esp)
                talloc_set_destructor(s, session_destructor);
                if (!generated_key) {
                        mprSetPropertyValue(&esp->variables[ESP_REQUEST_OBJ], 
-                                           "SESSION_EXPIRED", mprCreateStringVar("True", 0));
+                                           "SESSION_EXPIRED", mprCreateStringVar("true", 0));
                }
        }
 
@@ -798,7 +798,7 @@ void http_process_input(struct websrv_context *web)
                {"txt",  "text/plain"},
                {"ico",  "image/x-icon"},
                {"css",  "text/css"},
-               {"esp",  "text/html", True}
+               {"esp",  "text/html", true}
        };
 
        /*
@@ -924,7 +924,7 @@ void http_process_input(struct websrv_context *web)
        if (!web->output.output_pending) {
                http_output_headers(web);
                EVENT_FD_WRITEABLE(web->conn->event.fde);
-               web->output.output_pending = True;
+               web->output.output_pending = true;
        }
 
        /* copy any application data to long term storage in edata */
@@ -978,11 +978,11 @@ internal_error:
 NTSTATUS http_parse_header(struct websrv_context *web, const char *line)
 {
        if (line[0] == 0) {
-               web->input.end_of_headers = True;
+               web->input.end_of_headers = true;
        } else if (strncasecmp(line,"GET ", 4)==0) {
                web->input.url = talloc_strndup(web, &line[4], strcspn(&line[4], " \t"));
        } else if (strncasecmp(line,"POST ", 5)==0) {
-               web->input.post_request = True;
+               web->input.post_request = true;
                web->input.url = talloc_strndup(web, &line[5], strcspn(&line[5], " \t"));
        } else if (strchr(line, ':') == NULL) {
                http_error(web, 400, "This server only accepts GET and POST requests");
index 59399a9aef5ef5916480e2e5b500e62e72de4e46..5d7f7fd7a652b4ed10301bbc69485482d5108a62 100644 (file)
@@ -54,7 +54,7 @@ static NTSTATUS wb_irpc_SamLogon(struct irpc_message *msg,
        ctx->async.fn = wb_irpc_SamLogon_callback;
        ctx->async.private_data = s;
 
-       msg->defer_reply = True;
+       msg->defer_reply = true;
        return NT_STATUS_OK;
 }
 
index 3e27f31429130ff3054738ba1af3a0934d56a51e..6d002902d3046f30cec951db49b31858af1fa259 100644 (file)
@@ -155,7 +155,7 @@ static void winbind_task_init(struct task_server *task)
                                                          WINBINDD_SAMBA3_SOCKET);
        if (!listen_socket->socket_path) goto nomem;
        listen_socket->service          = service;
-       listen_socket->privileged       = False;
+       listen_socket->privileged       = false;
        status = stream_setup_socket(task->event_ctx, model_ops,
                                     &wbsrv_ops, "unix",
                                     listen_socket->socket_path, &port,
@@ -170,7 +170,7 @@ static void winbind_task_init(struct task_server *task)
                              WINBINDD_SAMBA3_PRIVILEGED_SOCKET);
        if (!listen_socket->socket_path) goto nomem;
        listen_socket->service          = service;
-       listen_socket->privileged       = True;
+       listen_socket->privileged       = true;
        status = stream_setup_socket(task->event_ctx, model_ops,
                                     &wbsrv_ops, "unix",
                                     listen_socket->socket_path, &port,
index 5fb14c1b4c91064dfa295ece9bd30d5ac0749725..dfd09a98feb6f325d3424d3c93db36c6884c1fc2 100644 (file)
@@ -27,7 +27,7 @@
  * as one string.
  * TODO: We probably will need to handle other formats later. */
 
-BOOL wb_samba3_split_username(TALLOC_CTX *mem_ctx, const char *domuser,
+bool wb_samba3_split_username(TALLOC_CTX *mem_ctx, const char *domuser,
                                 char **domain, char **user)
 {
        char *p = strchr(domuser, *lp_winbind_separator(global_loadparm));