1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-05 21:57:51 +03:00

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 <sys/capability.h>,
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 commit is contained in:
Derrell Lipman 2005-03-30 04:40:24 +00:00 committed by Gerald (Jerry) Carter
parent e1df648ea1
commit 5b19ede88e
14 changed files with 26 additions and 20 deletions

View File

@ -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 */

View File

@ -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"));

View File

@ -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);

View File

@ -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);

View File

@ -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)) && i<num_gr_members ) {
while ( next_token((const char **) &str, buffer, ",", sizeof(buffer)) && i<num_gr_members ) {
gr_members[i++] = smb_xstrdup(buffer);
}

View File

@ -11,7 +11,7 @@
*/
#ifndef SAFE_FREE
#define SAFE_FREE(x) do { if(x) {free(x); x=NULL;} } while(0)
#define SAFE_FREE(x) do { if(x) {free((void *) (x)); x=NULL;} } while(0)
#endif
#ifndef _WINBINDD_NTDOM_H

View File

@ -788,7 +788,8 @@ static int get_ldap_seq(const char *server, int port, uint32 *seq)
to.tv_sec = 10;
to.tv_usec = 0;
if (ldap_search_st(ldp, "", LDAP_SCOPE_BASE, "(objectclass=*)", &attrs[0], 0, &to, &res))
if (ldap_search_st(ldp, "", LDAP_SCOPE_BASE, "(objectclass=*)",
(char **) &attrs[0], 0, &to, &res))
goto done;
if (ldap_count_entries(ldp, res) != 1)

View File

@ -636,7 +636,7 @@ BOOL parse_domain_user(const char *domuser, fstring domain, fstring user)
*/
void fill_domain_username(fstring name, const char *domain, const char *user)
{
strlower_m( user );
strlower_m( (char *) user );
if (assume_domain(domain)) {
strlcpy(name, user, sizeof(fstring));

View File

@ -34,6 +34,8 @@ static TDB_CONTEXT *svcctl_tdb; /* used for share security descriptors */
/********************************************************************
********************************************************************/
#if 0 /* unused static function */
static BOOL init_svcctl_db( void )
{
static pid_t local_pid;
@ -69,6 +71,8 @@ static BOOL init_svcctl_db( void )
return True;
}
#endif
/********************************************************************
TODO
(a) get and set security descriptors on services

View File

@ -128,7 +128,7 @@
/* free memory if the pointer is valid and zero the pointer */
#ifndef SAFE_FREE
#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
#define BUCKET(hash) ((hash) % tdb->header.hash_size)

View File

@ -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);

View File

@ -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;
}

View File

@ -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;

View File

@ -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;
}