summaryrefslogtreecommitdiff
path: root/usr
diff options
context:
space:
mode:
authorToomas Soome <tsoome@me.com>2019-01-22 19:15:45 +0200
committerToomas Soome <tsoome@me.com>2019-07-03 10:29:11 +0300
commit51b02b292e47be2588e43efa7cff6e9fc931fba0 (patch)
treef8851fde561a9e31c9c70617c057c2bdf4f659f6 /usr
parent563485af1b25ed721b3a7a25a0c9153999957f71 (diff)
downloadillumos-joyent-51b02b292e47be2588e43efa7cff6e9fc931fba0.tar.gz
11167 libsldap: NULL pointer errors
Reviewed by: John Levon <john.levon@joyent.com> Approved by: Richard Lowe <richlowe@richlowe.net>
Diffstat (limited to 'usr')
-rw-r--r--usr/src/lib/libsldap/common/ns_config.c56
-rw-r--r--usr/src/lib/libsldap/common/ns_confmgr.c24
-rw-r--r--usr/src/lib/libsldap/common/ns_connect.c10
-rw-r--r--usr/src/lib/libsldap/common/ns_connmgmt.c2
-rw-r--r--usr/src/lib/libsldap/common/ns_mapping.c6
-rw-r--r--usr/src/lib/libsldap/common/ns_reads.c36
-rw-r--r--usr/src/lib/libsldap/common/ns_writes.c12
7 files changed, 76 insertions, 70 deletions
diff --git a/usr/src/lib/libsldap/common/ns_config.c b/usr/src/lib/libsldap/common/ns_config.c
index b739b9e55a..a8bde0f5c3 100644
--- a/usr/src/lib/libsldap/common/ns_config.c
+++ b/usr/src/lib/libsldap/common/ns_config.c
@@ -531,7 +531,7 @@ static ns_default_config defconfig[] = {
/* array terminator [not an entry] */
{NULL, NS_LDAP_FILE_VERSION_P,
- CLIENTCONFIG, NS_UNKNOWN, TRUE, NULL,
+ CLIENTCONFIG, NS_UNKNOWN, TRUE, 0,
NULL,
{ NS_UNKNOWN, 0, NULL },
NULL, NULL },
@@ -1170,7 +1170,7 @@ __s_api_crosscheck(ns_config_t *ptr, char *errstr, int check_dn)
/* check for auth value....passwd/bindn if necessary */
for (j = 0; ptr->paramList[NS_LDAP_AUTH_P].ns_pi != NULL &&
- ptr->paramList[NS_LDAP_AUTH_P].ns_pi[j] != NULL; j++) {
+ ptr->paramList[NS_LDAP_AUTH_P].ns_pi[j] != 0; j++) {
value = ptr->paramList[NS_LDAP_AUTH_P].ns_pi[j];
switch (value) {
case NS_LDAP_EA_SIMPLE:
@@ -1380,7 +1380,7 @@ set_default_value(ns_config_t *configptr, char *name,
(void) snprintf(errstr, sizeof (errstr), gettext(
"Illegal type name (%s).\n"), name);
MKERROR(LOG_ERR, *error, NS_CONFIG_SYNTAX, strdup(errstr),
- NULL);
+ NS_LDAP_MEMORY);
return (NS_LDAP_CONFIG);
}
@@ -1653,7 +1653,7 @@ __ns_ldap_setParamValue(ns_config_t *ptr, const ParamIndexType type,
gettext("Unable to set value: "
"invalid ParamIndexType (%d)"), type);
MKERROR(LOG_ERR, *error, NS_CONFIG_SYNTAX, strdup(errstr),
- NULL);
+ NS_LDAP_MEMORY);
return (NS_LDAP_CONFIG);
}
@@ -1699,7 +1699,7 @@ __ns_ldap_setParamValue(ns_config_t *ptr, const ParamIndexType type,
"invalid %s (%d)"), def->name,
def->index);
MKERROR(LOG_ERR, *error, NS_CONFIG_SYNTAX,
- strdup(errstr), NULL);
+ strdup(errstr), NS_LDAP_MEMORY);
if (tcp != NULL)
free(tcp);
return (NS_LDAP_CONFIG);
@@ -1721,7 +1721,7 @@ __ns_ldap_setParamValue(ns_config_t *ptr, const ParamIndexType type,
"invalid %s (%d)"), def->name,
def->index);
MKERROR(LOG_ERR, *error, NS_CONFIG_SYNTAX,
- strdup(errstr), NULL);
+ strdup(errstr), NS_LDAP_MEMORY);
if (tcp != NULL)
free(tcp);
return (NS_LDAP_CONFIG);
@@ -1750,7 +1750,7 @@ __ns_ldap_setParamValue(ns_config_t *ptr, const ParamIndexType type,
"invalid serviceAuthenticationMethod (%s)"),
cp);
MKERROR(LOG_ERR, *error, NS_CONFIG_SYNTAX,
- strdup(errstr), NULL);
+ strdup(errstr), NS_LDAP_MEMORY);
if (tcp != NULL)
free(tcp);
return (NS_LDAP_CONFIG);
@@ -1858,7 +1858,7 @@ __ns_ldap_setParamValue(ns_config_t *ptr, const ParamIndexType type,
"invalid serviceCredentialLevel (%s)"),
cp);
MKERROR(LOG_ERR, *error, NS_CONFIG_SYNTAX,
- strdup(errstr), NULL);
+ strdup(errstr), NS_LDAP_MEMORY);
if (tcp != NULL)
free(tcp);
return (NS_LDAP_CONFIG);
@@ -1970,7 +1970,7 @@ __ns_ldap_setParamValue(ns_config_t *ptr, const ParamIndexType type,
"invalid serviceSearchDescriptor (%s)"),
cp);
MKERROR(LOG_ERR, *error, NS_CONFIG_SYNTAX,
- strdup(errstr), NULL);
+ strdup(errstr), NS_LDAP_MEMORY);
if (tcp != NULL)
free(tcp);
return (NS_LDAP_CONFIG);
@@ -2213,7 +2213,7 @@ __ns_ldap_setParamValue(ns_config_t *ptr, const ParamIndexType type,
ptbuf);
MKERROR(LOG_ERR, *error,
NS_CONFIG_SYNTAX,
- strdup(errstr), NULL);
+ strdup(errstr), NS_LDAP_MEMORY);
free(conf.ns_pi);
if (tcp != NULL)
free(tcp);
@@ -2238,7 +2238,7 @@ __ns_ldap_setParamValue(ns_config_t *ptr, const ParamIndexType type,
gettext("Unable to set value: "
"invalid authenticationMethod (%s)"), ptbuf);
MKERROR(LOG_ERR, *error, NS_CONFIG_SYNTAX,
- strdup(errstr), NULL);
+ strdup(errstr), NS_LDAP_MEMORY);
if (tcp != NULL)
free(tcp);
return (NS_LDAP_CONFIG);
@@ -2285,7 +2285,7 @@ __ns_ldap_setParamValue(ns_config_t *ptr, const ParamIndexType type,
ptbuf);
MKERROR(LOG_ERR, *error,
NS_CONFIG_SYNTAX,
- strdup(errstr), NULL);
+ strdup(errstr), NS_LDAP_MEMORY);
free(conf.ns_pi);
if (tcp != NULL)
free(tcp);
@@ -2310,7 +2310,7 @@ __ns_ldap_setParamValue(ns_config_t *ptr, const ParamIndexType type,
gettext("Unable to set value: "
"invalid credentialLevel (%s)"), ptbuf);
MKERROR(LOG_ERR, *error, NS_CONFIG_SYNTAX,
- strdup(errstr), NULL);
+ strdup(errstr), NS_LDAP_MEMORY);
if (tcp != NULL)
free(tcp);
return (NS_LDAP_CONFIG);
@@ -2329,7 +2329,7 @@ __ns_ldap_setParamValue(ns_config_t *ptr, const ParamIndexType type,
"invalid schema mapping (%s)"), cp);
exitrc = NS_LDAP_CONFIG;
MKERROR(LOG_ERR, *error, NS_CONFIG_SYNTAX,
- strdup(errstr), NULL);
+ strdup(errstr), NS_LDAP_MEMORY);
}
if (tcp)
free(tcp);
@@ -2389,7 +2389,7 @@ __ns_ldap_setParamValue(ns_config_t *ptr, const ParamIndexType type,
MKERROR(LOG_ERR, *error,
NS_LDAP_INTERNAL,
strdup(errstr),
- NULL);
+ NS_LDAP_MEMORY);
break;
case NS_HASH_RC_EXISTED:
exitrc = NS_LDAP_CONFIG;
@@ -2404,7 +2404,7 @@ __ns_ldap_setParamValue(ns_config_t *ptr, const ParamIndexType type,
MKERROR(LOG_ERR, *error,
NS_CONFIG_SYNTAX,
strdup(errstr),
- NULL);
+ NS_LDAP_MEMORY);
break;
case NS_HASH_RC_NO_MEMORY:
exitrc = NS_LDAP_MEMORY;
@@ -2499,7 +2499,7 @@ __ns_ldap_setParamValue(ns_config_t *ptr, const ParamIndexType type,
MKERROR(LOG_ERR, *error,
NS_LDAP_INTERNAL,
strdup(errstr),
- NULL);
+ NS_LDAP_MEMORY);
break;
case NS_HASH_RC_NO_MEMORY:
exitrc = NS_LDAP_MEMORY;
@@ -2577,7 +2577,7 @@ __ns_ldap_setParamValue(ns_config_t *ptr, const ParamIndexType type,
MKERROR(LOG_ERR, *error,
NS_LDAP_INTERNAL,
strdup(errstr),
- NULL);
+ NS_LDAP_MEMORY);
break;
case NS_HASH_RC_EXISTED:
exitrc = NS_LDAP_CONFIG;
@@ -2591,7 +2591,7 @@ __ns_ldap_setParamValue(ns_config_t *ptr, const ParamIndexType type,
MKERROR(LOG_ERR, *error,
NS_CONFIG_SYNTAX,
strdup(errstr),
- NULL);
+ NS_LDAP_MEMORY);
break;
case NS_HASH_RC_NO_MEMORY:
exitrc = NS_LDAP_MEMORY;
@@ -2620,7 +2620,7 @@ __ns_ldap_setParamValue(ns_config_t *ptr, const ParamIndexType type,
gettext("Unable to set value: invalid configuration "
"type (%d)"), def->data_type);
MKERROR(LOG_ERR, *error, NS_CONFIG_SYNTAX, strdup(errstr),
- NULL);
+ NS_LDAP_MEMORY);
if (tcp != NULL)
free(tcp);
return (NS_LDAP_CONFIG);
@@ -2638,7 +2638,7 @@ __ns_ldap_setParamValue(ns_config_t *ptr, const ParamIndexType type,
(void) snprintf(errstr, sizeof (errstr),
gettext("%s"), errstr);
MKERROR(LOG_WARNING, *error, NS_CONFIG_SYNTAX,
- strdup(errstr), NULL);
+ strdup(errstr), NS_LDAP_MEMORY);
sav_conf = ptr->paramList[type];
ptr->paramList[type] = conf;
@@ -2730,7 +2730,7 @@ __ns_ldap_setParam(const ParamIndexType type,
gettext("Unable to set parameter from a client in "
"__ns_ldap_setParam()"));
MKERROR(LOG_WARNING, *error, NS_CONFIG_SYNTAX, strdup(errstr),
- NULL);
+ NS_LDAP_MEMORY);
if (cfg != NULL)
__s_api_release_config(cfg);
(void) mutex_unlock(&ns_loadrefresh_lock);
@@ -2755,7 +2755,7 @@ __ns_ldap_setParam(const ParamIndexType type,
errorp != NULL && errorp->message != NULL ?
errorp->message : "");
MKERROR(LOG_WARNING, *error, NS_CONFIG_NOTLOADED,
- strdup(errstr), NULL);
+ strdup(errstr), NS_LDAP_MEMORY);
if (errorp != NULL)
(void) __ns_ldap_freeError(&errorp);
(void) mutex_unlock(&ns_loadrefresh_lock);
@@ -2955,7 +2955,7 @@ __ns_ldap_getParam(const ParamIndexType Param,
errorp != NULL && errorp->message != NULL ?
errorp->message : "");
MKERROR(LOG_WARNING, *error, NS_CONFIG_NOTLOADED,
- strdup(errstr), NULL);
+ strdup(errstr), NS_LDAP_MEMORY);
if (errorp != NULL)
(void) __ns_ldap_freeError(&errorp);
(void) mutex_unlock(&ns_loadrefresh_lock);
@@ -2976,7 +2976,7 @@ __ns_ldap_getParam(const ParamIndexType Param,
(void) snprintf(errstr, sizeof (errstr),
gettext("No configuration information available."));
MKERROR(LOG_ERR, *error, NS_CONFIG_NOTLOADED,
- strdup(errstr), NULL);
+ strdup(errstr), NS_LDAP_MEMORY);
return (NS_LDAP_CONFIG);
}
@@ -3318,7 +3318,7 @@ __door_getconf(char **buffer, int *buflen, ns_ldap_error_t **error,
"ldap_cachemgr failed - error: %d."),
space->s_d.ldap_ret.ldap_errno);
MKERROR(LOG_WARNING, *error, NS_CONFIG_CACHEMGR,
- strdup(errstr), NULL);
+ strdup(errstr), NS_LDAP_MEMORY);
free(space);
return (NS_LDAP_OP_FAILED);
default:
@@ -3389,7 +3389,7 @@ SetDoorInfoToUnixCred(char *buffer, ns_ldap_error_t **errorp,
gettext("SetDoorInfoToUnixCred: "
"Unknown keyword encountered '%s'."), name);
MKERROR(LOG_ERR, *errorp, NS_CONFIG_SYNTAX,
- strdup(errstr), NULL);
+ strdup(errstr), NS_LDAP_MEMORY);
return (NS_LDAP_CONFIG);
}
switch (index) {
@@ -3404,7 +3404,7 @@ SetDoorInfoToUnixCred(char *buffer, ns_ldap_error_t **errorp,
gettext("SetDoorInfoToUnixCred: "
"Unknown index encountered '%d'."), index);
MKERROR(LOG_ERR, *errorp, NS_CONFIG_SYNTAX,
- strdup(errstr), NULL);
+ strdup(errstr), NS_LDAP_MEMORY);
return (NS_LDAP_CONFIG);
}
strptr = (char *)strtok_r(NULL, DOORLINESEP, &rest);
diff --git a/usr/src/lib/libsldap/common/ns_confmgr.c b/usr/src/lib/libsldap/common/ns_confmgr.c
index 5b99b9b4c2..862e20d035 100644
--- a/usr/src/lib/libsldap/common/ns_confmgr.c
+++ b/usr/src/lib/libsldap/common/ns_confmgr.c
@@ -123,7 +123,8 @@ read_file(ns_config_t *ptr, int cred_file, ns_ldap_error_t **error)
(void) snprintf(errstr, sizeof (errstr),
gettext("Unable to open filename '%s' "
"for reading (errno=%d)."), file, errno);
- MKERROR(LOG_ERR, *error, NS_CONFIG_FILE, strdup(errstr), NULL);
+ MKERROR(LOG_ERR, *error, NS_CONFIG_FILE, strdup(errstr),
+ NS_LDAP_MEMORY);
return (NS_NOTFOUND);
}
@@ -149,7 +150,7 @@ read_file(ns_config_t *ptr, int cred_file, ns_ldap_error_t **error)
gettext("Missing Name or Value on line %d."),
lineno);
MKERROR(LOG_ERR, *error, NS_CONFIG_SYNTAX,
- strdup(errstr), NULL);
+ strdup(errstr), NS_LDAP_MEMORY);
(void) fclose(fp);
return (NS_PARSE_ERR);
}
@@ -158,7 +159,7 @@ read_file(ns_config_t *ptr, int cred_file, ns_ldap_error_t **error)
gettext("Illegal profile type on line %d."),
lineno);
MKERROR(LOG_ERR, *error, NS_CONFIG_SYNTAX,
- strdup(errstr), NULL);
+ strdup(errstr), NS_LDAP_MEMORY);
(void) fclose(fp);
return (NS_PARSE_ERR);
}
@@ -167,7 +168,7 @@ read_file(ns_config_t *ptr, int cred_file, ns_ldap_error_t **error)
gettext("Illegal NS_LDAP_FILE_VERSION "
"on line %d."), lineno);
MKERROR(LOG_ERR, *error, NS_CONFIG_SYNTAX,
- strdup(errstr), NULL);
+ strdup(errstr), NS_LDAP_MEMORY);
(void) fclose(fp);
return (NS_PARSE_ERR);
}
@@ -187,7 +188,7 @@ read_file(ns_config_t *ptr, int cred_file, ns_ldap_error_t **error)
gettext("Illegal entry in '%s' on "
"line %d"), file, lineno);
MKERROR(LOG_ERR, *error, NS_CONFIG_SYNTAX,
- strdup(errstr), NULL);
+ strdup(errstr), NS_LDAP_MEMORY);
(void) fclose(fp);
return (NS_PARSE_ERR);
}
@@ -207,7 +208,7 @@ read_file(ns_config_t *ptr, int cred_file, ns_ldap_error_t **error)
gettext("Illegal entry in '%s' on "
"line %d"), file, lineno);
MKERROR(LOG_ERR, *error, NS_CONFIG_SYNTAX,
- strdup(errstr), NULL);
+ strdup(errstr), NS_LDAP_MEMORY);
(void) fclose(fp);
return (NS_PARSE_ERR);
}
@@ -219,7 +220,7 @@ read_file(ns_config_t *ptr, int cred_file, ns_ldap_error_t **error)
(void) snprintf(errstr, sizeof (errstr),
gettext("Empty config file: '%s'"), file);
MKERROR(LOG_ERR, *error, NS_CONFIG_SYNTAX, strdup(errstr),
- NULL);
+ NS_LDAP_MEMORY);
return (NS_PARSE_ERR);
}
if (linelen == -2) {
@@ -227,7 +228,7 @@ read_file(ns_config_t *ptr, int cred_file, ns_ldap_error_t **error)
(void) snprintf(errstr, sizeof (errstr),
gettext("Line too long in '%s'"), file);
MKERROR(LOG_ERR, *error, NS_CONFIG_SYNTAX, strdup(errstr),
- NULL);
+ NS_LDAP_MEMORY);
return (NS_PARSE_ERR);
}
return (NS_SUCCESS);
@@ -265,7 +266,8 @@ set_attr(ns_config_t *config_struct,
__s_api_get_versiontype(config_struct, attr_name, &idx) < 0) {
(void) snprintf(errmsg, sizeof (errmsg),
gettext("Illegal DUAProfile property: <%s>."), attr_name);
- MKERROR(LOG_ERR, *errorp, NS_LDAP_CONFIG, strdup(errmsg), NULL);
+ MKERROR(LOG_ERR, *errorp, NS_LDAP_CONFIG, strdup(errmsg),
+ NS_LDAP_MEMORY);
return (NS_LDAP_CONFIG);
}
@@ -1013,7 +1015,7 @@ __ns_ldap_download(const char *profile, char *addr, char *baseDN,
(void) snprintf(errstr, sizeof (errstr),
gettext("No configuration information available."));
MKERROR(LOG_ERR, *errorp, NS_CONFIG_NOTLOADED, strdup(errstr),
- NULL);
+ NS_LDAP_MEMORY);
return (NS_LDAP_CONFIG);
}
@@ -1047,7 +1049,7 @@ __ns_ldap_download(const char *profile, char *addr, char *baseDN,
if (rc != NS_LDAP_SUCCESS) {
__s_api_destroy_config(new_ptr);
MKERROR(LOG_ERR, *errorp, NS_CONFIG_NOTLOADED, strdup(errstr),
- NULL);
+ NS_LDAP_MEMORY);
return (NS_LDAP_CONFIG);
}
diff --git a/usr/src/lib/libsldap/common/ns_connect.c b/usr/src/lib/libsldap/common/ns_connect.c
index a8a03c16b1..44146a2c23 100644
--- a/usr/src/lib/libsldap/common/ns_connect.c
+++ b/usr/src/lib/libsldap/common/ns_connect.c
@@ -354,7 +354,7 @@ __s_api_requestServer(const char *request, const char *server,
(void) sprintf(errstr, gettext("No server FQDN format "
"returned from ldap_cachemgr"));
MKERROR(LOG_WARNING, *error, NS_CONFIG_CACHEMGR,
- strdup(errstr), NULL);
+ strdup(errstr), NS_LDAP_MEMORY);
free(ret->server);
ret->server = NULL;
return (NS_LDAP_OP_FAILED);
@@ -1170,7 +1170,7 @@ process_pwd_mgmt(char *bind_type, int ldaprc,
if (pwd_status != NS_PASSWD_GOOD) {
MKERROR_PWD_MGMT(*errorp,
ldaprc, strdup(errstr),
- pwd_status, 0, NULL);
+ pwd_status, 0, NS_LDAP_MEMORY);
} else {
MKERROR(LOG_ERR, *errorp, ldaprc, strdup(errstr),
NS_LDAP_MEMORY);
@@ -1271,7 +1271,7 @@ process_pwd_mgmt(char *bind_type, int ldaprc,
strdup(errstr),
pwd_status,
0,
- NULL);
+ NS_LDAP_MEMORY);
exit_rc = NS_LDAP_INTERNAL;
} else {
MKERROR_PWD_MGMT(*errorp,
@@ -1279,7 +1279,7 @@ process_pwd_mgmt(char *bind_type, int ldaprc,
NULL,
pwd_status,
0,
- NULL);
+ NS_LDAP_MEMORY);
exit_rc =
NS_LDAP_SUCCESS_WITH_INFO;
}
@@ -1300,7 +1300,7 @@ process_pwd_mgmt(char *bind_type, int ldaprc,
NULL,
pwd_status,
sec_until_exp,
- NULL);
+ NS_LDAP_MEMORY);
exit_rc =
NS_LDAP_SUCCESS_WITH_INFO;
break;
diff --git a/usr/src/lib/libsldap/common/ns_connmgmt.c b/usr/src/lib/libsldap/common/ns_connmgmt.c
index 975d5ad079..c7aaf342c6 100644
--- a/usr/src/lib/libsldap/common/ns_connmgmt.c
+++ b/usr/src/lib/libsldap/common/ns_connmgmt.c
@@ -2623,7 +2623,7 @@ start_thread(ns_conn_mgmt_t *cmg) {
/*
* start a thread to get and process config and server status changes
*/
- if (thr_create(NULL, NULL, get_server_change,
+ if (thr_create(NULL, 0, get_server_change,
(void *)cmg, THR_DETACHED, NULL) != 0) {
errnum = errno;
syslog(LOG_WARNING, NS_CONN_MSG_NO_PROCCHG_THREAD,
diff --git a/usr/src/lib/libsldap/common/ns_mapping.c b/usr/src/lib/libsldap/common/ns_mapping.c
index 7e8caaa0db..7a30a090f0 100644
--- a/usr/src/lib/libsldap/common/ns_mapping.c
+++ b/usr/src/lib/libsldap/common/ns_mapping.c
@@ -686,7 +686,7 @@ int __ns_ldap_getSearchDescriptors(
(void) snprintf(errstr, sizeof (errstr),
gettext("No configuration information available."));
MKERROR(LOG_ERR, *errorp, NS_CONFIG_NOTLOADED, strdup(errstr),
- NULL);
+ NS_LDAP_MEMORY);
return (NS_LDAP_CONFIG);
}
@@ -763,7 +763,7 @@ int __ns_ldap_getSearchDescriptors(
if (*srv != COLONTOK)
continue;
srv++;
- while (srv != NULL && *srv != NULL) {
+ while (srv != NULL && *srv != '\0') {
/* Process 1 */
rc = __s_api_parseASearchDesc(service, &srv, &ret);
if (rc != NS_LDAP_SUCCESS) {
@@ -774,7 +774,7 @@ int __ns_ldap_getSearchDescriptors(
(void) __ns_ldap_freeParam(&param);
param = NULL;
MKERROR(LOG_ERR, *errorp, NS_CONFIG_SYNTAX,
- strdup(errstr), NULL);
+ strdup(errstr), NS_LDAP_MEMORY);
return (rc);
}
if (ret != NULL) {
diff --git a/usr/src/lib/libsldap/common/ns_reads.c b/usr/src/lib/libsldap/common/ns_reads.c
index d18b1fc580..d4c6a1e477 100644
--- a/usr/src/lib/libsldap/common/ns_reads.c
+++ b/usr/src/lib/libsldap/common/ns_reads.c
@@ -1365,7 +1365,7 @@ get_mapped_filter(ns_ldap_cookie_t *cookie, char **new_filter)
if (err) {
MKERROR(LOG_WARNING, cookie->errorp,
NS_CONFIG_SYNTAX,
- err, NULL);
+ err, NS_LDAP_MEMORY);
}
free(filter_c);
@@ -2054,7 +2054,7 @@ multi_result(ns_ldap_cookie_t *cookie)
gettext(ldap_err2string(cookie->err_rc)));
err = strdup(errstr);
MKERROR(LOG_WARNING, *errorp, NS_LDAP_INTERNAL, err,
- NULL);
+ NS_LDAP_MEMORY);
cookie->err_rc = NS_LDAP_INTERNAL;
cookie->errorp = *errorp;
return (LDAP_ERROR);
@@ -2124,7 +2124,7 @@ multi_result(ns_ldap_cookie_t *cookie)
gettext(ldap_err2string(cookie->err_rc)));
err = strdup(errstr);
MKERROR(LOG_WARNING, *errorp, NS_LDAP_INTERNAL, err,
- NULL);
+ NS_LDAP_MEMORY);
cookie->err_rc = NS_LDAP_INTERNAL;
cookie->errorp = *errorp;
return (LDAP_ERROR);
@@ -2382,7 +2382,7 @@ search_state_machine(ns_ldap_cookie_t *cookie, ns_state_t state, int cycle)
state);
err = strdup(errstr);
MKERROR(LOG_WARNING, *errorp, NS_LDAP_INTERNAL, err,
- NULL);
+ NS_LDAP_MEMORY);
cookie->err_rc = NS_LDAP_INTERNAL;
cookie->errorp = *errorp;
cookie->new_state = EXIT;
@@ -2919,14 +2919,16 @@ search_state_machine(ns_ldap_cookie_t *cookie, ns_state_t state, int cycle)
if (cookie->err_from_result) {
if (cookie->err_rc == LDAP_SERVER_DOWN) {
MKERROR(LOG_INFO, *errorp,
- cookie->err_rc, err, NULL);
+ cookie->err_rc, err,
+ NS_LDAP_MEMORY);
} else {
MKERROR(LOG_WARNING, *errorp,
- cookie->err_rc, err, NULL);
+ cookie->err_rc, err,
+ NS_LDAP_MEMORY);
}
} else {
MKERROR(LOG_WARNING, *errorp, NS_LDAP_INTERNAL,
- err, NULL);
+ err, NS_LDAP_MEMORY);
}
cookie->err_rc = NS_LDAP_INTERNAL;
cookie->errorp = *errorp;
@@ -2950,7 +2952,7 @@ search_state_machine(ns_ldap_cookie_t *cookie, ns_state_t state, int cycle)
cookie->state);
err = strdup(errstr);
MKERROR(LOG_WARNING, *errorp, NS_LDAP_INTERNAL, err,
- NULL);
+ NS_LDAP_MEMORY);
cookie->err_rc = NS_LDAP_INTERNAL;
cookie->errorp = *errorp;
return (ERROR);
@@ -2975,7 +2977,7 @@ search_state_machine(ns_ldap_cookie_t *cookie, ns_state_t state, int cycle)
(void) sprintf(errstr,
gettext("Unexpected State machine error.\n"));
err = strdup(errstr);
- MKERROR(LOG_WARNING, *errorp, NS_LDAP_INTERNAL, err, NULL);
+ MKERROR(LOG_WARNING, *errorp, NS_LDAP_INTERNAL, err, NS_LDAP_MEMORY);
cookie->err_rc = NS_LDAP_INTERNAL;
cookie->errorp = *errorp;
return (ERROR);
@@ -3028,7 +3030,7 @@ check_shadow(ns_ldap_cookie_t *cookie, const char *service)
if (err == NULL)
return (NS_LDAP_MEMORY);
MKERROR(LOG_INFO, cookie->errorp, NS_LDAP_INTERNAL, err,
- NULL);
+ NS_LDAP_MEMORY);
return (NS_LDAP_INTERNAL);
}
cookie->i_flags |= NS_LDAP_READ_SHADOW;
@@ -4110,7 +4112,7 @@ __ns_ldap_getAttr(const ns_ldap_entry_t *entry, const char *attrname)
if (entry == NULL)
return (NULL);
for (i = 0; i < entry->attr_count; i++) {
- if (strcasecmp(entry->attr_pair[i]->attrname, attrname) == NULL)
+ if (strcasecmp(entry->attr_pair[i]->attrname, attrname) == 0)
return (entry->attr_pair[i]->attrvalue);
}
return (NULL);
@@ -4124,7 +4126,7 @@ __ns_ldap_getAttrStruct(const ns_ldap_entry_t *entry, const char *attrname)
if (entry == NULL)
return (NULL);
for (i = 0; i < entry->attr_count; i++) {
- if (strcasecmp(entry->attr_pair[i]->attrname, attrname) == NULL)
+ if (strcasecmp(entry->attr_pair[i]->attrname, attrname) == 0)
return (entry->attr_pair[i]);
}
return (NULL);
@@ -4222,7 +4224,7 @@ __ns_ldap_uid2dn(const char *uid,
(void) sprintf(errstr,
gettext("Too many entries are returned for %s"), uid);
MKERROR(LOG_WARNING, *errorp, NS_LDAP_INTERNAL, strdup(errstr),
- NULL);
+ NS_LDAP_MEMORY);
return (NS_LDAP_INTERNAL);
}
@@ -4293,7 +4295,7 @@ __ns_ldap_dn2uid(const char *dn,
(void) sprintf(errstr,
gettext("Too many entries are returned for %s"), dn);
MKERROR(LOG_WARNING, *errorp, NS_LDAP_INTERNAL, strdup(errstr),
- 0);
+ NS_LDAP_MEMORY);
rc = NS_LDAP_INTERNAL;
goto out;
}
@@ -4380,7 +4382,7 @@ __ns_ldap_host2dn(const char *host,
(void) sprintf(errstr,
gettext("Too many entries are returned for %s"), host);
MKERROR(LOG_WARNING, *errorp, NS_LDAP_INTERNAL, strdup(errstr),
- NULL);
+ NS_LDAP_MEMORY);
return (NS_LDAP_INTERNAL);
}
@@ -4566,7 +4568,7 @@ __ns_ldap_getServiceAuthMethods(const char *service,
gettext("Unsupported "
"serviceAuthenticationMethod: %s.\n"), srv);
MKERROR(LOG_WARNING, *errorp, NS_CONFIG_SYNTAX,
- strdup(errstr), NULL);
+ strdup(errstr), NS_LDAP_MEMORY);
__s_api_release_config(cfg);
return (NS_LDAP_CONFIG);
}
@@ -4668,7 +4670,7 @@ __s_api_convert_automountmapname(const char *service, char **dn,
"empty string.\n"));
MKERROR(LOG_ERR, *errp, NS_CONFIG_SYNTAX,
- strdup(errstr), NULL);
+ strdup(errstr), NS_LDAP_MEMORY);
return (NS_LDAP_CONFIG);
}
diff --git a/usr/src/lib/libsldap/common/ns_writes.c b/usr/src/lib/libsldap/common/ns_writes.c
index 5029598f19..0774eb7524 100644
--- a/usr/src/lib/libsldap/common/ns_writes.c
+++ b/usr/src/lib/libsldap/common/ns_writes.c
@@ -1066,9 +1066,10 @@ write_state_machine(
err = strdup(errstr);
if (pwd_status != NS_PASSWD_GOOD) {
MKERROR_PWD_MGMT(*errorp, Errno, err,
- pwd_status, 0, NULL);
+ pwd_status, 0, NS_LDAP_MEMORY);
} else {
- MKERROR(LOG_INFO, *errorp, Errno, err, NULL);
+ MKERROR(LOG_INFO, *errorp, Errno, err,
+ NS_LDAP_MEMORY);
}
if (conn_user != NULL &&
(Errno == LDAP_SERVER_DOWN ||
@@ -1085,7 +1086,8 @@ write_state_machine(
" (state = %d, rc = %d)."),
err_state, return_rc);
err = strdup(errstr);
- MKERROR(LOG_WARNING, *errorp, return_rc, err, NULL);
+ MKERROR(LOG_WARNING, *errorp, return_rc, err,
+ NS_LDAP_MEMORY);
new_state = W_EXIT;
break;
}
@@ -2854,7 +2856,7 @@ modify_ethers_bootp(
new_attrlist[0]->attrname = "objectclass";
new_attrlist[0]->value_count = 1;
- if (strcasecmp(service, "ethers") == NULL) {
+ if (strcasecmp(service, "ethers") == 0) {
(void) snprintf(&filter[0], sizeof (filter),
"(&(objectClass=ieee802Device)(%s))", rdn);
new_attrlist[0]->attrvalue[0] = "ieee802Device";
@@ -4133,7 +4135,7 @@ send_to_cachemgr(
"ldap_cachemgr failed - error: %d"),
space.s_d.ldap_ret.ldap_errno);
MKERROR(LOG_WARNING, *errorp, NS_CONFIG_CACHEMGR,
- strdup(errstr), NULL);
+ strdup(errstr), NS_LDAP_MEMORY);
return (NS_LDAP_OP_FAILED);
default:
return (NS_LDAP_OP_FAILED);