[Fedora-directory-commits] ldapserver/ldap/servers/plugins/pam_passthru pam_ptimpl.c, 1.12, 1.13
by Noriko Hosoi
Author: nhosoi
Update of /cvs/dirsec/ldapserver/ldap/servers/plugins/pam_passthru
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv25637/ldap/servers/plugins/pam_passthru
Modified Files:
pam_ptimpl.c
Log Message:
Resolves: #466702
Summary: Memory usage research: checking in the experimental code
See also: http://directory.fedoraproject.org/wiki/Memory_Usage_Research
Index: pam_ptimpl.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/plugins/pam_passthru/pam_ptimpl.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- pam_ptimpl.c 8 Oct 2008 17:29:02 -0000 1.12
+++ pam_ptimpl.c 15 Oct 2008 06:29:56 -0000 1.13
@@ -77,7 +77,7 @@
delete_my_str_buf(MyStrBuf *buf)
{
if (buf->str != buf->fixbuf) {
- slapi_ch_free_string(&buf->str);
+ slapi_ch_free_string(&(buf->str));
}
}
@@ -152,7 +152,7 @@
/* returns a berval value as a null terminated string */
static char *strdupbv(struct berval *bv)
{
- char *str = malloc(bv->bv_len+1);
+ char *str = slapi_ch_malloc(bv->bv_len+1);
memcpy(str, bv->bv_val, bv->bv_len);
str[bv->bv_len] = 0;
return str;
@@ -164,10 +164,10 @@
int ii;
for (ii = 0; ii < nresp; ++ii) {
if (resp[ii].resp) {
- free(resp[ii].resp);
+ slapi_ch_free((void **)&(resp[ii].resp));
}
}
- free(resp);
+ slapi_ch_free((void **)&resp);
}
/*
@@ -190,7 +190,7 @@
}
/* empty reply structure */
- reply = (struct pam_response *)calloc(num_msg,
+ reply = (struct pam_response *)slapi_ch_calloc(num_msg,
sizeof(struct pam_response));
slapi_pblock_get( my_data->pb, SLAPI_BIND_CREDENTIALS, &creds ); /* the password */
for (ii = 0; ii < num_msg; ++ii) {
@@ -206,7 +206,7 @@
reply[ii].resp = strdupbv(creds);
#endif
} else if (msg[ii]->msg_style == PAM_PROMPT_ECHO_ON) { /* assume username */
- reply[ii].resp = strdup(my_data->pam_identity);
+ reply[ii].resp = slapi_ch_strdup(my_data->pam_identity);
} else if (msg[ii]->msg_style == PAM_ERROR_MSG) {
slapi_log_error(SLAPI_LOG_FATAL, PAM_PASSTHRU_PLUGIN_SUBSYSTEM,
"pam msg [%d] error [%s]\n", ii, msg[ii]->msg);
15 years, 5 months
[Fedora-directory-commits] ldapserver/ldap/servers/plugins/dna dna.c, 1.11, 1.12
by Noriko Hosoi
Author: nhosoi
Update of /cvs/dirsec/ldapserver/ldap/servers/plugins/dna
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv25637/ldap/servers/plugins/dna
Modified Files:
dna.c
Log Message:
Resolves: #466702
Summary: Memory usage research: checking in the experimental code
See also: http://directory.fedoraproject.org/wiki/Memory_Usage_Research
Index: dna.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/plugins/dna/dna.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- dna.c 8 Oct 2008 17:29:02 -0000 1.11
+++ dna.c 15 Oct 2008 06:29:56 -0000 1.12
@@ -680,7 +680,7 @@
value = slapi_entry_get_ndn(e);
if (value) {
- entry->dn = strdup(value);
+ entry->dn = slapi_ch_strdup(value);
}
slapi_log_error(SLAPI_LOG_CONFIG, DNA_PLUGIN_SUBSYSTEM,
15 years, 5 months
[Fedora-directory-commits] ldapserver/ldap/servers/plugins/chainingdb cb_conn_stateless.c, 1.7, 1.8
by Noriko Hosoi
Author: nhosoi
Update of /cvs/dirsec/ldapserver/ldap/servers/plugins/chainingdb
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv25637/ldap/servers/plugins/chainingdb
Modified Files:
cb_conn_stateless.c
Log Message:
Resolves: #466702
Summary: Memory usage research: checking in the experimental code
See also: http://directory.fedoraproject.org/wiki/Memory_Usage_Research
Index: cb_conn_stateless.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/plugins/chainingdb/cb_conn_stateless.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- cb_conn_stateless.c 18 Oct 2007 00:08:28 -0000 1.7
+++ cb_conn_stateless.c 15 Oct 2008 06:29:54 -0000 1.8
@@ -386,7 +386,7 @@
rc=ldap_get_lderrno( ld, NULL, NULL );
prerr=PR_GetError();
}
- if ( ret == 0 ) free(plain); /* free plain only if it has been duplicated */
+ if ( ret == 0 ) slapi_ch_free_string(&plain); /* free plain only if it has been duplicated */
if ( rc != LDAP_SUCCESS ) {
if (cb_debug_on()) {
15 years, 5 months
[Fedora-directory-commits] ldapserver configure.ac, 1.51, 1.52 aclocal.m4, 1.72, 1.73 configure, 1.89, 1.90 config.h.in, 1.19, 1.20 missing, 1.54, 1.55 install-sh, 1.54, 1.55 depcomp, 1.54, 1.55 compile, 1.49, 1.50 Makefile.in, 1.94, 1.95 config.sub, 1.53, 1.54 config.guess, 1.53, 1.54
by Richard Allen Megginson
Author: rmeggins
Update of /cvs/dirsec/ldapserver
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv26598
Modified Files:
configure.ac aclocal.m4 configure config.h.in missing
install-sh depcomp compile Makefile.in config.sub config.guess
Log Message:
fix inttypes build breakage on HP-UX
Index: configure.ac
===================================================================
RCS file: /cvs/dirsec/ldapserver/configure.ac,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -r1.51 -r1.52
--- configure.ac 8 Oct 2008 17:29:00 -0000 1.51
+++ configure.ac 13 Oct 2008 16:32:41 -0000 1.52
@@ -300,6 +300,7 @@
AC_DEFINE([OS_hpux], [1], [OS HP-UX])
AC_DEFINE([_POSIX_C_SOURCE], [199506L], [POSIX revision])
AC_DEFINE([_HPUX_SOURCE], [1], [Source namespace])
+ AC_DEFINE([_INCLUDE_STDC__SOURCE_199901], [1], [to pick up all of the printf format macros in inttypes.h])
# assume 64 bit
perlexec='/opt/perl_64/bin/perl'
platform="hpux"
@@ -315,6 +316,7 @@
AC_DEFINE([OS_hpux], [1], [OS HP-UX])
AC_DEFINE([_POSIX_C_SOURCE], [199506L], [POSIX revision])
AC_DEFINE([_HPUX_SOURCE], [1], [Source namespace])
+ AC_DEFINE([_INCLUDE_STDC__SOURCE_199901], [1], [to pick up all of the printf format macros in inttypes.h])
# assume 64 bit
initconfigdir="/$PACKAGE_NAME/config"
perlexec='/opt/perl_64/bin/perl'
Index: configure
===================================================================
RCS file: /cvs/dirsec/ldapserver/configure,v
retrieving revision 1.89
retrieving revision 1.90
diff -u -r1.89 -r1.90
--- configure 8 Oct 2008 17:29:00 -0000 1.89
+++ configure 13 Oct 2008 16:32:41 -0000 1.90
@@ -23392,6 +23392,11 @@
#define _HPUX_SOURCE 1
_ACEOF
+
+cat >>confdefs.h <<\_ACEOF
+#define _INCLUDE_STDC__SOURCE_199901 1
+_ACEOF
+
# assume 64 bit
perlexec='/opt/perl_64/bin/perl'
platform="hpux"
@@ -23443,6 +23448,11 @@
#define _HPUX_SOURCE 1
_ACEOF
+
+cat >>confdefs.h <<\_ACEOF
+#define _INCLUDE_STDC__SOURCE_199901 1
+_ACEOF
+
# assume 64 bit
initconfigdir="/$PACKAGE_NAME/config"
perlexec='/opt/perl_64/bin/perl'
Index: config.h.in
===================================================================
RCS file: /cvs/dirsec/ldapserver/config.h.in,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- config.h.in 8 Oct 2008 17:29:00 -0000 1.19
+++ config.h.in 13 Oct 2008 16:32:42 -0000 1.20
@@ -344,6 +344,9 @@
/* Source namespace */
#undef _HPUX_SOURCE
+/* to pick up all of the printf format macros in inttypes.h */
+#undef _INCLUDE_STDC__SOURCE_199901
+
/* POSIX revision */
#undef _POSIX_C_SOURCE
15 years, 5 months
[Fedora-directory-commits] ldapserver/ldap/servers/slapd/back-ldbm back-ldbm.h, 1.16, 1.17 dblayer.c, 1.28, 1.29 perfctrs.c, 1.10, 1.11 proto-back-ldbm.h, 1.14, 1.15
by Richard Allen Megginson
Author: rmeggins
Update of /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv11117/ldapserver/ldap/servers/slapd/back-ldbm
Modified Files:
back-ldbm.h dblayer.c perfctrs.c proto-back-ldbm.h
Log Message:
Resolves: bug 454030, bug 463991
Bug Description: Need to address 64-bit compiler warnings - part 1
Reviewed by: nhosoi (Thanks!)
Fix Description: I inadvertantly committed fixes for 463991 along with fixes for 454030, and the fixes for 463991 broke the server. This commit makes the server work again.
Index: back-ldbm.h
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm/back-ldbm.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- back-ldbm.h 8 Oct 2008 17:29:03 -0000 1.16
+++ back-ldbm.h 9 Oct 2008 17:40:14 -0000 1.17
@@ -114,16 +114,6 @@
#define MEGABYTE (1024 * 1024)
#define GIGABYTE (1024 * MEGABYTE)
-#define DB_USES_LOCKING(env) \
- (DB_INIT_LOCK & ((env)->get_open_flags((env), NULL)))
-#define DB_USES_TRANSACTIONS(env) \
- (DB_INIT_TXN & ((env)->get_open_flags((env), NULL)))
-#define DB_USES_MPOOL(env) \
- (DB_INIT_MPOOL & ((env)->get_open_flags((env), NULL)))
-#define DB_USES_LOGGING(env) \
- (DB_INIT_LOG & ((env)->get_open_flags((env), NULL)))
-
-
/* include NSPR header files */
#include "nspr.h"
#include "plhash.h"
Index: dblayer.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm/dblayer.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- dblayer.c 8 Oct 2008 17:29:03 -0000 1.28
+++ dblayer.c 9 Oct 2008 17:40:14 -0000 1.29
@@ -277,6 +277,31 @@
return slapi_berval_cmp(&bv1, &bv2);
}
+static int db_uses_feature(DB_ENV *db_env, u_int32_t flags)
+{
+ u_int32_t openflags = 0;
+ PR_ASSERT(db_env);
+ (*db_env->get_open_flags)(db_env, &openflags);
+
+ return (flags & openflags);
+}
+
+int dblayer_db_uses_locking(DB_ENV *db_env) {
+ return db_uses_feature(db_env, DB_INIT_LOCK);
+}
+
+int dblayer_db_uses_transactions(DB_ENV *db_env) {
+ return db_uses_feature(db_env, DB_INIT_TXN);
+}
+
+int dblayer_db_uses_mpool(DB_ENV *db_env) {
+ return db_uses_feature(db_env, DB_INIT_MPOOL);
+}
+
+int dblayer_db_uses_logging(DB_ENV *db_env) {
+ return db_uses_feature(db_env, DB_INIT_LOG);
+};
+
/* this flag use if user remotely turned batching off */
#define FLUSH_REMOTEOFF -1
@@ -3456,7 +3481,7 @@
{
if (priv->dblayer_enable_transactions)
{
- if (DB_USES_LOCKING(priv->dblayer_env->dblayer_DB_ENV)) {
+ if (dblayer_db_uses_locking(priv->dblayer_env->dblayer_DB_ENV)) {
int aborted;
if ((rval = LOCK_DETECT(priv->dblayer_env->dblayer_DB_ENV,
0,
@@ -3626,7 +3651,7 @@
checkpoint_interval)
continue;
- if (!DB_USES_TRANSACTIONS(priv->dblayer_env->dblayer_DB_ENV))
+ if (!dblayer_db_uses_transactions(priv->dblayer_env->dblayer_DB_ENV))
continue;
/* now checkpoint */
@@ -3784,7 +3809,7 @@
DS_Sleep(interval); /* 622855: wait for other threads fully started */
if (priv->dblayer_enable_transactions)
{
- if ( DB_USES_MPOOL(priv->dblayer_env->dblayer_DB_ENV) &&
+ if ( dblayer_db_uses_mpool(priv->dblayer_env->dblayer_DB_ENV) &&
(0 != priv->dblayer_trickle_percentage) )
{
int pages_written = 0;
Index: perfctrs.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm/perfctrs.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- perfctrs.c 8 Oct 2008 17:29:04 -0000 1.10
+++ perfctrs.c 9 Oct 2008 17:40:14 -0000 1.11
@@ -296,7 +296,7 @@
return;
}
/* Call libdb to get the various stats */
- if (DB_USES_LOGGING(db_env))
+ if (dblayer_db_uses_logging(db_env))
{
DB_LOG_STAT *logstat = NULL;
ret = LOG_STAT(db_env,&logstat,0,malloc);
@@ -307,7 +307,7 @@
}
free(logstat);
}
- if (DB_USES_TRANSACTIONS(db_env))
+ if (dblayer_db_uses_transactions(db_env))
{
DB_TXN_STAT *txnstat = NULL;
ret = TXN_STAT(db_env, &txnstat, 0, malloc);
@@ -320,7 +320,7 @@
if (txnstat)
free(txnstat);
}
- if (DB_USES_LOCKING(db_env))
+ if (dblayer_db_uses_locking(db_env))
{
DB_LOCK_STAT *lockstat = NULL;
ret = LOCK_STAT(db_env,&lockstat,0,malloc);
@@ -338,7 +338,7 @@
}
free(lockstat);
}
- if (DB_USES_MPOOL(db_env))
+ if (dblayer_db_uses_mpool(db_env))
{
DB_MPOOL_STAT *mpstat = NULL;
ret = MEMP_STAT(db_env,&mpstat,NULL,0,malloc);
Index: proto-back-ldbm.h
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- proto-back-ldbm.h 2 Oct 2007 18:39:51 -0000 1.14
+++ proto-back-ldbm.h 9 Oct 2008 17:40:14 -0000 1.15
@@ -166,6 +166,10 @@
char *buf, int buflen);
void autosize_import_cache(struct ldbminfo *li);
+int dblayer_db_uses_locking(DB_ENV *db_env);
+int dblayer_db_uses_transactions(DB_ENV *db_env);
+int dblayer_db_uses_mpool(DB_ENV *db_env);
+int dblayer_db_uses_logging(DB_ENV *db_env);
/*
* dn2entry.c
15 years, 5 months
[Fedora-directory-commits] ldapserver/ldap/servers/slapd/back-ldbm ldif2ldbm.c, 1.17, 1.18
by Richard Allen Megginson
Author: rmeggins
Update of /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv26015
Modified Files:
ldif2ldbm.c
Log Message:
Resolves: bug 454030
Description: Need to address 64-bit compiler warnings - part 1
Fix Description: missed one line from my previous commit
Index: ldif2ldbm.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm/ldif2ldbm.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- ldif2ldbm.c 8 Oct 2008 17:29:04 -0000 1.17
+++ ldif2ldbm.c 9 Oct 2008 14:57:32 -0000 1.18
@@ -269,7 +269,7 @@
int import_subcount_mother_init(import_subcount_stuff *mothers, ID parent_id,
size_t count)
{
- PR_ASSERT(NULL == PL_HashTableLookup(mothers->hashtable,(void*)parent_id));
+ PR_ASSERT(NULL == PL_HashTableLookup(mothers->hashtable,(void*)((uintptr_t)parent_id)));
PL_HashTableAdd(mothers->hashtable,(void*)((uintptr_t)parent_id),(void*)count);
return 0;
}
15 years, 5 months
[Fedora-directory-commits] ldapserver/ldap/servers/snmp ldap-agent.h, 1.9, 1.10
by Richard Allen Megginson
Author: rmeggins
Update of /cvs/dirsec/ldapserver/ldap/servers/snmp
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv26931/ldapserver/ldap/servers/snmp
Modified Files:
ldap-agent.h
Log Message:
Bug Description: Need to address 64-bit compiler warnings - part 1
Reviewed by: nhosoi (Thanks!)
Fix Description: The intptr_t and uintptr_t are types which are defined as integer types that are the same size as the pointer (void *) type. On the platforms we currently support, this is the same as long and unsigned long, respectively (ILP32 and LP64). However, intptr_t and uintptr_t are more portable. These can be used to assign a value passed as a void * to get an integer value, then "cast down" to an int or PRBool, and vice versa. This seems to be a common idiom in other applications where values must be passed as void *.
For the printf/scanf formats, there is a standard header called inttypes.h which defines formats to use for various 64 bit quantities, so that you don't need to figure out if you have to use %lld or %ld for a 64-bit value - you just use PRId64 which is set to the correct value. I also assumed that size_t is defined as the same size as a pointer so I used the PRIuPTR format macro for size_t.
I removed many unused variables and some unused functions.
I put parentheses around assignments in conditional expressions to tell the compiler not to complain about them.
I cleaned up some #defines that were defined more than once.
I commented out some unused goto labels.
Some of our header files shared among several source files define static variables. I made it so that those variables are not defined unless a macro is set in the source file. This avoids a lot of unused variable warnings.
I added some return values to functions that were declared as returning a value but did not return a value. In all of these cases no one was checking the return value anyway.
I put explicit parentheses around cases like this: expr || expr && expr - the && has greater precedence than the ||. The compiler complains because it wants you to make sure you mean expr || (expr && expr), not (expr || expr) && expr.
I cleaned up several places where the compiler was complaining about possible use of uninitialized variables. There are still a lot of these cases remaining.
There are a lot of warnings like this:
lib/ldaputil/certmap.c:1279: warning: dereferencing type-punned pointer will break strict-aliasing rules
These are due to our use of void ** to pass in addresses of addresses of structures. Many of these are calls to slapi_ch_free, but many are not - they are cases where we do not know what the type is going to be and may have to cast and modify the structure or pointer. I started replacing the calls to slapi_ch_free with slapi_ch_free_string, but there are many many more that need to be fixed.
The dblayer code also contains a fix for https://bugzilla.redhat.com/show_bug.cgi?id=463991 - instead of checking for dbenv->foo_handle to see if a db "feature" is enabled, instead check the flags passed to open the dbenv. This works for bdb 4.2 through bdb 4.7 and probably other releases as well.
Platforms tested: RHEL5 x86_64, Fedora 8 i386
Flag Day: no
Doc impact: no
Index: ldap-agent.h
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/snmp/ldap-agent.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- ldap-agent.h 10 Nov 2006 23:45:53 -0000 1.9
+++ ldap-agent.h 8 Oct 2008 17:29:04 -0000 1.10
@@ -47,7 +47,27 @@
extern "C" {
#endif
+/* net-snmp-config.h defines
+ all of these unconditionally - so we undefine
+ them here to make the compiler warnings shut up
+ hopefully we don't need the real versions
+ of these, but then with no warnings the compiler
+ will just silently redefine them to the wrong
+ ones anyway
+ Then undefine them after the include so that
+ our own local defines will take effect
+*/
+#undef PACKAGE_BUGREPORT
+#undef PACKAGE_NAME
+#undef PACKAGE_STRING
+#undef PACKAGE_TARNAME
+#undef PACKAGE_VERSION
#include <net-snmp/net-snmp-config.h>
+#undef PACKAGE_BUGREPORT
+#undef PACKAGE_NAME
+#undef PACKAGE_STRING
+#undef PACKAGE_TARNAME
+#undef PACKAGE_VERSION
#include <net-snmp/net-snmp-includes.h>
#include <net-snmp/agent/net-snmp-agent-includes.h>
#include <net-snmp/library/snmp_assert.h>
15 years, 5 months
[Fedora-directory-commits] ldapserver/lib/libsi18n getstrmem.h, 1.7, 1.8 gsslapd.h, 1.7, 1.8
by Richard Allen Megginson
Author: rmeggins
Update of /cvs/dirsec/ldapserver/lib/libsi18n
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv26931/ldapserver/lib/libsi18n
Modified Files:
getstrmem.h gsslapd.h
Log Message:
Bug Description: Need to address 64-bit compiler warnings - part 1
Reviewed by: nhosoi (Thanks!)
Fix Description: The intptr_t and uintptr_t are types which are defined as integer types that are the same size as the pointer (void *) type. On the platforms we currently support, this is the same as long and unsigned long, respectively (ILP32 and LP64). However, intptr_t and uintptr_t are more portable. These can be used to assign a value passed as a void * to get an integer value, then "cast down" to an int or PRBool, and vice versa. This seems to be a common idiom in other applications where values must be passed as void *.
For the printf/scanf formats, there is a standard header called inttypes.h which defines formats to use for various 64 bit quantities, so that you don't need to figure out if you have to use %lld or %ld for a 64-bit value - you just use PRId64 which is set to the correct value. I also assumed that size_t is defined as the same size as a pointer so I used the PRIuPTR format macro for size_t.
I removed many unused variables and some unused functions.
I put parentheses around assignments in conditional expressions to tell the compiler not to complain about them.
I cleaned up some #defines that were defined more than once.
I commented out some unused goto labels.
Some of our header files shared among several source files define static variables. I made it so that those variables are not defined unless a macro is set in the source file. This avoids a lot of unused variable warnings.
I added some return values to functions that were declared as returning a value but did not return a value. In all of these cases no one was checking the return value anyway.
I put explicit parentheses around cases like this: expr || expr && expr - the && has greater precedence than the ||. The compiler complains because it wants you to make sure you mean expr || (expr && expr), not (expr || expr) && expr.
I cleaned up several places where the compiler was complaining about possible use of uninitialized variables. There are still a lot of these cases remaining.
There are a lot of warnings like this:
lib/ldaputil/certmap.c:1279: warning: dereferencing type-punned pointer will break strict-aliasing rules
These are due to our use of void ** to pass in addresses of addresses of structures. Many of these are calls to slapi_ch_free, but many are not - they are cases where we do not know what the type is going to be and may have to cast and modify the structure or pointer. I started replacing the calls to slapi_ch_free with slapi_ch_free_string, but there are many many more that need to be fixed.
The dblayer code also contains a fix for https://bugzilla.redhat.com/show_bug.cgi?id=463991 - instead of checking for dbenv->foo_handle to see if a db "feature" is enabled, instead check the flags passed to open the dbenv. This works for bdb 4.2 through bdb 4.7 and probably other releases as well.
Platforms tested: RHEL5 x86_64, Fedora 8 i386
Flag Day: no
Doc impact: no
Index: getstrmem.h
===================================================================
RCS file: /cvs/dirsec/ldapserver/lib/libsi18n/getstrmem.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- getstrmem.h 10 Nov 2006 23:46:05 -0000 1.7
+++ getstrmem.h 8 Oct 2008 17:29:05 -0000 1.8
@@ -53,7 +53,6 @@
#define NUM_BUCKETS 32 /* must be a power of 2 */
/* strings in library libadmin */
-static char* libadminid[] = {"$DBT: libadmin in memory v1 $"};
static char* libadmin[] = {
"",
" Help ",
@@ -89,7 +88,6 @@
{emptyString,NULL,0} };
/* strings in library userforms */
-static char* userformsid[] = {"$DBT: userforms in memory v1 $"};
static char* userforms[] = {
"",
"Error: could not open servers list file.<p>\n",
@@ -113,7 +111,6 @@
{emptyString,NULL,0} };
/* strings in library libaccess */
-static char* libaccessid[] = {"$DBT: libaccess in memory v1 $"};
static char* libaccess[] = {
"",
"basic-ncsa",
@@ -274,7 +271,6 @@
{emptyString,NULL,0} };
/* strings in library frame */
-static char* frameid[] = {"$DBT: frame in memory v1 $"};
static char* frame[] = {
"",
"<TITLE>Not Found</TITLE><H1>Not Found</H1> The requested object does not exist on this server. The link you followed is either outdated, inaccurate, or the server has been instructed not to let you have it. ",
@@ -465,7 +461,6 @@
{emptyString,NULL,0} };
/* strings in library admserv */
-static char* admservid[] = {"$DBT: admserv in memory v1 $"};
static char* admserv[] = {
"",
"Unauthorized host",
@@ -477,7 +472,6 @@
emptyString };
/* strings in library libir */
-static char* libirid[] = {"$DBT: libadmin in memory v1 $"};
static char* libir[] = {
"",
"An I/O error occurred before all form data could be read.",
@@ -494,7 +488,6 @@
{emptyString,NULL,0} };
/* strings in library httpdaemon */
-static char* httpdaemonid[] = {"$DBT: httpdaemon in memory v1 $"};
static char* httpdaemon[] = {
"",
"Error in ConvertThreadToFiber",
@@ -540,7 +533,6 @@
{emptyString,NULL,0} };
/* strings in library dsgw */
-static char* dsgwid[] = {"$DBT: dsgw in memory v1 $"};
static char* dsgw[] = {
"",
"Unknown HTTP request method",
@@ -856,7 +848,6 @@
{emptyString,NULL,0} };
/* strings in library base */
-static char* baseid[] = {"$DBT: base in memory v1 $"};
static char* base[] = {
"",
"insufficient memory to create hash table",
@@ -1072,7 +1063,6 @@
{emptyString,NULL,0} };
/* strings in library cgiadmin */
-static char* cgiadminid[] = {"$DBT: cgiadmin in memory v1 $"};
static char* cgiadmin[] = {
"",
"Missing REQUEST_METHOD",
Index: gsslapd.h
===================================================================
RCS file: /cvs/dirsec/ldapserver/lib/libsi18n/gsslapd.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- gsslapd.h 27 Apr 2007 22:59:32 -0000 1.7
+++ gsslapd.h 8 Oct 2008 17:29:05 -0000 1.8
@@ -54,10 +54,10 @@
#undef LIBRARY_NAME
static RESOURCE_GLOBAL allxpstr[] = {
- base,
- libaccess,
- libadmin,
- 0
+ {base},
+ {libaccess},
+ {libadmin},
+ {0}
};
#endif /* ifdef RESOURCE_STR */
15 years, 5 months
[Fedora-directory-commits] ldapserver/lib/libaccess aclerror.cpp, 1.8, 1.9 acltools.cpp, 1.8, 1.9 lasdns.cpp, 1.8, 1.9 lasip.cpp, 1.7, 1.8 ldapacl.cpp, 1.6, 1.7 oneeval.cpp, 1.8, 1.9
by Richard Allen Megginson
Author: rmeggins
Update of /cvs/dirsec/ldapserver/lib/libaccess
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv26931/ldapserver/lib/libaccess
Modified Files:
aclerror.cpp acltools.cpp lasdns.cpp lasip.cpp ldapacl.cpp
oneeval.cpp
Log Message:
Bug Description: Need to address 64-bit compiler warnings - part 1
Reviewed by: nhosoi (Thanks!)
Fix Description: The intptr_t and uintptr_t are types which are defined as integer types that are the same size as the pointer (void *) type. On the platforms we currently support, this is the same as long and unsigned long, respectively (ILP32 and LP64). However, intptr_t and uintptr_t are more portable. These can be used to assign a value passed as a void * to get an integer value, then "cast down" to an int or PRBool, and vice versa. This seems to be a common idiom in other applications where values must be passed as void *.
For the printf/scanf formats, there is a standard header called inttypes.h which defines formats to use for various 64 bit quantities, so that you don't need to figure out if you have to use %lld or %ld for a 64-bit value - you just use PRId64 which is set to the correct value. I also assumed that size_t is defined as the same size as a pointer so I used the PRIuPTR format macro for size_t.
I removed many unused variables and some unused functions.
I put parentheses around assignments in conditional expressions to tell the compiler not to complain about them.
I cleaned up some #defines that were defined more than once.
I commented out some unused goto labels.
Some of our header files shared among several source files define static variables. I made it so that those variables are not defined unless a macro is set in the source file. This avoids a lot of unused variable warnings.
I added some return values to functions that were declared as returning a value but did not return a value. In all of these cases no one was checking the return value anyway.
I put explicit parentheses around cases like this: expr || expr && expr - the && has greater precedence than the ||. The compiler complains because it wants you to make sure you mean expr || (expr && expr), not (expr || expr) && expr.
I cleaned up several places where the compiler was complaining about possible use of uninitialized variables. There are still a lot of these cases remaining.
There are a lot of warnings like this:
lib/ldaputil/certmap.c:1279: warning: dereferencing type-punned pointer will break strict-aliasing rules
These are due to our use of void ** to pass in addresses of addresses of structures. Many of these are calls to slapi_ch_free, but many are not - they are cases where we do not know what the type is going to be and may have to cast and modify the structure or pointer. I started replacing the calls to slapi_ch_free with slapi_ch_free_string, but there are many many more that need to be fixed.
The dblayer code also contains a fix for https://bugzilla.redhat.com/show_bug.cgi?id=463991 - instead of checking for dbenv->foo_handle to see if a db "feature" is enabled, instead check the flags passed to open the dbenv. This works for bdb 4.2 through bdb 4.7 and probably other releases as well.
Platforms tested: RHEL5 x86_64, Fedora 8 i386
Flag Day: no
Doc impact: no
Index: aclerror.cpp
===================================================================
RCS file: /cvs/dirsec/ldapserver/lib/libaccess/aclerror.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- aclerror.cpp 10 Nov 2006 23:46:02 -0000 1.8
+++ aclerror.cpp 8 Oct 2008 17:29:05 -0000 1.9
@@ -100,7 +100,7 @@
void aclErrorFmt(NSErr_t * errp, char * msgbuf, int maxlen, int maxdepth)
{
NSEFrame_t * efp; /* error frame pointer */
- int len; /* length of error message text */
+ int len = 0; /* length of error message text */
int depth = 0; /* current depth */
msgbuf[0] = 0;
Index: acltools.cpp
===================================================================
RCS file: /cvs/dirsec/ldapserver/lib/libaccess/acltools.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- acltools.cpp 18 Oct 2007 00:08:36 -0000 1.8
+++ acltools.cpp 8 Oct 2008 17:29:05 -0000 1.9
@@ -3060,7 +3060,7 @@
const int block_size = 50;
int rv, list_size, list_index;
- char ** local_list;
+ char ** local_list = NULL;
char * block ;
char * name;
char * next;
Index: lasdns.cpp
===================================================================
RCS file: /cvs/dirsec/ldapserver/lib/libaccess/lasdns.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- lasdns.cpp 10 Nov 2006 23:46:02 -0000 1.8
+++ lasdns.cpp 8 Oct 2008 17:29:05 -0000 1.9
@@ -140,7 +140,7 @@
size_t delimiter; /* length of valid token */
char token[256]; /* max length dns name */
int i;
- int ipcnt;
+ int ipcnt = 0;
char **p;
unsigned long *ipaddrs=0;
pool_handle_t *pool;
@@ -347,7 +347,7 @@
int result;
int aliasflg;
char *my_dns;
- LASDnsContext_t *context;
+ LASDnsContext_t *context = NULL;
int rv;
*cachable = ACL_INDEF_CACHABLE;
Index: lasip.cpp
===================================================================
RCS file: /cvs/dirsec/ldapserver/lib/libaccess/lasip.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- lasip.cpp 10 Nov 2006 23:46:02 -0000 1.7
+++ lasip.cpp 8 Oct 2008 17:29:05 -0000 1.8
@@ -340,7 +340,7 @@
int stopbit; /* Don't care after this point */
int curbit; /* current bit we're working on */
int curval; /* value of pattern[curbit] */
- LASIpTree_t *curptr; /* pointer to the current node */
+ LASIpTree_t *curptr = NULL; /* pointer to the current node */
LASIpTree_t *newptr;
/* stop at the first 1 in the netmask from low to high */
@@ -448,7 +448,7 @@
IPAddr_t ip;
int retcode;
LASIpTree_t *node;
- LASIpContext_t *context;
+ LASIpContext_t *context = NULL;
int rv;
char ip_str[124];
Index: ldapacl.cpp
===================================================================
RCS file: /cvs/dirsec/ldapserver/lib/libaccess/ldapacl.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ldapacl.cpp 10 Nov 2006 23:46:02 -0000 1.6
+++ ldapacl.cpp 8 Oct 2008 17:29:05 -0000 1.7
@@ -762,7 +762,7 @@
PList_t resource = 0;
PList_t auth_info = 0;
PList_t global_auth = NULL;
- int rv;
+ int rv = 0;
/* Check if the userdn is available in the usr_cache */
if (acl_usr_cache_enabled() && userdn) {
Index: oneeval.cpp
===================================================================
RCS file: /cvs/dirsec/ldapserver/lib/libaccess/oneeval.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- oneeval.cpp 18 Oct 2007 00:08:36 -0000 1.8
+++ oneeval.cpp 8 Oct 2008 17:29:05 -0000 1.9
@@ -344,7 +344,7 @@
ACLHandle_t *acl;
ACLExprHandle_t *ace;
int ace_cnt = -1;
- ACLAceEntry_t *acelast, *new_ace;
+ ACLAceEntry_t *acelast = NULL, *new_ace;
ACLAceNumEntry_t *entry, *temp_entry;
char **argp;
ACLListCache_t *cache;
@@ -635,7 +635,7 @@
int i, j, right_num, delta;
ACLCachable_t ace_cachable;
int result;
- int absolute;
+ int absolute = 0;
int skipflag;
int g_num; /* index into the generic rights array. */
char **g_rights;
15 years, 5 months
[Fedora-directory-commits] ldapserver/lib/ldaputil certmap.c, 1.8, 1.9 ldapauth.c, 1.7, 1.8 ldapdb.c, 1.6, 1.7
by Richard Allen Megginson
Author: rmeggins
Update of /cvs/dirsec/ldapserver/lib/ldaputil
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv26931/ldapserver/lib/ldaputil
Modified Files:
certmap.c ldapauth.c ldapdb.c
Log Message:
Bug Description: Need to address 64-bit compiler warnings - part 1
Reviewed by: nhosoi (Thanks!)
Fix Description: The intptr_t and uintptr_t are types which are defined as integer types that are the same size as the pointer (void *) type. On the platforms we currently support, this is the same as long and unsigned long, respectively (ILP32 and LP64). However, intptr_t and uintptr_t are more portable. These can be used to assign a value passed as a void * to get an integer value, then "cast down" to an int or PRBool, and vice versa. This seems to be a common idiom in other applications where values must be passed as void *.
For the printf/scanf formats, there is a standard header called inttypes.h which defines formats to use for various 64 bit quantities, so that you don't need to figure out if you have to use %lld or %ld for a 64-bit value - you just use PRId64 which is set to the correct value. I also assumed that size_t is defined as the same size as a pointer so I used the PRIuPTR format macro for size_t.
I removed many unused variables and some unused functions.
I put parentheses around assignments in conditional expressions to tell the compiler not to complain about them.
I cleaned up some #defines that were defined more than once.
I commented out some unused goto labels.
Some of our header files shared among several source files define static variables. I made it so that those variables are not defined unless a macro is set in the source file. This avoids a lot of unused variable warnings.
I added some return values to functions that were declared as returning a value but did not return a value. In all of these cases no one was checking the return value anyway.
I put explicit parentheses around cases like this: expr || expr && expr - the && has greater precedence than the ||. The compiler complains because it wants you to make sure you mean expr || (expr && expr), not (expr || expr) && expr.
I cleaned up several places where the compiler was complaining about possible use of uninitialized variables. There are still a lot of these cases remaining.
There are a lot of warnings like this:
lib/ldaputil/certmap.c:1279: warning: dereferencing type-punned pointer will break strict-aliasing rules
These are due to our use of void ** to pass in addresses of addresses of structures. Many of these are calls to slapi_ch_free, but many are not - they are cases where we do not know what the type is going to be and may have to cast and modify the structure or pointer. I started replacing the calls to slapi_ch_free with slapi_ch_free_string, but there are many many more that need to be fixed.
The dblayer code also contains a fix for https://bugzilla.redhat.com/show_bug.cgi?id=463991 - instead of checking for dbenv->foo_handle to see if a db "feature" is enabled, instead check the flags passed to open the dbenv. This works for bdb 4.2 through bdb 4.7 and probably other releases as well.
Platforms tested: RHEL5 x86_64, Fedora 8 i386
Flag Day: no
Doc impact: no
Index: certmap.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/lib/ldaputil/certmap.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- certmap.c 18 Oct 2007 00:08:36 -0000 1.8
+++ certmap.c 8 Oct 2008 17:29:05 -0000 1.9
@@ -55,6 +55,7 @@
#include <key.h>
#include <cert.h>
+#define DEFINE_LDAPU_STRINGS 1
#include <ldaputil/certmap.h>
#include <ldaputil/ldapauth.h>
#include <ldaputil/errors.h>
@@ -300,7 +301,8 @@
int rv;
while(node) {
- rv = (int)(*print_fn)(node->info, pinfo);
+ uintptr_t retval = (uintptr_t)(*print_fn)(node->info, pinfo);
+ rv = (int)retval;
if (rv != LDAPU_SUCCESS) return rv;
node = node->next;
}
@@ -1691,6 +1693,7 @@
char *ptr;
int eof;
int rv;
+ uintptr_t retval;
LDAPUPrintInfo_t pinfo;
#ifdef XP_WIN32
@@ -1730,7 +1733,8 @@
pinfo.fp = tfp;
pinfo.arg = default_certmap_info->issuerName;
- rv = (int)ldapu_certinfo_print (default_certmap_info, &pinfo);
+ retval = (uintptr_t)ldapu_certinfo_print (default_certmap_info, &pinfo);
+ rv = (int)retval;
if (rv != LDAPU_SUCCESS) {
fclose(tfp);
Index: ldapauth.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/lib/ldaputil/ldapauth.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ldapauth.c 10 Nov 2006 23:46:00 -0000 1.7
+++ ldapauth.c 8 Oct 2008 17:29:05 -0000 1.8
@@ -53,6 +53,7 @@
#include <ldap.h>
#include <prprf.h>
+#define DEFINE_LDAPU_STRINGS 1
#include <ldaputil/certmap.h>
#include <ldaputil/errors.h>
#include <ldaputil/ldapauth.h>
Index: ldapdb.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/lib/ldaputil/ldapdb.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ldapdb.c 10 Nov 2006 23:46:00 -0000 1.6
+++ ldapdb.c 8 Oct 2008 17:29:05 -0000 1.7
@@ -171,7 +171,10 @@
LDAPHostEnt *result, char *buffer, int buflen, int *statusp,
void *extradata )
{
+ /* old code did this which was clearly wrong:
return( (LDAPHostEnt *)PR_GetError() );
+ which leads me to believe this is not used */
+ return( NULL );
}
#endif /* LDAP_OPT_DNS_FN_PTRS */
15 years, 5 months