summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Telka <marcel.telka@nexenta.com>2014-05-16 16:01:13 +0200
committerDan McDonald <danmcd@omniti.com>2014-05-21 16:53:41 -0400
commitd00075c72fe6e0468054c64c53d70554c1d1cb02 (patch)
treef34ab12fd11ba3d8b4f38150ea6a8a5e059175be
parentd7141854234c22ab8fe0547bf51a2f3a30781870 (diff)
downloadillumos-joyent-d00075c72fe6e0468054c64c53d70554c1d1cb02.tar.gz
4867 Uninitialized variables in libnsl
Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com> Approved by: Dan McDonald <danmcd@omniti.com>
-rw-r--r--usr/src/lib/libnsl/key/publickey.c5
-rw-r--r--usr/src/lib/libnsl/nsl/t_sndvudata.c16
-rw-r--r--usr/src/lib/libnsl/nss/getexecattr.c30
-rw-r--r--usr/src/lib/libnsl/rpc/clnt_vc.c2
-rw-r--r--usr/src/lib/libnsl/rpc/netnamer.c4
5 files changed, 35 insertions, 22 deletions
diff --git a/usr/src/lib/libnsl/key/publickey.c b/usr/src/lib/libnsl/key/publickey.c
index ffea570d75..7796883fd0 100644
--- a/usr/src/lib/libnsl/key/publickey.c
+++ b/usr/src/lib/libnsl/key/publickey.c
@@ -23,6 +23,9 @@
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
+/*
+ * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
+ */
/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
@@ -580,6 +583,7 @@ __getpublickey_cached_g(const char netname[], /* in */
syslog(LOG_INFO, "Unknown publickey nameservice '%s'",
look->service_name);
err = __NSW_UNAVAIL;
+ res = 0;
}
switch (look->actions[err]) {
@@ -662,6 +666,7 @@ getsecretkey_g(
syslog(LOG_INFO, "Unknown publickey nameservice '%s'",
look->service_name);
err = __NSW_UNAVAIL;
+ res = 0;
}
switch (look->actions[err]) {
case __NSW_CONTINUE :
diff --git a/usr/src/lib/libnsl/nsl/t_sndvudata.c b/usr/src/lib/libnsl/nsl/t_sndvudata.c
index b6c9d4f602..88a593b0ec 100644
--- a/usr/src/lib/libnsl/nsl/t_sndvudata.c
+++ b/usr/src/lib/libnsl/nsl/t_sndvudata.c
@@ -24,8 +24,9 @@
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-
-#pragma ident "%Z%%M% %I% %E% SMI"
+/*
+ * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
+ */
/*
* t_sndudata.c and t_sndvudata.c are very similar and contain common code.
@@ -56,7 +57,7 @@ _tx_sndvudata(int fd, const struct t_unitdata *unitdata, struct t_iovec *tiov,
struct _ti_user *tiptr;
int sv_errno;
int didalloc;
- char *dataptr;
+ char *dataptr = NULL;
unsigned int nbytes;
assert(api_semantics == TX_XTI_XNS5_API);
@@ -157,7 +158,6 @@ _tx_sndvudata(int fd, const struct t_unitdata *unitdata, struct t_iovec *tiov,
ctlbuf.len = size;
- dataptr = NULL;
if (nbytes != 0) {
if ((dataptr = malloc((size_t)nbytes)) == NULL) {
t_errno = TSYSERR;
@@ -187,13 +187,12 @@ _tx_sndvudata(int fd, const struct t_unitdata *unitdata, struct t_iovec *tiov,
sig_mutex_lock(&tiptr->ti_lock);
_T_TX_NEXTSTATE(T_SNDUDATA, tiptr,
- "t_sndvudata: invalid state event T_SNDUDATA");
+ "t_sndvudata: invalid state event T_SNDUDATA");
if (didalloc)
free(ctlbuf.buf);
else
tiptr->ti_ctlbuf = ctlbuf.buf;
- if (dataptr != NULL)
- free(dataptr);
+ free(dataptr);
sig_mutex_unlock(&tiptr->ti_lock);
return (0);
err_out:
@@ -202,8 +201,7 @@ err_out:
free(ctlbuf.buf);
else
tiptr->ti_ctlbuf = ctlbuf.buf;
- if (dataptr != NULL)
- free(dataptr);
+ free(dataptr);
sig_mutex_unlock(&tiptr->ti_lock);
errno = sv_errno;
return (-1);
diff --git a/usr/src/lib/libnsl/nss/getexecattr.c b/usr/src/lib/libnsl/nss/getexecattr.c
index dca29eeb45..8df3b6a076 100644
--- a/usr/src/lib/libnsl/nss/getexecattr.c
+++ b/usr/src/lib/libnsl/nss/getexecattr.c
@@ -22,6 +22,9 @@
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
+/*
+ * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
+ */
#include "mt.h"
#include <stdio.h>
@@ -167,36 +170,37 @@ _getexecprof(char *name,
{
int getby_flag;
char policy_buf[BUFSIZ];
- const char *empty = NULL;
nss_status_t res = NSS_NOTFOUND;
nss_XbyY_args_t arg;
_priv_execattr _priv_exec;
static mutex_t _nsw_exec_lock = DEFAULTMUTEX;
+ if ((name != NULL) && (id != NULL)) {
+ getby_flag = NSS_DBOP_EXECATTR_BYNAMEID;
+ } else if (name != NULL) {
+ getby_flag = NSS_DBOP_EXECATTR_BYNAME;
+ } else if (id != NULL) {
+ getby_flag = NSS_DBOP_EXECATTR_BYID;
+ } else {
+ return (NULL);
+ }
+
NSS_XbyY_INIT(&arg, result, buffer, buflen, str2execattr);
- _priv_exec.name = (name == NULL) ? empty : (const char *)name;
- _priv_exec.type = (type == NULL) ? empty : (const char *)type;
- _priv_exec.id = (id == NULL) ? empty : (const char *)id;
+ _priv_exec.name = name;
+ _priv_exec.type = type;
+ _priv_exec.id = id;
#ifdef SI_SECPOLICY
if (sysinfo(SI_SECPOLICY, policy_buf, BUFSIZ) == -1)
#endif /* SI_SECPOLICY */
(void) strncpy(policy_buf, DEFAULT_POLICY, BUFSIZ);
retry_policy:
- _priv_exec.policy = IS_SEARCH_ALL(search_flag) ? empty : policy_buf;
+ _priv_exec.policy = IS_SEARCH_ALL(search_flag) ? NULL : policy_buf;
_priv_exec.search_flag = search_flag;
_priv_exec.head_exec = NULL;
_priv_exec.prev_exec = NULL;
- if ((name != NULL) && (id != NULL)) {
- getby_flag = NSS_DBOP_EXECATTR_BYNAMEID;
- } else if (name != NULL) {
- getby_flag = NSS_DBOP_EXECATTR_BYNAME;
- } else if (id != NULL) {
- getby_flag = NSS_DBOP_EXECATTR_BYID;
- }
-
arg.key.attrp = &(_priv_exec);
switch (getby_flag) {
diff --git a/usr/src/lib/libnsl/rpc/clnt_vc.c b/usr/src/lib/libnsl/rpc/clnt_vc.c
index 0c0fb01037..4f92a3379b 100644
--- a/usr/src/lib/libnsl/rpc/clnt_vc.c
+++ b/usr/src/lib/libnsl/rpc/clnt_vc.c
@@ -907,6 +907,8 @@ clnt_vc_control(CLIENT *cl, int request, char *info)
/* LINTED pointer cast */
ct->ct_blocking_mode: *(int *)info);
ret = (0 == res);
+ } else {
+ ret = FALSE;
}
rpc_fd_unlock(vctbl, ct->ct_fd);
return (ret);
diff --git a/usr/src/lib/libnsl/rpc/netnamer.c b/usr/src/lib/libnsl/rpc/netnamer.c
index 80ce59c358..b257403b70 100644
--- a/usr/src/lib/libnsl/rpc/netnamer.c
+++ b/usr/src/lib/libnsl/rpc/netnamer.c
@@ -23,6 +23,9 @@
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
+/*
+ * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
+ */
/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
@@ -429,6 +432,7 @@ netname2user(const char netname[MAXNETNAMELEN + 1], uid_t *uidp, gid_t *gidp,
"netname2user: unknown nameservice for publickey"
"info '%s'\n", look->service_name);
err = __NSW_UNAVAIL;
+ res = 0;
}
switch (look->actions[err]) {
case __NSW_CONTINUE :