mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-11-05 14:38:57 +08:00
2009-03-27 Sebastian Huber <sebastian.huber@embedded-brains.de>
* Makefile.am, preinstall.am, libmisc/Makefile.am, libmisc/shell/shell.c, libmisc/shell/shell.h, telnetd/check_passwd.c, telnetd/telnetd.c, telnetd/telnetd.h: Generalized login check. * libmisc/shell/login.h, libmisc/shell/login_check.c, libmisc/shell/login_prompt.c: New files. * libmisc/stackchk/check.c: Changed format for blown stack message. * libcsupport/src/libio_sockets.c: Removed superfluous cast. * libnetworking/rtems/ftpfs.h: Documentation.
This commit is contained in:
1 parent
8916bdc71b
commit
8a775c27fc
12 files changed
+392
-477
No files matched your search
@@ -1,3 +1,15 @@
|
||||
2009-03-27 Sebastian Huber <sebastian.huber@embedded-brains.de>
|
||||
|
||||
* Makefile.am, preinstall.am, libmisc/Makefile.am,
|
||||
libmisc/shell/shell.c, libmisc/shell/shell.h, telnetd/check_passwd.c,
|
||||
telnetd/telnetd.c, telnetd/telnetd.h:
|
||||
Generalized login check.
|
||||
* libmisc/shell/login.h, libmisc/shell/login_check.c,
|
||||
libmisc/shell/login_prompt.c: New files.
|
||||
* libmisc/stackchk/check.c: Changed format for blown stack message.
|
||||
* libcsupport/src/libio_sockets.c: Removed superfluous cast.
|
||||
* libnetworking/rtems/ftpfs.h: Documentation.
|
||||
|
||||
2009-03-26 Sebastian Huber <sebastian.huber@embedded-brains.de>
|
||||
|
||||
* libmisc/shell/shell.h: Pointer to
|
||||
|
||||
+2
-1
@@ -125,7 +125,8 @@ include_rtems_HEADERS += libmisc/mw-fb/mw_fb.h libmisc/mw-fb/mw_uid.h
|
||||
|
||||
## shell
|
||||
if LIBSHELL
|
||||
include_rtems_HEADERS += libmisc/shell/shell.h libmisc/shell/shellconfig.h
|
||||
include_rtems_HEADERS += libmisc/shell/shell.h libmisc/shell/shellconfig.h \
|
||||
libmisc/shell/login.h
|
||||
endif
|
||||
|
||||
## i2c
|
||||
|
||||
@@ -70,6 +70,6 @@ int rtems_bsdnet_makeFdForSocket(
|
||||
iop->flags |= LIBIO_FLAGS_WRITE | LIBIO_FLAGS_READ;
|
||||
iop->data0 = fd;
|
||||
iop->data1 = so;
|
||||
iop->handlers = (rtems_filesystem_file_handlers_r *) h;
|
||||
iop->handlers = h;
|
||||
return fd;
|
||||
}
|
||||
@@ -85,7 +85,7 @@ libshell_a_SOURCES = shell/cat_file.c shell/cmds.c shell/internal.h \
|
||||
shell/err.c shell/errx.c shell/verr.c shell/vis.c \
|
||||
shell/verrx.c shell/vwarn.c shell/vwarnx.c shell/warn.c shell/warnx.c \
|
||||
shell/fts.c shell/print_heapinfo.c shell/main_wkspaceinfo.c \
|
||||
shell/shell_script.c
|
||||
shell/shell_script.c shell/login_prompt.c shell/login_check.c
|
||||
if LIBNETWORKING
|
||||
libshell_a_SOURCES += shell/main_mount_ftp.c shell/main_mount_tftp.c \
|
||||
shell/main_ifconfig.c shell/main_route.c shell/main_netstats.c \
|
||||
|
||||
+47
-138
File diff suppressed because it is too large.
Load diff
@@ -24,6 +24,7 @@
|
||||
#include <termios.h>
|
||||
#include <rtems/fs.h>
|
||||
#include <rtems/libio.h>
|
||||
#include <rtems/login.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -99,18 +100,11 @@ rtems_shell_cmd_t * rtems_shell_alias_cmd(
|
||||
|
||||
int rtems_shell_make_args(
|
||||
char *commandLine,
|
||||
int *argc_p,
|
||||
char **argv_p,
|
||||
int *argc_p,
|
||||
char **argv_p,
|
||||
int max_args
|
||||
);
|
||||
|
||||
int rtems_shell_scanline(
|
||||
char *line,
|
||||
int size,
|
||||
FILE *in,
|
||||
FILE *out
|
||||
);
|
||||
|
||||
int rtems_shell_cat_file(
|
||||
FILE *out,
|
||||
const char *name
|
||||
@@ -135,7 +129,7 @@ int rtems_shell_script_file(
|
||||
* @param task_priority The priority the shell runs at.
|
||||
* @param forever Repeat logins.
|
||||
* @param wait Caller should block until shell exits.
|
||||
* @param login Demand user login.
|
||||
* @param login_check User login check function, NULL disables login checks.
|
||||
*
|
||||
*/
|
||||
rtems_status_code rtems_shell_init(
|
||||
@@ -145,7 +139,7 @@ rtems_status_code rtems_shell_init(
|
||||
const char *devname,
|
||||
bool forever,
|
||||
bool wait,
|
||||
bool login
|
||||
rtems_login_check login_check
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -179,20 +173,20 @@ rtems_status_code rtems_shell_script(
|
||||
int rtems_shell_str2int(const char * s);
|
||||
|
||||
typedef struct {
|
||||
rtems_name magic; /* 'S','E','N','V': Shell Environment */
|
||||
const char *devname;
|
||||
const char *taskname;
|
||||
rtems_name magic; /* 'S','E','N','V': Shell Environment */
|
||||
const char *devname;
|
||||
const char *taskname;
|
||||
/* user extensions */
|
||||
bool exit_shell; /* logout */
|
||||
bool forever ; /* repeat login */
|
||||
int errorlevel;
|
||||
bool echo;
|
||||
char cwd[256];
|
||||
const char* input;
|
||||
const char* output;
|
||||
bool output_append;
|
||||
rtems_id wake_on_end;
|
||||
bool login;
|
||||
bool exit_shell; /* logout */
|
||||
bool forever; /* repeat login */
|
||||
int errorlevel;
|
||||
bool echo;
|
||||
char cwd[256];
|
||||
const char *input;
|
||||
const char *output;
|
||||
bool output_append;
|
||||
rtems_id wake_on_end;
|
||||
rtems_login_check login_check;
|
||||
} rtems_shell_env_t;
|
||||
|
||||
bool rtems_shell_main_loop(
|
||||
@@ -210,7 +204,7 @@ extern rtems_shell_env_t *rtems_current_shell_env;
|
||||
* all possible file systems being included it would force the
|
||||
* networking stack into the applcation and this may not be
|
||||
* required.
|
||||
*/
|
||||
*/
|
||||
struct rtems_shell_filesystems_tt;
|
||||
typedef struct rtems_shell_filesystems_tt rtems_shell_filesystems_t;
|
||||
|
||||
|
||||
@@ -205,45 +205,49 @@ void rtems_stack_checker_begin_extension(
|
||||
* NOTE: The system is in a questionable state... we may not get
|
||||
* the following message out.
|
||||
*/
|
||||
void Stack_check_report_blown_task(
|
||||
Thread_Control *running,
|
||||
bool pattern_ok
|
||||
)
|
||||
void Stack_check_report_blown_task(Thread_Control *running, bool pattern_ok)
|
||||
{
|
||||
Stack_Control *stack = &running->Start.Initial_stack;
|
||||
char *pattern_area = Stack_check_Get_pattern_area(stack);
|
||||
char name [32];
|
||||
|
||||
printk("BLOWN STACK!!!\n");
|
||||
printk("task control block: 0x%08lx\n", (unsigned long) running);
|
||||
printk("task ID: 0x%08lx\n", (unsigned long) running->Object.id);
|
||||
printk(
|
||||
"BLOWN STACK!!! Offending task(0x%p): "
|
||||
"id=0x%08" PRIx32 "; name=0x%08" PRIx32,
|
||||
running,
|
||||
running->Object.id,
|
||||
running->Object.name.name_u32
|
||||
"task name: 0x%08lx\n",
|
||||
(unsigned long) running->Object.name.name_u32
|
||||
);
|
||||
printk(
|
||||
"task name string: %s\n",
|
||||
rtems_object_get_name(running->Object.id, sizeof(name), name)
|
||||
);
|
||||
printk(
|
||||
"task stack area (%lu Bytes): 0x%08lx .. 0x%08lx\n",
|
||||
(unsigned long) stack->size,
|
||||
(unsigned long) stack->area,
|
||||
(unsigned long) ((char *) stack->area + stack->size)
|
||||
);
|
||||
if (!pattern_ok) {
|
||||
printk(
|
||||
"damaged pattern area (%lu Bytes): 0x%08lx .. 0x%08lx\n",
|
||||
(unsigned long) PATTERN_SIZE_BYTES,
|
||||
(unsigned long) pattern_area,
|
||||
(unsigned long) (pattern_area + PATTERN_SIZE_BYTES)
|
||||
);
|
||||
}
|
||||
|
||||
#if defined(RTEMS_MULTIPROCESSING)
|
||||
if (rtems_configuration_get_user_multiprocessing_table()) {
|
||||
printk(
|
||||
"; node=%d",
|
||||
rtems_configuration_get_user_multiprocessing_table()->node
|
||||
"node: 0x%08lx\n",
|
||||
(unsigned long)
|
||||
rtems_configuration_get_user_multiprocessing_table()->node
|
||||
);
|
||||
}
|
||||
#endif
|
||||
|
||||
printk(
|
||||
"\n stack covers range 0x%p - 0x%p (%d bytes)\n",
|
||||
stack->area,
|
||||
stack->area + stack->size - 1,
|
||||
stack->size
|
||||
);
|
||||
|
||||
if ( !pattern_ok ) {
|
||||
printk(
|
||||
" Damaged pattern begins at 0x%08lx and is %d bytes long\n",
|
||||
(unsigned long) Stack_check_Get_pattern_area(stack),
|
||||
PATTERN_SIZE_BYTES);
|
||||
}
|
||||
|
||||
rtems_fatal_error_occurred( 0x81 );
|
||||
rtems_fatal_error_occurred(0x81);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -56,16 +56,13 @@ extern "C" {
|
||||
* To open a file @c file.txt in the directory @c dir (relative to home
|
||||
* directory of the server) on a server named @c host using the user name
|
||||
* @c user and the password @c pw you must specify the following path:
|
||||
*
|
||||
* @c /FTP/user:pw@host/dir/file.txt
|
||||
* <tt>/FTP/user:pw@@host/dir/file.txt</tt>.
|
||||
*
|
||||
* If the server is the default server specified in BOOTP, it can be ommitted:
|
||||
*
|
||||
* @c /FTP/user:pw/dir/file.txt
|
||||
* <tt>/FTP/user:pw/dir/file.txt</tt>.
|
||||
*
|
||||
* The user name will be used for the password if it is ommitted:
|
||||
*
|
||||
* @c /FTP/user@host/dir/file.txt
|
||||
* <tt>/FTP/user@@host/dir/file.txt</tt>.
|
||||
*
|
||||
* For the data transfer passive (= default) and active (= fallback) mode are
|
||||
* supported.
|
||||
|
||||
@@ -237,6 +237,10 @@ PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/shell.h
|
||||
$(PROJECT_INCLUDE)/rtems/shellconfig.h: libmisc/shell/shellconfig.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)
|
||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/shellconfig.h
|
||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/shellconfig.h
|
||||
|
||||
$(PROJECT_INCLUDE)/rtems/login.h: libmisc/shell/login.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)
|
||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/login.h
|
||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/login.h
|
||||
endif
|
||||
$(PROJECT_INCLUDE)/rtems/libi2c.h: libi2c/libi2c.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)
|
||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/libi2c.h
|
||||
|
||||
+51
-145
File diff suppressed because it is too large.
Load diff
+131
-105
File diff suppressed because it is too large.
Load diff
+91
-29
@@ -3,49 +3,111 @@
|
||||
* May 2001
|
||||
* Reworked by Till Straumann and .h overhauled by Joel Sherrill.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* Copyright (c) 2009
|
||||
* embedded brains GmbH
|
||||
* Obere Lagerstr. 30
|
||||
* D-82178 Puchheim
|
||||
* Germany
|
||||
* <rtems@embedded-brains.de>
|
||||
*
|
||||
* $Id$
|
||||
* Modified by Sebastian Huber <sebastian.huber@embedded-brains.de>.
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rtems.com/license/LICENSE.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef _RTEMS_TELNETD_H
|
||||
#define _RTEMS_TELNETD_H
|
||||
|
||||
#include <rtems.h>
|
||||
#include <rtems/login.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
bool rtems_telnetd_login_check(
|
||||
const char *user,
|
||||
const char *passphrase
|
||||
);
|
||||
|
||||
/**
|
||||
* This method initializes the telnetd subsystem.
|
||||
*
|
||||
* @param[in] cmd is the function which is the "shell" telnetd invokes
|
||||
* @param[in] arg is the context pointer to cmd
|
||||
* @param[in] remainOnCallerSTDIO is set to TRUE if telnetd takes over the
|
||||
* standard in, out and error associated with task. In this case,
|
||||
* it will be NOT be listening on any sockets. When this parameters
|
||||
* is FALSE the telnetd will create other tasks for the shell
|
||||
* which listen on sockets.
|
||||
* @param[in] stack is stack size of spawned task.
|
||||
* @param[in] priority is the initial priority of spawned task(s). If
|
||||
* this parameter is less than 2, then the default priority of 100 is used.
|
||||
* @param[in] askForPassword is set to TRUE if telnetd is to ask for a
|
||||
* password. This is set to FALSE to invoke "cmd" with no password check.
|
||||
* This may be OK if "cmd" includes its own check and indeed the RTEMS Shell
|
||||
* uses a login with a user name and password so this is the usual case.
|
||||
* @brief Telnet command type.
|
||||
*/
|
||||
int rtems_telnetd_initialize(
|
||||
void (*cmd)(char *, void *),
|
||||
void *arg,
|
||||
bool remainOnCallerSTDIO,
|
||||
size_t stack,
|
||||
rtems_task_priority priority,
|
||||
bool askForPassword
|
||||
typedef void (*rtems_telnetd_command)(
|
||||
char * /* device name */,
|
||||
void * /* arg */
|
||||
);
|
||||
|
||||
/**
|
||||
* @brief Telnet configuration structure.
|
||||
*/
|
||||
typedef struct {
|
||||
/**
|
||||
* @brief Function invoked for each Telnet connection.
|
||||
*
|
||||
* The first parameter contains the device name. The second parameter
|
||||
* contains the argument pointer of this configuration table.
|
||||
*/
|
||||
rtems_telnetd_command command;
|
||||
|
||||
/**
|
||||
* @brief Argument for command function.
|
||||
*/
|
||||
void *arg;
|
||||
|
||||
/**
|
||||
* @brief Task priority.
|
||||
*
|
||||
* If this parameter is equal to zero, then the priority of network task is
|
||||
* used or 100 if this priority is less than two.
|
||||
*/
|
||||
rtems_task_priority priority;
|
||||
|
||||
/**
|
||||
* @brief Task stack size.
|
||||
*/
|
||||
size_t stack_size;
|
||||
|
||||
/**
|
||||
* @brief Login check function.
|
||||
*
|
||||
* Method used for login checks. Use @c NULL to disable a login check.
|
||||
*/
|
||||
rtems_login_check login_check;
|
||||
|
||||
/**
|
||||
* @brief Keep standard IO of the caller.
|
||||
*
|
||||
* Telnet takes over the standard input, output and error associated with
|
||||
* task, if this parameter is set to @c true. In this case, it will @b not
|
||||
* listen on any sockets. When this parameter is @c false, Telnet will
|
||||
* create other tasks for the shell which listen on sockets.
|
||||
*/
|
||||
bool keep_stdio;
|
||||
} rtems_telnetd_config_table;
|
||||
|
||||
/**
|
||||
* @brief Telnet configuration.
|
||||
*
|
||||
* The application must provide this configuration table. It is used by
|
||||
* rtems_telnetd_initialize() to configure the Telnet subsystem. Do not modify
|
||||
* the entries after the intialization since it is used internally.
|
||||
*/
|
||||
extern rtems_telnetd_config_table rtems_telnetd_config;
|
||||
|
||||
/**
|
||||
* @brief Initializes the Telnet subsystem.
|
||||
*
|
||||
* Uses the application provided @ref rtems_telnetd_config configuration table.
|
||||
*/
|
||||
rtems_status_code rtems_telnetd_initialize( void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user