summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorDerrell Lipman <derrell@samba.org>2005-03-31 05:06:04 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:56:24 -0500
commit9840db418bad5a39edc4a32a1786f5e2d2c9dff8 (patch)
tree4116543c742e1563ae869e1053583dbabf4195b5 /source3/lib
parentb76112f2116c3c08c7656387a4a49ea64915f470 (diff)
downloadsamba-9840db418bad5a39edc4a32a1786f5e2d2c9dff8.tar.gz
samba-9840db418bad5a39edc4a32a1786f5e2d2c9dff8.tar.bz2
samba-9840db418bad5a39edc4a32a1786f5e2d2c9dff8.zip
r6149: Fixes bugs #2498 and 2484.
1. using smbc_getxattr() et al, one may now request all access control entities in the ACL without getting all other NT attributes. 2. added the ability to exclude specified attributes from the result set provided by smbc_getxattr() et al, when requesting all attributes, all NT attributes, or all DOS attributes. 3. eliminated all compiler warnings, including when --enable-developer compiler flags are in use. removed -Wcast-qual flag from list, as that is specifically to force warnings in the case of casting away qualifiers. Note: In the process of eliminating compiler warnings, a few nasties were discovered. In the file libads/sasl.c, PRIVATE kerberos interfaces are being used; and in libsmb/clikrb5.c, both PRIAVE and DEPRECATED kerberos interfaces are being used. Someone who knows kerberos should look at these and determine if there is an alternate method of accomplishing the task. (This used to be commit 994694f7f26da5099f071e1381271a70407f33bb)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/access.c2
-rw-r--r--source3/lib/iconv.c2
-rw-r--r--source3/lib/smbldap.c7
-rw-r--r--source3/lib/util_str.c22
-rw-r--r--source3/lib/util_unistr.c14
-rw-r--r--source3/lib/util_uuid.c2
6 files changed, 26 insertions, 23 deletions
diff --git a/source3/lib/access.c b/source3/lib/access.c
index fcc795d1f2..d8e40c99f7 100644
--- a/source3/lib/access.c
+++ b/source3/lib/access.c
@@ -133,7 +133,7 @@ static BOOL string_match(const char *tok,const char *s, char *invalid_char)
/* client_match - match host name and address against token */
static BOOL client_match(const char *tok, const char *item)
{
- const char **client = (const char **)item;
+ const char **client = CONST_ADD(const char **, item);
BOOL match;
char invalid_char = '\0';
diff --git a/source3/lib/iconv.c b/source3/lib/iconv.c
index d58165fed0..f23e4351c0 100644
--- a/source3/lib/iconv.c
+++ b/source3/lib/iconv.c
@@ -135,7 +135,7 @@ static size_t sys_iconv(void *cd,
{
#ifdef HAVE_NATIVE_ICONV
size_t ret = iconv((iconv_t)cd,
- (char **)inbuf, inbytesleft,
+ CONST_DISCARD(char **, inbuf), inbytesleft,
outbuf, outbytesleft);
if (ret == (size_t)-1) {
int saved_errno = errno;
diff --git a/source3/lib/smbldap.c b/source3/lib/smbldap.c
index 78ec249717..cf2f03e0a2 100644
--- a/source3/lib/smbldap.c
+++ b/source3/lib/smbldap.c
@@ -1066,7 +1066,9 @@ 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, (char **) attrs, attrsonly, res);
+ utf8_filter,
+ CONST_DISCARD(char **, attrs),
+ attrsonly, res);
SAFE_FREE(utf8_filter);
return rc;
@@ -1471,7 +1473,8 @@ 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=*)", (char **) attrs, 0 , &msg);
+ "(objectclass=*)", CONST_DISCARD(char **, attrs),
+ 0 , &msg);
if (rc != LDAP_SUCCESS) {
DEBUG(3,("smbldap_check_root_dse: Could not search rootDSE\n"));
diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c
index b13ec1f0da..12ee3dc162 100644
--- a/source3/lib/util_str.c
+++ b/source3/lib/util_str.c
@@ -45,7 +45,7 @@ BOOL next_token(const char **ptr,char *buff, const char *sep, size_t bufsize)
if (!ptr)
return(False);
- s = (char *)*ptr;
+ s = CONST_DISCARD(char *, *ptr);
/* default to simple separators */
if (!sep)
@@ -109,7 +109,7 @@ void set_first_token(char *ptr)
char **toktocliplist(int *ctok, const char *sep)
{
- char *s=(char *)last_ptr;
+ char *s = CONST_DISCARD(char *, last_ptr);
int ictok=0;
char **ret, **iret;
@@ -132,7 +132,7 @@ char **toktocliplist(int *ctok, const char *sep)
} while(*s);
*ctok=ictok;
- s=(char *)last_ptr;
+ s = CONST_DISCARD(char *, last_ptr);
if (!(ret=iret=SMB_MALLOC_ARRAY(char *,ictok+1)))
return NULL;
@@ -1221,7 +1221,7 @@ char *strchr_m(const char *src, char c)
for (s = src; *s && !(((unsigned char)s[0]) & 0x80); s++) {
if (*s == c)
- return (char *)s;
+ return CONST_DISCARD(char *, s);
}
if (!*s)
@@ -1238,7 +1238,7 @@ char *strchr_m(const char *src, char c)
return NULL;
*p = 0;
pull_ucs2_pstring(s2, ws);
- return (char *)(s+strlen(s2));
+ return CONST_DISCARD(char *, (s+strlen(s2)));
}
char *strrchr_m(const char *s, char c)
@@ -1275,7 +1275,7 @@ char *strrchr_m(const char *s, char c)
break;
}
/* No - we have a match ! */
- return (char *)cp;
+ return CONST_DISCARD(char *, cp);
}
} while (cp-- != s);
if (!got_mb)
@@ -1294,7 +1294,7 @@ char *strrchr_m(const char *s, char c)
return NULL;
*p = 0;
pull_ucs2_pstring(s2, ws);
- return (char *)(s+strlen(s2));
+ return CONST_DISCARD(char *, (s+strlen(s2)));
}
}
@@ -1315,7 +1315,7 @@ char *strnrchr_m(const char *s, char c, unsigned int n)
return NULL;
*p = 0;
pull_ucs2_pstring(s2, ws);
- return (char *)(s+strlen(s2));
+ return CONST_DISCARD(char *, (s+strlen(s2)));
}
/***********************************************************************
@@ -1334,7 +1334,7 @@ char *strstr_m(const char *src, const char *findstr)
/* for correctness */
if (!findstr[0]) {
- return (char*)src;
+ return CONST_DISCARD(char *, src);
}
/* Samba does single character findstr calls a *lot*. */
@@ -1351,7 +1351,7 @@ char *strstr_m(const char *src, const char *findstr)
findstr_len = strlen(findstr);
if (strncmp(s, findstr, findstr_len) == 0) {
- return (char *)s;
+ return CONST_DISCARD(char *, s);
}
}
}
@@ -1392,7 +1392,7 @@ char *strstr_m(const char *src, const char *findstr)
DEBUG(0,("strstr_m: dest malloc fail\n"));
return NULL;
}
- retp = (char *)(s+strlen(s2));
+ retp = CONST_DISCARD(char *, (s+strlen(s2)));
SAFE_FREE(src_w);
SAFE_FREE(find_w);
SAFE_FREE(s2);
diff --git a/source3/lib/util_unistr.c b/source3/lib/util_unistr.c
index 04985c6ab6..0b4552e1f5 100644
--- a/source3/lib/util_unistr.c
+++ b/source3/lib/util_unistr.c
@@ -398,10 +398,10 @@ size_t strnlen_w(const smb_ucs2_t *src, size_t max)
smb_ucs2_t *strchr_w(const smb_ucs2_t *s, smb_ucs2_t c)
{
while (*s != 0) {
- if (c == *s) return (smb_ucs2_t *)s;
+ if (c == *s) return CONST_DISCARD(smb_ucs2_t *, s);
s++;
}
- if (c == *s) return (smb_ucs2_t *)s;
+ if (c == *s) return CONST_DISCARD(smb_ucs2_t *, s);
return NULL;
}
@@ -422,7 +422,7 @@ smb_ucs2_t *strrchr_w(const smb_ucs2_t *s, smb_ucs2_t c)
if (len == 0) return NULL;
p += (len - 1);
do {
- if (c == *p) return (smb_ucs2_t *)p;
+ if (c == *p) return CONST_DISCARD(smb_ucs2_t *, p);
} while (p-- != s);
return NULL;
}
@@ -443,7 +443,7 @@ smb_ucs2_t *strnrchr_w(const smb_ucs2_t *s, smb_ucs2_t c, unsigned int n)
n--;
if (!n)
- return (smb_ucs2_t *)p;
+ return CONST_DISCARD(smb_ucs2_t *, p);
} while (p-- != s);
return NULL;
}
@@ -461,7 +461,7 @@ smb_ucs2_t *strstr_w(const smb_ucs2_t *s, const smb_ucs2_t *ins)
return NULL;
inslen = strlen_w(ins);
- r = (smb_ucs2_t *)s;
+ r = CONST_DISCARD(smb_ucs2_t *, s);
while ((r = strchr_w(r, *ins))) {
if (strncmp_w(r, ins, inslen) == 0)
@@ -732,7 +732,7 @@ smb_ucs2_t *strpbrk_wa(const smb_ucs2_t *s, const char *p)
int i;
for (i=0; p[i] && *s != UCS2_CHAR(p[i]); i++)
;
- if (p[i]) return (smb_ucs2_t *)s;
+ if (p[i]) return CONST_DISCARD(smb_ucs2_t *, s);
s++;
}
return NULL;
@@ -747,7 +747,7 @@ smb_ucs2_t *strstr_wa(const smb_ucs2_t *s, const char *ins)
return NULL;
inslen = strlen(ins);
- r = (smb_ucs2_t *)s;
+ r = CONST_DISCARD(smb_ucs2_t *, s);
while ((r = strchr_w(r, UCS2_CHAR(*ins)))) {
if (strncmp_wa(r, ins, inslen) == 0)
diff --git a/source3/lib/util_uuid.c b/source3/lib/util_uuid.c
index df70740b33..8b8e70a36e 100644
--- a/source3/lib/util_uuid.c
+++ b/source3/lib/util_uuid.c
@@ -94,7 +94,7 @@ BOOL smb_string_to_uuid(const char *in, struct uuid* uu)
{
BOOL ret = False;
const char *ptr = in;
- char *end = (char *)in;
+ char *end = CONST_DISCARD(char *, in);
int i;
unsigned v1, v2;