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