#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <ctype.h>
#include <termios.h>
#include <sys/utsname.h>
#include <sys/param.h>
#include <arpa/telnet.h>
#include <osmocom/vty/vty.h>
#include <osmocom/vty/command.h>
#include <osmocom/vty/buffer.h>
#include <osmocom/core/talloc.h>
/* \addtogroup vty
* @{
*/
/*! \file vty.c */
#define SYSCONFDIR "/usr/local/etc"
/* our callback, located in telnet_interface.c */
void vty_event(enum event event, int sock, struct vty *vty);
extern struct host host;
/* Vector which store each vty structure. */
static vector vtyvec;
vector Vvty_serv_thread;
char *vty_cwd = NULL;
/* Configure lock. */
static int vty_config;
static int no_password_check = 1;
void *tall_vty_ctx;
static void vty_clear_buf(struct vty *vty)
{
memset(vty->buf, 0, vty->max);
}
/*! \brief Allocate a new vty interface structure */
struct vty *vty_new(void)
{
struct vty *new = talloc_zero(tall_vty_ctx, struct vty);
if (!new)
goto out;
new->obuf = buffer_new(new, 0); /* Use default buffer size. */
if (!new->obuf)
goto out_new;
new->buf = _talloc_zero(new, VTY_BUFSIZ, "vty_new->buf");
if (!new->buf)
goto out_obuf;
new->max = VTY_BUFSIZ;
return new;
out_obuf:
buffer_free(new->obuf);
out_new:
talloc_free(new);
new = NULL;
out:
return new;
}
/* Authentication of vty */
static void vty_auth(struct vty *vty, char *
|