北京英吉特科技有限公司
  • 设为首页|收藏本站
  • 客服热线:010-82967121

  • 首页
  • 新闻中心
    公司新闻
    公司公告
    行业新闻
  • 产品展示
    工业控制
    人机界面
    工业通讯
    移动互联
    信号采集
    固态存储
  • 嵌入式系统
    x86系统
    ARM系统
    DSP系统
    VxWorks
    Linux
    WinEmbeded
    QT-VxWorks
  • 集成解决方案
    可靠性仿真系统
    可用度仿真软件
    数据采集系统
  • 客制化服务
    通用处理器
    嵌入式软件
    存储系统
  • 在线留言
  • 关于我们
嵌入式系统

x86系统
ARM系统
DSP系统
VxWorks
Linux
WinEmbeded
QT-VxWorks

联系方式

北京英吉特科技有限公司
地址:北京市海淀区西三旗桥东上奥世纪大厦B座9层
电话:010-82967121
手机:
E-mail:support@ingite.cn
网站:www.ingite.cn

当前位置:首页 > 嵌入式系统> VxWorks
VxWorks

VxWorks 6.6 FTP服务端访问权限设置方法初探

VxWorks 6.6 FTP服务器搭建

 方法一:

在kernel configuration中增加FTP Server组件(INCLUDE_IPFTPS);
 将Authentication callback routine (FTPS_AUTH_CALLBACK_HOOK)挂到自己的回调函数myAuthenticateCallback;
 将FTP initial directory 定义为"/tffs0";将FTP root directory定义为"/";
 将install ftp server callback routine (FTPS_INSTALL_CALLBACK_HOOK)定义为TRUE;
 将下面的代码copy到usrAppInit.c,放在usrAppInit()前。

#include
#include

int myAuthenticateCallback (Ipftps_session * session,char * password)
{
   return 0;
}

使用fileZilla作为FTP客户端登陆,账户密码随便设定。

方法二:

事先请参阅Wind River Network Stack for VxWorks 6 Programmer's Guide, 6.6的文档!
里面的文档说的很详细!
FTP Server
The parameters used to configure the FTP server in Workbench are described in
Table 2-9.

Authentication callback routine
FTPS_AUTH_CALLBACK_HOOK
You can use your own routine to authenticate clients. To do
this, specify a function pointer for the
FTPS_AUTH_CALLBACK_HOOK. The FTP server will call
this routine to authenticate clients.
The prototype for this routine is as follows:
int myAuthenticateCallback (Ipftps_session * session,
char * password);
It should return 0 (zero) if the password is valid for the
session, or 1 (one) if you cannot validate the password.
If you do not specify an authentication routine, the server
will call its own default authentication callback routine that
allows read-only access to the user anonymous with no
password.
If you set a function pointer here, you must also set the
FTPS_INSTALL_CALLBACK_HOOK to TRUE in order to
install this callback hook.
NULL
funcptr
Install ftp server callback routine         
FTPS_INSTALL_CALLBACK_HOOK  FALSE
Indicates whether the FTP server uses the authentication
callback routine that you specified by the configuration
parameter FTPS_AUTH_CALLBACK_HOOK to authenticate
clients.
If this is FALSE, the server instead uses its own
authentication routine—one that allows the user
anonymous with no password.

就是说了:
/*
* FTPS_INSTALL_CALLBACK_HOOK - install ftp server callback routine
* Determine if the user-defined ftp server authentication callback routine
* as specified by the macro FTPS_AUTH_CALLBACK_HOOK should be installed.
* If FALSE, the FTPS_AUTH_CALLBACK_HOOK configuration is not applicable.
*/
#define FTPS_INSTALL_CALLBACK_HOOK   TRUE  //调用自己的回调函数

/*
* FTPS_AUTH_CALLBACK_HOOK - Authentication callback routine.
* User-defined authentication callback routine used by FTP server. If not
* specified, internal authenticaion callback routine will be used. The
* FTPS_INSTALL_CALLBACK_HOOK must also be set to TRUE in order to install
* this callback hook.
*/
#define FTPS_AUTH_CALLBACK_HOOK   myAuthenticateCallback//回调函数

在回调函数里面int myAuthenticateCallback (Ipftps_session * session,char * password)
{

加入自己的判断对password的字符串,对于是否符合的密码!
return 0 (zero) if the password is valid//有效地密码!
return 1 (one) if you cannot validate the password//无效!
}

定义宏这样来认证,否则就是If this is FALSE, the server instead uses its own
authentication routine—one that allows the user
anonymous with no password.

有时自己仔细的看文档就会有帮助!
但是vx6.6的ftp server还是有问题,跟当年的vx5.5的类似用图形ftp 客户端的工具登陆的时候还是看不到文件!
用DOS的ftp一般可以!风河真是的,这么久了还这样!

另外由于VX6.6 FTP已经默认没有VX5.5的根目录了“/”。


需要指定初始化的根目录如tffs0等


#define INCLUDE_IPFTPS


#define FTPS_INITIAL_DIR
"/tffs0"


否则无法登陆ftp


响应: 421 Service not available, closing control connection



具体的步骤如下:
在WindRiver\components\ip_net2-6.6\osconfig\vxworks\src\ipnet\
下面的ipftps_example.c里面就有
#if FTPS_INSTALL_CALLBACK_HOOK == TRUE

/*
* forward declarations for the user-defined ftp server authentication
* callback hook to satisfy the compiler.
*/
int FTPS_AUTH_CALLBACK_HOOK (Ipftps_session *, char *);

#else

/*
* FTPS_AUTH_CALLBACK_HOOK is applicable only if FTPS_INSTALL_CALLBACK_HOOK
* is set to TRUE. Explicitly re-define to NULL so that we don't get
* compiler errors.
*/
#endif /* FTPS_INSTALL_CALLBACK_HOOK */




修改如下述:
#if FTPS_INSTALL_CALLBACK_HOOK == TRUE

/*
* forward declarations for the user-defined ftp server authentication
* callback hook to satisfy the compiler.
*/
int FTPS_AUTH_CALLBACK_HOOK (Ipftps_session *, char *password);

int myAuthenticateCallback (Ipftps_session * session,char * password)
{
        /*printf("Login attempt with user: %s, pw: %s",session->username, password);*/
        
       if((strcmp(password, "vxworks" ) == 0)&&(strcmp(session->username, "vxworks" ) == 0) )
                {
                        return IPCOM_SUCCESS;
                }
               
                else
                        {
                                
                                return IPCOM_ERR_FAILED;
                        }
        
}

#else

/*
* FTPS_AUTH_CALLBACK_HOOK is applicable only if FTPS_INSTALL_CALLBACK_HOOK
* is set to TRUE. Explicitly re-define to NULL so that we don't get
* compiler errors.
*/
#endif /* FTPS_INSTALL_CALLBACK_HOOK */


本文链接:http://www.ingite.cn/aspcms/news/2014-12-9/92.html
分享到:
点击次数:  更新时间:2014-12-9 12:53:06  【打印此页】  【关闭】
上一条:VxWorks实时系统定制开发与服务  下一条:没有了!

相关文章

  • VxWorks实时系统定制开发与服务
  • VxWorks 6.6 FTP服务端访问权限设置方法初探
首页|新闻中心|产品展示|嵌入式系统|集成解决方案|客制化服务|在线留言|关于我们

Copyright © 北京英吉特科技有限公司 京ICP备11012957号-1