From 934d41d23956c663406ff9d68e5a8ba9d81b5096 Mon Sep 17 00:00:00 2001 From: Derrell Lipman Date: Wed, 30 Mar 2005 04:40:24 +0000 Subject: r6127: Eliminated all compiler warnings pertaining to mismatched "qualifiers". The whole of samba comiles warning-free with the default compiler flags. Temporarily defined -Wall to locate other potential problems. Found an unused static function (#ifdefed out rather than deleted, in case it's needed for something in progress). There are also a number of uses of undeclared functions, mostly krb5_*. Files with these problems need to have appropriate header files included, but they are not fixed in this update. oplock_linux.c.c has undefined functions capget() and capset(), which need to have "#undef _POSIX_SOURCE" specified before including , but that could potentially have other side effects, so that remains uncorrected as well. The flag -Wall should be added permanently to CFLAGS, and all warnings then generated should be eliminated. (This used to be commit 5b19ede88ed80318e392f8017f4573fbb2ecbe0f) --- source3/include/smb_macros.h | 2 +- source3/lib/smbldap.c | 4 ++-- source3/libads/kerberos.c | 3 ++- source3/libsmb/spnego.c | 12 ++++++------ source3/nsswitch/winbindd_acct.c | 2 +- source3/nsswitch/winbindd_nss.h | 2 +- source3/nsswitch/winbindd_rpc.c | 3 ++- source3/nsswitch/winbindd_util.c | 2 +- source3/rpc_server/srv_svcctl_nt.c | 4 ++++ source3/tdb/tdb.c | 2 +- source3/tdb/tdbutil.c | 4 ++-- source3/utils/net_ads.c | 2 +- source3/utils/net_lookup.c | 2 +- source3/utils/smbcontrol.c | 2 +- 14 files changed, 26 insertions(+), 20 deletions(-) diff --git a/source3/include/smb_macros.h b/source3/include/smb_macros.h index 68a80ec402..9a78718605 100644 --- a/source3/include/smb_macros.h +++ b/source3/include/smb_macros.h @@ -43,7 +43,7 @@ * @note You are explicitly allowed to pass NULL pointers -- they will * always be ignored. **/ -#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0) +#define SAFE_FREE(x) do { if ((x) != NULL) {free((void *) (x)); x=NULL;} } while(0) #endif /* zero a structure */ diff --git a/source3/lib/smbldap.c b/source3/lib/smbldap.c index 68084b0404..78ec249717 100644 --- a/source3/lib/smbldap.c +++ b/source3/lib/smbldap.c @@ -1066,7 +1066,7 @@ int smbldap_search(struct smbldap_state *ldap_state, while (another_ldap_try(ldap_state, &rc, &attempts, endtime)) rc = ldap_search_s(ldap_state->ldap_struct, base, scope, - utf8_filter, attrs, attrsonly, res); + utf8_filter, (char **) attrs, attrsonly, res); SAFE_FREE(utf8_filter); return rc; @@ -1471,7 +1471,7 @@ static BOOL smbldap_check_root_dse(struct smbldap_state *ldap_state, const char } rc = ldap_search_s(ldap_state->ldap_struct, "", LDAP_SCOPE_BASE, - "(objectclass=*)", attrs, 0 , &msg); + "(objectclass=*)", (char **) attrs, 0 , &msg); if (rc != LDAP_SUCCESS) { DEBUG(3,("smbldap_check_root_dse: Could not search rootDSE\n")); diff --git a/source3/libads/kerberos.c b/source3/libads/kerberos.c index 4c9997e080..43ccb18b5a 100644 --- a/source3/libads/kerberos.c +++ b/source3/libads/kerberos.c @@ -88,7 +88,8 @@ int kerberos_kinit_password(const char *principal, return code; } - if ((code = krb5_get_init_creds_password(ctx, &my_creds, me, password, + if ((code = krb5_get_init_creds_password(ctx, &my_creds, me, + (char *) password, kerb_prompter, NULL, 0, NULL, NULL))) { krb5_free_principal(ctx, me); diff --git a/source3/libsmb/spnego.c b/source3/libsmb/spnego.c index a0f5565d4f..090148d415 100644 --- a/source3/libsmb/spnego.c +++ b/source3/libsmb/spnego.c @@ -42,12 +42,12 @@ static BOOL read_negTokenInit(ASN1_DATA *asn1, negTokenInit_t *token) asn1_start_tag(asn1, ASN1_CONTEXT(0)); asn1_start_tag(asn1, ASN1_SEQUENCE(0)); - token->mechTypes = SMB_MALLOC_P(char *); + token->mechTypes = SMB_MALLOC_P(const char *); for (i = 0; !asn1->has_error && 0 < asn1_tag_remaining(asn1); i++) { token->mechTypes = - SMB_REALLOC_ARRAY(token->mechTypes, char *, i + 2); - asn1_read_OID(asn1, token->mechTypes + i); + SMB_REALLOC_ARRAY(token->mechTypes, const char *, i + 2); + asn1_read_OID(asn1, (char **) (token->mechTypes + i)); } token->mechTypes[i] = NULL; @@ -182,7 +182,7 @@ static BOOL read_negTokenTarg(ASN1_DATA *asn1, negTokenTarg_t *token) break; case ASN1_CONTEXT(1): asn1_start_tag(asn1, ASN1_CONTEXT(1)); - asn1_read_OID(asn1, &token->supportedMech); + asn1_read_OID(asn1, (char **) &token->supportedMech); asn1_end_tag(asn1); break; case ASN1_CONTEXT(2): @@ -317,7 +317,7 @@ BOOL free_spnego_data(SPNEGO_DATA *spnego) if (spnego->negTokenInit.mechTypes) { int i; for (i = 0; spnego->negTokenInit.mechTypes[i]; i++) { - free(spnego->negTokenInit.mechTypes[i]); + free((void *) spnego->negTokenInit.mechTypes[i]); } free(spnego->negTokenInit.mechTypes); } @@ -326,7 +326,7 @@ BOOL free_spnego_data(SPNEGO_DATA *spnego) break; case SPNEGO_NEG_TOKEN_TARG: if (spnego->negTokenTarg.supportedMech) { - free(spnego->negTokenTarg.supportedMech); + free((void *) spnego->negTokenTarg.supportedMech); } data_blob_free(&spnego->negTokenTarg.responseToken); data_blob_free(&spnego->negTokenTarg.mechListMIC); diff --git a/source3/nsswitch/winbindd_acct.c b/source3/nsswitch/winbindd_acct.c index 2c8b7cae28..cd0b5b7e06 100644 --- a/source3/nsswitch/winbindd_acct.c +++ b/source3/nsswitch/winbindd_acct.c @@ -222,7 +222,7 @@ static WINBINDD_GR* string2group( char *string ) gr_members = SMB_XMALLOC_ARRAY(char*, num_gr_members+1); i = 0; - while ( next_token(&str, buffer, ",", sizeof(buffer)) && iheader.hash_size) diff --git a/source3/tdb/tdbutil.c b/source3/tdb/tdbutil.c index 682f8cc68e..29fbd25904 100644 --- a/source3/tdb/tdbutil.c +++ b/source3/tdb/tdbutil.c @@ -43,7 +43,7 @@ static void gotalarm_sig(void) TDB_DATA make_tdb_data(const char *dptr, size_t dsize) { TDB_DATA ret; - ret.dptr = dptr; + ret.dptr = (char *) dptr; ret.dsize = dsize; return ret; } @@ -62,7 +62,7 @@ static int tdb_chainlock_with_timeout_internal( TDB_CONTEXT *tdb, TDB_DATA key, /* Allow tdb_chainlock to be interrupted by an alarm. */ int ret; gotalarm = 0; - tdb_set_lock_alarm(&gotalarm); + tdb_set_lock_alarm((sig_atomic_t *) &gotalarm); if (timeout) { CatchSignal(SIGALRM, SIGNAL_CAST gotalarm_sig); diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c index 9c00f05bfb..83fdb08a9a 100644 --- a/source3/utils/net_ads.c +++ b/source3/utils/net_ads.c @@ -81,7 +81,7 @@ static int net_ads_lookup(int argc, const char **argv) d_printf("Didn't find the cldap server!\n"); return -1; } if (!ads->config.realm) { - ads->config.realm = opt_target_workgroup; + ads->config.realm = (char *) opt_target_workgroup; ads->ldap_port = 389; } diff --git a/source3/utils/net_lookup.c b/source3/utils/net_lookup.c index 7e5f12da45..7f7a88c66d 100644 --- a/source3/utils/net_lookup.c +++ b/source3/utils/net_lookup.c @@ -209,7 +209,7 @@ static int net_lookup_kdc(int argc, const char **argv) realm.length = strlen(realm.data); } - rc = krb5_locate_kdc(ctx, &realm, &addrs, &num_kdcs, 0); + rc = krb5_locate_kdc(ctx, &realm, (struct sockaddr **) &addrs, &num_kdcs, 0); if (rc) { DEBUG(1, ("krb5_locate_kdc failed (%s)\n", error_message(rc))); return -1; diff --git a/source3/utils/smbcontrol.c b/source3/utils/smbcontrol.c index 2eb661c8b6..154bc5b1ae 100644 --- a/source3/utils/smbcontrol.c +++ b/source3/utils/smbcontrol.c @@ -428,7 +428,7 @@ static BOOL do_printnotify(const pid_t pid, const int argc, const char **argv) return False; } - notify_printer_byname(argv[2], attribute, argv[4]); + notify_printer_byname(argv[2], attribute, (char *) argv[4]); goto send; } -- cgit