Skip to contentSkip to conversation

from which hook , I can get the usrname that pppd used?

DISCUSSION cyx_mail 3 participants 5 messages May 15, 2008 – May 16, 2008 PPP protocol drivers and compressors

lore
Share & tools
lore

cyx_mail

author
#0 lore raw

from which hook , I can get the usrname that pppd used? both chap or pap, is that a same hook?

#1 lore raw
Quoted 1 line · cyx_mail

from which hook , I can get the usrname that pppd used? both chap or pap, is that a same hook?

What "user name" do you want? Inside of a script, pppd sets a bunch of environment variables, which are documented in the "SCRIPTS" section of the man page. (You've read through the man page, correct?)

If the peer authenticates itself, then PEERNAME will be set. The variables ORIG_UID and PPPLOGNAME have the invoking user's UID and name. The local 'name' value in use (the our_name[] array) isn't put into the environment. Perhaps it could be.

If you're not talking about a script, but are instead talking about a pppd plugin, then you can just reference the variables you want -- our_name[] or peer_authname[].

It's possible that you may need to provide more details about what you're attempting to do, what you've already tried to do, and what doesn't work in order to get more substantial guidance.

Signature · 1 line
James Carlson         42.703N 71.076W         <[email protected]>
#2 lore raw
In reply to cyx_mail

Thank for your help! username that I want to get is the one pppd read from chap-secret or pap-secret, I think they my be store in an global var?

2008-05-15

cyx

·¢¼şÈË£º James Carlson
·¢ËÍʱ¼ä£º 2008-05-15 21:56:09
ÊÕ¼şÈË£º cyx_mail
³­ËÍ£º linux-ppp
Ö÷Ì⣺ Re: from which hook , I can get the usrname that pppd used?

Quoted 1 line · cyx_mail

from which hook , I can get the usrname that pppd used? both chap or pap, is that a same hook?

What "user name" do you want? Inside of a script, pppd sets a bunch of environment variables, which are documented in the "SCRIPTS" section of the man page. (You've read through the man page, correct?) If the peer authenticates itself, then PEERNAME will be set. The variables ORIG_UID and PPPLOGNAME have the invoking user's UID and name. The local 'name' value in use (the our_name[] array) isn't put into the environment. Perhaps it could be.
If you're not talking about a script, but are instead talking about a pppd plugin, then you can just reference the variables you want -- our_name[] or peer_authname[].
It's possible that you may need to provide more details about what you're attempting to do, what you've already tried to do, and what doesn't work in order to get more substantial guidance.

Signature · 9 lines
James Carlson         42.703N 71.076W         <[email protected]>
--
To unsubscribe from this list: send the line "unsubscribe linux-ppp" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
__________ NOD32 3040 (20080419) Information __________
This message was checked by NOD32 antivirus system.
http://www.nod32cn.com
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ¥Šwÿº{.nÇ+‰·¥Š{±şšiş)í…æèw*jg¬±¨¶‰š�Šİ¢jÿ¾«şG«�éÿ¢¸¢·¦j:+v‰¨ŠwèjØm¶Ÿÿşø¯ù®w¥şŠàşf£¢·hš�â�úÿ†Ù¥
#3 lore raw
In reply to cyx_mail
Quoted 1 line · cyx

Thank for your help! username that I want to get is the one pppd read from chap-secret or pap-secret, I think they my be store in an global var?

I'm afraid you're still not being specific enough.

pppd can be configured to behave as an authenticator ("server"), an authenticatee ("client"), both, or neither.

When configured as an authenticator, pppd will acquire a name from the peer and will validate that identity. The resulting validated peer name appears in the peer_authname[] array.

When configured as an authenticatee, the name pppd presents to the peer for identification is in the our_name[] array.

This is all in the pppd/auth.c module, which is common to all authentication schemes (including PAP and CHAP). If you're trying to write code that integrates with pppd, I *strongly* recommend spending the time to read through the pppd source code. The layout of the code is fairly logical, so it's not hard to read, and there are substantial and informative comments in many places.

(Note that it's really not proper to talk about "users" here. PPP is a layer two technology; there are no "users." There are only peers.)

Signature · 1 line
James Carlson         42.703N 71.076W         <[email protected]>
author
#4 lore raw
In reply to cyx_mail

ok, Thanks for your patient. I'm going to write a PPPoE Proxy base on the pppoe-server and pppd, the proxy acts both as "server" and "clent". So it acquire the usrname from the peer which connect to the proxy and establish a connection to the real pppoe-server(or BAS),so I have to acquire this two kinds of user names from pppd. any suggestions?

2008-05-16

cyx_mail

·¢¼şÈË£º James Carlson
·¢ËÍʱ¼ä£º 2008-05-16 03:16:16
ÊÕ¼şÈË£º cyx
³­ËÍ£º linux-ppp
Ö÷Ì⣺ Re: Re: from which hook , I can get the usrname that pppd used?

Quoted 1 line · cyx

Thank for your help! username that I want to get is the one pppd read from chap-secret or pap-secret, I think they my be store in an global var?

I'm afraid you're still not being specific enough.
pppd can be configured to behave as an authenticator ("server"), an authenticatee ("client"), both, or neither.
When configured as an authenticator, pppd will acquire a name from the peer and will validate that identity. The resulting validated peer name appears in the peer_authname[] array.
When configured as an authenticatee, the name pppd presents to the peer for identification is in the our_name[] array.
This is all in the pppd/auth.c module, which is common to all authentication schemes (including PAP and CHAP). If you're trying to write code that integrates with pppd, I *strongly* recommend spending the time to read through the pppd source code. The layout of the code is fairly logical, so it's not hard to read, and there are substantial and informative comments in many places.
(Note that it's really not proper to talk about "users" here. PPP is a layer two technology; there are no "users." There are only peers.)

Signature · 8 lines
James Carlson         42.703N 71.076W         <[email protected]>
--
To unsubscribe from this list: send the line "unsubscribe linux-ppp" in
the body of a message to [email protected]
__________ NOD32 3090 (20080509) Information __________
This message was checked by NOD32 antivirus system.
http://www.nod32cn.com
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ¥Šwÿº{.nÇ+‰·¥Š{±şšiş)í…æèw*jg¬±¨¶‰š�Šİ¢jÿ¾«şG«�éÿ¢¸¢·¦j:+v‰¨ŠwèjØm¶Ÿÿşø¯ù®w¥şŠàşf£¢·hš�â�úÿ†Ù¥