summaryrefslogtreecommitdiff
path: root/vtysh/vtysh_user.c
diff options
context:
space:
mode:
Diffstat (limited to 'vtysh/vtysh_user.c')
-rw-r--r--vtysh/vtysh_user.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/vtysh/vtysh_user.c b/vtysh/vtysh_user.c
index 0d72c378a3..1886ba3a67 100644
--- a/vtysh/vtysh_user.c
+++ b/vtysh/vtysh_user.c
@@ -116,7 +116,7 @@ struct list *userlist;
static struct vtysh_user *
user_new (void)
{
- return XCALLOC (0, sizeof (struct vtysh_user));
+ return XCALLOC (MTYPE_TMP, sizeof (struct vtysh_user));
}
static struct vtysh_user *
@@ -195,7 +195,11 @@ vtysh_auth (void)
struct vtysh_user *user;
struct passwd *passwd;
- passwd = getpwuid (geteuid ());
+ if ((passwd = getpwuid (geteuid ())) == NULL)
+ {
+ fprintf (stderr, "could not lookup user ID %d\n", (int) geteuid());
+ exit (1);
+ }
user = user_lookup (passwd->pw_name);
if (user && user->nopassword)