summaryrefslogtreecommitdiffstats
path: root/ldap
diff options
context:
space:
mode:
authorRich Megginson <rmeggins@redhat.com>2009-05-19 13:17:11 -0600
committerRich Megginson <rmeggins@redhat.com>2009-05-19 14:05:25 -0600
commitf9db3ac14855eb07e49f2f5797cbb7d338bb614b (patch)
tree4bc8d8283ba975ed2decaa664615548081866679 /ldap
parent47a59378cbf4b48eef492530ebc1c8ea6059a757 (diff)
downloadds-f9db3ac14855eb07e49f2f5797cbb7d338bb614b.tar.gz
ds-f9db3ac14855eb07e49f2f5797cbb7d338bb614b.tar.xz
ds-f9db3ac14855eb07e49f2f5797cbb7d338bb614b.zip
Fix various compiler warnings
1) Make sure we use "const" consistently 2) Make sure we use "unsigned char" consistently for some reason (unsigned char)*p did not compare to '\xHH' literals unless the literal was also cast to (unsigned char) 3) added some missing function prototypes 4) removed some unused variables/functions, or commented out for use when debugging 5) various other compiler warnings With all of these, the code compiles cleanly on RHEL5 x86_64 using gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-44) and CFLAGS="-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic" The only warning now is the spurious message about %llu or %lld having the wrong format argument. Reviewed by: nhosoi (Thanks!)
Diffstat (limited to 'ldap')
-rw-r--r--ldap/servers/plugins/acl/acllas.c2
-rw-r--r--ldap/servers/plugins/syntaxes/cis.c4
-rw-r--r--ldap/servers/plugins/syntaxes/dn.c18
-rw-r--r--ldap/servers/plugins/syntaxes/phonetic.c6
-rw-r--r--ldap/servers/plugins/syntaxes/syntax.h18
-rw-r--r--ldap/servers/plugins/syntaxes/validate.c36
-rw-r--r--ldap/servers/plugins/syntaxes/validate_task.c2
-rw-r--r--ldap/servers/slapd/libglobs.c6
-rw-r--r--ldap/servers/slapd/modify.c2
-rw-r--r--ldap/servers/slapd/opshared.c10
-rw-r--r--ldap/servers/slapd/pagedresults.c2
-rw-r--r--ldap/servers/slapd/pblock.c2
-rw-r--r--ldap/servers/slapd/plugin_syntax.c2
-rw-r--r--ldap/servers/slapd/proto-slap.h3
-rw-r--r--ldap/servers/slapd/snmp_collator.c5
-rw-r--r--ldap/servers/slapd/tools/mmldif.c1
-rw-r--r--ldap/servers/slapd/util.c29
17 files changed, 54 insertions, 94 deletions
diff --git a/ldap/servers/plugins/acl/acllas.c b/ldap/servers/plugins/acl/acllas.c
index e79562a9..baa756db 100644
--- a/ldap/servers/plugins/acl/acllas.c
+++ b/ldap/servers/plugins/acl/acllas.c
@@ -1130,7 +1130,7 @@ struct userdnattr_info {
char *attr;
int result;
char *clientdn;
- Acl_PBlock *aclpb
+ Acl_PBlock *aclpb;
};
#define ACLLAS_MAX_LEVELS 10
int
diff --git a/ldap/servers/plugins/syntaxes/cis.c b/ldap/servers/plugins/syntaxes/cis.c
index f20ae5eb..4f1d9d71 100644
--- a/ldap/servers/plugins/syntaxes/cis.c
+++ b/ldap/servers/plugins/syntaxes/cis.c
@@ -730,7 +730,7 @@ static int postal_validate(
if (*p == '\\') {
p++;
/* ensure that we're not at the end of the value */
- if ((p > end) || (strncmp(p, "24", 2) != 0) && (strncasecmp(p, "5C", 2) != 0)) {
+ if ((p > end) || ((strncmp(p, "24", 2) != 0) && (strncasecmp(p, "5C", 2) != 0))) {
rc = 1;
goto exit;
} else {
@@ -776,7 +776,7 @@ static int oid_validate(
{
int rc = 0; /* assume the value is valid */
const char *p = NULL;
- char *end = NULL;
+ const char *end = NULL;
/* Per RFC4512:
*
diff --git a/ldap/servers/plugins/syntaxes/dn.c b/ldap/servers/plugins/syntaxes/dn.c
index 80a3f8bf..ab6b254d 100644
--- a/ldap/servers/plugins/syntaxes/dn.c
+++ b/ldap/servers/plugins/syntaxes/dn.c
@@ -58,7 +58,7 @@ static int dn_assertion2keys_ava( Slapi_PBlock *pb, Slapi_Value *val,
static int dn_assertion2keys_sub( Slapi_PBlock *pb, char *initial, char **any,
char *final, Slapi_Value ***ivals );
static int dn_validate( struct berval *val );
-static int rdn_validate( char *begin, char *end, char **last );
+static int rdn_validate( const char *begin, const char *end, const char **last );
/* the first name is the official one from RFC 2252 */
static char *names[] = { "DN", DN_SYNTAX_OID, 0 };
@@ -156,9 +156,9 @@ static int dn_validate( struct berval *val )
*/
if (val->bv_len > 0) {
int strict = 0;
- char *p = val->bv_val;
- char *end = &(val->bv_val[val->bv_len - 1]);
- char *last = NULL;
+ const char *p = val->bv_val;
+ const char *end = &(val->bv_val[val->bv_len - 1]);
+ const char *last = NULL;
/* Check if we should be performing strict validation. */
strict = config_get_dn_validate_strict();
@@ -168,7 +168,7 @@ static int dn_validate( struct berval *val )
* stored in the backend unmodified. */
val_copy = PL_strndup(val->bv_val, val->bv_len);
p = val_copy;
- end = slapi_dn_normalize_to_end(p, NULL) - 1;
+ end = slapi_dn_normalize_to_end(val_copy, NULL) - 1;
}
/* Validate one RDN at a time in a loop. */
@@ -212,12 +212,12 @@ exit:
* will be set in the "last parameter. This will be the end of the RDN
* in the valid case, and the illegal character in the invalid case.
*/
-static int rdn_validate( char *begin, char *end, char **last )
+static int rdn_validate( const char *begin, const char *end, const char **last )
{
int rc = 0; /* Assume RDN is valid */
int numericform = 0;
char *separator = NULL;
- char *p = begin;
+ const char *p = begin;
/* Find the '=', then use the helpers for descr and numericoid */
if ((separator = PL_strnchr(p, '=', end - begin + 1)) == NULL) {
@@ -228,13 +228,13 @@ static int rdn_validate( char *begin, char *end, char **last )
/* Process an attribute type. The 'descr'
* form must start with a 'leadkeychar'. */
if (IS_LEADKEYCHAR(*p)) {
- if (rc = keystring_validate(p, separator - 1)) {
+ if ((rc = keystring_validate(p, separator - 1))) {
goto exit;
}
/* See if the 'numericoid' form is being used */
} else if (isdigit(*p)) {
numericform = 1;
- if (rc = numericoid_validate(p, separator - 1)) {
+ if ((rc = numericoid_validate(p, separator - 1))) {
goto exit;
}
} else {
diff --git a/ldap/servers/plugins/syntaxes/phonetic.c b/ldap/servers/plugins/syntaxes/phonetic.c
index f8f8e023..dd9e8304 100644
--- a/ldap/servers/plugins/syntaxes/phonetic.c
+++ b/ldap/servers/plugins/syntaxes/phonetic.c
@@ -249,9 +249,9 @@ static char vsvfn[26] = {
char *
phonetic( char *Word )
{
- unsigned char *n, *n_start, *n_end; /* pointers to string */
+ unsigned char *n_start, *n, *n_end; /* pointers to string */
char *metaph_end; /* pointers to metaph */
- char ntrans[42]; /* word with uppercase letters */
+ unsigned char ntrans[42]; /* word with uppercase letters */
int KSflag; /* state flag for X -> KS */
char buf[MAXPHONEMELEN + 2];
char *Metaph;
@@ -268,7 +268,7 @@ phonetic( char *Word )
}
++Word;
} else {
- auto const size_t len = LDAP_UTF8COPY(n, Word);
+ auto const size_t len = LDAP_UTF8COPY((char *)n, Word);
n += len; Word += len;
}
}
diff --git a/ldap/servers/plugins/syntaxes/syntax.h b/ldap/servers/plugins/syntaxes/syntax.h
index b9a01370..e673718f 100644
--- a/ldap/servers/plugins/syntaxes/syntax.h
+++ b/ldap/servers/plugins/syntaxes/syntax.h
@@ -75,13 +75,13 @@
#define IS_LDIGIT(c) ( (c != '0') && isdigit(c) )
#define IS_SHARP(c) ( (c == '#') )
#define IS_ESC(c) ( (c == '\\') )
-#define IS_UTF0(c) ( (c >= '\x80') && (c <= '\xBF') )
-#define IS_UTF1(c) ( !(c & 128) )
+#define IS_UTF0(c) ( ((unsigned char)(c) >= (unsigned char)'\x80') && ((unsigned char)(c) <= (unsigned char)'\xBF') )
+#define IS_UTF1(c) ( !((unsigned char)(c) & 128) )
/* These are only checking the first byte of the multibyte character. They
* do not verify that the entire multibyte character is correct. */
-#define IS_UTF2(c) ( (c >= '\xC2') && (c <= '\xDF') )
-#define IS_UTF3(c) ( (c >= '\xE0') && (c <= '\xEF') )
-#define IS_UTF4(c) ( (c >= '\xF0') && (c <= '\xF4') )
+#define IS_UTF2(c) ( ((unsigned char)(c) >= (unsigned char)'\xC2') && ((unsigned char)(c) <= (unsigned char)'\xDF') )
+#define IS_UTF3(c) ( ((unsigned char)(c) >= (unsigned char)'\xE0') && ((unsigned char)(c) <= (unsigned char)'\xEF') )
+#define IS_UTF4(c) ( ((unsigned char)(c) >= (unsigned char)'\xF0') && ((unsigned char)(c) <= (unsigned char)'\xF4') )
#define IS_UTFMB(c) ( IS_UTF2(c) || IS_UTF3(c) || IS_UTF4(c) )
#define IS_UTF8(c) ( IS_UTF1(c) || IS_UTFMB(c) )
@@ -119,9 +119,9 @@ char *next_word( char *s );
char *phonetic( char *s );
/* Validation helper functions */
-int keystring_validate( char *begin, char *end );
-int numericoid_validate( char *begin, char *end );
-int utf8char_validate( char *begin, char *end, char **last );
-int utf8string_validate( char *begin, char *end, char **last );
+int keystring_validate( const char *begin, const char *end );
+int numericoid_validate( const char *begin, const char *end );
+int utf8char_validate( const char *begin, const char *end, const char **last );
+int utf8string_validate( const char *begin, const char *end, const char **last );
#endif
diff --git a/ldap/servers/plugins/syntaxes/validate.c b/ldap/servers/plugins/syntaxes/validate.c
index 8367e083..a34830cd 100644
--- a/ldap/servers/plugins/syntaxes/validate.c
+++ b/ldap/servers/plugins/syntaxes/validate.c
@@ -52,8 +52,8 @@
* Returns non-zero if the value is not a valide 'keystring'.
*/
int keystring_validate(
- char *begin,
- char *end
+ const char *begin,
+ const char *end
)
{
int rc = 0; /* assume the value is valid */
@@ -90,13 +90,13 @@ exit:
* Returns non-zero if the value is not a valide 'numericoid'.
*/
int numericoid_validate(
- char *begin,
- char *end
+ const char *begin,
+ const char *end
)
{
int rc = 0; /* assume the value is valid */
int found_separator = 0;
- char *p = NULL;
+ const char *p = NULL;
if ((begin == NULL) || (end == NULL)) {
rc = 1;
@@ -181,13 +181,13 @@ exit:
*
* Returns 0 if it is valid and non-zero otherwise. */
int utf8char_validate(
- char *begin,
- char *end,
- char **last
+ const char *begin,
+ const char *end,
+ const char **last
)
{
int rc = 0; /* Assume char is valid */
- char *p = begin;
+ const char *p = begin;
if ((begin == NULL) || (end == NULL)) {
rc = 1;
@@ -233,14 +233,14 @@ int utf8char_validate(
if (*p == '\xE0') {
/* The next byte must be %xA0-BF. */
p++;
- if ((*p < '\xA0') || (*p > '\xBF')) {
+ if (((unsigned char)*p < (unsigned char)'\xA0') || ((unsigned char)*p > (unsigned char)'\xBF')) {
rc = 1;
goto exit;
}
} else if (*p == '\xED') {
/* The next byte must be %x80-9F. */
p++;
- if ((*p < '\x80') || (*p > '\x9F')) {
+ if (((unsigned char)*p < (unsigned char)'\x80') || ((unsigned char)*p > (unsigned char)'\x9F')) {
rc = 1;
goto exit;
}
@@ -270,13 +270,13 @@ int utf8char_validate(
* the second byte. */
if (*p == '\xF0') {
/* The next byte must be %x90-BF. */
- if ((*p < '\x90') || (*p > '\xBF')) {
+ if (((unsigned char)*p < (unsigned char)'\x90') || ((unsigned char)*p > (unsigned char)'\xBF')) {
rc = 1;
goto exit;
}
} else if (*p == '\xF4') {
/* The next byte must be %x80-BF. */
- if ((*p < '\x80') || (*p > '\xBF')) {
+ if (((unsigned char)*p < (unsigned char)'\x80') || ((unsigned char)*p > (unsigned char)'\xBF')) {
rc = 1;
goto exit;
}
@@ -307,7 +307,7 @@ int utf8char_validate(
exit:
if (last) {
- *last = p;
+ *last = (const char *)p;
}
return(rc);
}
@@ -321,13 +321,13 @@ exit:
*
* Returns 0 if it is valid and non-zero otherwise. */
int utf8string_validate(
- char *begin,
- char *end,
- char **last
+ const char *begin,
+ const char *end,
+ const char **last
)
{
int rc = 0; /* Assume string is valid */
- char *p = NULL;
+ const char *p = NULL;
if ((begin == NULL) || (end == NULL)) {
rc = 1;
diff --git a/ldap/servers/plugins/syntaxes/validate_task.c b/ldap/servers/plugins/syntaxes/validate_task.c
index d469ccd6..38c35218 100644
--- a/ldap/servers/plugins/syntaxes/validate_task.c
+++ b/ldap/servers/plugins/syntaxes/validate_task.c
@@ -49,8 +49,6 @@
/*
* Globals
*/
-static Slapi_PluginDesc pdesc = { "syntax-validate-task", PLUGIN_MAGIC_VENDOR_STR,
- PRODUCTTEXT, "syntax validation task plugin" };
static void* _PluginID = NULL;
diff --git a/ldap/servers/slapd/libglobs.c b/ldap/servers/slapd/libglobs.c
index 8c13a9b6..1155c8c7 100644
--- a/ldap/servers/slapd/libglobs.c
+++ b/ldap/servers/slapd/libglobs.c
@@ -125,12 +125,6 @@ static int config_set_schemareplace ( const char *attrname, char *value,
char *errorbuf, int apply );
static int
-isIntegralType(ConfigVarType type)
-{
- return type == CONFIG_INT || type == CONFIG_LONG || type == CONFIG_ON_OFF;
-}
-
-static int
isInt(ConfigVarType type)
{
return type == CONFIG_INT || type == CONFIG_ON_OFF || type == CONFIG_SPECIAL_SSLCLIENTAUTH || type == CONFIG_SPECIAL_ERRORLOGLEVEL;
diff --git a/ldap/servers/slapd/modify.c b/ldap/servers/slapd/modify.c
index 09ccd424..d90d2b49 100644
--- a/ldap/servers/slapd/modify.c
+++ b/ldap/servers/slapd/modify.c
@@ -438,7 +438,7 @@ void slapi_modify_internal_set_pb (Slapi_PBlock *pb, const char *dn, LDAPMod **m
static int modify_internal_pb (Slapi_PBlock *pb)
{
LDAPControl **controls;
- LDAPControl *pwpolicy_ctrl;
+ int pwpolicy_ctrl = 0;
Operation *op;
int opresult = 0;
LDAPMod **normalized_mods = NULL;
diff --git a/ldap/servers/slapd/opshared.c b/ldap/servers/slapd/opshared.c
index 06ff32f6..0f3c0681 100644
--- a/ldap/servers/slapd/opshared.c
+++ b/ldap/servers/slapd/opshared.c
@@ -61,7 +61,6 @@ static char *pwpolicy_lock_attrs_all [] = { "passwordRetryCount",
NULL};
/* Forward declarations */
static void compute_limits (Slapi_PBlock *pb);
-static int send_results (Slapi_PBlock *pb, int send_result, int *nentries);
static int send_results_ext (Slapi_PBlock *pb, int send_result, int *nentries, int pagesize, unsigned int *pr_stat);
static int process_entry(Slapi_PBlock *pb, Slapi_Entry *e, int send_result);
@@ -1461,15 +1460,6 @@ send_results_ext(Slapi_PBlock *pb, int send_result, int *nentries, int pagesize,
return rc;
}
-/* Iterates through results and send them to the client.
- * Returns 0 if successful and -1 otherwise
- */
-static int
-send_results(Slapi_PBlock *pb, int send_result, int *nentries)
-{
- return send_results_ext(pb, send_result, nentries, -1, NULL);
-}
-
void op_shared_log_error_access (Slapi_PBlock *pb, const char *type, const char *dn, const char *msg)
{
char ebuf[BUFSIZ];
diff --git a/ldap/servers/slapd/pagedresults.c b/ldap/servers/slapd/pagedresults.c
index f140933e..e82053bc 100644
--- a/ldap/servers/slapd/pagedresults.c
+++ b/ldap/servers/slapd/pagedresults.c
@@ -131,7 +131,7 @@ pagedresults_set_response_control( Slapi_PBlock *pb, int iscritical,
/* begin sequence, payload, end sequence */
if (curr_search_count < 0) {
- cookie_str = slapi_ch_smprintf("");
+ cookie_str = slapi_ch_strdup("");
} else {
cookie_str = slapi_ch_smprintf("%d", curr_search_count);
}
diff --git a/ldap/servers/slapd/pblock.c b/ldap/servers/slapd/pblock.c
index dd8239db..c89a6485 100644
--- a/ldap/servers/slapd/pblock.c
+++ b/ldap/servers/slapd/pblock.c
@@ -1082,7 +1082,7 @@ slapi_pblock_get( Slapi_PBlock *pblock, int arg, void *value )
if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_SYNTAX ) {
return( -1 );
}
- (*(int *)value) = pblock->pb_plugin->plg_syntax_validate;
+ (*(IFP *)value) = pblock->pb_plugin->plg_syntax_validate;
break;
/* controls we know about */
diff --git a/ldap/servers/slapd/plugin_syntax.c b/ldap/servers/slapd/plugin_syntax.c
index 3290a954..945271ec 100644
--- a/ldap/servers/slapd/plugin_syntax.c
+++ b/ldap/servers/slapd/plugin_syntax.c
@@ -278,7 +278,6 @@ slapi_entry_syntax_check(
int ret = 0;
int i = 0;
int is_replicated_operation = 0;
- int badval = 0;
int syntaxcheck = config_get_syntaxcheck();
int syntaxlogging = config_get_syntaxlogging();
Slapi_Attr *prevattr = NULL;
@@ -366,7 +365,6 @@ slapi_mods_syntax_check(
int ret = 0;
int i, j = 0;
int is_replicated_operation = 0;
- int badval = 0;
int syntaxcheck = config_get_syntaxcheck();
int syntaxlogging = config_get_syntaxlogging();
char errtext[ BUFSIZ ];
diff --git a/ldap/servers/slapd/proto-slap.h b/ldap/servers/slapd/proto-slap.h
index 1ba7ddae..ba18a29c 100644
--- a/ldap/servers/slapd/proto-slap.h
+++ b/ldap/servers/slapd/proto-slap.h
@@ -1339,6 +1339,9 @@ int pagedresults_get_search_result_count(Connection *conn);
int pagedresults_set_search_result_count(Connection *conn, int cnt);
int pagedresults_get_with_sort(Connection *conn);
int pagedresults_set_with_sort(Connection *conn, int flags);
+int pagedresults_get_sort_result_code(Connection *conn);
+int pagedresults_set_sort_result_code(Connection *conn, int code);
+int pagedresults_set_timelimit(Connection *conn, time_t timelimit);
/*
* sort.c
diff --git a/ldap/servers/slapd/snmp_collator.c b/ldap/servers/slapd/snmp_collator.c
index 9fb629d2..9beb878a 100644
--- a/ldap/servers/slapd/snmp_collator.c
+++ b/ldap/servers/slapd/snmp_collator.c
@@ -80,7 +80,9 @@
#define URL_CHARS_LEN 9
static char *make_ds_url(char *host, int port);
+#ifdef DEBUG_SNMP_INTERACTION
static void print_snmp_interaction_table();
+#endif /* DEBUG_SNMP_INTERACTION */
static int search_interaction_table(char *dsURL, int *isnew);
static void loadConfigStats();
static Slapi_Entry *getConfigEntry( Slapi_Entry **e );
@@ -338,6 +340,8 @@ static int search_interaction_table(char *dsURL, int *isnew)
return index;
}
+
+#ifdef DEBUG_SNMP_INTERACTION
/* for debuging until subagent part working, print contents of interaction table */
static void print_snmp_interaction_table()
{
@@ -356,6 +360,7 @@ static void print_snmp_interaction_table()
fprintf(stderr, "\n");
}
}
+#endif /* DEBUG_SNMP_INTERACTION */
/*-------------------------------------------------------------------------
*
diff --git a/ldap/servers/slapd/tools/mmldif.c b/ldap/servers/slapd/tools/mmldif.c
index ccc4eabd..409ce3ed 100644
--- a/ldap/servers/slapd/tools/mmldif.c
+++ b/ldap/servers/slapd/tools/mmldif.c
@@ -53,6 +53,7 @@
# include <io.h>
#endif
+#include <nss.h>
#include <pk11func.h>
#include <slap.h>
diff --git a/ldap/servers/slapd/util.c b/ldap/servers/slapd/util.c
index 2aff1e30..672eff1d 100644
--- a/ldap/servers/slapd/util.c
+++ b/ldap/servers/slapd/util.c
@@ -887,35 +887,6 @@ slapi_urlparse_err2string( int err )
#include <sasl.h>
-/* copied from mozldap libldap/saslbind.c */
-static int
-slapd_sasl_fail()
-{
- return( SASL_FAIL );
-}
-
-/* copied from slapd/saslbind.c - not an easy way to share this function
- between the two files */
-static int slapd_sasl_getpluginpath(sasl_conn_t *conn, const char **path)
-{
- /* Try to get path from config, otherwise check for SASL_PATH environment
- * variable. If neither of these are set, default to /usr/lib64/sasl2 on
- * 64-bit Linux machines, and /usr/lib/sasl2 on all other platforms.
- */
- char *pluginpath = config_get_saslpath();
- if ((!pluginpath) || (*pluginpath == '\0')) {
- if (!(pluginpath = getenv("SASL_PATH"))) {
-#if defined(LINUX) && defined(__LP64__)
- pluginpath = "/usr/lib64/sasl2";
-#else
- pluginpath = "/usr/lib/sasl2";
-#endif
- }
- }
- *path = pluginpath;
- return SASL_OK;
-}
-
/*
Perform LDAP init and return an LDAP* handle. If ldapurl is given,
that is used as the basis for the protocol, host, port, and whether