RIP BOOL. Convert BOOL -> bool. I found a few interesting
[jerry/samba.git] / source / libads / kerberos.c
index c721b5638500ad45e03bdae9215cb5fd045a4582..281ca2fd6836fdd513eb478b6f04bf004ab4b566 100644 (file)
@@ -9,7 +9,7 @@
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
@@ -18,8 +18,7 @@
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #include "includes.h"
@@ -55,11 +54,11 @@ kerb_prompter(krb5_context ctx, void *data,
        return 0;
 }
 
-static BOOL smb_krb5_err_io_nstatus(TALLOC_CTX *mem_ctx, 
+static bool smb_krb5_err_io_nstatus(TALLOC_CTX *mem_ctx, 
                                    DATA_BLOB *edata_blob, 
                                    KRB5_EDATA_NTSTATUS *edata)
 {
-       BOOL ret = False;
+       bool ret = False;
        prs_struct ps;
 
        if (!mem_ctx || !edata_blob || !edata) 
@@ -89,7 +88,7 @@ static BOOL smb_krb5_err_io_nstatus(TALLOC_CTX *mem_ctx,
        return ret;
 }
 
- static BOOL smb_krb5_get_ntstatus_from_krb5_error(krb5_error *error,
+ static bool smb_krb5_get_ntstatus_from_krb5_error(krb5_error *error,
                                                   NTSTATUS *nt_status)
 {
        DATA_BLOB edata;
@@ -138,11 +137,11 @@ static BOOL smb_krb5_err_io_nstatus(TALLOC_CTX *mem_ctx,
        return True;
 }
 
- static BOOL smb_krb5_get_ntstatus_from_krb5_error_init_creds_opt(krb5_context ctx, 
+ static bool smb_krb5_get_ntstatus_from_krb5_error_init_creds_opt(krb5_context ctx, 
                                                                  krb5_get_init_creds_opt *opt, 
                                                                  NTSTATUS *nt_status)
 {
-       BOOL ret = False;
+       bool ret = False;
        krb5_error *error = NULL;
 
 #ifdef HAVE_KRB5_GET_INIT_CREDS_OPT_GET_ERROR
@@ -187,8 +186,8 @@ int kerberos_kinit_password_ext(const char *principal,
                                time_t *expire_time,
                                time_t *renew_till_time,
                                const char *cache_name,
-                               BOOL request_pac,
-                               BOOL add_netbios_addr,
+                               bool request_pac,
+                               bool add_netbios_addr,
                                time_t renewable_time,
                                NTSTATUS *ntstatus)
 {
@@ -248,7 +247,8 @@ int kerberos_kinit_password_ext(const char *principal,
        }
 
        if ((code = krb5_get_init_creds_password(ctx, &my_creds, me, CONST_DISCARD(char *,password), 
-                                                kerb_prompter, NULL, 0, NULL, opt))) {
+                                                kerb_prompter, CONST_DISCARD(char *,password),
+                                                0, NULL, opt))) {
                goto out;
        }
 
@@ -443,10 +443,10 @@ static char* des_salt_key( void )
 /************************************************************************
 ************************************************************************/
 
-BOOL kerberos_secrets_store_des_salt( const char* salt )
+bool kerberos_secrets_store_des_salt( const char* salt )
 {
        char* key;
-       BOOL ret;
+       bool ret;
 
        if ( (key = des_salt_key()) == NULL ) {
                DEBUG(0,("kerberos_secrets_store_des_salt: failed to generate key!\n"));
@@ -535,12 +535,12 @@ krb5_principal kerberos_fetch_salt_princ_for_host_princ(krb5_context context,
  Setting principal to NULL deletes this entry.
  ************************************************************************/
 
-BOOL kerberos_secrets_store_salting_principal(const char *service,
+bool kerberos_secrets_store_salting_principal(const char *service,
                                              int enctype,
                                              const char *principal)
 {
        char *key = NULL;
-       BOOL ret = False;
+       bool ret = False;
        krb5_context context = NULL;
        krb5_principal princ = NULL;
        char *princ_s = NULL;
@@ -616,9 +616,11 @@ int kerberos_kinit_password(const char *principal,
 
 static char *get_kdc_ip_string(char *mem_ctx, const char *realm, const char *sitename, struct in_addr primary_ip)
 {
-       struct ip_service *ip_srv_site;
+       int i;
+       struct ip_service *ip_srv_site = NULL;
        struct ip_service *ip_srv_nonsite;
-       int count_site, count_nonsite, i;
+       int count_site = 0;
+       int count_nonsite;
        char *kdc_str = talloc_asprintf(mem_ctx, "\tkdc = %s\n",
                                        inet_ntoa(primary_ip));
 
@@ -698,7 +700,7 @@ static char *get_kdc_ip_string(char *mem_ctx, const char *realm, const char *sit
  run as root or will fail (which is a good thing :-).
 ************************************************************************/
 
-BOOL create_local_private_krb5_conf_for_domain(const char *realm, const char *domain,
+bool create_local_private_krb5_conf_for_domain(const char *realm, const char *domain,
                                        const char *sitename, struct in_addr ip)
 {
        char *dname = talloc_asprintf(NULL, "%s/smb_krb5", lp_lockdir());