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 used to be commit
5b19ede88ed80318e392f8017f4573fbb2ecbe0f)
* @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 */
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;
}
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"));
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);
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;
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):
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);
}
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);
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);
}
*/
#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
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)
*/
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));
/********************************************************************
********************************************************************/
+#if 0 /* unused static function */
+
static BOOL init_svcctl_db( void )
{
static pid_t local_pid;
return True;
}
+#endif
+
/********************************************************************
TODO
(a) get and set security descriptors on services
/* 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)
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;
}
/* 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);
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;
}
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;
return False;
}
- notify_printer_byname(argv[2], attribute, argv[4]);
+ notify_printer_byname(argv[2], attribute, (char *) argv[4]);
goto send;
}