opppd怎么pppd 354中文字幕下载东西

2228人阅读
linux(37)
The idea of plugins is to&provide a way for people to customize the behaviour of pppd without&having to either apply local patches to each version or get their&patches accepted into the standard distribution.&
A plugin is a standard shared library object, typically with a name&ending in .so. &They are loaded using the standard dlopen() library
call, so plugins are only supported on systems which support shared&libraries and the dlopen call. &At present pppd is compiled with
plugin support only under Linux and Solaris.
Using gcc&under Linux, a plugin called `xyz' could be compiled and linked with&the following commands:
gcc -c -O xyz.c
gcc -shared -o xyz.so xyz.o
Plugins can access global variables within pppd, so it is useful for&them to #include &pppd.h& from the pppd source directory.
Plugins can affect the behaviour of pppd in at least three ways:
1. They can add extra options which pppd will then recognize. &This is&done by calling the add_options() procedure with a pointer to & & & & an&array of option_t structures. &The last entry in the array must&have its name field set to NULL.
2. Pppd contains `hook' variables which are procedure pointers. &If a&given hook is not NULL, pppd will call the procedure it points to
& & at the appropriate point in its processing. &The plugin can set any&of these hooks to point to its own procedures. &See below for a
& & description of the hooks which are currently implemented.
3. Plugin code can call any global procedures and access any global&variables in pppd.
int (*pap_check_hook)(void);
int (*pap_passwd_hook)(char *user, char *passwd);
int (*pap_auth_hook)(char *user, int userlen,
& & char *passwd, int passlen,
& & char **msgp, int *msglenp,
& & struct wordlist **paddrs,
& & struct wordlist **popts);
These hooks are designed to allow a plugin to replace the normal PAP&password processing in pppd with something different (e.g. contacting&an external server).
The pap_check_hook is called to check whether there is any possibility&that the peer could authenticate itself to us. &If it returns 1, pppd&will ask the peer to authenticate itself. &If it returns 0, pppd will&not ask the peer to authenticate itself (but if
authentication is
required, pppd may exit, or terminate the link before network protocol&negotiation). &If it returns -1, pppd will look in the pap-secrets
file as it would normally.
The pap_passwd_hook is called to determine what username and password&pppd should use in authenticating itself to the peer with PAP. &The&user string will already be initialized, by the `user' option, the&`name' option, or from the hostname, but can be changed
if necessary.&MAXNAMELEN bytes of space are available at *user, and MAXSECRETLEN&bytes of space at *passwd. &If this hook returns 0, pppd will use the&values at *user and * if it returns -1, pppd will look in the&pap-secrets file, or use the value from
the +ua or password option, as&it would normally.
The pap_auth_hook is called to determine whether the username and&password supplied by the peer are valid. &user and passwd point to&null-terminated strings containing the username and password supplied&by the peer, with non-printable
characters converted to a printable&form. &The pap_auth_hook function should set msg to a string to be&returned to the peer and return 1 if the username/password was valid&and 0 if not. &If the hook returns -1, pppd will look in the&pap-secrets file as usual.
If the username/password was valid, the hook can set *paddrs to point&to a wordlist containing the IP address(es) which the peer is
permitted to use, formatted as in the pap-secrets file. &It can also&set *popts to a wordlist containing any extra options for this user
which pppd should apply at this point.
现以我们学校的电信拨号为例详解plugin的创建步骤。中国电信上网真正的密码是他提供给我们的密码经过几种加密算法得到的新的密码。因此我们直接用电信提供的密码无法上网,而每次输入加密后的密码又太麻烦,所以我们可以制作plugin将加密密码传给pppd。
首先来看pppd.h中定义的struct option_t
typedef struct {
/* name of the option */
enum opt_//见下面enum opt_type
void *//optin的地址
char *//描述
int //常用的flags就是OPT_STATIC
void *addr2;//NULL
int upper_//optin最大长度
int lower_
const char *//此三项可填NULL
} option_t;enum opt_type {
o_special_noarg = 0,
o_special = 1,
};/* Values for flags */
#define OPT_STATIC 0x2000 /* string option goes into static array */我的plugin开始部分就是#include &string.h&
#include &pppd/pppd.h&
#include &dialcrypt.h&
#include &pap-secrets.h&
char pppd_version[] = VERSION;
static char pwd[MAXSECRETLEN] = {0};//电信提供的密码
static char modefied_pwd[MAXSECRETLEN] = {0};//经过加密后的密码
static int is_passwd_modified = 0;
static option_t options[] = {
{ &pwd&, o_string, pwd,
&the given password&,
OPT_STATIC, NULL, MAXSECRETLEN-1 },
}; 然后是得出加密密码,由于电信密码的加密算法不是相关内容,此处就不列出。static int pap_modifypasswd(char *user, char* passwd)
if( is_passwd_modified == 0)
if(user[0] == 0)
info(&cumtdial : pppd!!!!no user&);
info(&cumtdial : username %s\n&,user);
if(pwd[0] == 0)
info(&cumtdial :load passwd from secret file&);
n = get_pap_passwd(user,pwd);//若没有输入密码,则从pap-secret文件中读取默认密码,若电信密码固定,可写入此文件
info(&cumtdial :load passwd from pap-secret file fail!!!!&);
info(&cumtdial : load passwd success. passwd:&hidden&&);
cumt_dial_get_entire_cipher(pwd,modefied_pwd);//得出加密密码
is_passwd_modified = 1;
if(passwd != NULL)
strcpy(passwd,modefied_pwd);//将加密后的密码写入pppd要读取的密码passwd
}然后是pppd要调用的plugin_init()函数void plugin_init(void)
add_options(options);
pap_passwd_hook=pap_
}用前文讲到的步骤将它编译成动态链接库,复制到/usr/lib/pppd/2.4.5/,然后在/etc/ppp/peers下创建文件cumtdialnoipdefault
defaultroute
replacedefaultroute
usepeerdns
plugin rp-pppoe.so eth0
plugin cumtdial.sorp-pppoe.so用于通过网线上网,还有其他方式比如无线,3g。
之后上网就可以用命令pppd call cumtdial user &***& pwd &***&,这个pwd就是电信给你的密码。
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:71319次
排名:千里之外
原创:21篇
转载:17篇
评论:12条
(1)(2)(14)(9)(2)(10) 上传我的文档
 下载
 收藏
该文档贡献者很忙,什么也没留下。
 下载此文档
正在努力加载中...
基本操作规则
下载积分:900
内容提示:基本操作规则
文档格式:PDF|
浏览次数:23|
上传日期: 15:07:10|
文档星级:
该用户还上传了这些文档
基本操作规则
官方公共微信&&强烈建议使用百度网盘离线下载、迅雷看看在线观看。或者使用迅雷下载观看!!!
PPPD-309.mp4
磁力链影视搜索()
<div style="visibility:hidden"PPPD-277.jpg163.06KBPPPD-277.mp4957.62MB
CreateTime
UpdateTime
FileTotalCount7
TotalSize1.87GB
ViewTimes24
DMCA Report Email
magnetLink
Torrent Down
AVideos Introduce:
Latest Search:&1.&&&2.&&&3.&&&4.&&&5.&&&6.&&&7.&&&8.&&&9.&&&10.&&&11.&&&12.&&&13.&&&14.&&&15.&&&16.&&&17.&&&18.&&&19.&&&20.&&&21.&&&22.&&&23.&&&24.&&&25.&&&26.&&&27.&&&28.&&&29.&&&30.&&&31.&&&32.&&&33.&&&34.&&&35.&&&36.&&&37.&&&38.&&&39.&&&40.&&&41.&&&42.&&&43.&&&44.&&&45.&&&46.&&&47.&&&48.&&&49.&&&50.&&&51.&&&52.&&&53.&&&54.&&&55.&&&56.&&&57.&&&58.&&&59.&&&60.&&&61.&&&62.&&&63.&&&64.&&&65.&&&66.&&&67.&&&68.&&&69.&&&70.&&&71.&&&72.&&&73.&&&74.&&&75.&&&76.&&&77.&&&78.&&&79.&&&80.&&&81.&&&82.&&&83.&&&84.&&&85.&&&86.&&&87.&&&88.&&&89.&&&90.&&&91.&&&92.&&&93.&&&94.&&&95.&&&96.&&&97.&&&98.&&&99.&&&100.&&&一、不得利用本站危害国家安全、泄露国家秘密,不得侵犯国家社会集体的和公民的合法权益,不得利用本站制作、复制和传播不法有害信息!
二、互相尊重,对自己的言论和行为负责。
本文标题:
本页链接:}

我要回帖

更多关于 pppd 439中文字幕下载 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信