--- embedaddon/quagga/vtysh/vtysh_user.c 2012/02/21 17:26:12 1.1.1.1 +++ embedaddon/quagga/vtysh/vtysh_user.c 2016/11/02 10:09:10 1.1.1.2 @@ -37,6 +37,7 @@ #include "memory.h" #include "linklist.h" #include "command.h" +#include "vtysh_user.h" #ifdef USE_PAM static struct pam_conv conv = @@ -45,7 +46,7 @@ static struct pam_conv conv = NULL }; -int +static int vtysh_pam (const char *user) { int ret; @@ -98,19 +99,21 @@ struct vtysh_user struct list *userlist; -struct vtysh_user * +static struct vtysh_user * user_new () { return XCALLOC (0, sizeof (struct vtysh_user)); } -void +#if 0 +static void user_free (struct vtysh_user *user) { XFREE (0, user); } +#endif -struct vtysh_user * +static struct vtysh_user * user_lookup (const char *name) { struct listnode *node, *nnode; @@ -124,7 +127,8 @@ user_lookup (const char *name) return NULL; } -void +#if 0 +static void user_config_write () { struct listnode *node, *nnode; @@ -136,8 +140,9 @@ user_config_write () printf (" username %s nopassword\n", user->name); } } +#endif -struct vtysh_user * +static struct vtysh_user * user_get (const char *name) { struct vtysh_user *user; @@ -166,7 +171,7 @@ DEFUN (username_nopassword, } int -vtysh_auth () +vtysh_auth (void) { struct vtysh_user *user; struct passwd *passwd; @@ -186,8 +191,18 @@ vtysh_auth () return 0; } +char * +vtysh_get_home (void) +{ + struct passwd *passwd; + + passwd = getpwuid (getuid ()); + + return passwd ? passwd->pw_dir : NULL; +} + void -vtysh_user_init () +vtysh_user_init (void) { userlist = list_new (); install_element (CONFIG_NODE, &username_nopassword_cmd);