[prev in list] [next in list] [prev in thread] [next in thread]
List: fedora-directory-devel
Subject: [389-devel] Please review: various compiler warnings in adminutil, admin, dsgw
From: Rich Megginson <rmeggins () redhat ! com>
Date: 2013-08-15 21:50:55
Message-ID: 520D4D3F.4040903 () redhat ! com
[Download RAW message or body]
["0001-fix-mem-leak-in-admldapBuildInfoSSL-when-there-is-no.patch" (text/x-patch)]
From 41a05f031694a46786ffbd29c61b122fe2d56e3b Mon Sep 17 00:00:00 2001
From: Rich Megginson <rmeggins@redhat.com>
Date: Tue, 13 Aug 2013 10:05:11 -0600
Subject: [PATCH 1/3] fix mem leak in admldapBuildInfoSSL when there is no password
---
lib/libadmsslutil/admsslutil.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/lib/libadmsslutil/admsslutil.c b/lib/libadmsslutil/admsslutil.c
index 7ea9eb0..a86c37c 100644
--- a/lib/libadmsslutil/admsslutil.c
+++ b/lib/libadmsslutil/admsslutil.c
@@ -106,6 +106,7 @@ admldapBuildInfoSSL(AdmldapInfo info, int *errorcode)
} else {
/* no password means just punt rather than do anon bind */
/* this mimics the same logic in admldapBuildInfoCbk() */
+ ldap_unbind_ext(ld, NULL, NULL);
*errorcode = ADMUTIL_LDAP_ERR;
return 1; /* have to return true here to mimic admldapBuildInfoCbk() */
}
--
1.7.1
["0002-fix-compiler-warnings.patch" (text/x-patch)]
From fc4f333b5f3f9fd330a15b9bfedd99d0c1a3e323 Mon Sep 17 00:00:00 2001
From: Rich Megginson <rmeggins@redhat.com>
Date: Thu, 15 Aug 2013 15:01:22 -0600
Subject: [PATCH 2/3] fix compiler warnings
---
lib/libadminutil/acclanglist.c | 6 ++--
lib/libadminutil/admutil.c | 67 +++------------------------------------
lib/libadminutil/form_post.c | 4 +-
lib/libadminutil/psetc.c | 3 +-
lib/libadmsslutil/admsslutil.c | 13 --------
5 files changed, 12 insertions(+), 81 deletions(-)
diff --git a/lib/libadminutil/acclanglist.c b/lib/libadminutil/acclanglist.c
index 903be02..671dfcc 100644
--- a/lib/libadminutil/acclanglist.c
+++ b/lib/libadminutil/acclanglist.c
@@ -54,8 +54,8 @@ AcceptLangList(const char* AcceptLanguage,
char* cPtr;
char* cPtr1;
char* cPtr2;
- int i;
- int j;
+ size_t i;
+ size_t j;
size_t countLang = 0;
input = strdup(AcceptLanguage);
@@ -145,7 +145,7 @@ static int
langIsInList(const char *lang, size_t listsize, ACCEPT_LANGUAGE_LIST accll)
{
int retval = 0;
- int ii;
+ size_t ii;
for (ii = 0; !retval && (ii < listsize); ++ii) {
if (!strcmp(lang, accll[ii])) {
diff --git a/lib/libadminutil/admutil.c b/lib/libadminutil/admutil.c
index b4e12dd..bf04c10 100644
--- a/lib/libadminutil/admutil.c
+++ b/lib/libadminutil/admutil.c
@@ -37,20 +37,6 @@
#define strcasecmp stricmp
#define strncasecmp _strnicmp
#endif
-
-#ifdef XP_UNIX
-/*
- * Version information for the 'ident' and 'what commands
- *
- * NOTE: the first component of the concatenated rcsid string
- * must not end in a '$' to prevent rcs keyword substitution.
- */
-static char rcsid[] = "$Header: AdminUtil " ADMSDK_PRODUCT
- " " ADMSDK_BUILDNUM " $";
-static char sccsid[] = "@(#)AdminUtil " ADMSDK_PRODUCT
- " " ADMSDK_BUILDNUM;
-#endif /* XP_UNIX */
-
/* Max size for a pathname */
#ifndef PATH_MAX
@@ -2286,17 +2272,19 @@ admutil_ldap_init(
#if defined(USE_OPENLDAP)
char *certdir = admldapGetSecurityDir(info);
int optval = 0;
+#else
+ LDAP *myld = NULL;
#endif /* !USE_OPENLDAP */
int ssl_strength = 0;
- LDAP *myld = NULL;
+#if !defined(USE_OPENLDAP)
/* we can only use the set functions below with a real
LDAP* if it has already gone through ldapssl_init -
so, use NULL if using starttls */
if (secure == 1) {
myld = ld;
}
-
+#endif
/* verify certificate only */
#if defined(USE_OPENLDAP)
ssl_strength = LDAP_OPT_X_TLS_NEVER;
@@ -2414,55 +2402,12 @@ admutil_ldap_bind(
{
int rc = LDAP_SUCCESS;
int err = LDAP_SUCCESS;
- int secure = 0;
struct berval bvcreds = {0, NULL};
LDAPMessage *result = NULL;
struct berval *servercredp = NULL;
-#if defined(USE_OPENLDAP)
- /* openldap doesn't have a SSL/TLS yes/no flag - so grab the
- ldapurl, parse it, and see if it is a secure one */
- char *ldapurl = NULL;
- ldap_get_option(ld, LDAP_OPT_URI, &ldapurl);
- if (ldapurl && !PL_strncasecmp(ldapurl, "ldaps", 5)) {
- secure = 1;
- }
- PL_strfree(ldapurl);
- ldapurl = NULL;
-#else /* !USE_OPENLDAP */
- ldap_get_option(ld, LDAP_OPT_SSL, &secure);
-#endif
-
-#ifdef EXTERNAL_AUTH_SUPPORTED
- if (secure && mech && !strcmp(mech, LDAP_SASL_EXTERNAL)) {
- /* SSL connections will use the server's security context
- and cert for client auth */
- rc = slapd_SSL_client_auth(ld);
-
- if (rc != 0) {
-#ifdef DEBUG
- fprintf(stderr, "admutil_ldap_bind: "
- "Error: could not configure the server for cert "
- "auth - error %d - make sure the server is "
- "correctly configured for SSL/TLS\n", rc);
-#endif
- goto done;
- } else {
-#ifdef DEBUG
- fprintf(stderr, "admutil_ldap_bind: "
- "Set up conn to use client auth\n");
-#endif
- }
- bvcreds.bv_val = NULL; /* ignore username and passed in creds */
- bvcreds.bv_len = 0; /* for external auth */
- bindid = NULL;
- } else { /* other type of auth */
-#endif /* EXTERNAL_AUTH_SUPPORTED */
- bvcreds.bv_val = (char *)creds;
- bvcreds.bv_len = creds ? strlen(creds) : 0;
-#ifdef EXTERNAL_AUTH_SUPPORTED
- }
-#endif /* EXTERNAL_AUTH_SUPPORTED */
+ bvcreds.bv_val = (char *)creds;
+ bvcreds.bv_len = creds ? strlen(creds) : 0;
/* The connection has been set up - now do the actual bind, depending on
the mechanism and arguments */
diff --git a/lib/libadminutil/form_post.c b/lib/libadminutil/form_post.c
index cbe5299..9bc9e41 100644
--- a/lib/libadminutil/form_post.c
+++ b/lib/libadminutil/form_post.c
@@ -174,13 +174,13 @@ PR_IMPLEMENT(void)
unescape_entities(char *s)
{
int idx;
- char *p, *r, *d;
+ char *p, *r;
if (!s || !*s) {
return;
}
- d = r = s;
+ r = s;
for ( p = s; *p != '\0'; LDAP_UTF8INC( p )) {
if ( ((*p) & 0x80) == 0 && ( (*p) == '&') ) {
for( idx = 0; idx < entitynum; ++idx ) {
diff --git a/lib/libadminutil/psetc.c b/lib/libadminutil/psetc.c
index 42d0871..6a09638 100644
--- a/lib/libadminutil/psetc.c
+++ b/lib/libadminutil/psetc.c
@@ -1109,13 +1109,12 @@ psetRootModAttribute(PsetRootPtr psetRoot, int mode, NameType name,
{
PsetPtr pset = NULL;
LDAPMod **mods;
- int nameLen, nodeFlag, errorcode;
+ int nodeFlag, errorcode;
char namebuf[256];
char *attrName, *nodeName;
ValueType valsptr;
PsetNodePtr nodePtr;
- nameLen = PL_strlen(name);
PR_snprintf(namebuf, sizeof(namebuf), "%s", name);
attrName = strrchr(namebuf, '.');
if (!attrName) {
diff --git a/lib/libadmsslutil/admsslutil.c b/lib/libadmsslutil/admsslutil.c
index a86c37c..1ba0dfa 100644
--- a/lib/libadmsslutil/admsslutil.c
+++ b/lib/libadmsslutil/admsslutil.c
@@ -51,19 +51,6 @@
#define SECURITY_ATTR "configuration.nsServerSecurity"
-#ifdef XP_UNIX
-/*
- * Version information for the 'ident' and 'what commands
- *
- * NOTE: the first component of the concatenated rcsid string
- * must not end in a '$' to prevent rcs keyword substitution.
- */
-static char rcsid[] = "$Header: AdminUtil " ADMSDK_PRODUCT
- " " ADMSDK_BUILDNUM " $";
-static char sccsid[] = "@(#)AdminUtil " ADMSDK_PRODUCT
- " " ADMSDK_BUILDNUM;
-#endif /* XP_UNIX */
-
void servssl_error(char *fmt, ...);
char custom_file[BIG_LINE] = "";
--
1.7.1
["0002-fix-compiler-warnings.patch" (text/x-patch)]
From 6198857fb3f4644a32d608d6b34ae73329c551b8 Mon Sep 17 00:00:00 2001
From: Rich Megginson <rmeggins@redhat.com>
Date: Thu, 15 Aug 2013 15:03:44 -0600
Subject: [PATCH 2/4] fix compiler warnings
---
admserv/cgi-src40/admpw.c | 4 +-
admserv/cgi-src40/config.c | 9 ++----
admserv/cgi-src40/dsconfig.c | 1 +
admserv/cgi-src40/htmladmin.c | 1 +
admserv/cgi-src40/monreplication.c | 1 +
admserv/cgi-src40/restartsrv.c | 1 +
admserv/cgi-src40/sec-activate.c | 1 +
admserv/cgi-src40/statpingserv.c | 1 +
admserv/cgi-src40/stopsrv.c | 1 +
admserv/cgi-src40/ugdsconfig.c | 1 +
admserv/cgi-src40/viewdata.c | 1 +
admserv/cgi-src40/viewlog.c | 1 +
include/libadmin/dbtlibadmin.h | 2 -
lib/base/file.cpp | 8 -----
lib/base/nscputil.cpp | 5 ++-
lib/libadmin/util.c | 53 ++++-------------------------------
lib/libdsa/dsalib_util.c | 8 -----
mod_admserv/mod_admserv.c | 5 +---
18 files changed, 25 insertions(+), 79 deletions(-)
diff --git a/admserv/cgi-src40/admpw.c b/admserv/cgi-src40/admpw.c
index ff0dc6c..e695881 100644
--- a/admserv/cgi-src40/admpw.c
+++ b/admserv/cgi-src40/admpw.c
@@ -73,11 +73,10 @@ sha1_pw_enc(const char *pwd)
unsigned char hash[SHA1_LENGTH];
char *enc;
char *retval;
- SECStatus rc;
int32 pwdlen = strlen(pwd);
/* SHA1 hash the user's key */
- rc = PK11_HashBuf(SEC_OID_SHA1, hash, (unsigned char *)pwd, pwdlen);
+ PK11_HashBuf(SEC_OID_SHA1, hash, (unsigned char *)pwd, pwdlen);
/* convert to base64 */
if (!(enc = BTOA_DataToAscii(hash, sizeof(hash)))) {
return NULL;
@@ -181,6 +180,7 @@ int main(int argc, char *argv[])
int errorcode = 0;
char *configdir = util_get_conf_dir();
+ (void)_ai; /* get rid of unused variable warning */
logMsg(" In %s\n", argv[0]);
i18nInit();
diff --git a/admserv/cgi-src40/config.c b/admserv/cgi-src40/config.c
index 74e0a0c..ddb4af3 100644
--- a/admserv/cgi-src40/config.c
+++ b/admserv/cgi-src40/config.c
@@ -155,9 +155,8 @@ int main(int argc, char *argv[])
char **inputs = 0;
char *operation = 0;
char *qs = 0;
- char *nameptr, *valptr, *val;
+ char *nameptr, *valptr;
char error_info[128];
- char *valsbuf[2];
int setFlag = 0, getFlag = 0, forceSetFlag = 0;
int ignorePsetErrors = 0;
AttributeList resultList, nvl;
@@ -176,11 +175,9 @@ int main(int argc, char *argv[])
while (waitforever);
#endif
+ (void)_ai; /* get rid of unused variable warning */
i18nResource = res_find_and_init_resource(PROPERTYDIR, RESOURCE_FILE);
- valsbuf[0] = NULL;
- valsbuf[1] = NULL;
-
memset((void *)errp, 0, sizeof(int));
method = getenv("REQUEST_METHOD");
@@ -620,7 +617,7 @@ int main(int argc, char *argv[])
#endif
errorCode = PSET_OP_OK;
- val = psetGetAttrSingleValue(pset, nameptr, &errorCode);
+ (void)psetGetAttrSingleValue(pset, nameptr, &errorCode);
if (errorCode && !ignorePsetErrors) {
if (forceSetFlag)
addSingleValueAttribute(addList, j++, nameptr, valptr);
diff --git a/admserv/cgi-src40/dsconfig.c b/admserv/cgi-src40/dsconfig.c
index 899836b..b35826e 100644
--- a/admserv/cgi-src40/dsconfig.c
+++ b/admserv/cgi-src40/dsconfig.c
@@ -159,6 +159,7 @@ int main(int argc, char *argv[])
logMsg(" In %s\n", argv[0]);
+ (void)_ai; /* get rid of unused variable warning */
i18nInit();
/* GET or POST method */
diff --git a/admserv/cgi-src40/htmladmin.c b/admserv/cgi-src40/htmladmin.c
index 7110526..b168ce7 100644
--- a/admserv/cgi-src40/htmladmin.c
+++ b/admserv/cgi-src40/htmladmin.c
@@ -1582,6 +1582,7 @@ int main(int argc, char *argv[])
const char *configdir = util_get_conf_dir();
const char *secdir = util_get_security_dir();
+ (void)_ai; /* get rid of unused variable warning */
i18nResource = res_find_and_init_resource(PROPERTYDIR, RESOURCE_FILE);
acceptLanguage = "en";
if (lang) acceptLanguage = strdup(lang);
diff --git a/admserv/cgi-src40/monreplication.c b/admserv/cgi-src40/monreplication.c
index 253dcaf..2b07038 100644
--- a/admserv/cgi-src40/monreplication.c
+++ b/admserv/cgi-src40/monreplication.c
@@ -85,6 +85,7 @@ int main(int argc, char *argv[])
char configfile[256] = {'\0'};
char *resstr;
+ (void)_ai; /* get rid of unused variable warning */
i18nInit();
fprintf(stdout, "Content-type: text/html;charset=utf-8\n\n");
diff --git a/admserv/cgi-src40/restartsrv.c b/admserv/cgi-src40/restartsrv.c
index 87e76bf..69d8853 100644
--- a/admserv/cgi-src40/restartsrv.c
+++ b/admserv/cgi-src40/restartsrv.c
@@ -125,6 +125,7 @@ int main(int argc, char *argv[])
char *acceptLanguage = (char*)"en", *lang=getenv((char*)"HTTP_ACCEPT_LANGUAGE");
Resource *i18nResource = NULL;
+ (void)_ai; /* get rid of unused variable warning */
i18nResource = res_find_and_init_resource(PROPERTYDIR, RESOURCE_FILE);
if (lang) acceptLanguage = strdup(lang);
diff --git a/admserv/cgi-src40/sec-activate.c b/admserv/cgi-src40/sec-activate.c
index a36f75f..6ae70ed 100644
--- a/admserv/cgi-src40/sec-activate.c
+++ b/admserv/cgi-src40/sec-activate.c
@@ -499,6 +499,7 @@ int main(int argc, char *argv[])
AdmldapInfo ldapInfo = NULL;
char *lang;
+ (void)_ai; /* get rid of unused variable warning */
memset((void *)errp, 0, sizeof(int));
method = getenv("REQUEST_METHOD");
diff --git a/admserv/cgi-src40/statpingserv.c b/admserv/cgi-src40/statpingserv.c
index d6e55f7..3fc5616 100644
--- a/admserv/cgi-src40/statpingserv.c
+++ b/admserv/cgi-src40/statpingserv.c
@@ -75,6 +75,7 @@ int main(int argc, char *argv[])
char *portstr;
struct PRFileInfo64 prfileinfo;
+ (void)_ai; /* get rid of unused variable warning */
m = getenv("REQUEST_METHOD");
if(!strcmp(m, "GET")) {
diff --git a/admserv/cgi-src40/stopsrv.c b/admserv/cgi-src40/stopsrv.c
index 436989e..b2b83c9 100644
--- a/admserv/cgi-src40/stopsrv.c
+++ b/admserv/cgi-src40/stopsrv.c
@@ -85,6 +85,7 @@ int main(int argc, char *argv[])
char *return_format = NULL;
char *qs = 0;
+ (void)_ai; /* get rid of unused variable warning */
i18nResource = res_find_and_init_resource(PROPERTYDIR, RESOURCE_FILE);
if (lang) acceptLanguage = strdup(lang);
diff --git a/admserv/cgi-src40/ugdsconfig.c b/admserv/cgi-src40/ugdsconfig.c
index 9be5332..0b23d93 100644
--- a/admserv/cgi-src40/ugdsconfig.c
+++ b/admserv/cgi-src40/ugdsconfig.c
@@ -179,6 +179,7 @@ int main(int argc, char *argv[])
const char *configdir = util_get_conf_dir();
const char *secdir = util_get_security_dir();
+ (void)_ai; /* get rid of unused variable warning */
logMsg(" In %s\n", argv[0]);
i18nInit();
diff --git a/admserv/cgi-src40/viewdata.c b/admserv/cgi-src40/viewdata.c
index 7dd5d80..5cba168 100644
--- a/admserv/cgi-src40/viewdata.c
+++ b/admserv/cgi-src40/viewdata.c
@@ -412,6 +412,7 @@ int main(int argc, char *argv[])
AdmldapInfo ldapInfo = get_adm_ldapinfo(configdir, secdir);
+ (void)_ai; /* get rid of unused variable warning */
i18nInit();
if(!get_bindinfo(&binddn, &bindpw))
diff --git a/admserv/cgi-src40/viewlog.c b/admserv/cgi-src40/viewlog.c
index e4ec208..4a36780 100644
--- a/admserv/cgi-src40/viewlog.c
+++ b/admserv/cgi-src40/viewlog.c
@@ -341,6 +341,7 @@ int main(int argc, char *argv[])
int rc = 0;
char *configdir = NULL;
+ (void)_ai; /* get rid of unused variable warning */
i18nInit();
fprintf(stdout, "Content-type: text/html;charset=utf-8\n\n");
diff --git a/include/libadmin/dbtlibadmin.h b/include/libadmin/dbtlibadmin.h
index 24048c7..9c40647 100644
--- a/include/libadmin/dbtlibadmin.h
+++ b/include/libadmin/dbtlibadmin.h
@@ -21,8 +21,6 @@
#define LIBRARY_NAME "libadmin"
-static char dbtlibadminid[] = "$DBT: libadmin referenced v1 $";
-
#include "i18n.h"
BEGIN_STR(libadmin)
diff --git a/lib/base/file.cpp b/lib/base/file.cpp
index ac2ece6..0ca4c9b 100644
--- a/lib/base/file.cpp
+++ b/lib/base/file.cpp
@@ -483,19 +483,11 @@ NSAPI_PUBLIC int system_errmsg_fn(char **buff, size_t maxlen)
char static_error[128];
char *lmsg = 0; /* Local message pointer */
size_t msglen = 0;
- int sys_error = 0;
PRErrorCode nscp_error;
#ifdef XP_WIN32
LPTSTR sysmsg = 0;
#endif
-
- /* Grab the OS error message */
-#ifdef XP_WIN32
- sys_error = GetLastError();
-#else
- sys_error = errno;
-#endif
nscp_error = PR_GetError();
/* If there is a NSPR error, but it is "unknown", try to get the OSError
diff --git a/lib/base/nscputil.cpp b/lib/base/nscputil.cpp
index 77e7a6e..1fb6a27 100644
--- a/lib/base/nscputil.cpp
+++ b/lib/base/nscputil.cpp
@@ -833,11 +833,12 @@ util_waitpid(pid_t pid, int *statptr, int options)
for(rv = 0; !rv; PR_Sleep(500)) {
rv = waitpid(pid, statptr, options | WNOHANG);
if (rv == -1) {
- if (errno == EINTR)
+ if (errno == EINTR) {
rv = 0; /* sleep and try again */
- else
+ } else {
// ereport(LOG_WARN, "waitpid failed for pid %d:%s", pid, system_errmsg());
;
+ }
}
}
return rv;
diff --git a/lib/libadmin/util.c b/lib/libadmin/util.c
index be651b4..29c77b5 100644
--- a/lib/libadmin/util.c
+++ b/lib/libadmin/util.c
@@ -1558,17 +1558,19 @@ util_ldap_init(
if (secure > 0) {
#if defined(USE_OPENLDAP)
int optval = 0;
+#else
+ LDAP *myld = NULL;
#endif /* !USE_OPENLDAP */
int ssl_strength = 0;
- LDAP *myld = NULL;
+#if !defined(USE_OPENLDAP)
/* we can only use the set functions below with a real
LDAP* if it has already gone through ldapssl_init -
so, use NULL if using starttls */
if (secure == 1) {
myld = ld;
}
-
+#endif
/* verify certificate only */
#if defined(USE_OPENLDAP)
ssl_strength = LDAP_OPT_X_TLS_NEVER;
@@ -1683,55 +1685,12 @@ util_ldap_bind(
{
int rc = LDAP_SUCCESS;
int err = LDAP_SUCCESS;
- int secure = 0;
struct berval bvcreds = {0, NULL};
LDAPMessage *result = NULL;
struct berval *servercredp = NULL;
-#if defined(USE_OPENLDAP)
- /* openldap doesn't have a SSL/TLS yes/no flag - so grab the
- ldapurl, parse it, and see if it is a secure one */
- char *ldapurl = NULL;
-
- ldap_get_option(ld, LDAP_OPT_URI, &ldapurl);
- if (ldapurl && !PL_strncasecmp(ldapurl, "ldaps", 5)) {
- secure = 1;
- }
- PL_strfree(ldapurl);
- ldapurl = NULL;
-#else /* !USE_OPENLDAP */
- ldap_get_option(ld, LDAP_OPT_SSL, &secure);
-#endif
-#ifdef EXTERNAL_AUTH_SUPPORTED
- if (secure && mech && !strcmp(mech, LDAP_SASL_EXTERNAL)) {
- /* SSL connections will use the server's security context
- and cert for client auth */
- rc = slapd_SSL_client_auth(ld);
-
- if (rc != 0) {
-#ifdef DEBUG
- fprintf(stderr, "util_ldap_bind: "
- "Error: could not configure the server for cert "
- "auth - error %d - make sure the server is "
- "correctly configured for SSL/TLS\n", rc);
-#endif
- goto done;
- } else {
-#ifdef DEBUG
- fprintf(stderr, "util_ldap_bind: "
- "Set up conn to use client auth\n");
-#endif
- }
- bvcreds.bv_val = NULL; /* ignore username and passed in creds */
- bvcreds.bv_len = 0; /* for external auth */
- bindid = NULL;
- } else { /* other type of auth */
-#endif /* EXTERNAL_AUTH_SUPPORTED */
- bvcreds.bv_val = (char *)creds;
- bvcreds.bv_len = creds ? strlen(creds) : 0;
-#ifdef EXTERNAL_AUTH_SUPPORTED
- }
-#endif /* EXTERNAL_AUTH_SUPPORTED */
+ bvcreds.bv_val = (char *)creds;
+ bvcreds.bv_len = creds ? strlen(creds) : 0;
/* The connection has been set up - now do the actual bind, depending on
the mechanism and arguments */
diff --git a/lib/libdsa/dsalib_util.c b/lib/libdsa/dsalib_util.c
index da875df..803f86d 100644
--- a/lib/libdsa/dsalib_util.c
+++ b/lib/libdsa/dsalib_util.c
@@ -402,18 +402,10 @@ ds_system_errmsg(void)
static char static_error[BUFSIZ];
char *lmsg = 0; /* Local message pointer */
size_t msglen = 0;
- int sys_error = 0;
#ifdef XP_WIN32
LPTSTR sysmsg = 0;
#endif
- /* Grab the OS error message */
-#ifdef XP_WIN32
- sys_error = GetLastError();
-#else
- sys_error = errno;
-#endif
-
#if defined(XP_WIN32)
msglen = FormatMessage(
FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_ALLOCATE_BUFFER,
diff --git a/mod_admserv/mod_admserv.c b/mod_admserv/mod_admserv.c
index 9eca803..744364c 100644
--- a/mod_admserv/mod_admserv.c
+++ b/mod_admserv/mod_admserv.c
@@ -2641,7 +2641,7 @@ static int
authenticate_user(LdapServerData *data, char *baseDN, char *user, const char *pw, request_rec *r)
{
LDAP *server;
- char *uid, *userdn, *ldapURL;
+ char *userdn, *ldapURL;
int ldapError = LDAP_SUCCESS;
int pw_expiring = 0;
int tries = 0;
@@ -2686,13 +2686,10 @@ authenticate_user(LdapServerData *data, char *baseDN, char *user, const char *pw
return DECLINED; /* fall back to final check against admpw */
}
-
- uid = user;
} else {
/* it's a DN */
userdn = user;
- uid = NULL;
/* strip the leading "ldap:", if present */
--
1.7.1
["0002-fix-compiler-warnings.patch" (text/x-patch)]
From c7e28b29d092539ed2f7f4e20785d5bd5cba115b Mon Sep 17 00:00:00 2001
From: Rich Megginson <rmeggins@redhat.com>
Date: Thu, 15 Aug 2013 15:41:51 -0600
Subject: [PATCH 2/2] fix compiler warnings
---
doauth.c | 8 ++------
emitf.c | 4 +++-
htmlout.c | 3 +--
htmlparse.c | 2 --
newentry.c | 2 --
sort.c | 6 +++++-
tmplout.c | 7 ++-----
unauth.c | 6 ++----
8 files changed, 15 insertions(+), 23 deletions(-)
diff --git a/doauth.c b/doauth.c
index 5fe0472..18fbb4a 100644
--- a/doauth.c
+++ b/doauth.c
@@ -27,13 +27,9 @@ static void do_autherror( int rc, char *msg, char *lderrtxt,
int ommitclosebutton );
-int main( argc, argv, env )
- int argc;
- char *argv[];
+int main( int argc, char *argv[] )
{
- int reqmethod;
-
- reqmethod = dsgw_init( argc, argv, DSGW_METHOD_POST );
+ (void)dsgw_init( argc, argv, DSGW_METHOD_POST );
post_request();
diff --git a/emitf.c b/emitf.c
index b20e5f9..dc9a39d 100644
--- a/emitf.c
+++ b/emitf.c
@@ -309,7 +309,9 @@ dsgw_vxprintf (dsgw_producer produce, void* parm,
}
}
if (aslot == islot) { /* No slot refers to this arg. */
- if (va_arg (argl, const char*)); /* Skip over it. */
+ if (va_arg (argl, const char*)) {
+ ; /* Skip over it. */
+ }
} else {
/*fprintf (stderr, " %i:%i", (int)(aslot-slot), aslot->type);*/
switch (aslot->type) {
diff --git a/htmlout.c b/htmlout.c
index f49b34a..7be0e10 100644
--- a/htmlout.c
+++ b/htmlout.c
@@ -460,7 +460,7 @@ dsgw_emit_confirm_script()
{
char *yes_key_str = dsgw_get_cgi_var("YES", DSGW_CGIVAR_OPTIONAL);
/* char *no_key_str = dsgw_get_cgi_var("NO", DSGW_CGIVAR_OPTIONAL); unused apparently */
- int yes_key, no_key;
+ int yes_key;
char *yes = NULL, *no = NULL;
if (!yes_key_str) {
@@ -476,7 +476,6 @@ dsgw_emit_confirm_script()
} else if (!strcasecmp(yes_key_str, "CONFIRMVALUE5")) {
yes_key = DBT_confirmValue5;
}
- no_key = 0; /* unused apparently */
yes = XP_GetClientStr(yes_key);
diff --git a/htmlparse.c b/htmlparse.c
index 187ed2d..1326238 100644
--- a/htmlparse.c
+++ b/htmlparse.c
@@ -655,14 +655,12 @@ int *argc
)
{
char **vars = (char **) NULL;
- register int x;
int isvar;
char scratch[BIG_LINE];
char lastchar, *p;
int numvars = 0;
isvar = -1;
- x = 0;
scratch[0] = '\0';
lastchar = ' ';
diff --git a/newentry.c b/newentry.c
index 6110184..ce49170 100644
--- a/newentry.c
+++ b/newentry.c
@@ -31,7 +31,6 @@ emit_file (char* filename, dsgwnewtype* entType)
auto char line[ BIG_LINE ];
auto int argc;
auto char **argv;
- char *deleteme = NULL;
while ( dsgw_next_html_line( html, line )) {
if ( dsgw_parse_line( line, &argc, &argv, 0, dsgw_simple_cond_is_true, NULL )) {
@@ -106,7 +105,6 @@ emit_file (char* filename, dsgwnewtype* entType)
"function submitNameForm(nameForm)\n"
"{\n"
" if ( nameForm.entryname.value == '' ) {\n");
- deleteme = XP_GetClientStr (DBT_enterNameForNewEntry_);
dsgw_emit_alert ("newentryNameFrame", "width=400,height=130,resizable",
"%s", XP_GetClientStr (DBT_enterNameForNewEntry_));
diff --git a/sort.c b/sort.c
index 2bc6a50..0b995f2 100644
--- a/sort.c
+++ b/sort.c
@@ -75,7 +75,7 @@ ldap_keysort_entries(
LDAP_KEYCMP_CALLBACK *cmp,
LDAP_KEYFREE_CALLBACK *fre)
{
- size_t count, i;
+ int count, i;
keycmp_t kc = {0};
keything_t **kt;
LDAPMessage *e, *last;
@@ -129,8 +129,12 @@ ldap_keysort_entries(
LDAPMessage *tmp;
/* delete (unlink) the message from its unsorted place in the chain */
tmp = ldap_delete_result_entry(chain, kt[i-1]->kt_msg);
+#if defined(DEBUG) || defined(FORCE_PR_ASSERT)
PR_ASSERT(tmp != NULL); /* should be in the list */
PR_ASSERT(tmp == kt[i]->kt_msg); /* should return a pointer into the chain list */
+#else
+ (void)tmp; /* eliminate compiler warning */
+#endif
/* ldap_add_result_entry adds the msg/entry to the front of the list */
/* so we have to add them backwards to preserve the sorted order */
ldap_add_result_entry(chain, kt[i-1]->kt_msg);
diff --git a/tmplout.c b/tmplout.c
index a51e6a1..2a6762e 100644
--- a/tmplout.c
+++ b/tmplout.c
@@ -455,7 +455,7 @@ do_entry2text_search(
char *urlprefix
)
{
- int err, freedn, html;
+ int err, freedn;
char *buf, **fetchattrs, **vals;
LDAPMessage *ldmp;
struct ldap_disptmpl *tmpl;
@@ -470,8 +470,6 @@ do_entry2text_search(
return( err );
}
- html = ( urlprefix != NULL );
-
timeout.tv_sec = SEARCH_TIMEOUT_SECS;
timeout.tv_usec = 0;
@@ -1029,7 +1027,7 @@ searchaction( LDAP *ld, char *buf, char *base, LDAPMessage *entry, char *dn,
char **members;
struct berval **bmembers;
struct berval **bvals;
- char *value, *filtpattern, *attr, *selectname;
+ char *value, *filtpattern, *attr;
char *retattrs[2], filter[ 256 ];
LDAPMessage *ldmp;
struct timeval timeout;
@@ -1046,7 +1044,6 @@ searchaction( LDAP *ld, char *buf, char *base, LDAPMessage *entry, char *dn,
filtpattern = tip->ti_args[ 1 ];
retattrs[ 0 ] = tip->ti_args[ 2 ];
retattrs[ 1 ] = NULL;
- selectname = tip->ti_args[ 3 ];
bvals = NULL;
if ( attr == NULL ) {
diff --git a/unauth.c b/unauth.c
index dcfea72..525b073 100644
--- a/unauth.c
+++ b/unauth.c
@@ -30,12 +30,10 @@ void generate_message( int type );
int main( int argc, char **argv )
{
- int reqmethod;
char *expck;
char *authck;
- int rc;
- reqmethod = dsgw_init( argc, argv, DSGW_METHOD_GET );
+ (void)dsgw_init( argc, argv, DSGW_METHOD_GET );
authck = dsgw_get_auth_cookie();
if ( authck == NULL ) {
@@ -46,7 +44,7 @@ int main( int argc, char **argv )
}
/* Remove the cookie from the cookie database */
- rc = dsgw_delcookie( authck );
+ (void)dsgw_delcookie( authck );
/* Generate a cookie header with the cookie set to [unauthenticated] */
expck = dsgw_ch_malloc( strlen( DSGW_CKHDR ) + strlen( DSGW_AUTHCKNAME ) +
--
1.7.1
[Attachment #7 (text/plain)]
--
389-devel mailing list
389-devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/389-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic