Menu

#41 Another script invoking mechanism

open
5
2008-12-25
2008-12-25
gistart
No

This patch makes MPD 5.2 to execute "up-scripts" and "down-scripts"
with execve mechanism.

New command:

set iface enable execenv

If the command is set, MPD executes script with ExecCmdEnv function.
This function sets a list of environmental variables to child proccess:

MPD_SELF_IFACE # self iface name (e.g. ng0)
MPD_SELF_IP # self address range
MPD_PEER_IP # real IP
MPD_PEER_AUTH_IP # given after authentication
MPD_PEER_NAME # auth name
MPD_PEER_MAC # MAC address of the peer (formatted)
MPD_PEER_IFACE # Peer iface name
MPD_PEER_PORT # Number of peer's port
MPD_CALLING_NUM # with pppoe - unformatted peer MAC
MPD_CALLED_NUM # don't know)
MPD_PEER_NS0 # if peer uses DNS - ns #1
MPD_PEER_NS1 # ns #2

If some of this information is unavailable, the variables are set to "N/A".

This method seems to be more secure, and it provides more information
to user scripts increasing their usability.

We tested this patch on pptp and pppoe connections. Everything works just fine
but other types of connections remain untested.

We'd appriciate, this patch to be included to the next release of MPD.

Discussion

  • gistart

    gistart - 2008-12-25
     
  • gistart

    gistart - 2008-12-25
    • labels: --> Authentication
    • assigned_to: nobody --> amotin
     
  • Alexander Motin

    Alexander Motin - 2011-12-21

    While idea is good, it needs some work. These scrips supposed to be called for every protocol up/down, while here it is called only for IPv4. Obviously that IPv6 require different set of arguments. That's really nice that list of arguments is extendable there.

     

Log in to post a comment.